AABB tree: more on doc.

This commit is contained in:
Pierre Alliez 2009-04-26 14:39:35 +00:00
parent 4018a88be9
commit e52c14ffc9
4 changed files with 11 additions and 10 deletions

View File

@ -1,11 +1,11 @@
\section{Introduction}
\label{AABB_tree_section_intro}
The AABB tree component offers a data structure and algorithms to perform efficient intersection and projection of queries against a large set of geometric objects. Common examples of intersection queries include a 3D ray against a set of 3D triangles, and a 3D plane against a set of 3D segments. A common example of projection query is to find the closest point from a 3D point query to a set of 3D triangles.
The AABB tree component offers a data structure and algorithms to perform efficient intersection and projection of 3D queries against a large set of 3D geometric objects. Common examples of intersection queries include a ray or line or segment against a set of triangles, and a plane against a set of segments. A common example of projection query is to find the closest point from a point query to a set of triangles.
More generally, the set of geometric objects stored in the data structure may be queried for intersection detection, intersection computation and projection with any type of query type, provided that the corresponding predicates and constructors are implemented in the traits class.
More generally, the set of geometric objects stored in the data structure may be queried for intersection detection, intersection computation and projection with any type of query type, provided that the corresponding intersection predicates and constructors are implemented in the traits class.
The data structure takes as input an iterator range of geometric primitives, where a primitive wraps both one input geometric object and id (e.g., a 3D triangle and a face handle of a polyhedral surface). These primitive which are to be queried for intersection and projection. From these primitives a hierarchy of axis-aligned bounding boxes (AABBs) is built, and used to speed up intersection and projection queries (see Figure \ref{fig:AABB-tree-shark}).
The data structure takes as input an iterator range of geometric primitives, where a primitive wraps both one input geometric object (so-called datum) and one id (e.g., a 3D triangle and a face handle of a polyhedral surface). From these primitives a hierarchy of axis-aligned bounding boxes (AABBs) is constructed, and used to speed up intersection and projection queries (see Figure \ref{fig:AABB-tree-shark}).
\begin{center}
\label{fig:AABB-tree-shark}
@ -32,7 +32,7 @@ In the following example a set of 3D triangles are stored into a list. The AABB
The following example computes the number of intersections between a 3D ray and a set of facets of a triangle polyhedral surface. The AABB primitive wraps a facet handle and generates on the fly a 3D triangle each time its object function is called.
\ccIncludeExampleCode{AABB_tree/AABB_polyhedron_facet_example.cpp}
The following example computes the number of intersections between a 3D plane and a set of 3D segments. The segments are stored into a list, and the AABB primitive simply wraps a segment and an iterator in the list.
The following example computes the number of intersections between a 3D plane and a set of 3D segments. The segments are stored into a list, and the AABB primitive wraps a segment and an iterator in the list.
\ccIncludeExampleCode{AABB_tree/AABB_segment_3_example.cpp}
The following example computes the number of intersections between a 3D plane and a set of edges of a triangle polyhedral surfaces. The AABB primitive wraps a halfedge handle and generates on the fly a 3D segment each time its object function is called..
@ -42,6 +42,6 @@ The following example computes the number of intersections between a 3D plane an
\section{Implementation Details}
\label{AABB_tree_section_intro}
The hierarchy construction is initialized by computing the AABB of the whole set of input primitives. All primitives are then stored along the longest axis of this box, and the primitives are separated into two equal sized sets. This procedure is applied recursively until an AABB contains conceptually only one primitive.
The hierarchy construction is initialized by computing the AABB of the whole set of input primitives. All primitives are then stored along the longest axis of this box, and the primitives are separated into two equal sized sets. This procedure is applied recursively until an AABB contains a single primitive.
In practice the design is slightly different than the one described above as the tree is leafless as presented in OPCODE \cite{opcode}. An intersection query traverses the tree by computing intersection tests only with respect to the AABBs during traversal, and with respect to the input primitives at the end of traversal, i.e., in the leafs of the tree. A projection query between, e.g., a point $q$ and a set of triangle primitives is turned into a \emph{ball} query centered at the query point. The ball then traverses the tree while recursively querying intersections with the AABBs, and computes the closest point $p$ from the query point to the input primitives only when the traversal ends at a leaf of the tree. The ball radius is then shrunk to the distance between p and q for all remaining recursive tree traversals. Efficiency is achieved through setting the initial ball radius to a small value although guaranteed to intersect the input primitives.
In practice the design is slightly different than the one described above as the tree is leafless as presented in OPCODE \cite{opcode}. An intersection query traverses the tree by computing intersection tests only with respect to the AABBs during traversal, and with respect to the input primitives at the end of traversal, i.e., in the leafs of the tree. A projection query between, e.g., a point $q$ and a set of triangle primitives is turned into a \emph{ball} query centered at the query point. The ball traverses the tree while recursively querying intersections with the AABBs, and computes the closest point $p$ from the query point to the input primitives when the traversal ends, i.e., at the leafs of the tree. The ball radius is then shrunk to the distance between $p$ and $q$ for all remaining recursive tree traversals. Efficiency is achieved through setting the initial ball radius to a small value albeit guaranteed to intersect the input primitives.

View File

@ -42,7 +42,7 @@ The concept \ccRefName\ describes the requirements for the primitives stored in
{Returns the corresponding identifier. This identifier is only used as a reference for the objects in the output of the \ccc{AABB_tree} methods.}
\ccMethod{FT xref();}
{Returns the \ccc{x} reference coordinate of the primitive used for sorting the primitives.}
{Returns the \ccc{x} reference coordinate of the primitive used for sorting the primitives. It can be the x coordinate of either one vertex of the geometric object, or of its centroid, or any other reference point taken on the object.}
\ccMethod{FT yref();}
{Returns the \ccc{y} reference coordinate of the primitive used for sorting the primitives.}
@ -58,7 +58,7 @@ The concept \ccRefName\ describes the requirements for the primitives stored in
\ccExample
Usually, the \ccc{Primitive} type is a wrapper around a \ccc{Handle}. Assume for instance that the input objects are the triangle faces of a mesh stored as a \ccc{CGAL::Polyhedron}, the Primitive type would be a wrapper around the \ccc{Face_handle} type of the polyhedron. The \ccc{Datum} would be a \ccc{Triangle_3}, the \ccc{Id} would be a \ccc{Face_handle}. \ccc{datum()} would return a \ccc{Triangle_3} either constructed on the fly from the id (stored as face handle) or stored internally. \ccc{id()} would return the \ccc{Face_handle}.
The \ccc{Primitive} type can be, e.g., a wrapper around a \ccc{Handle}. Assume for instance that the input objects are the triangle faces of a mesh stored as a \ccc{CGAL::Polyhedron}. The \ccc{Datum} would be a \ccc{Triangle_3} and the \ccc{Id} would be a polyhedron \ccc{Face_handle}. Function \ccc{datum()} can return either a \ccc{Triangle_3} constructed on the fly (memory saving) from the id (face handle) or a \ccc{Triangle_3} stored internally (faster but more memory consuming).
\end{ccRefConcept}

View File

@ -42,10 +42,11 @@ private:
Datum m_datum; // 3D segment
public:
// constructor
AABB_segment_primitive(Id it)
: m_it(it)
{
m_datum = *it; // copy segmetn
m_datum = *it; // copy segment
}
public:
const Datum& datum() const { return m_datum; }

View File

@ -41,7 +41,7 @@ private:
Id m_it; // iterator
Datum m_datum; // 3D triangle
// cosntructor
// constructor
public:
AABB_triangle_primitive(Id it)
: m_it(it)