From e52c14ffc92723a7de334023089418af988fa2e6 Mon Sep 17 00:00:00 2001 From: Pierre Alliez Date: Sun, 26 Apr 2009 14:39:35 +0000 Subject: [PATCH] AABB tree: more on doc. --- AABB_tree/doc_tex/AABB_tree/AABB_tree_user.tex | 12 ++++++------ AABB_tree/doc_tex/AABB_tree_ref/AABBPrimitive.tex | 4 ++-- AABB_tree/include/CGAL/AABB_segment_primitive.h | 3 ++- AABB_tree/include/CGAL/AABB_triangle_primitive.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/AABB_tree/doc_tex/AABB_tree/AABB_tree_user.tex b/AABB_tree/doc_tex/AABB_tree/AABB_tree_user.tex index 5d284833d4b..ad075c33b26 100644 --- a/AABB_tree/doc_tex/AABB_tree/AABB_tree_user.tex +++ b/AABB_tree/doc_tex/AABB_tree/AABB_tree_user.tex @@ -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. \ No newline at end of file +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. \ No newline at end of file diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABBPrimitive.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABBPrimitive.tex index 1ab822488a9..850277a354f 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABBPrimitive.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABBPrimitive.tex @@ -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} diff --git a/AABB_tree/include/CGAL/AABB_segment_primitive.h b/AABB_tree/include/CGAL/AABB_segment_primitive.h index f8feea145d4..f930fc67f28 100644 --- a/AABB_tree/include/CGAL/AABB_segment_primitive.h +++ b/AABB_tree/include/CGAL/AABB_segment_primitive.h @@ -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; } diff --git a/AABB_tree/include/CGAL/AABB_triangle_primitive.h b/AABB_tree/include/CGAL/AABB_triangle_primitive.h index b651eaf44db..3b5c161323d 100644 --- a/AABB_tree/include/CGAL/AABB_triangle_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangle_primitive.h @@ -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)