mirror of https://github.com/CGAL/cgal
polish AABB Tree
This commit is contained in:
parent
3d8e818ba1
commit
d16be07906
|
|
@ -61,15 +61,15 @@ objects.
|
||||||
|
|
||||||
Tests:
|
Tests:
|
||||||
|
|
||||||
- Function AABB_tree::do_intersect() tests if the input primitives are
|
- Function `AABB_tree::do_intersect()` tests if the input primitives are
|
||||||
intersected by the query. This function is fast as it involves only
|
intersected by the query. This function is fast as it involves only
|
||||||
predicates and stops after the first encountered intersection.
|
predicates and stops after the first encountered intersection.
|
||||||
- Function AABB_tree::number_of_intersected_primitives counts all
|
- Function `AABB_tree::number_of_intersected_primitives()` counts all
|
||||||
intersected primitives.
|
intersected primitives.
|
||||||
- Function AABB_tree::all_intersected_primitives enumerates all intersected
|
- Function `AABB_tree::all_intersected_primitives()` enumerates all intersected
|
||||||
primitives ids without constructing the corresponding intersection
|
primitives ids without constructing the corresponding intersection
|
||||||
objects.
|
objects.
|
||||||
- Function AABB_tree::any_intersected_primitive returns the first
|
- Function `AABB_tree::any_intersected_primitive()` returns the first
|
||||||
encountered intersecting primitive id (if any) without constructing
|
encountered intersecting primitive id (if any) without constructing
|
||||||
the corresponding intersection object, and stops after the first
|
the corresponding intersection object, and stops after the first
|
||||||
encountered intersection. Note that the traversal order of the tree is
|
encountered intersection. Note that the traversal order of the tree is
|
||||||
|
|
@ -78,9 +78,9 @@ the intersections with respect to the query.
|
||||||
|
|
||||||
Constructions:
|
Constructions:
|
||||||
|
|
||||||
- Function AABB_tree::all_intersections() detects and constructs all
|
- Function `AABB_tree::all_intersections()` detects and constructs all
|
||||||
intersection objects with the input primitives.
|
intersection objects with the input primitives.
|
||||||
- Function AABB_tree::any_intersection() detects and constructs the first
|
- Function `AABB_tree::any_intersection()` detects and constructs the first
|
||||||
encountered intersection and constructs the corresponding object. This
|
encountered intersection and constructs the corresponding object. This
|
||||||
function is fast as it stops after the first encountered intersection.
|
function is fast as it stops after the first encountered intersection.
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ triangle query and the closest point from a point query.
|
||||||
|
|
||||||
The AABB tree is a static data structure, but it allows to insert
|
The AABB tree is a static data structure, but it allows to insert
|
||||||
primitives, and will internally rebuild triggered by the first query,
|
primitives, and will internally rebuild triggered by the first query,
|
||||||
or because the user calls the `AABB_tree::build` method. The following
|
or because the user calls the `AABB_tree::build()` method. The following
|
||||||
example illustrates this for two polyhedral surfaces.
|
example illustrates this for two polyhedral surfaces.
|
||||||
|
|
||||||
\include AABB_insertion_example.cpp
|
\include AABB_insertion_example.cpp
|
||||||
|
|
@ -267,7 +267,7 @@ surface mesh.
|
||||||
|
|
||||||
|
|
||||||
\cgalFigureBegin{figAABB-tree-bench,bench.png}
|
\cgalFigureBegin{figAABB-tree-bench,bench.png}
|
||||||
Number of queries per second against number of triangles for the knot model with 14K (shown), 57K, 230K and 921K triangles. We call the `all_intersections` function with segment queries randomly chosen within the bounding box.
|
Number of queries per second against number of triangles for the knot model with 14K (shown), 57K, 230K and 921K triangles. We call the `all_intersections()` function with segment queries randomly chosen within the bounding box.
|
||||||
\cgalFigureEnd
|
\cgalFigureEnd
|
||||||
|
|
||||||
The following table measures the number of `AABB_tree::all_intersections()`
|
The following table measures the number of `AABB_tree::all_intersections()`
|
||||||
|
|
@ -322,7 +322,7 @@ query and location of query in space.
|
||||||
|
|
||||||
- %Kernel: The type of \cgal kernel turns out to dominate the final
|
- %Kernel: The type of \cgal kernel turns out to dominate the final
|
||||||
execution times, the maximum performances being obtained with the
|
execution times, the maximum performances being obtained with the
|
||||||
simple Cartesian kernel parameterized with the double precision
|
`Simple_cartesian` kernel parameterized with the double precision
|
||||||
number type. In applications where the intersection and distance
|
number type. In applications where the intersection and distance
|
||||||
execution times are crucial it is possible to use this kernel for
|
execution times are crucial it is possible to use this kernel for
|
||||||
the AABB tree in combination with a more robust kernel for the main
|
the AABB tree in combination with a more robust kernel for the main
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,11 @@ namespace CGAL {
|
||||||
/// AABB tree is built should not be deleted while the AABB tree
|
/// AABB tree is built should not be deleted while the AABB tree
|
||||||
/// is in use.
|
/// is in use.
|
||||||
///
|
///
|
||||||
/// The template parameter \c GeomTraits provides a \c %Point_3
|
/// \tparam GeomTraits must provide a \c %Point_3
|
||||||
/// type, used as \c Point, and a \c %Segment_3 type, used as \c
|
/// type, used as \c Point, and a \c %Segment_3 type, used as \c
|
||||||
/// Datum and constructible from two arguments of type \c
|
/// Datum and constructible from two arguments of type \c
|
||||||
/// Point. The template parameter \c Polyhedron should be a
|
/// Point.
|
||||||
|
/// \tparam Polyhedron must be a
|
||||||
/// \c CGAL::Polyhedron_3 whose points have type \c Point.
|
/// \c CGAL::Polyhedron_3 whose points have type \c Point.
|
||||||
///
|
///
|
||||||
/// \sa \ref AABBPrimitive
|
/// \sa \ref AABBPrimitive
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,11 @@ namespace CGAL {
|
||||||
/// the polyhedron from which the AABB tree is built should not be
|
/// the polyhedron from which the AABB tree is built should not be
|
||||||
/// deleted while the AABB tree is in use.
|
/// deleted while the AABB tree is in use.
|
||||||
///
|
///
|
||||||
/// The template parameter \c GeomTraits provides a \c %Point_3
|
/// \tparam GeomTraits must provides a \c %Point_3
|
||||||
/// type, used as \c Point, and a \c %Triangle_3 type, used as \c
|
/// type, used as \c Point, and a \c %Triangle_3 type, used as \c
|
||||||
/// Datum and constructible from three arguments of type \c
|
/// Datum and constructible from three arguments of type \c
|
||||||
/// Point. The template parameter \c Polyhedron should be a
|
/// Point.
|
||||||
|
/// \tparam Polyhedron must be a
|
||||||
/// \c CGAL::Polyhedron_3 whose points have type \c Point.
|
/// \c CGAL::Polyhedron_3 whose points have type \c Point.
|
||||||
///
|
///
|
||||||
/// \sa \ref AABBPrimitive
|
/// \sa \ref AABBPrimitive
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,11 @@ namespace CGAL {
|
||||||
/// constructions are implemented. It handles points, rays, lines and
|
/// constructions are implemented. It handles points, rays, lines and
|
||||||
/// segments as query types for intersection detection and
|
/// segments as query types for intersection detection and
|
||||||
/// computations, and it handles points as query type for distance
|
/// computations, and it handles points as query type for distance
|
||||||
/// queries. The template parameter \c GeomTraits provides the
|
/// queries.
|
||||||
/// geometric types as well as the intersection tests and computations
|
/// \tparam GeomTraits must be a model of the concept \ref AABBGeomTraits,
|
||||||
/// required. This type must be a model of the concept \ref AABBGeomTraits.
|
/// snd provide the geometric types as well as the intersection tests and computations.
|
||||||
/// The template parameter \c Primitive provides the
|
/// \tparam Primitive must be a model of the concept \ref AABBPrimitive and provide the
|
||||||
/// type of primitives stored in the AABB_tree. This parameter must be
|
/// type of primitives stored in the AABB_tree.
|
||||||
/// a model of the concept \ref AABBPrimitive.
|
|
||||||
///
|
///
|
||||||
/// \sa \ref AABBTraits
|
/// \sa \ref AABBTraits
|
||||||
/// \sa AABB_tree
|
/// \sa AABB_tree
|
||||||
|
|
|
||||||
|
|
@ -128,21 +128,21 @@ namespace CGAL {
|
||||||
template<typename ConstPrimitiveIterator>
|
template<typename ConstPrimitiveIterator>
|
||||||
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
|
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
|
||||||
|
|
||||||
/// Add a sequence of primitives to the set of primitive of the
|
/// Adds a sequence of primitives to the set of primitives of the
|
||||||
/// AABB_tree. Type InputIterator can be any const iterator
|
/// tree. Type ConstPrimitiveIterator can be any const iterator
|
||||||
/// such that AABB_tree::Primitive has a constructor taking an
|
/// such that `AABB_tree::Primitive` has a constructor taking an
|
||||||
/// InputIterator as argument.
|
/// ConstPrimitiveIterator as argument.
|
||||||
template<typename ConstPrimitiveIterator>
|
template<typename ConstPrimitiveIterator>
|
||||||
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
|
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
|
||||||
|
|
||||||
/// Add a primitive to the set of primitives of the AABB_tree.
|
/// Adds a primitive to the set of primitives of the tree.
|
||||||
inline void insert(const Primitive& p);
|
inline void insert(const Primitive& p);
|
||||||
|
|
||||||
/// \name Advanced
|
/// \name Advanced
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// After one or more calls to AABB_tree::insert the internal data
|
/// After one or more calls to `AABB_tree::insert()` the internal data
|
||||||
/// structure of AABB_tree must be reconstructed. This procedure
|
/// structure of the tree must be reconstructed. This procedure
|
||||||
/// has a complexity of \f$O(n log(n))\f$, where \f$n\f$ is the number of
|
/// has a complexity of \f$O(n log(n))\f$, where \f$n\f$ is the number of
|
||||||
/// primitives of the tree. This procedure is called implicitly
|
/// primitives of the tree. This procedure is called implicitly
|
||||||
/// at the first call to a query member function. You can call
|
/// at the first call to a query member function. You can call
|
||||||
|
|
@ -153,13 +153,13 @@ namespace CGAL {
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
// Non virtual destructor
|
// Non virtual destructor.
|
||||||
~AABB_tree()
|
~AABB_tree()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clears the tree AABB_tree.
|
/// Clears the tree.
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
// clear AABB tree
|
// clear AABB tree
|
||||||
|
|
@ -174,7 +174,7 @@ namespace CGAL {
|
||||||
/// Returns the number of primitives in the tree.
|
/// Returns the number of primitives in the tree.
|
||||||
size_type size() const { return m_primitives.size(); }
|
size_type size() const { return m_primitives.size(); }
|
||||||
|
|
||||||
/// Returns \c true, iff tree contains no primitive.
|
/// Returns \c true, iff the tree contains no primitive.
|
||||||
bool empty() const { return m_primitives.empty(); }
|
bool empty() const { return m_primitives.empty(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -202,7 +202,7 @@ public:
|
||||||
|
|
||||||
/// Outputs to the iterator the list of all intersected primitives
|
/// Outputs to the iterator the list of all intersected primitives
|
||||||
/// ids. This function does not compute the intersection points
|
/// ids. This function does not compute the intersection points
|
||||||
/// and is hence faster than the function `all_intersections`
|
/// and is hence faster than the function `all_intersections()`
|
||||||
/// function below. Type `Query` must be a type for which
|
/// function below. Type `Query` must be a type for which
|
||||||
/// `do_intersect` predicates are defined
|
/// `do_intersect` predicates are defined
|
||||||
/// in the traits class AABBTraits.
|
/// in the traits class AABBTraits.
|
||||||
|
|
@ -252,7 +252,7 @@ public:
|
||||||
|
|
||||||
/// Returns the minimum squared distance between the query point
|
/// Returns the minimum squared distance between the query point
|
||||||
/// and all input primitives. Method
|
/// and all input primitives. Method
|
||||||
/// `accelerate_distance_queries` should be called before the
|
/// `accelerate_distance_queries()` should be called before the
|
||||||
/// first distance query, so that an internal secondary search
|
/// first distance query, so that an internal secondary search
|
||||||
/// structure is build, for improving performance.
|
/// structure is build, for improving performance.
|
||||||
FT squared_distance(const Point& query) const;
|
FT squared_distance(const Point& query) const;
|
||||||
|
|
@ -260,7 +260,7 @@ public:
|
||||||
/// Returns the point in the union of all input primitives which
|
/// Returns the point in the union of all input primitives which
|
||||||
/// is closest to the query. In case there are several closest
|
/// is closest to the query. In case there are several closest
|
||||||
/// points, one arbitrarily chosen closest point is
|
/// points, one arbitrarily chosen closest point is
|
||||||
/// returned. Method `accelerate_distance_queries` should be
|
/// returned. Method `accelerate_distance_queries()` should be
|
||||||
/// called before the first distance query, so that an internal
|
/// called before the first distance query, so that an internal
|
||||||
/// secondary search structure is build, for improving
|
/// secondary search structure is build, for improving
|
||||||
/// performance.
|
/// performance.
|
||||||
|
|
@ -269,7 +269,7 @@ public:
|
||||||
|
|
||||||
/// Returns a `Point_and_primitive_id` which realizes the
|
/// Returns a `Point_and_primitive_id` which realizes the
|
||||||
/// smallest distance between the query point and all input
|
/// smallest distance between the query point and all input
|
||||||
/// primitives. Method `accelerate_distance_queries` should be
|
/// primitives. Method `accelerate_distance_queries()` should be
|
||||||
/// called before the first distance query, so that an internal
|
/// called before the first distance query, so that an internal
|
||||||
/// secondary search structure is build, for improving
|
/// secondary search structure is build, for improving
|
||||||
/// performance.
|
/// performance.
|
||||||
|
|
@ -319,7 +319,7 @@ public:
|
||||||
/// In order to accelerate distance queries significantly, the
|
/// In order to accelerate distance queries significantly, the
|
||||||
/// AABB tree builds an internal KD-tree containing a set of
|
/// AABB tree builds an internal KD-tree containing a set of
|
||||||
/// potential hints, when the method
|
/// potential hints, when the method
|
||||||
/// `accelerate_distance_queries` is called. This KD-tree
|
/// `accelerate_distance_queries()` is called. This KD-tree
|
||||||
/// provides very good hints that allow the algorithms to run much
|
/// provides very good hints that allow the algorithms to run much
|
||||||
/// faster than with a default hint (such as the
|
/// faster than with a default hint (such as the
|
||||||
/// `reference_point` of the first primitive). The set of
|
/// `reference_point` of the first primitive). The set of
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue