mirror of https://github.com/CGAL/cgal
concept bugfix
* CODE+DOC: Bbox_3 is a nested type in CGAL's Kernel; the code uses Bbox_3 * DOC: Add Compute_squared_distance_3 in AABBGeomTraits as it is needed by AABBTraits * DOC: remove Splitting_direction from AABBTraits as it is not used * DOC: Squared_distance in AABBTraits is only used between two points (I guess the confusion from the fact that nearest_point use the other version but without using the AABBTraits model). * CODE+DOC add the function to construct Squared_distance functor in AABBTraits + AABB_traits and use it instead of AABBTraits::Compute_squared_distance_3 which was not in the concept * DOC: remove from AABB_traits types Ray_3, Line_3 and Segment_3 that are not required by AABBTraits * CODE: The code was using AABBTraits::Point which is not in the concept. Use Point_3 instead * CODE: reorder typedefs in AABB_traits to match concept order
This commit is contained in:
parent
a8daadeed0
commit
8f22de68ce
|
|
@ -23,7 +23,6 @@ The concept \ccRefName\ defines the requirements for the first template paramete
|
||||||
|
|
||||||
\ccTypes
|
\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{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.}
|
\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:
|
\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}.}
|
\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
|
\ccCreation
|
||||||
\ccCreationVariable{geomtraits} %% choose variable name
|
\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_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
|
\ccHasModels
|
||||||
Any instantiation of \ccc{CGAL::Kernel} is a model of this traits concept.
|
Any instantiation of \ccc{CGAL::Kernel} is a model of this traits concept.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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:
|
\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. }
|
\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:
|
%remove as not used any where in the code
|
||||||
\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}.}
|
%\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}
|
The following predicates are required for each type \ccc{Query}
|
||||||
for which the class \ccc{AABB_tree<AT>} may receive an intersection detection or computation query.
|
for which the class \ccc{AABB_tree<AT>} may receive an intersection detection or computation query.
|
||||||
|
|
@ -71,8 +72,8 @@ for which the class \ccc{AABB_tree<AT>} may receive a distance query.
|
||||||
\ccNestedType{Closest_point}{A functor object to compute closest point from the query on a primitive. Provides the operator:
|
\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.}
|
\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:
|
\ccNestedType{Squared_distance}{A functor object to compute the squared distance between two points. Provides the operator:
|
||||||
\ccc{FT operator()(const Query& query, const Point_3 & p);} which returns the squared distance between \ccc{query} and \ccc{p}.}
|
\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
|
\ccCreationVariable{traits} %% choose variable name
|
||||||
|
|
||||||
|
|
@ -94,6 +95,8 @@ for which the class \ccc{AABB_tree<AT>} may receive a distance query.
|
||||||
|
|
||||||
\ccMethod{Closest_point closest_point_object();}{Returns the closest point constructor.}
|
\ccMethod{Closest_point closest_point_object();}{Returns the closest point constructor.}
|
||||||
|
|
||||||
|
\ccMethod{Squared_distance squared_distance_object();}{Returns the squared distance functor.}
|
||||||
|
|
||||||
\ccHasModels
|
\ccHasModels
|
||||||
\ccc{AABB_traits<GeomTraits,Primitive>}.
|
\ccc{AABB_traits<GeomTraits,Primitive>}.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,11 @@ The template parameter \ccc{GeomTraits} provides the geometric types as well as
|
||||||
|
|
||||||
\ccTypes
|
\ccTypes
|
||||||
|
|
||||||
\ccTypedef{typedef GeomTraits::Point_3 Point_3;}{Point query type.}
|
\ccTypedef{typedef GeomTraits::FT FT;}{}
|
||||||
\ccGlue
|
\ccGlue
|
||||||
\ccTypedef{typedef GeomTraits::Ray_3 Ray_3;}{Ray query type.}
|
\ccTypedef{typedef GeomTraits::Point_3 Point_3;}{}
|
||||||
\ccGlue
|
\ccGlue
|
||||||
\ccTypedef{typedef GeomTraits::Line_3 Line_3;}{Line query type.}
|
\ccTypedef{typedef CGAL::Bbox_3 Bounding_box;}{}
|
||||||
\ccGlue
|
|
||||||
\ccTypedef{typedef GeomTraits::Segment_3 Segment_3;}{Segment query type.}
|
|
||||||
\ccGlue
|
\ccGlue
|
||||||
\ccNestedType{size_type}{Unsigned integral type.}
|
\ccNestedType{size_type}{Unsigned integral type.}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,34 +41,29 @@ namespace CGAL {
|
||||||
template<typename GeomTraits, typename AABB_primitive>
|
template<typename GeomTraits, typename AABB_primitive>
|
||||||
class AABB_traits
|
class AABB_traits
|
||||||
{
|
{
|
||||||
|
typedef typename CGAL::Object Object;
|
||||||
public:
|
public:
|
||||||
typedef AABB_traits<GeomTraits, AABB_primitive> AT;
|
typedef AABB_traits<GeomTraits, AABB_primitive> AT;
|
||||||
/// AABBTraits concept types
|
/// 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,typename Primitive::Id> Object_and_primitive_id;
|
|
||||||
typedef typename std::pair<Point,typename Primitive::Id> Point_and_primitive_id;
|
|
||||||
|
|
||||||
// types for search tree
|
|
||||||
typedef typename GeomTraits::FT FT;
|
typedef typename GeomTraits::FT FT;
|
||||||
typedef typename GeomTraits::Point_3 Point_3;
|
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,typename Primitive::Id> Object_and_primitive_id;
|
||||||
|
typedef typename std::pair<Point_3,typename Primitive::Id> 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::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_center_3 Construct_center_3;
|
||||||
typedef typename GeomTraits::Construct_iso_cuboid_3 Construct_iso_cuboid_3;
|
typedef typename GeomTraits::Compute_squared_radius_3 Compute_squared_radius_3;
|
||||||
typedef typename GeomTraits::Construct_min_vertex_3 Construct_min_vertex_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_max_vertex_3 Construct_max_vertex_3;
|
||||||
typedef typename GeomTraits::Compute_squared_radius_3 Compute_squared_radius_3;
|
typedef typename GeomTraits::Construct_iso_cuboid_3 Construct_iso_cuboid_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;
|
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
AABB_traits() { };
|
AABB_traits() { };
|
||||||
|
|
@ -76,6 +71,8 @@ public:
|
||||||
/// Non-virtual Destructor
|
/// Non-virtual Destructor
|
||||||
~AABB_traits() { };
|
~AABB_traits() { };
|
||||||
|
|
||||||
|
typedef typename GeomTraits::Compute_squared_distance_3 Squared_distance;
|
||||||
|
Squared_distance squared_distance_object() const { return GeomTraits().compute_squared_distance_3_object(); }
|
||||||
|
|
||||||
///
|
///
|
||||||
/**
|
/**
|
||||||
|
|
@ -180,7 +177,7 @@ Intersection intersection_object() {return Intersection();}
|
||||||
|
|
||||||
// This should go down to the GeomTraits, i.e. the kernel
|
// This should go down to the GeomTraits, i.e. the kernel
|
||||||
class Closest_point {
|
class Closest_point {
|
||||||
typedef typename AT::Point Point;
|
typedef typename AT::Point_3 Point;
|
||||||
typedef typename AT::Primitive Primitive;
|
typedef typename AT::Primitive Primitive;
|
||||||
public:
|
public:
|
||||||
Point operator()(const Point& p, const Primitive& pr, const Point& bound) const
|
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,
|
// do_intersect to something like does_contain (this is what we compute,
|
||||||
// this is not the same do_intersect as the spherical kernel)
|
// this is not the same do_intersect as the spherical kernel)
|
||||||
class Compare_distance {
|
class Compare_distance {
|
||||||
typedef typename AT::Point Point;
|
typedef typename AT::Point_3 Point;
|
||||||
typedef typename AT::FT FT;
|
typedef typename AT::FT FT;
|
||||||
typedef typename AT::Primitive Primitive;
|
typedef typename AT::Primitive Primitive;
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace CGAL {
|
||||||
/// types
|
/// types
|
||||||
typedef AABBTraits AABB_traits;
|
typedef AABBTraits AABB_traits;
|
||||||
typedef typename AABBTraits::FT FT;
|
typedef typename AABBTraits::FT FT;
|
||||||
typedef typename AABBTraits::Point Point;
|
typedef typename AABBTraits::Point_3 Point;
|
||||||
typedef typename AABBTraits::Primitive Primitive;
|
typedef typename AABBTraits::Primitive Primitive;
|
||||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||||
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
||||||
|
|
@ -518,7 +518,7 @@ public:
|
||||||
const Point& hint) const
|
const Point& hint) const
|
||||||
{
|
{
|
||||||
const Point closest = this->closest_point(query, hint);
|
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
|
// squared distance without user-specified hint
|
||||||
|
|
@ -527,7 +527,7 @@ public:
|
||||||
AABB_tree<Tr>::squared_distance(const Point& query) const
|
AABB_tree<Tr>::squared_distance(const Point& query) const
|
||||||
{
|
{
|
||||||
const Point closest = this->closest_point(query);
|
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
|
// closest point with user-specified hint
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ template<typename AABBTraits, typename Query>
|
||||||
class First_intersection_traits
|
class First_intersection_traits
|
||||||
{
|
{
|
||||||
typedef typename AABBTraits::FT FT;
|
typedef typename AABBTraits::FT FT;
|
||||||
typedef typename AABBTraits::Point Point;
|
typedef typename AABBTraits::Point_3 Point;
|
||||||
typedef typename AABBTraits::Primitive Primitive;
|
typedef typename AABBTraits::Primitive Primitive;
|
||||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||||
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
||||||
|
|
@ -110,7 +110,7 @@ template<typename AABBTraits, typename Query, typename Output_iterator>
|
||||||
class Listing_intersection_traits
|
class Listing_intersection_traits
|
||||||
{
|
{
|
||||||
typedef typename AABBTraits::FT FT;
|
typedef typename AABBTraits::FT FT;
|
||||||
typedef typename AABBTraits::Point Point;
|
typedef typename AABBTraits::Point_3 Point;
|
||||||
typedef typename AABBTraits::Primitive Primitive;
|
typedef typename AABBTraits::Primitive Primitive;
|
||||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||||
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
||||||
|
|
@ -152,7 +152,7 @@ template<typename AABBTraits, typename Query, typename Output_iterator>
|
||||||
class Listing_primitive_traits
|
class Listing_primitive_traits
|
||||||
{
|
{
|
||||||
typedef typename AABBTraits::FT FT;
|
typedef typename AABBTraits::FT FT;
|
||||||
typedef typename AABBTraits::Point Point;
|
typedef typename AABBTraits::Point_3 Point;
|
||||||
typedef typename AABBTraits::Primitive Primitive;
|
typedef typename AABBTraits::Primitive Primitive;
|
||||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||||
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
||||||
|
|
@ -192,7 +192,7 @@ template<typename AABBTraits, typename Query>
|
||||||
class First_primitive_traits
|
class First_primitive_traits
|
||||||
{
|
{
|
||||||
typedef typename AABBTraits::FT FT;
|
typedef typename AABBTraits::FT FT;
|
||||||
typedef typename AABBTraits::Point Point;
|
typedef typename AABBTraits::Point_3 Point;
|
||||||
typedef typename AABBTraits::Primitive Primitive;
|
typedef typename AABBTraits::Primitive Primitive;
|
||||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||||
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
||||||
|
|
@ -237,7 +237,7 @@ template<typename AABBTraits, typename Query>
|
||||||
class Do_intersect_traits
|
class Do_intersect_traits
|
||||||
{
|
{
|
||||||
typedef typename AABBTraits::FT FT;
|
typedef typename AABBTraits::FT FT;
|
||||||
typedef typename AABBTraits::Point Point;
|
typedef typename AABBTraits::Point_3 Point;
|
||||||
typedef typename AABBTraits::Primitive Primitive;
|
typedef typename AABBTraits::Primitive Primitive;
|
||||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||||
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
||||||
|
|
@ -278,7 +278,7 @@ template <typename AABBTraits>
|
||||||
class Projection_traits
|
class Projection_traits
|
||||||
{
|
{
|
||||||
typedef typename AABBTraits::FT FT;
|
typedef typename AABBTraits::FT FT;
|
||||||
typedef typename AABBTraits::Point Point;
|
typedef typename AABBTraits::Point_3 Point;
|
||||||
typedef typename AABBTraits::Primitive Primitive;
|
typedef typename AABBTraits::Primitive Primitive;
|
||||||
typedef typename AABBTraits::Bounding_box Bounding_box;
|
typedef typename AABBTraits::Bounding_box Bounding_box;
|
||||||
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
typedef typename AABBTraits::Primitive::Id Primitive_id;
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ class Naive_implementations
|
||||||
typedef typename Traits::Object_and_primitive_id Object_and_primitive_id;
|
typedef typename Traits::Object_and_primitive_id Object_and_primitive_id;
|
||||||
typedef typename Pr::Id Primitive_id;
|
typedef typename Pr::Id Primitive_id;
|
||||||
typedef typename Traits::FT FT;
|
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 typename Traits::Point_and_primitive_id Point_and_primitive_id;
|
||||||
|
|
||||||
typedef boost::optional<Object_and_primitive_id> Intersection_result;
|
typedef boost::optional<Object_and_primitive_id> Intersection_result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue