Adapted AABB_tree to the new concept and documented the API changes

This commit is contained in:
Philipp Möller 2011-11-15 17:13:09 +00:00
parent 94affd589d
commit 376b6309f4
7 changed files with 50 additions and 15 deletions

View File

@ -33,9 +33,12 @@ Provides the operators:
where \ccc{Type_1} and \ccc{Type_2} are relevant types
among \ccc{Ray_3}, \ccc{Segment_3}, \ccc{Line_3}, \ccc{Triangle_3}, \ccc{Plane_3} and \ccc{Bbox_3}. Relevant herein means that a line primitive (ray, segment, line) is tested against a planar or solid primitive (plane, triangle, box), and a solid primitive is tested against another solid primitive (box against box). The operator returns \ccc{true} iff \ccc{type_1} and \ccc{type_2} have a non empty intersection.}
\ccNestedType{Intersect_3}{A functor object to construct the intersection between two geometric objects.
Provides the operators:
\ccc{CGAL::Object operator()(const Type_1& type_1, const Type_2& type_2);} where \ccc{Type_1} and \ccc{Type_2} are any relevant types among \ccc{Ray_3}, \ccc{Segment_3}, \ccc{Line_3}, \ccc{Triangle_3}, \ccc{Plane_3} and \ccc{Bbox_3}. Relevant herein means that a line primitive (ray, segment, line) is tested against a planar or solid primitive (plane, triangle, box). The operator computes a \ccc{CGAL::Object} which is the intersection between the objects \ccc{type_1} and \ccc{type_2}.}
\ccNestedType{Intersect_3}{A functor object to construct the intersection between two geometric objects. \\
Provides the metafunction: \\
\ccc{Result<A, B>}; where \ccc{Result<A, B>::Type} is the return type of the \ccc{operator()} \\
and the operator: \\
\ccc{Result<A, B>::Type operator()(const Type_1& type_1, const Type_2& type_2);} \\ where \ccc{Type_1} and \ccc{Type_2} are any relevant types among \ccc{Ray_3}, \ccc{Segment_3}, \ccc{Line_3}, \ccc{Triangle_3}, \ccc{Plane_3} and \ccc{Bbox_3}. Relevant herein means that a line primitive (ray, segment, line) is tested against a planar or solid primitive (plane, triangle, box). The operator computes a \ccc{CGAL::Object} which is the intersection between the objects \ccc{type_1} and \ccc{type_2}.
}
\ccNestedType{Construct_sphere_3}{A functor object to construct the sphere centered at one point and passing through another one. Provides the operator:
\ccc{Sphere_3 operator()(const Point_3& p, const Point_3 & q);} which returns the sphere centered at \ccc{p} and passing through \ccc{q}.}

View File

@ -36,7 +36,12 @@ The concept \ccRefName\ provides the geometric primitive types and methods for t
\ccTypedef{typedef std::pair<Point_3, Primitive::Id> Point_and_primitive_id;}{}
\begin{ccDeprecated}
\ccTypedef{typedef std::pair<Object, Primitive::Id> Object_and_primitive_id;}{}
\end{ccDeprecated}
\ccNestedType{Intersection_and_primitive_id<Query>}{An unary metafunction to aquire the
return type of intersections with an object of type \ccStyle{Query} through the member typedef \ccStyle{Type}.}
During the construction of the \ccc{AABB_tree}, the primitives are sorted according to some comparison functions related to the $x$, $y$ or $z$ coordinate axis:
@ -59,8 +64,13 @@ for which the class \ccc{AABB_tree<AT>} may receive an intersection detection or
\ccNestedType{Do_intersect}{A functor object to compute intersection predicates between the query and the nodes of the tree. Provides the operators:
\ccc{bool operator()(const Query & q, const Bounding_box & box);} which returns \ccc{true} iff the query intersects the bounding box, and \ccc{bool operator()(const Query & q, const Primitive & primitive);} which returns \ccc{true} iff the query intersects the primitive.}
\begin{ccDeprecated}
\ccNestedType{Intersect}{A functor object to compute the intersection of a query and a primitive. Provides the operator:
\ccc{boost::optional<Object_and_primitive_id> operator()(const Query & q, const Primitive& primitive);} which returns the intersection as a pair composed of an object and a primitive id, iff the query intersects the primitive.}
\end{ccDeprecated}
\ccNestedType{Intersect}{A functor object to compute the intersection of a query and a primitive. Provides the operator:
\ccc{Intersection_and_primitive_id<Query>::type operator()(const Query & q, const Primitive& primitive);} which returns the intersection as a pair composed of an intersection object and the id of the primitive.}
The following predicates are required for each type \ccc{Query}
for which the class \ccc{AABB_tree<AT>} may receive a distance query.

View File

@ -37,6 +37,8 @@ The template parameter \ccc{GeomTraits} provides the geometric types as well as
\ccTypedef{typedef GeomTraits::Segment_3 Segment_3;}{Segment query type.}
\ccGlue
\ccNestedType{size_type}{Unsigned integral type.}
\ccGlue
\ccNestedType{Intersection}{The function object used for Intersection computation.}
%\ccCreation
\ccCreationVariable{traits}

View File

@ -36,7 +36,13 @@ Class \ccRefName\ is a static data structure for efficient intersection and dist
\ccGlue
\ccTypedef{typedef std::pair<Point, Primitive::Id> Point_and_primitive_id;}{}
\ccGlue
\begin{ccDeprecated}
\ccTypedef{typedef std::pair<CGAL::Object, Primitive::Id> Object_and_primitive_id;}{}
\end{ccDeprecated}
\ccGlue
\ccNestedType{Intersection_and_primitive_id<Query>}{An unary metafunction to aquire the
return type of intersections with an object of type \ccStyle{Query} through the member typedef \ccStyle{Type}.}
\ccCreation
\ccCreationVariable{tree}
@ -104,17 +110,22 @@ Class \ccRefName\ is a static data structure for efficient intersection and dist
% INTERSECTIONS
\ccHeading{Intersections}
\ccMethod{template <class Query, class OutputIterator>
OutputIterator
all_intersections(const Query& query,
OutputIterator out);}{Outputs to the iterator the list of all intersections between the query and input data, as objects of type \ccc{Object_and_primitive_id}. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.}
OutputIterator all_intersections(const Query& query,
OutputIterator out);}{Outputs the list of all intersections, as objects of
type \ccc{Intersection__and_primitive_id<Query>::Type},
between the query and the input data to
the iterator. \ccHtmlNoLinksFrom{\ccc{do_intersect}}
predicates and intersections must be defined for \ccc{Query}
in the \ccc{AT} class.}
\ccGlue
\begin{ccDeprecated}
\ccMethod{template <class Query>
boost::optional<Object_and_primitive_id>
any_intersection(const Query& query);}{Returns the first encountered intersection, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.}
\end{ccDeprecated}
\ccGlue
\ccMethod{template<class Query> Intersection_and_primitive_id<Query>::Type any_intersection(const Query& query);}{Returns the first encountered intersection. No particular order is guaranteed over the tree traversal, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections must be defined for \ccc{Query} in the \ccc{AT} class.}
% DISTANCE QUERIES
\ccHeading{Distance Queries}

View File

@ -27,6 +27,7 @@
#include <CGAL/Bbox_3.h>
#include <CGAL/AABB_intersections.h>
#include <CGAL/Kernel_traits.h>
#include <boost/optional.hpp>
@ -55,7 +56,9 @@ public:
template<typename Query>
struct Intersection_and_primitive_id {
typedef std::pair< typename IT< Query, typename Primitive::Datum >::result_type, typename Primitive::Id > type;
typedef std::pair< typename GeomTraits::Intersect_3::template Result< Query, typename Primitive::Datum >::Type,
typename Primitive::Id > Type;
typedef Type type;
};
typedef typename std::pair<Point,typename Primitive::Id> Point_and_primitive_id;
@ -181,7 +184,7 @@ public:
}
#else
template<typename Query>
typename Intersection_and_primitive_id<Query>::type
typename Intersection_and_primitive_id<Query>::Type
operator()(const Query& query, const typename AT::Primitive& primitive) const {
return std::make_pair(GeomTraits().intersect_3_object()(primitive.datum(),query),
primitive.id());

View File

@ -47,6 +47,12 @@ namespace CGAL {
typedef typename AABBTraits::Primitive::Id Primitive_id;
typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id;
typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id;
template<typename Query>
struct Intersection_and_primitive_id {
typedef typename AABBTraits::template Intersection_and_primitive_id<Query>::Type Type;
typedef Type type;
};
private:
// internal KD-tree used to accelerate the distance queries
@ -150,7 +156,7 @@ namespace CGAL {
#if CGAL_INTERSECTION_VERSION < 2
boost::optional<Object_and_primitive_id>
#else
typename AABB_traits::template Intersection_and_primitive_id<Query>::type
typename Intersection_and_primitive_id<Query>::Type
#endif
any_intersection(const Query& query) const;
@ -434,7 +440,7 @@ namespace CGAL {
#if CGAL_INTERSECTION_VERSION < 2
boost::optional<typename AABB_tree<Tr>::Object_and_primitive_id>
#else
typename Tr::template Intersection_and_primitive_id<Query>::type
typename AABB_tree<Tr>::template Intersection_and_primitive_id<Query>::Type
#endif
AABB_tree<Tr>::any_intersection(const Query& query) const
{

View File

@ -80,7 +80,7 @@ public:
#if CGAL_INTERSECTION_VERSION < 2
boost::optional<Object_and_primitive_id>
#else
AABBTraits::template Intersection_and_primitive_id<Query>::type
AABBTraits::template Intersection_and_primitive_id<Query>::Type
#endif
Result;
public:
@ -147,7 +147,7 @@ public:
#if CGAL_INTERSECTION_VERSION < 2
boost::optional<Object_and_primitive_id>
#else
typename AABBTraits::template Intersection_and_primitive_id<Query>::type
typename AABBTraits::template Intersection_and_primitive_id<Query>::Type
#endif
intersection = AABBTraits().intersection_object()(query, primitive);