diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABBGeomTraits.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABBGeomTraits.tex index 4938cb28af2..a3051c52acc 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABBGeomTraits.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABBGeomTraits.tex @@ -23,7 +23,6 @@ The concept \ccRefName\ defines the requirements for the first template paramete \ccTypes -\ccNestedType{Bbox_3}{Bounding box type.} \ccNestedType{Sphere_3}{Sphere type, that should be consistent with the distance function chosen for the distance queries, namely the \ccc{Squared_distance_3} functor.} \ccNestedType{Point_3}{Point type.} @@ -50,6 +49,9 @@ Provides the operator: \ccNestedType{Compute_squared_radius_3}{A functor object to compute the squared radius of a sphere. Provides the operator: \ccc{FT operator()(const Sphere_3& s);} which returns the squared radius of \ccc{s}.} +\CCNestedType{Compute_squared_distance_3}{A functor object to compute the squared distance between two points. Provides the operator: +\ccc{FT operator()(const Point_3& p, const Point_3& q);} which returns the squared distance between \ccc{p} and \ccc{q}.} + \ccCreation \ccCreationVariable{geomtraits} %% choose variable name @@ -67,6 +69,8 @@ Provides the operator: \ccMethod{Compute_squared_radius_3 compute_squared_radius_3_object();}{Returns the squared radius functor.} +\ccMethod{Compute_squared_distance_3 compute_squared_distance_3_object();}{Returns the squared distance functor.} + \ccHasModels Any instantiation of \ccc{CGAL::Kernel} is a model of this traits concept. diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABBTraits.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABBTraits.tex index 095f8f5a732..ee8a3f47bbc 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABBTraits.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABBTraits.tex @@ -50,8 +50,9 @@ During the construction of the \ccc{AABB_tree}, the primitives are sorted accord \ccNestedType{Compute_bbox}{A functor object to compute the bounding box of a set of primitives. Provides the operator: \ccc{Bounding_box operator()(Input_iterator begin, Input_iterator beyond);} Iterator \ccc{InputIterator} must have \ccc{Primitive} as value type. } -\ccNestedType{Splitting_direction}{A functor object to specify the direction along which the bounding box should be split: -\ccc{Axis operator()(const Bounding_box& bbox);} which returns the direction used for splitting \ccc{bbox}. It is usually the axis aligned with the longest edge of \ccc{bbox}.} +%remove as not used any where in the code +%\ccNestedType{Splitting_direction}{A functor object to specify the direction along which the bounding box should be split: +%\ccc{Axis operator()(const Bounding_box& bbox);} which returns the direction used for splitting \ccc{bbox}. It is usually the axis aligned with the longest edge of \ccc{bbox}.} The following predicates are required for each type \ccc{Query} for which the class \ccc{AABB_tree} may receive an intersection detection or computation query. @@ -71,8 +72,8 @@ for which the class \ccc{AABB_tree} may receive a distance query. \ccNestedType{Closest_point}{A functor object to compute closest point from the query on a primitive. Provides the operator: \ccc{Point_3 operator()(const Query& query, const Primitive& primitive, const Point_3 & closest);} which returns the closest point to \ccc{query}, among \ccc{closest} and all points of the primitive.} -\ccNestedType{Squared_distance}{A functor object to compute the squared distance between the query and a point. Provides the operator: -\ccc{FT operator()(const Query& query, const Point_3 & p);} which returns the squared distance between \ccc{query} and \ccc{p}.} +\ccNestedType{Squared_distance}{A functor object to compute the squared distance between two points. Provides the operator: +\ccc{FT operator()(const Point_3& p, const Point_3 & q);} which returns the squared distance between \ccc{p} and \ccc{q}.} \ccCreationVariable{traits} %% choose variable name @@ -94,6 +95,8 @@ for which the class \ccc{AABB_tree} may receive a distance query. \ccMethod{Closest_point closest_point_object();}{Returns the closest point constructor.} +\ccMethod{Squared_distance squared_distance_object();}{Returns the squared distance functor.} + \ccHasModels \ccc{AABB_traits}. diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex index 5acde9aa6aa..f6c22933f5b 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex @@ -28,13 +28,11 @@ The template parameter \ccc{GeomTraits} provides the geometric types as well as \ccTypes -\ccTypedef{typedef GeomTraits::Point_3 Point_3;}{Point query type.} +\ccTypedef{typedef GeomTraits::FT FT;}{} \ccGlue -\ccTypedef{typedef GeomTraits::Ray_3 Ray_3;}{Ray query type.} +\ccTypedef{typedef GeomTraits::Point_3 Point_3;}{} \ccGlue -\ccTypedef{typedef GeomTraits::Line_3 Line_3;}{Line query type.} -\ccGlue -\ccTypedef{typedef GeomTraits::Segment_3 Segment_3;}{Segment query type.} +\ccTypedef{typedef CGAL::Bbox_3 Bounding_box;}{} \ccGlue \ccNestedType{size_type}{Unsigned integral type.} diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 0a7f553527f..cbcfb928f7d 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -41,34 +41,29 @@ namespace CGAL { template class AABB_traits { + typedef typename CGAL::Object Object; public: typedef AABB_traits AT; /// AABBTraits concept types - typedef typename CGAL::Bbox_3 Bounding_box; - typedef typename CGAL::Object Object; - - typedef AABB_primitive Primitive; - typedef typename AABB_primitive::Datum Datum; - - typedef typename GeomTraits::Point_3 Point; - - typedef typename std::pair Object_and_primitive_id; - typedef typename std::pair Point_and_primitive_id; - - // types for search tree typedef typename GeomTraits::FT FT; typedef typename GeomTraits::Point_3 Point_3; - typedef typename GeomTraits::Sphere_3 Sphere_3; + typedef AABB_primitive Primitive; + typedef typename CGAL::Bbox_3 Bounding_box; + typedef typename std::pair Object_and_primitive_id; + typedef typename std::pair Point_and_primitive_id; + + /// additionnal types for the search tree, required by the RangeSearchTraits concept + /// (This is not documented for now in the AABBTraits concept, which is a bug) typedef typename GeomTraits::Iso_cuboid_3 Iso_cuboid_3; + typedef typename GeomTraits::Sphere_3 Sphere_3; + typedef typename GeomTraits::Cartesian_const_iterator_3 Cartesian_const_iterator_3; + typedef typename GeomTraits::Construct_cartesian_const_iterator_3 Construct_cartesian_const_iterator_3; typedef typename GeomTraits::Construct_center_3 Construct_center_3; - typedef typename GeomTraits::Construct_iso_cuboid_3 Construct_iso_cuboid_3; - typedef typename GeomTraits::Construct_min_vertex_3 Construct_min_vertex_3; - typedef typename GeomTraits::Construct_max_vertex_3 Construct_max_vertex_3; typedef typename GeomTraits::Compute_squared_radius_3 Compute_squared_radius_3; - typedef typename GeomTraits::Compute_squared_distance_3 Compute_squared_distance_3; - typedef typename GeomTraits::Cartesian_const_iterator_3 Cartesian_const_iterator_3; - typedef typename GeomTraits::Construct_cartesian_const_iterator_3 - Construct_cartesian_const_iterator_3; + typedef typename GeomTraits::Construct_min_vertex_3 Construct_min_vertex_3; + typedef typename GeomTraits::Construct_max_vertex_3 Construct_max_vertex_3; + typedef typename GeomTraits::Construct_iso_cuboid_3 Construct_iso_cuboid_3; + /// Constructor AABB_traits() { }; @@ -76,7 +71,9 @@ public: /// Non-virtual Destructor ~AABB_traits() { }; - + typedef typename GeomTraits::Compute_squared_distance_3 Squared_distance; + Squared_distance squared_distance_object() const { return GeomTraits().compute_squared_distance_3_object(); } + /// /** * @brief Sorts [first,beyond[ @@ -180,7 +177,7 @@ Intersection intersection_object() {return Intersection();} // This should go down to the GeomTraits, i.e. the kernel class Closest_point { - typedef typename AT::Point Point; + typedef typename AT::Point_3 Point; typedef typename AT::Primitive Primitive; public: Point operator()(const Point& p, const Primitive& pr, const Point& bound) const @@ -194,7 +191,7 @@ Intersection intersection_object() {return Intersection();} // do_intersect to something like does_contain (this is what we compute, // this is not the same do_intersect as the spherical kernel) class Compare_distance { - typedef typename AT::Point Point; + typedef typename AT::Point_3 Point; typedef typename AT::FT FT; typedef typename AT::Primitive Primitive; public: diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index fb8be4af0a6..74a35a26907 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -46,7 +46,7 @@ namespace CGAL { /// types typedef AABBTraits AABB_traits; typedef typename AABBTraits::FT FT; - typedef typename AABBTraits::Point Point; + typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Primitive::Id Primitive_id; @@ -518,7 +518,7 @@ public: const Point& hint) const { const Point closest = this->closest_point(query, hint); - return typename Tr::Compute_squared_distance_3()(query, closest); + return Tr().squared_distance_object()(query, closest); } // squared distance without user-specified hint @@ -527,7 +527,7 @@ public: AABB_tree::squared_distance(const Point& query) const { const Point closest = this->closest_point(query); - return typename Tr::Compute_squared_distance_3()(query, closest); + return Tr().squared_distance_object()(query, closest); } // closest point with user-specified hint diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h index a5499444274..373874c4a04 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h @@ -67,7 +67,7 @@ template class First_intersection_traits { typedef typename AABBTraits::FT FT; - typedef typename AABBTraits::Point Point; + typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Primitive::Id Primitive_id; @@ -110,7 +110,7 @@ template class Listing_intersection_traits { typedef typename AABBTraits::FT FT; - typedef typename AABBTraits::Point Point; + typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Primitive::Id Primitive_id; @@ -152,7 +152,7 @@ template class Listing_primitive_traits { typedef typename AABBTraits::FT FT; - typedef typename AABBTraits::Point Point; + typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Primitive::Id Primitive_id; @@ -192,7 +192,7 @@ template class First_primitive_traits { typedef typename AABBTraits::FT FT; - typedef typename AABBTraits::Point Point; + typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Primitive::Id Primitive_id; @@ -237,7 +237,7 @@ template class Do_intersect_traits { typedef typename AABBTraits::FT FT; - typedef typename AABBTraits::Point Point; + typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Primitive::Id Primitive_id; @@ -278,7 +278,7 @@ template class Projection_traits { typedef typename AABBTraits::FT FT; - typedef typename AABBTraits::Point Point; + typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Primitive::Id Primitive_id; diff --git a/AABB_tree/test/AABB_tree/AABB_test_util.h b/AABB_tree/test/AABB_tree/AABB_test_util.h index a7b8ac34d09..6ac91ade4c9 100644 --- a/AABB_tree/test/AABB_tree/AABB_test_util.h +++ b/AABB_tree/test/AABB_tree/AABB_test_util.h @@ -311,7 +311,7 @@ class Naive_implementations typedef typename Traits::Object_and_primitive_id Object_and_primitive_id; typedef typename Pr::Id Primitive_id; typedef typename Traits::FT FT; - typedef typename Traits::Point Point; + typedef typename Traits::Point_3 Point; typedef typename Traits::Point_and_primitive_id Point_and_primitive_id; typedef boost::optional Intersection_result;