Merge branch 'AABB_tree-one_primitive_per_object-sloriot-old' into AABB_tree-one_primitive_per_object-sloriot

Conflicts:
	.gitattributes
	AABB_tree/doc_tex/AABB_tree_ref/AABBGeomTraits.tex
	AABB_tree/doc_tex/AABB_tree_ref/AABBTraits.tex
	AABB_tree/dont_submit
	AABB_tree/include/CGAL/AABB_traits.h
	AABB_tree/include/CGAL/AABB_tree.h
	AABB_tree/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h
	AABB_tree/test/AABB_tree/AABB_test_util.h
	AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp
	AABB_tree/test/AABB_tree/aabb_distance_edge_test.cpp
	AABB_tree/test/AABB_tree/aabb_distance_triangle_hint_test.cpp
	AABB_tree/test/AABB_tree/aabb_distance_triangle_test.cpp
	AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp
	Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp
	Installation/cmake/modules/CGAL_Common.cmake
	Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake
	Installation/cmake/modules/CGAL_Macros.cmake
	Installation/cmake/modules/CGAL_SetupBoost.cmake
	Installation/cmake/modules/CGAL_SetupDependencies.cmake
	Installation/cmake/modules/CGAL_SetupGMP.cmake
	Installation/cmake/modules/CGAL_SetupGMPXX.cmake
	Installation/cmake/modules/CGAL_SetupLEDA.cmake
	Installation/cmake/modules/CGAL_SetupMPFI.cmake
	Installation/cmake/modules/CGAL_SetupNTL.cmake
	Installation/cmake/modules/CGAL_SetupRS.cmake
	Installation/cmake/modules/CGAL_UseMPFI.cmake
	Installation/cmake/modules/CGAL_UseNTL.cmake
	Installation/cmake/modules/CGAL_UseRS.cmake
	Installation/cmake/modules/CGAL_VersionUtils.cmake
	Interval_skip_list/examples/Interval_skip_list/isl_terrain.pts
	Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_triangulation.cpp
	Maintenance/svn_server/hooks/Mail/Sender/CType/Ext.pm
	Point_set_processing_3/include/CGAL/property_map.h
	Principal_component_analysis/include/CGAL/linear_least_squares_fitting_cuboids_3.h
	Principal_component_analysis/include/CGAL/linear_least_squares_fitting_segments_3.h
	Principal_component_analysis/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h
	Principal_component_analysis/test/Principal_component_analysis/linear_least_squares_fitting_segments_3.cpp
	Principal_component_analysis/test/Principal_component_analysis/linear_least_squares_fitting_spheres_3.cpp
	Scripts/developer_scripts/list_package_files.rb
	Scripts/developer_scripts/mirror_all_packages.rb
	Scripts/developer_scripts/mirror_package.rb
	Scripts/developer_scripts/mirror_package_files.rb
	Scripts/developer_scripts/remove_package_files_from_build_tree.rb
	Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt
	Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/PS_demo_normal_estimation_plugin.cpp
	Surface_reconstruction_points_3/doc_tex/Surface_reconstruction_points_3/contouring.tex
	Surface_reconstruction_points_3/doc_tex/Surface_reconstruction_points_3/output.tex
This commit is contained in:
Sébastien Loriot 2013-06-18 11:50:30 +02:00
commit 650f9b4295
46 changed files with 1766 additions and 252 deletions

5
AABB_tree/TODO Normal file
View File

@ -0,0 +1,5 @@
*DOC:
- AABB_tree
add traits in the constructor taking a range?
*CODE:
-insert primitive and data?

View File

@ -27,6 +27,13 @@ The concept \ccRefName\ describes the requirements for the primitives stored in
\ccNestedType{Datum}{Type of input datum.}
\ccNestedType{Point_reference}{The type of a reference to an element of type \ccc{Point} returned by the \ccc{point()} function. It is convertible to the type \ccc{Point}.}
\ccNestedType{Datum_reference}{The type of a reference to an element of type \ccc{Datum} returned by the \ccc{datum()} function. It is convertible to the type \ccc{Datum}.}
\ccNestedType{Id}{Type of identifiers through which the input objects are referred to. It must be a model of the concepts DefaultConstructible and Assignable.}
@ -35,13 +42,14 @@ The concept \ccRefName\ describes the requirements for the primitives stored in
\ccOperations
\ccMethod{Datum datum();}{Returns the datum (geometric object) represented by the primitive.}
\ccMethod{Datum_reference datum();}{Returns the datum (geometric object) represented by the primitive.}
\ccMethod{Id id();}{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{Point reference_point();}{Returns a 3D point located on the geometric object represented by the primitive. This function is used to sort the primitives during the AABB tree construction as well as to construct the search KD-tree internal to the AABB tree used to accelerate distance queries.}
\ccMethod{Point_reference reference_point();}{Returns a 3D point located on the geometric object represented by the primitive. This function is used to sort the primitives during the AABB tree construction as well as to construct the search KD-tree internal to the AABB tree used to accelerate distance queries.}
\ccSeeAlso
\ccc{AABBPrimitiveWithSharedData}\\
\ccc{AABB_tree<AT>}
\ccExample
@ -49,8 +57,12 @@ The concept \ccRefName\ describes the requirements for the primitives stored in
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}. Method \ccc{datum()} can return either a \ccc{Triangle_3} constructed on the fly from the face handle or a \ccc{Triangle_3} stored internally. This provides a way for the user to trade memory for efficiency.
\ccHasModels
\ccc{AABB_polyhedron_triangle_primitive<GeomTraits,Polyhedron>},\\
\ccc{AABB_polyhedron_segment_primitive<GeomTraits,Polyhedron>}.
\ccc{AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,Tag_false,cache_datum>},\\
\ccc{AABB_segment_primitive<Iterator,cache_datum>},\\
\ccc{AABB_triangle_primitive<Iterator,cache_datum>},\\
\ccc{AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,Tag_false,cache_datum>},\\
\ccc{AABB_FaceGraph_triangle_primitive<FaceGraph,Tag_false,cache_datum>}.\\
\end{ccRefConcept}

View File

@ -0,0 +1,56 @@
\ccRefPageBegin
\begin{ccRefConcept}{AABBPrimitiveWithSharedData}
\ccDefinition
The concept \ccRefName\ describes the requirements for the primitives stored in the AABB tree data structure. The concept encapsulates a type for the input datum (a geometric object) and an identifier (id) type through which those primitives are referred to. The concept \ccRefName\ also refines the concepts DefaultConstructible and Assignable.
The concept is similar to \ccc{AABBPrimitive} except that some data stored outside of the primitives are required to access the datum and the reference point.
\ccTypes
\ccNestedType{Point}{3D point type.}
\ccNestedType{Datum}{Type of input datum.}
\ccNestedType{Id}{Type of identifiers through which the input objects are referred to. It must be a model of the concepts DefaultConstructible and Assignable.}
\ccNestedType{Point_reference}{The type of a reference to an element of type \ccc{Point} returned by the \ccc{point(const Shared_data&)} function. It is convertible to the type \ccc{Point}.}
\ccNestedType{Datum_reference}{The type of a reference to an element of type \ccc{Datum} returned by the \ccc{datum(const Shared_data&)} function. It is convertible to the type \ccc{Datum}.}
\ccNestedType{Shared_data}{An arbitrary type default constructible.}
% variable name
\ccCreationVariable{primitive}
\ccOperations
\ccMethod{Datum_reference datum(const Shared_data& data);}{Returns the datum (geometric object) represented by the primitive.}
\ccMethod{Id id();}{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{Point_reference reference_point(const Shared_data& data);}{Returns a 3D point located on the geometric object represented by the primitive. This function is used to sort the primitives during the AABB tree construction as well as to construct the search KD-tree internal to the AABB tree used to accelerate distance queries.}
\ccMethod{template <class ... T> static Shared_data construct_shared_data(T ... t);}
{A static function responsible for the creation of the shared data of a primitive type \ccc{T...}.
The parameter pack is such that there exists a constructor \ccc{template <class T1, class ... T>} \ccRefName\ \ccc{(T1,T...)}.
}
\ccSeeAlso
\ccc{AABBPrimitive}\\
\ccc{AABB_tree<AT>}
\ccExample
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}. Method \ccc{datum()} can return either a \ccc{Triangle_3} constructed on the fly from the face handle or a \ccc{Triangle_3} stored internally. This provides a way for the user to trade memory for efficiency.
\ccHasModels
\ccc{AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,Tag_true,cache_datum>},\\
\ccc{AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,Tag_true,cache_datum>},\\
\ccc{AABB_FaceGraph_triangle_primitive<FaceGraph,Tag_true,cache_datum>}.\\
\end{ccRefConcept}
\ccRefPageEnd

View File

@ -28,7 +28,7 @@ The concept \ccRefName\ provides the geometric primitive types and methods for t
\ccNestedType{Point_3}{Type of a 3D point.}
\ccNestedType{Primitive}{Type of primitive.
Must be a model of the concept \ccc{AABBPrimitive}.}
Must be a model of the concepts \ccc{AABBPrimitive} or \ccc{AABBPrimitiveWithSharedData}.}
\ccNestedType{Bounding_box}{Bounding box type.}
@ -109,6 +109,15 @@ for which the class \ccc{AABB_tree<AT>} may receive a distance query.
\ccMethod{Squared_distance squared_distance_object();}{Returns the squared distance functor.}
In addition, if \ccc{Primitive} is a model of the concept \ccc{AABBPrimitiveWithSharedData}, the following functions are part of the concept:
\ccMethod{template <class ... T> void set_shared_data(T ... t);}
{the signature of that function must be the same as the static function \ccc{Primitive::construct_shared_data}. The type \ccc{Primitive} expects that the data constructed
by a call to \ccc{Primitive::construct_shared_data(t...)} is the one given back when accessing the reference point and the datum of a primitive.}
\ccMethod{const Primitive::Shared_data& shared_data() const;}{Returns the shared data of the primitive constructed after a call to \ccc{set_shared_data}. If no call to \ccc{set_shared_data}
has been done, \ccc{Primitive::Shared_data()} is returned.}
\ccHasModels
\ccc{AABB_traits<GeomTraits,Primitive>}.

View File

@ -0,0 +1,48 @@
\ccRefPageBegin
\begin{ccRefClass}{AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>}
\ccDefinition
If \ccc{OneFaceGraphPerTree} is \ccc{CGAL::Tag_false}, the class is a model of the concept \ccc{AABBPrimitive}.
If \ccc{OneFaceGraphPerTree} is \ccc{CGAL::Tag_true}, the class is a model of the concept \ccc{AABBPrimitiveWithSharedData}.
It wraps a \ccc{face_descriptor} of a class model of \ccc{FaceGraph} to a 3D triangle.
The class model of \ccc{FaceGraph} from which the primitive is built should not be deleted
while the AABB tree holding the primitive is in use.
\ccParameters
\ccc{FaceGraph} is a model of the face graph concept.\\
\ccc{OneFaceGraphPerTree} is either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, we guarantee that all the primitives will be from a common \ccc{FaceGraph} and some data
will be factorized so that the size of the primitive is reduced. In the latter case, the primitives can be from different graphs and extra storage is required in the primitives. The default is \ccc{CGAL::Tag_true}.\\
\ccc{cache_datum} is either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, the datum is stored in the primitive, while in the latter it is constructed on the fly to reduce
the memory footprint. The default is \ccc{CGAL::Tag_false} (datum is not stored).\\
\ccInclude{CGAL/AABB_FaceGraph_triangle_primitive.h}
\ccTypes
\ccTypedef{typedef boost::property_traits< boost::property_map< FaceGraph, vertex_point_t>::type >::value_type Point;}{The point type.}
\ccGlue
\ccTypedef{typedef Kernel_traits<Point>::Kernel::Triangle_3 Datum;}{Geometric data type.}
\ccGlue
\ccTypedef{typedef boost::graph_traits<FaceGraph>::face_descriptor Id;}{Id type.}
\ccCreation
\ccCreationVariable{p}
\ccConstructor{
template <class Iterator>
AABB_FaceGraph_triangle_primitive(Iterator it,const FaceGraph& graph)}
{Constructs a primitive. \ccc{Iterator} is an input iterator with \ccc{Id} as \ccc{value_type}.}
\ccSeeAlso
\ccc{AABBPrimitive},\\
\ccc{AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,cache_datum>},\\
\ccc{AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>}.\\
\end{ccRefClass}
\ccRefPageEnd

View File

@ -0,0 +1,51 @@
\ccRefPageBegin
\begin{ccRefClass}{AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>}
\ccDefinition
If \ccc{OneHalfedgeGraphPerTree} is \ccc{CGAL::Tag_false}, the class is a model of the concept \ccc{AABBPrimitive}.
If \ccc{OneHalfedgeGraphPerTree} is \ccc{CGAL::Tag_true}, the class is a model of the concept \ccc{AABBPrimitiveWithSharedData}.
It wraps an \ccc{edge_descriptor} of a class model of \ccc{HalfedgeGraph} to a 3D segment.
The class model of \ccc{HalfedgeGraph} from which the primitive is built should not be deleted
while the AABB tree holding the primitive is in use.
\ccParameters
\ccc{HalfedgeGraph} is a model of the halfedge graph concept.\\
\ccc{OneHalfedgeGraphPerTree} is either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, we guarantee that all the primitives will be from a common \ccc{HalfedgeGraph} and some data
will be factorized so that the size of the primitive is reduced. In the latter case, the primitives can be from different graphs and extra storage is required in the primitives. The default is \ccc{CGAL::Tag_true}.\\
\ccc{cache_datum} is either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, the datum is stored in the primitive, while in the latter it is constructed on the fly to reduce
the memory footprint. The default is \ccc{CGAL::Tag_false} (datum is not stored).
\ccInclude{CGAL/AABB_HalfedgeGraph_segment_primitive.h}
\ccTypes
\ccTypedef{typedef boost::property_traits< boost::property_map< HalfedgeGraph, vertex_point_t>::type >::value_type Point;}{The point type.}
\ccGlue
\ccTypedef{typedef Kernel_traits<Point>::Kernel::Segment_3 Datum;}{Geometric data type.}
\ccGlue
\ccTypedef{typedef boost::graph_traits<HalfedgeGraph>::edge_descriptor Id;}{Id type.}
\ccCreation
\ccCreationVariable{p}
\ccConstructor{
template <class Iterator>
AABB_HalfedgeGraph_segment_primitive(Iterator it,const HalfedgeGraph& graph)}
{Constructs a primitive. \ccc{Iterator} is an input iterator with \ccc{Id} as \ccc{value_type}.
The example below gives a way to call this constructor the insert-by-range method of the class \ccc{CGAL::AABB_tree<Traits>}.}
\ccSeeAlso
\ccc{AABBPrimitive},\\
\ccc{AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,cache_datum>},\\
\ccc{AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>}.\\
\ccIncludeExampleCode{AABB_tree/AABB_HalfedgeGraph_edge_example.cpp}
\end{ccRefClass}
\ccRefPageEnd

View File

@ -17,6 +17,10 @@
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
%% \ccHtmlIndexC[class]{} %% add further index entries
This class is deprecated since \cgal\ 4.2, the class \ccc{CGAL::AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>} should be used instead.
\begin{ccDeprecated}
\ccDefinition
The class \ccRefName\ is a model of the concept \ccc{AABBPrimitive}. It wraps a halfedge handle of a polyhedron, which is used as id, and allows the construction of the datum on the fly. Since only the halfedge handle is stored in this primitive, the polyhedron from which the AABB tree is built should not be deleted while the AABB tree is in use.
@ -35,9 +39,11 @@ The template parameter \ccc{GeomTraits} provides a \ccc{Point_3} type, used as \
\ccc{AABBPrimitive},\\
\ccc{AABB_polyhedron_triangle_primitive<GeomTraits,Polyhedron>}\\
\end{ccDeprecated}
\end{ccRefClass}
% +------------------------------------------------------------------------+
%%RefPage: end of main body, begin of footer
\ccRefPageEnd

View File

@ -12,11 +12,15 @@
% +------------------------------------------------------------------------+
\begin{ccRefClass}{AABB_polyhedron_triangle_primitive<GeomTraits,Polyhedron>}
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
%% \ccHtmlIndexC[class]{} %% add further index entries
This class is deprecated since \cgal\ 4.2, the class \ccc{CGAL::AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>} should be used instead.
\begin{ccDeprecated}
\ccDefinition
The class \ccRefName\ is a model of the concept \ccc{AABBPrimitive}. It wraps a facet handle of a polyhedron, which is used as id, and allows the construction of the datum on the fly. Since only the facet handle is stored in this primitive, the polyhedron from which the AABB tree is built should not be deleted while the AABB tree is in use.
@ -36,6 +40,7 @@ The template parameter \ccc{GeomTraits} provides a \ccc{Point_3} type, used as \
\ccc{AABBPrimitive},\\
\ccc{AABB_polyhedron_segment_primitive<GeomTraits,Polyhedron>}\\
\end{ccDeprecated}
\end{ccRefClass}

View File

@ -0,0 +1,49 @@
\begin{ccRefClass}{AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,cache_datum>}
\ccDefinition
If \ccc{ExternalPropertyMaps} is \ccc{CGAL::Tag_false}, the class is a model of the concept \ccc{AABBPrimitive}.
If \ccc{ExternalPropertyMaps} is \ccc{CGAL::Tag_true}, the class is a model of the concept \ccc{AABBPrimitiveWithSharedData}.
The two property maps which are template parameters of the class enable to get the datum and the reference point of
the primitive from the identifier. The last template parameter controls whether the primitive class holds a copy of the datum.
\ccParameters
\ccc{ObjectPropertyMap} is a model of \ccAnchor{http://www.boost.org/doc/libs/release/libs/property_map/doc/ReadablePropertyMap.html}{boost::ReadablePropertyMap}
with \ccc{Id} as \ccc{key_type}. It must be default constructible.\\
\ccc{PointPropertyMap} is a model of \ccAnchor{http://www.boost.org/doc/libs/release/libs/property_map/doc/ReadablePropertyMap.html}{boost::ReadablePropertyMap}
with \ccc{Id} as \ccc{key_type}. It must be default constructible.\\
\ccc{ExternalPropertyMaps}: either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, the property maps will be stored in the traits class, while in the latter they will be stored in the primitive (which increases the size of each primitive).\\
\ccc{cache_datum}: either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, the datum is stored in the primitive, while in the latter it is constructed on the fly to reduce
the memory footprint. The default is \ccc{CGAL::Tag_false} (datum is not stored).
\ccInclude{CGAL/AABB_primitive.h}
\ccTypes
\ccTypedef{typedef boost::property_traits< ObjectPropertyMap >::value_type Datum;}{The geometric data type is the \ccc{value_type} of \ccc{ObjectPropertyMap}.}
\ccGlue
\ccTypedef{typedef boost::property_traits< PointPropertyMap >::value_type Point;}{The point type is the \ccc{value_type} of \ccc{PointPropertyMap}.}
\ccGlue
\ccTypedef{typedef Id Id;}{Id type.}
\ccCreation
\ccCreationVariable{p}
\ccConstructor{AABB_primitive(Id id,ObjectPropertyMap o_pmap=ObjectPropertyMap(),PointPropertyMap p_pmap=PointPropertyMap());}
{Constructs a primitive and initialize the property maps.}
\ccSeeAlso
\ccc{AABBPrimitive},\\
\ccc{AABB_segment_primitive<Iterator,cache_datum>},\\
\ccc{AABB_triangle_primitive<Iterator,cache_datum>},\\
\ccc{AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>},\\
\ccc{AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>}.
\end{ccRefClass}
\ccRefPageEnd

View File

@ -0,0 +1,42 @@
\begin{ccRefClass}{AABB_segment_primitive<Iterator,cache_datum>}
\ccDefinition
The class \ccRefName\ is a model of the concept \ccc{AABBPrimitive}.
An iterator with a 3D segment as \ccc{value_type} is used as identifier.
The iterator from which the primitive is built should not be invalided while the AABB tree holding the primitive is in use.
\ccParameters
\ccc{Iterator} is a model of Forward Iterator concept, with \ccc{value_type} being \ccc{CGAL::Segment_3<Kernel>}.\\
\ccc{cache_datum}: either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, the datum is stored in the primitive, while in the latter it is constructed on the fly to reduce
the memory footprint. The default is \ccc{CGAL::Tag_false} (datum is not stored).
\ccInclude{CGAL/AABB_segment_primitive.h}
\ccTypes
\ccTypedef{typedef std::iterator_traits< Iterator >::value_type Datum;}{The geometric data type is the \ccc{value_type} of \ccc{Iterator}.}
\ccGlue
\ccTypedef{typedef CGAL::Kernel_traits<Datum>::Kernel::Point_3 Point;}{The point type is from the same Kernel as the 3D segment.}
\ccGlue
\ccTypedef{typedef Iterator Id;}{Id type.}
\ccCreation
\ccCreationVariable{p}
\ccConstructor{AABB_primitive(Id id);}{Constructs a primitive.}
\ccSeeAlso
\ccc{AABBPrimitive},\\
\ccc{AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,cache_datum>},\\
\ccc{AABB_triangle_primitive<Iterator,cache_datum>},\\
\ccc{AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>},\\
\ccc{AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>}.
\end{ccRefClass}
\ccRefPageEnd

View File

@ -22,7 +22,7 @@
The class \ccRefName\ is a model of the concept \ccc{AABBTraits}. This traits class handles any type of 3D geometric primitives provided that the proper intersection tests and constructions are implemented. It handles points, rays, lines and segments as query types for intersection detection and computations, and it handles points as query type for distance queries.
\ccParameters
The template parameter \ccc{GeomTraits} provides the geometric types as well as the intersection tests and computations required. This type must be a model of the concept \ccc{AABBGeomTraits}. The template parameter \ccc{Primitive} provides the type of primitives stored in the AABB tree. This parameter must be a model of the concept \ccc{AABBPrimitive}.
The template parameter \ccc{GeomTraits} provides the geometric types as well as the intersection tests and computations required. This type must be a model of the concept \ccc{AABBGeomTraits}. The template parameter \ccc{Primitive} provides the type of primitives stored in the AABB tree. This parameter must be a model of the concept \ccc{AABBPrimitive} or of the concept \ccc{AABBPrimitiveWithSharedData}.
\ccInclude{CGAL/AABB_traits.h}
@ -52,6 +52,7 @@ The template parameter \ccc{GeomTraits} provides the geometric types as well as
\ccc{AABBTraits},\\
\ccc{AABB_tree<AT>}, \\
\ccc{AABBPrimitive}\\
\ccc{AABBPrimitiveWithSharedData}\\
\end{ccRefClass}

View File

@ -20,6 +20,7 @@
\ccDefinition
Class \ccRefName\ is a static data structure for efficient intersection and distance computations in 3D. It builds a hierarchy of axis-aligned bounding boxes (an AABB tree) from a set of 3D geometric objects, and can receive intersection and distance queries, provided that the corresponding predicates are implemented in the traits class \ccc{AT}. The template parameter \ccc{AT} stands for a traits class which must be a model of the concept \ccc{AABBTraits}.
An instance of the class \ccc{AABBTraits} is internally stored.
\ccInclude{CGAL/AABB_tree.h}
@ -47,26 +48,34 @@ return type of intersections with an object of type \ccStyle{Query} through the
\ccCreation
\ccCreationVariable{tree}
\ccConstructor{AABB_tree();}{Constructs an empty tree.}
\ccConstructor{template < class InputIterator>
\ccConstructor{AABB_tree(AABBTraits traits=AABBTraits());}{Constructs an empty tree, and initializes the internally stored traits class using \ccc{traits}.}
\ccConstructor{template < class InputIterator, class ... T>
AABB_tree( InputIterator begin,
InputIterator beyond);}{Builds the AABB tree data structure. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} has a constructor taking a \ccc{InputIterator} as argument. The tree stays empty if the memory allocation is not successful.}
InputIterator beyond,
T ... t);}
{ Equivalent to constructing an empty tree and calling \ccc{insert(first,last,t...)}.
For compilers that do not support variadic templates, overloads up to 5 template arguments are provided.}
\ccOperations
\ccMethod{template < class InputIterator>
\ccMethod{template < class InputIterator, class ... T>
void rebuild(InputIterator begin,
InputIterator beyond);}{Clears the current tree and rebuilds it from scratch. See constructor above for the parameters. }
\ccGlue
InputIterator beyond,
T ... t);}
{ Equivalent to calling \ccc{clear()} followed by \ccc{insert(first,last,t...)}.
For compilers that do not support variadic templates, overloads up to 5 template arguments are provided.}
\ccMethod{void clear();}{Clears the AABB tree. }
\ccGlue
\ccMethod{template <class InputIterator>
void insert(InputIterator begin, InputIterator beyond);}
{Add a sequence of primitives to the set of primitive of the AABB
tree. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive}
has a constructor taking an InputIterator as argument.}
\ccGlue
\ccMethod{template <class InputIterator, class ... T>
void insert(InputIterator begin, InputIterator beyond, T ... t);}
{Add a sequence of primitives to the set of primitives of the AABB
tree. Type \ccc{InputIterator} is any iterator and parameter pack \ccc{T} any types such that \ccc{Primitive}
has a constructor with the following signature: \ccc{Primitive(InputIterator, T...)}. If \ccc{Primitive} is a model of
the concept \ccc{AABBPrimitiveWithSharedData}, a call to \ccc{AABBTraits::set_shared_data(t...)} is made using the internally stored traits.
For compilers that do not support variadic templates, overloads up to 5 template arguments are provided.}
\ccMethod{void insert(const Primitive p);}
{Add a primitive to the set of primitives of the AABB tree.}
@ -82,13 +91,13 @@ return type of intersections with an object of type \ccStyle{Query} through the
\end{ccAdvanced}
\ccGlue
\ccMethod{Bounding_box bbox() const;}{Returns the axis-aligned bounding box of the whole tree. }
\ccGlue
\ccMethod{size_type size() const;}{Returns the number of primitives in the tree. }
\ccGlue
\ccMethod{bool empty() const;}{Returns \ccc{true}, iff tree contains no primitive. }
\ccGlue
\ccMethod{const AABBTraits& traits() const;}{Returns a const reference to the internally stored traits class.}
% INTERSECTION TESTS
\ccHeading{Intersection Tests}

View File

@ -0,0 +1,42 @@
\begin{ccRefClass}{AABB_triangle_primitive<Iterator,cache_datum>}
\ccDefinition
The class \ccRefName\ is a model of the concept \ccc{AABBPrimitive}.
An iterator with a 3D triangle as \ccc{value_type} is used as identifier.
The iterator from which the primitive is built should not be invalided while the AABB tree holding the primitive is in use.
\ccParameters
\ccc{Iterator} is a model of Forward Iterator concept, with \ccc{value_type} being \ccc{CGAL::Triangle_3<Kernel>}.\\
\ccc{cache_datum}: either \ccc{CGAL::Tag_true} or \ccc{CGAL::Tag_false}. In the former case, the datum is stored in the primitive, while in the latter it is constructed on the fly to reduce
the memory footprint. The default is \ccc{CGAL::Tag_false} (datum is not stored).
\ccInclude{CGAL/AABB_triangle_primitive.h}
\ccTypes
\ccTypedef{typedef std::iterator_traits< Iterator >::value_type Datum;}{The geometric data type is the \ccc{value_type} of \ccc{Iterator}.}
\ccGlue
\ccTypedef{typedef CGAL::Kernel_traits<Datum>::Kernel::Point_3 Point;}{The point type is from the same Kernel as the 3D triangle.}
\ccGlue
\ccTypedef{typedef Iterator Id;}{Id type.}
\ccCreation
\ccCreationVariable{p}
\ccConstructor{AABB_primitive(Id id);}{Constructs a primitive.}
\ccSeeAlso
\ccc{AABBPrimitive},\\
\ccc{AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,cache_datum>},\\
\ccc{AABB_segment_primitive<Iterator,cache_datum>},\\
\ccc{AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>},\\
\ccc{AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>}.
\end{ccRefClass}
\ccRefPageEnd

View File

@ -7,9 +7,15 @@
\subsection*{Concepts}
\ccRefConceptPage{AABBPrimitive} \\
\ccRefConceptPage{AABBPrimitiveWithSharedData} \\
\ccRefConceptPage{AABBTraits} \\
\ccRefConceptPage{AABBGeomTraits}
\subsection*{Classes}
\ccRefIdfierPage{CGAL::AABB_traits<GeomTraits,Primitive>} \\
\ccRefIdfierPage{CGAL::AABB_tree<AT>} \\
\ccRefIdfierPage{CGAL::AABB_triangle_primitive<Iterator,cache_datum>}\\
\ccRefIdfierPage{CGAL::AABB_segment_primitive<Iterator,cache_datum>}\\
\ccRefIdfierPage{CGAL::AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,cache_datum>}\\
\ccRefIdfierPage{CGAL::AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>}\\
\ccRefIdfierPage{AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>}

View File

@ -10,9 +10,15 @@
\input{AABB_tree_ref/AABB_tree.tex}
\input{AABB_tree_ref/AABBGeomTraits.tex}
\input{AABB_tree_ref/AABBPrimitive.tex}
\input{AABB_tree_ref/AABB_polyhedron_triangle_primitive.tex}
\input{AABB_tree_ref/AABB_polyhedron_segment_primitive.tex}
\input{AABB_tree_ref/AABBPrimitiveWithSharedData.tex}
\input{AABB_tree_ref/AABB_primitive.tex}
\input{AABB_tree_ref/AABB_triangle_primitive.tex}
\input{AABB_tree_ref/AABB_segment_primitive.tex}
\input{AABB_tree_ref/AABB_HalfedgeGraph_segment_primitive.tex}
\input{AABB_tree_ref/AABB_FaceGraph_triangle_primitive.tex}
\input{AABB_tree_ref/AABBTraits.tex}
\input{AABB_tree_ref/AABB_traits.tex}
\input{AABB_tree_ref/AABB_polyhedron_triangle_primitive.tex}
\input{AABB_tree_ref/AABB_polyhedron_segment_primitive.tex}
%% EOF

View File

@ -0,0 +1,58 @@
// Author(s) : Pierre Alliez
#include <iostream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_HalfedgeGraph_segment_primitive.h>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/bind.hpp>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_HalfedgeGraph_segment_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
template <class Kernel, class HalfedgeGraph>
void run(const HalfedgeGraph& graph){
typename Kernel::Point_3 p(1.0, 0.0, 0.0);
typename Kernel::Point_3 q(0.0, 1.0, 0.0);
typename Kernel::Point_3 r(0.0, 0.0, 1.0);
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor edge_descriptor;
// constructs the AABB tree and the internal search tree for
// efficient distance queries.
Tree tree(boost::edges(graph).first,boost::edges(graph).second,graph);
tree.accelerate_distance_queries();
// counts #intersections with a triangle query
Triangle triangle_query(p,q,r);
std::cout << tree.number_of_intersected_primitives(triangle_query)
<< " intersections(s) with triangle" << std::endl;
// computes the closest point from a query point
typename Kernel::Point_3 point_query(2.0, 2.0, 2.0);
typename Kernel::Point_3 closest = tree.closest_point(point_query);
std::cerr << "closest point is: " << closest << std::endl;
}
int main()
{
Point p(1.0, 0.0, 0.0);
Point q(0.0, 1.0, 0.0);
Point r(0.0, 0.0, 1.0);
Point s(0.0, 0.0, 0.0);
Polyhedron polyhedron;
polyhedron.make_tetrahedron(p, q, r, s);
run<K>(polyhedron);
return EXIT_SUCCESS;
}

View File

@ -4,14 +4,15 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Segment_3 Segment;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Point_and_primitive_id Point_and_primitive_id;

View File

@ -6,14 +6,15 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_polyhedron_segment_primitive.h>
#include <CGAL/AABB_HalfedgeGraph_segment_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_polyhedron_segment_primitive<K,Polyhedron> Primitive;
typedef CGAL::AABB_HalfedgeGraph_segment_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;

View File

@ -7,14 +7,14 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Segment_3 Segment;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Point_and_primitive_id Point_and_primitive_id;

View File

@ -5,8 +5,8 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_3 Point;
@ -14,7 +14,7 @@ typedef K::Plane_3 Plane;
typedef K::Vector_3 Vector;
typedef K::Segment_3 Segment;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef boost::optional< Tree::Intersection_and_primitive_id<Segment>::Type > Segment_intersection;

View File

@ -17,7 +17,7 @@ typedef K::Segment_3 Segment;
typedef K::Triangle_3 Triangle;
typedef std::list<Segment>::iterator Iterator;
typedef CGAL::AABB_segment_primitive<K,Iterator> Primitive;
typedef CGAL::AABB_segment_primitive<Iterator> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;

View File

@ -17,7 +17,7 @@ typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
typedef std::list<Triangle>::iterator Iterator;
typedef CGAL::AABB_triangle_primitive<K,Iterator> Primitive;
typedef CGAL::AABB_triangle_primitive<Iterator> Primitive;
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;

View File

@ -0,0 +1,72 @@
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sebastien Loriot
//
//******************************************************************************
// File Description :
//
//******************************************************************************
#ifndef CGAL_AABB_FACEGRAPH_TRIANGLE_PRIMITIVE_H
#define CGAL_AABB_FACEGRAPH_TRIANGLE_PRIMITIVE_H
#include <CGAL/AABB_primitive.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_3_property_map.h>
namespace CGAL {
template < class FaceGraph,
class OneFaceGraphPerTree=Tag_true,
class cache_datum=Tag_false,
class Id_=typename FaceGraph::Face_handle //this one should be autodetected using face_descriptor
>
class AABB_FaceGraph_triangle_primitive : public AABB_primitive< Id_,
Triangle_from_facet_handle_property_map<FaceGraph>,
One_point_from_facet_handle_property_map<FaceGraph>,
OneFaceGraphPerTree,
cache_datum >
{
typedef Triangle_from_facet_handle_property_map<FaceGraph> Triangle_property_map;
typedef One_point_from_facet_handle_property_map<FaceGraph> Point_property_map;
typedef AABB_primitive< Id_,
Triangle_property_map,
Point_property_map,
Tag_true,
cache_datum > Base;
public:
// constructors
AABB_FaceGraph_triangle_primitive(Id_ it) : Base(it){}
template <class Iterator>
AABB_FaceGraph_triangle_primitive(Iterator it) : Base( it->second,
Triangle_property_map((it->first)),
Point_property_map((it->first)) ){}
static typename Base::Shared_data construct_shared_data() {return typename Base::Shared_data();}
};
} // end namespace CGAL
#endif // CGAL_AABB_FACEGRAPH_TRIANGLE_PRIMITIVE_H

View File

@ -0,0 +1,92 @@
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sebastien Loriot
//
//******************************************************************************
// File Description :
//
//******************************************************************************
#ifndef CGAL_AABB_HALFEDGEGRAPH_TRIANGLE_PRIMITIVE_H
#define CGAL_AABB_HALFEDGEGRAPH_TRIANGLE_PRIMITIVE_H
#include <CGAL/AABB_primitive.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_3_property_map.h>
#include <iterator>
#include <boost/mpl/and.hpp>
#include <CGAL/is_iterator.h>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
namespace CGAL {
template < class HalfedgeGraph,
class OneHalfedgeGraphPerTree=Tag_true,
class cache_datum=Tag_false,
class Id_=typename boost::graph_traits<HalfedgeGraph>::edge_descriptor
>
class AABB_HalfedgeGraph_segment_primitive : public AABB_primitive< Id_,
Segment_from_edge_descriptor_property_map<HalfedgeGraph>,
Source_point_from_edge_descriptor<HalfedgeGraph>,
OneHalfedgeGraphPerTree,
cache_datum >
{
typedef Segment_from_edge_descriptor_property_map<HalfedgeGraph> Triangle_property_map;
typedef Source_point_from_edge_descriptor<HalfedgeGraph> Point_property_map;
typedef AABB_primitive< Id_,
Triangle_property_map,
Point_property_map,
Tag_true,
cache_datum > Base;
public:
// constructors
template <class Iterator>
AABB_HalfedgeGraph_segment_primitive(Iterator it, const HalfedgeGraph& graph)
: Base( Id_(*it),
Triangle_property_map(&graph),
Point_property_map(&graph) ){}
//for backward-compatibility with AABB_polyhedron_segment_primitive
AABB_HalfedgeGraph_segment_primitive(Id_ id)
: Base( id,
Triangle_property_map(NULL),
Point_property_map(NULL) ){}
static typename Base::Shared_data construct_shared_data( const HalfedgeGraph& graph )
{
return Base::construct_shared_data(Triangle_property_map(&graph), Point_property_map(&graph));
}
//for backward-compatibility with AABB_polyhedron_segment_primitive
static typename Base::Shared_data construct_shared_data()
{
return Base::construct_shared_data(Triangle_property_map(NULL), Point_property_map(NULL));
}
};
} // end namespace CGAL
#endif // CGAL_AABB_HALFEDGEGRAPH_TRIANGLE_PRIMITIVE_H

View File

@ -26,6 +26,10 @@
#ifndef CGAL_AABB_POLYHEDRON_SEGMENT_PRIMITIVE_H_
#define CGAL_AABB_POLYHEDRON_SEGMENT_PRIMITIVE_H_
#define CGAL_DEPRECATED_HEADER "<CGAL/AABB_polyhedron_segment_primitive.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/AABB_HalfedgeGraph_segment_primitive.h>"
#include <CGAL/internal/deprecation_warning.h>
namespace CGAL {
/// \addtogroup PkgAABB_tree

View File

@ -26,6 +26,11 @@
#ifndef CGAL_AABB_POLYHEDRON_TRIANGLE_PRIMITIVE_H_
#define CGAL_AABB_POLYHEDRON_TRIANGLE_PRIMITIVE_H_
#define CGAL_DEPRECATED_HEADER "<CGAL/AABB_polyhedron_triangle_primitive.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/AABB_FaceGraph_triangle_primitive.h>"
#include <CGAL/internal/deprecation_warning.h>
namespace CGAL {
/// \ingroup PkgAABB_tree
/// The class AABB_polyhedron_triangle_primitive is a model of the concept

View File

@ -0,0 +1,161 @@
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sebastien Loriot
//
//******************************************************************************
// File Description :
//
//******************************************************************************
#ifndef CGAL_AABB_PRIMITIVE_H
#define CGAL_AABB_PRIMITIVE_H
#include <CGAL/property_map.h>
#include <CGAL/tags.h>
namespace CGAL {
//class for the typedefs
template < class Id_,
class ObjectPropertyMap,
class PointPropertyMap >
struct AABB_primitive_base
{
typedef typename boost::property_traits< ObjectPropertyMap >::value_type Datum; //datum type
typedef typename boost::property_traits< PointPropertyMap >::value_type Point; //point type
typedef typename boost::property_traits< ObjectPropertyMap >::reference Datum_reference; //reference datum type
typedef typename boost::property_traits< PointPropertyMap >::reference Point_reference; //reference point type
typedef Id_ Id; // Id type
protected:
Id m_id;
public:
// constructors
AABB_primitive_base(Id id) : m_id(id) {}
Id id() const {return m_id;}
};
template < class Id,
class ObjectPropertyMap,
class PointPropertyMap,
class ExternalPropertyMaps,
class cache_datum>
struct AABB_primitive;
//no caching, property maps internally stored
template < class Id,
class ObjectPropertyMap,
class PointPropertyMap >
class AABB_primitive<Id, ObjectPropertyMap, PointPropertyMap,Tag_false,Tag_false>
: public AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap>
{
typedef AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap> Base;
ObjectPropertyMap m_obj_pmap;
PointPropertyMap m_pt_pmap;
public:
AABB_primitive(Id id, ObjectPropertyMap obj_pmap=ObjectPropertyMap(), PointPropertyMap pt_pmap=PointPropertyMap())
: Base(id), m_obj_pmap(obj_pmap), m_pt_pmap(pt_pmap) {}
typename Base::Datum_reference
datum() const { return get(m_obj_pmap,this->m_id); }
typename Base::Point_reference
reference_point() const { return get(m_pt_pmap,this->m_id); }
};
//caching, property maps internally stored
template < class Id,
class ObjectPropertyMap,
class PointPropertyMap >
class AABB_primitive<Id, ObjectPropertyMap, PointPropertyMap,Tag_false,Tag_true>
: public AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap>
{
typedef AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap> Base;
typename boost::property_traits< ObjectPropertyMap >::value_type m_datum;
PointPropertyMap m_pt_pmap;
public:
typedef const typename Base::Datum& Datum_reference;
AABB_primitive(Id id, ObjectPropertyMap obj_pmap=ObjectPropertyMap(), PointPropertyMap pt_pmap=PointPropertyMap())
: Base(id), m_datum( get(obj_pmap,id) ), m_pt_pmap(pt_pmap){}
Datum_reference datum() const { return m_datum; }
typename Base::Point_reference
reference_point() const { return get(m_pt_pmap,this->m_id); }
};
//no caching, property maps are stored outside the class
template < class Id,
class ObjectPropertyMap,
class PointPropertyMap >
class AABB_primitive<Id, ObjectPropertyMap, PointPropertyMap,Tag_true,Tag_false>
: public AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap>
{
typedef AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap> Base;
public:
typedef std::pair<ObjectPropertyMap,PointPropertyMap> Shared_data;
AABB_primitive(Id id, ObjectPropertyMap=ObjectPropertyMap(), PointPropertyMap=PointPropertyMap())
: Base(id) {}
typename Base::Datum_reference
datum(const Shared_data& data) const { return get(data.first,this->m_id); }
typename Base::Point_reference
reference_point(const Shared_data& data) const { return get(data.second,this->m_id); }
static Shared_data construct_shared_data(ObjectPropertyMap obj, PointPropertyMap pt) {return Shared_data(obj,pt);}
};
//caching, property map is stored outside the class
template < class Id,
class ObjectPropertyMap,
class PointPropertyMap >
class AABB_primitive<Id, ObjectPropertyMap, PointPropertyMap,Tag_true,Tag_true>
: public AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap>
{
typedef AABB_primitive_base<Id,ObjectPropertyMap,PointPropertyMap> Base;
typename boost::property_traits< ObjectPropertyMap >::value_type m_datum;
public:
typedef PointPropertyMap Shared_data;
typedef const typename Base::Datum& Datum_reference;
AABB_primitive(Id id, ObjectPropertyMap obj_pmap=ObjectPropertyMap(), PointPropertyMap=PointPropertyMap())
: Base(id), m_datum( get(obj_pmap,id) ) {}
Datum_reference datum(Shared_data) const { return m_datum; }
typename Base::Point_reference
reference_point(const Shared_data& data) const { return get(data,this->m_id); }
static Shared_data construct_shared_data(ObjectPropertyMap, PointPropertyMap pt) {return pt;}
};
} // end namespace CGAL
#endif // CGAL_AABB_PRIMITIVE_H

View File

@ -1,4 +1,4 @@
// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@ -16,7 +16,7 @@
// $Id$
//
//
// Author(s) : Pierre Alliez, Stephane Tayeb
// Author(s) : Sebastien Loriot
//
//******************************************************************************
// File Description :
@ -26,46 +26,56 @@
#ifndef CGAL_AABB_SEGMENT_PRIMITIVE_H_
#define CGAL_AABB_SEGMENT_PRIMITIVE_H_
#include <CGAL/AABB_primitive.h>
#include <CGAL/Kernel_traits.h>
#include <iterator>
namespace CGAL {
template <class GeomTraits, class Iterator>
class AABB_segment_primitive
namespace internal {
template <class Iterator>
struct Source_of_segment_3_iterator_property_map{
//classical typedefs
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<Iterator>::value_type >::Kernel GeomTraits;
typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type;
typedef const typename GeomTraits::Point_3& reference;
typedef boost::readable_property_map_tag category;
};
//get function for property map
template <class Iterator>
inline
typename Source_of_segment_3_iterator_property_map<Iterator>::reference
get(Source_of_segment_3_iterator_property_map<Iterator>, Iterator it)
{
return it->source();
}
}//namespace internal
template < class Iterator,
class cache_datum=Tag_false>
class AABB_segment_primitive : public AABB_primitive< Iterator,
Input_iterator_property_map<Iterator>,
internal::Source_of_segment_3_iterator_property_map<Iterator>,
Tag_true,
cache_datum >
{
// types
typedef AABB_primitive< Iterator,
Input_iterator_property_map<Iterator>,
internal::Source_of_segment_3_iterator_property_map<Iterator>,
Tag_true,
cache_datum > Base;
public:
typedef typename GeomTraits::Point_3 Point; // point type
typedef typename GeomTraits::Segment_3 Datum; // datum type
typedef Iterator Id; // Id type
// member data
private:
Id m_it;
Datum m_datum;
public:
// constructors
AABB_segment_primitive() {}
AABB_segment_primitive(Id it)
: m_it(it)
{
m_datum = *it; // copy segment
}
AABB_segment_primitive(const AABB_segment_primitive& primitive)
{
m_it = primitive.id();
m_datum = primitive.datum();
}
public:
Id& id() { return m_it; }
const Id& id() const { return m_it; }
Datum& datum() { return m_datum; }
const Datum& datum() const { return m_datum; }
/// Returns a point on the primitive
Point reference_point() const { return m_datum.source(); }
// constructors
AABB_segment_primitive(Iterator it) : Base(it){}
static typename Base::Shared_data construct_shared_data() {return typename Base::Shared_data();}
};
} // end namespace CGAL
#endif // CGAL_AABB_SEGMENT_PRIMITIVE_H_

View File

@ -28,9 +28,11 @@
#include <CGAL/Bbox_3.h>
#include <CGAL/AABB_intersections.h>
#include <CGAL/Kernel_traits.h>
#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
#include <CGAL/internal/AABB_tree/Primitive_helper.h>
#include <boost/optional.hpp>
#include <boost/bind.hpp>
/// \file AABB_traits.h
@ -45,6 +47,57 @@ namespace internal{ namespace AABB_tree {
} } //end of namespace internal::AABB_tree
namespace internal{
//helper controlling whether extra data should be stored in the AABB_tree traits class
template <class Primitive, bool has_shared_data=Has_nested_type_Shared_data<Primitive>::value>
struct AABB_traits_base;
template <class Primitive>
struct AABB_traits_base<Primitive,false>{};
template <class Primitive>
struct AABB_traits_base<Primitive,true>{
typename Primitive::Shared_data m_primitive_data;
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template <class PrimitiveType, typename ... T>
void set_shared_data(T ... t){
m_primitive_data=PrimitiveType::construct_shared_data(t...);
}
#else
template <class PrimitiveType>
void set_shared_data(){
m_primitive_data=PrimitiveType::construct_shared_data();
}
template <class PrimitiveType, class T1>
void set_shared_data(T1 t1){
m_primitive_data=PrimitiveType::construct_shared_data(t1);
}
template <class PrimitiveType, class T1,class T2,class T3>
void set_shared_data(T1 t1,T2 t2,T3 t3){
m_primitive_data=PrimitiveType::construct_shared_data(t1,t2,t3);
}
template <class PrimitiveType, class T1,class T2,class T3,class T4>
void set_shared_data(T1 t1,T2 t2,T3 t3,T4 t4){
m_primitive_data=PrimitiveType::construct_shared_data(t1,t2,t3,t4);
}
template <class PrimitiveType, class T1,class T2,class T3,class T4,class T5>
void set_shared_data(T1 t1,T2 t2,T3 t3,T4 t4,T5 t5){
m_primitive_data=PrimitiveType::construct_shared_data(t1,t2,t3,t4,t5);
}
#endif
const typename Primitive::Shared_data& shared_data() const {return m_primitive_data;}
};
}
/// \addtogroup PkgAABB_tree
/// @{
@ -63,8 +116,9 @@ namespace internal{ namespace AABB_tree {
/// \sa `AABBTraits`
/// \sa `AABB_tree`
/// \sa `AABBPrimitive`
template<typename GeomTraits, typename AABB_primitive>
class AABB_traits
template<typename GeomTraits, typename AABBPrimitive>
class AABB_traits:
public internal::AABB_traits_base<AABBPrimitive>
{
typedef typename CGAL::Object Object;
public:
@ -135,33 +189,37 @@ public:
* Sorts the range defined by [first,beyond[. Sort is achieved on bbox longuest
* axis, using the comparison function `<dim>_less_than` (dim in {x,y,z})
*/
class Sort_primitives
{
public:
template<typename PrimitiveIterator>
void operator()(PrimitiveIterator first,
PrimitiveIterator beyond,
const typename AT::Bounding_box& bbox) const
class Sort_primitives
{
PrimitiveIterator middle = first + (beyond - first)/2;
switch(longest_axis(bbox))
{
case AT::CGAL_AXIS_X: // sort along x
std::nth_element(first, middle, beyond, less_x);
break;
case AT::CGAL_AXIS_Y: // sort along y
std::nth_element(first, middle, beyond, less_y);
break;
case AT::CGAL_AXIS_Z: // sort along z
std::nth_element(first, middle, beyond, less_z);
break;
default:
CGAL_error();
}
}
};
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
public:
Sort_primitives(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
: m_traits(traits) {}
template<typename PrimitiveIterator>
void operator()(PrimitiveIterator first,
PrimitiveIterator beyond,
const typename AT::Bounding_box& bbox) const
{
PrimitiveIterator middle = first + (beyond - first)/2;
switch(longest_axis(bbox))
{
case AT::CGAL_AXIS_X: // sort along x
std::nth_element(first, middle, beyond, boost::bind(less_x,_1,_2,m_traits));
break;
case AT::CGAL_AXIS_Y: // sort along y
std::nth_element(first, middle, beyond, boost::bind(less_y,_1,_2,m_traits));
break;
case AT::CGAL_AXIS_Z: // sort along z
std::nth_element(first, middle, beyond, boost::bind(less_z,_1,_2,m_traits));
break;
default:
CGAL_error();
}
}
};
Sort_primitives sort_primitives_object() {return Sort_primitives();}
Sort_primitives sort_primitives_object() const {return Sort_primitives(*this);}
/*
@ -170,43 +228,54 @@ Sort_primitives sort_primitives_object() {return Sort_primitives();}
* @param beyond an iterator on the past-the-end primitive
* @return the bounding box of the primitives of the iterator range
*/
class Compute_bbox {
public:
template<typename ConstPrimitiveIterator>
typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond) const
{
typename AT::Bounding_box bbox = compute_bbox(*first);
for(++first; first != beyond; ++first)
class Compute_bbox {
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
public:
Compute_bbox(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
:m_traits (traits) {}
template<typename ConstPrimitiveIterator>
typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond) const
{
typename AT::Bounding_box bbox = compute_bbox(*first,m_traits);
for(++first; first != beyond; ++first)
{
bbox = bbox + compute_bbox(*first,m_traits);
}
return bbox;
}
};
Compute_bbox compute_bbox_object() const {return Compute_bbox(*this);}
class Do_intersect {
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
public:
Do_intersect(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
:m_traits(traits) {}
template<typename Query>
bool operator()(const Query& q, const Bounding_box& bbox) const
{
bbox = bbox + compute_bbox(*first);
return CGAL::do_intersect(q, bbox);
}
return bbox;
}
};
Compute_bbox compute_bbox_object() {return Compute_bbox();}
template<typename Query>
bool operator()(const Query& q, const Primitive& pr) const
{
return GeomTraits().do_intersect_3_object()(q, internal::Primitive_helper<AT>::get_datum(pr,m_traits));
}
};
class Do_intersect {
public:
template<typename Query>
bool operator()(const Query& q, const Bounding_box& bbox) const
{
return CGAL::do_intersect(q, bbox);
}
template<typename Query>
bool operator()(const Query& q, const Primitive& pr) const
{
return GeomTraits().do_intersect_3_object()(q, pr.datum());
}
};
Do_intersect do_intersect_object() {return Do_intersect();}
Do_intersect do_intersect_object() const {return Do_intersect(*this);}
class Intersection {
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
public:
Intersection(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
:m_traits(traits) {}
#if CGAL_INTERSECTION_VERSION < 2
template<typename Query>
boost::optional<typename AT::Object_and_primitive_id>
@ -214,7 +283,7 @@ operator()(const Query& query, const typename AT::Primitive& primitive) const
{
typedef boost::optional<Object_and_primitive_id> Intersection;
CGAL::Object object = GeomTraits().intersect_3_object()(primitive.datum(),query);
CGAL::Object object = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
if ( object.empty() )
return Intersection();
else
@ -225,7 +294,7 @@ operator()(const Query& query, const typename AT::Primitive& primitive) const
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
operator()(const Query& query, const typename AT::Primitive& primitive) const {
typename cpp11::result_of<typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) >::type
inter_res = GeomTraits().intersect_3_object()(primitive.datum(),query);
inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
if (!inter_res)
return boost::optional<typename Intersection_and_primitive_id<Query>::Type>();
return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );
@ -233,17 +302,22 @@ operator()(const Query& query, const typename AT::Primitive& primitive) const
#endif
};
Intersection intersection_object() {return Intersection();}
Intersection intersection_object() const {return Intersection(*this);}
// This should go down to the GeomTraits, i.e. the kernel
class Closest_point {
typedef typename AT::Point_3 Point;
typedef typename AT::Primitive Primitive;
const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
public:
Point operator()(const Point& p, const Primitive& pr, const Point& bound) const
{
return CGAL::nearest_point_3(p, pr.datum(), bound);
}
Closest_point(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
: m_traits(traits) {}
Point operator()(const Point& p, const Primitive& pr, const Point& bound) const
{
return CGAL::nearest_point_3(p, internal::Primitive_helper<AT>::get_datum(pr,m_traits), bound);
}
};
// This should go down to the GeomTraits, i.e. the kernel
@ -275,8 +349,8 @@ Intersection intersection_object() {return Intersection();}
}
};
Closest_point closest_point_object() {return Closest_point();}
Compare_distance compare_distance_object() {return Compare_distance();}
Closest_point closest_point_object() const {return Closest_point(*this);}
Compare_distance compare_distance_object() const {return Compare_distance();}
private:
@ -285,9 +359,10 @@ private:
* @param pr the primitive
* @return the bounding box of the primitive \c pr
*/
static Bounding_box compute_bbox(const Primitive& pr)
static Bounding_box compute_bbox (const Primitive& pr,
const AABB_traits<GeomTraits,AABBPrimitive>& traits)
{
return pr.datum().bbox();
return internal::Primitive_helper<AT>::get_datum(pr,traits).bbox();
}
typedef enum { CGAL_AXIS_X = 0,
@ -297,12 +372,12 @@ private:
static Axis longest_axis(const Bounding_box& bbox);
/// Comparison functions
static bool less_x(const Primitive& pr1, const Primitive& pr2)
{ return pr1.reference_point().x() < pr2.reference_point().x(); }
static bool less_y(const Primitive& pr1, const Primitive& pr2)
{ return pr1.reference_point().y() < pr2.reference_point().y(); }
static bool less_z(const Primitive& pr1, const Primitive& pr2)
{ return pr1.reference_point().z() < pr2.reference_point().z(); }
static bool less_x(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
{ return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).x() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).x(); }
static bool less_y(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
{ return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).y() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).y(); }
static bool less_z(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
{ return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).z() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).z(); }
}; // end class AABB_traits

View File

@ -26,6 +26,8 @@
#include <CGAL/internal/AABB_tree/AABB_traversal_traits.h>
#include <CGAL/internal/AABB_tree/AABB_node.h>
#include <CGAL/internal/AABB_tree/AABB_search_tree.h>
#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
#include <CGAL/internal/AABB_tree/Primitive_helper.h>
#include <boost/optional.hpp>
#ifdef CGAL_HAS_THREADS
@ -103,7 +105,7 @@ namespace CGAL {
///@{
/// Constructs an empty tree.
AABB_tree();
AABB_tree(const AABBTraits& traits);
/**
* @brief Builds the datastructure from a sequence of primitives.
@ -117,8 +119,23 @@ namespace CGAL {
* has a constructor taking a ConstPrimitiveIterator as
* argument.
*/
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template<typename ConstPrimitiveIterator,typename ... T>
AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T...);
#else
template<typename ConstPrimitiveIterator>
AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
template<typename ConstPrimitiveIterator, typename T1>
AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1);
template<typename ConstPrimitiveIterator, typename T1, typename T2>
AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3,T4);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3,T4,T5);
#endif
///@}
@ -127,15 +144,47 @@ namespace CGAL {
/// Clears the current tree and rebuilds it from scratch. See
/// constructor above for the parameters.
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template<typename ConstPrimitiveIterator,typename ... T>
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T...);
#else
template<typename ConstPrimitiveIterator>
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
template<typename ConstPrimitiveIterator, typename T1>
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1);
template<typename ConstPrimitiveIterator, typename T1, typename T2>
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3,T4);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3,T4,T5);
#endif
/// Adds a sequence of primitives to the set of primitives of the
/// tree. \tparam ConstPrimitiveIterator can be any const iterator
/// such that `AABB_tree::Primitive` has a constructor taking an
/// ConstPrimitiveIterator as argument.
template<typename ConstPrimitiveIterator>
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template<typename ConstPrimitiveIterator,typename ... T>
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T...);
#else
template<typename ConstPrimitiveIterator>
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
template<typename ConstPrimitiveIterator, typename T1>
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1);
template<typename ConstPrimitiveIterator, typename T1, typename T2>
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3,T4);
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
void insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1,T2,T3,T4,T5);
#endif
/// Adds a primitive to the set of primitives of the tree.
inline void insert(const Primitive& p);
@ -146,6 +195,10 @@ namespace CGAL {
clear();
}
const AABBTraits& traits() const{
return m_traits;
}
/// Clears the tree.
void clear()
{
@ -188,7 +241,80 @@ namespace CGAL {
///@}
private:
private:
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template <typename PrimitiveType, typename ... T>
void set_primitive_data_impl(CGAL::Boolean_tag<false>,T ... ){}
template <typename PrimitiveType, typename ... T>
void set_primitive_data_impl(CGAL::Boolean_tag<true>,T ... t)
{m_traits.set_shared_data<PrimitiveType>(t...);}
template <typename PrimitiveType, typename ... T>
void set_shared_data(T...t){
set_primitive_data_impl<PrimitiveType>(CGAL::Boolean_tag<internal::Has_nested_type_Shared_data<PrimitiveType>::value>(),t...);
}
#else
template <typename PrimitiveType>
void set_primitive_data_impl(CGAL::Boolean_tag<false>){}
template <typename PrimitiveType>
void set_primitive_data_impl(CGAL::Boolean_tag<true>)
{m_traits.set_shared_data<PrimitiveType>();}
template <typename PrimitiveType>
void set_shared_data(){
set_primitive_data_impl<PrimitiveType>(CGAL::Boolean_tag<internal::Has_nested_type_Shared_data<PrimitiveType>::value>());
}
template <typename PrimitiveType, typename T1>
void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1){}
template <typename PrimitiveType, typename T1>
void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1 t1)
{m_traits.set_shared_data<PrimitiveType>(t1);}
template <typename PrimitiveType, typename T1>
void set_shared_data(T1 t1){
set_primitive_data_impl<PrimitiveType>(Boolean_tag<internal::Has_nested_type_Shared_data<PrimitiveType>::value>(),t1);
}
template <typename PrimitiveType, typename T1, typename T2>
void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2){}
template <typename PrimitiveType, typename T1, typename T2>
void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1 t1,T2 t2)
{m_traits.set_shared_data<PrimitiveType>(t1,t2);}
template <typename PrimitiveType, typename T1, typename T2>
void set_shared_data(T1 t1,T2 t2){
set_primitive_data_impl<PrimitiveType>(Boolean_tag<internal::Has_nested_type_Shared_data<PrimitiveType>::value>(),t1,t2);
}
template <typename PrimitiveType, typename T1, typename T2, typename T3>
void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3){}
template <typename PrimitiveType, typename T1, typename T2, typename T3>
void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1 t1,T2 t2,T3 t3)
{m_traits.set_shared_data<PrimitiveType>(t1,t2,t3);}
template <typename PrimitiveType, typename T1, typename T2, typename T3>
void set_shared_data(T1 t1,T2 t2,T3 t3){
set_primitive_data_impl<PrimitiveType>(Boolean_tag<internal::Has_nested_type_Shared_data<PrimitiveType>::value>(),t1,t2,t3);
}
template <typename PrimitiveType, typename T1, typename T2, typename T3, typename T4>
void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3,T4){}
template <typename PrimitiveType, typename T1, typename T2, typename T3, typename T4>
void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1 t1,T2 t2,T3 t3,T4 t4)
{m_traits.set_shared_data<PrimitiveType>(t1,t2,t3,t4);}
template <typename PrimitiveType, typename T1, typename T2, typename T3, typename T4>
void set_shared_data(T1 t1,T2 t2,T3 t3,T4 t4){
set_primitive_data_impl<PrimitiveType>(Boolean_tag<internal::Has_nested_type_Shared_data<PrimitiveType>::value>(),t1,t2,t3,t4);
}
template <typename PrimitiveType, typename T1, typename T2, typename T3, typename T4, typename T5>
void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3,T4,T5){}
template <typename PrimitiveType, typename T1, typename T2, typename T3, typename T4, typename T5>
void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1 t1,T2 t2,T3 t3,T4 t4,T5 t5)
{m_traits.set_shared_data<PrimitiveType>(t1,t2,t3,t4,t5);}
template <typename PrimitiveType, typename T1, typename T2, typename T3, typename T4, typename T5>
void set_shared_data(T1 t1,T2 t2,T3 t3,T4 t4,T5 t5){
set_primitive_data_impl<PrimitiveType>(Boolean_tag<internal::Has_nested_type_Shared_data<PrimitiveType>::value>(),t1,t2,t3,t4,t5);
}
#endif
template<typename ConstPointIterator>
bool accelerate_distance_queries_impl(ConstPointIterator first,
ConstPointIterator beyond) const;
@ -445,7 +571,9 @@ public:
Point_and_primitive_id any_reference_point_and_id() const
{
CGAL_assertion(!empty());
return Point_and_primitive_id(m_primitives[0].reference_point(), m_primitives[0].id());
return Point_and_primitive_id(
internal::Primitive_helper<AABB_traits>::get_reference_point(m_primitives[0],m_traits), m_primitives[0].id()
);
}
public:
@ -458,6 +586,8 @@ public:
}
private:
//Traits class
AABBTraits m_traits;
// set of input primitives
Primitives m_primitives;
// single root node
@ -502,8 +632,9 @@ public:
/// @}
template<typename Tr>
AABB_tree<Tr>::AABB_tree()
: m_primitives()
AABB_tree<Tr>::AABB_tree(const Tr& traits)
: m_traits(traits)
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
@ -511,11 +642,62 @@ public:
, m_need_build(false)
{}
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template<typename Tr>
template<typename ConstPrimitiveIterator, typename ... T>
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T ... t)
: m_traits()
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
, m_default_search_tree_constructed(false)
, m_need_build(false)
{
// Insert each primitive into tree
insert(first, beyond,t...);
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename ... T>
void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T ... t)
{
set_shared_data<Primitive>(t...);
while(first != beyond)
{
m_primitives.push_back(Primitive(first,t...));
++first;
}
m_need_build = true;
}
// Clears tree and insert a set of primitives
template<typename Tr>
template<typename ConstPrimitiveIterator, typename ... T>
void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T ... t)
{
// cleanup current tree and internal KD tree
clear();
// inserts primitives
insert(first, beyond,t...);
build();
}
#else
//=============constructor======================
template<typename Tr>
template<typename ConstPrimitiveIterator>
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond)
: m_primitives()
: m_traits()
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
@ -526,11 +708,97 @@ public:
insert(first, beyond);
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1>
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1)
: m_traits()
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
, m_default_search_tree_constructed(false)
, m_need_build(false)
{
// Insert each primitive into tree
insert(first, beyond,t1);
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2>
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2)
: m_traits()
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
, m_default_search_tree_constructed(false)
, m_need_build(false)
{
// Insert each primitive into tree
insert(first, beyond,t1,t2);
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3)
: m_traits()
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
, m_default_search_tree_constructed(false)
, m_need_build(false)
{
// Insert each primitive into tree
insert(first, beyond,t1,t2,t3);
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3,T4 t4)
: m_traits()
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
, m_default_search_tree_constructed(false)
, m_need_build(false)
{
// Insert each primitive into tree
insert(first, beyond,t1,t2,t3,t4);
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3,T4 t4,T5 t5)
: m_traits()
, m_primitives()
, m_p_root_node(NULL)
, m_p_search_tree(NULL)
, m_search_tree_constructed(false)
, m_default_search_tree_constructed(false)
, m_need_build(false)
{
// Insert each primitive into tree
insert(first, beyond,t1,t2,t3,t4,t5);
}
//=============insert======================
template<typename Tr>
template<typename ConstPrimitiveIterator>
void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond)
{
set_shared_data<Primitive>();
while(first != beyond)
{
m_primitives.push_back(Primitive(first));
@ -540,13 +808,81 @@ public:
}
template<typename Tr>
void AABB_tree<Tr>::insert(const Primitive& p)
template<typename ConstPrimitiveIterator, typename T1>
void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1)
{
m_primitives.push_back(p);
set_shared_data<Primitive>(t1);
while(first != beyond)
{
m_primitives.push_back(Primitive(first,t1));
++first;
}
m_need_build = true;
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2>
void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2)
{
set_shared_data<Primitive>(t1,t2);
while(first != beyond)
{
m_primitives.push_back(Primitive(first,t1,t2));
++first;
}
m_need_build = true;
}
// Clears tree and insert a set of primitives
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3)
{
set_shared_data<Primitive>(t1,t2,t3);
while(first != beyond)
{
m_primitives.push_back(Primitive(first,t1,t2,t3));
++first;
}
m_need_build = true;
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3,T4 t4)
{
set_shared_data<Primitive>(t1,t2,t3,t4);
while(first != beyond)
{
m_primitives.push_back(Primitive(first,t1,t2,t3,t4));
++first;
}
m_need_build = true;
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3,T4 t4,T5 t5)
{
set_shared_data<Primitive>(t1,t2,t3,t4,t5);
while(first != beyond)
{
m_primitives.push_back(Primitive(first,t1,t2,t3,t4,t5));
++first;
}
m_need_build = true;
}
//=============insert======================
template<typename Tr>
template<typename ConstPrimitiveIterator>
void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
@ -561,6 +897,89 @@ public:
build();
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1>
void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1)
{
// cleanup current tree and internal KD tree
clear();
// inserts primitives
insert(first, beyond,t1);
build();
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2>
void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2)
{
// cleanup current tree and internal KD tree
clear();
// inserts primitives
insert(first, beyond,t1,t2);
build();
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3)
{
// cleanup current tree and internal KD tree
clear();
// inserts primitives
insert(first, beyond,t1,t2,t3);
build();
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3,T4 t4)
{
// cleanup current tree and internal KD tree
clear();
// inserts primitives
insert(first, beyond,t1,t2,t3,t4);
build();
}
template<typename Tr>
template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
T1 t1,T2 t2,T3 t3,T4 t4,T5 t5)
{
// cleanup current tree and internal KD tree
clear();
// inserts primitives
insert(first, beyond,t1,t2,t3,t4,t5);
build();
}
#endif
template<typename Tr>
void AABB_tree<Tr>::insert(const Primitive& p)
{
m_primitives.push_back(p);
m_need_build = true;
}
// Build the data structure, after calls to insert(..)
template<typename Tr>
void AABB_tree<Tr>::build()
@ -581,7 +1000,7 @@ public:
// constructs the tree
m_p_root_node->expand(m_primitives.begin(), m_primitives.end(),
m_primitives.size());
m_primitives.size(), m_traits);
}
// In case the users has switched on the accelerated distance query
@ -630,9 +1049,14 @@ public:
// iterate over primitives to get reference points on them
std::vector<Point_and_primitive_id> points;
points.reserve(m_primitives.size());
typename Primitives::const_iterator it;
for(it = m_primitives.begin(); it != m_primitives.end(); ++it)
points.push_back(Point_and_primitive_id(it->reference_point(), it->id()));
points.push_back(
Point_and_primitive_id(
internal::Primitive_helper<AABB_traits>::get_reference_point(*it,m_traits), it->id()
)
);
// clears current KD tree
clear_search_tree();
@ -647,7 +1071,7 @@ public:
{
using namespace CGAL::internal::AABB_tree;
typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
Do_intersect_traits<AABBTraits, Query> traversal_traits;
Do_intersect_traits<AABBTraits, Query> traversal_traits(m_traits);
this->traversal(query, traversal_traits);
return traversal_traits.is_intersection_found();
}
@ -666,7 +1090,7 @@ public:
Counting_iterator out(&counter);
Listing_primitive_traits<AABBTraits,
Query, Counting_iterator> traversal_traits(out);
Query, Counting_iterator> traversal_traits(out,m_traits);
this->traversal(query, traversal_traits);
return counter;
}
@ -680,7 +1104,7 @@ public:
using namespace CGAL::internal::AABB_tree;
typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
Listing_primitive_traits<AABBTraits,
Query, OutputIterator> traversal_traits(out);
Query, OutputIterator> traversal_traits(out,m_traits);
this->traversal(query, traversal_traits);
return out;
}
@ -694,7 +1118,7 @@ public:
using namespace CGAL::internal::AABB_tree;
typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
Listing_intersection_traits<AABBTraits,
Query, OutputIterator> traversal_traits(out);
Query, OutputIterator> traversal_traits(out,m_traits);
this->traversal(query, traversal_traits);
return out;
}
@ -711,7 +1135,7 @@ public:
{
using namespace CGAL::internal::AABB_tree;
typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
First_intersection_traits<AABBTraits, Query> traversal_traits;
First_intersection_traits<AABBTraits, Query> traversal_traits(m_traits);
this->traversal(query, traversal_traits);
return traversal_traits.result();
}
@ -723,7 +1147,7 @@ public:
{
using namespace CGAL::internal::AABB_tree;
typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
First_primitive_traits<AABBTraits, Query> traversal_traits;
First_primitive_traits<AABBTraits, Query> traversal_traits(m_traits);
this->traversal(query, traversal_traits);
return traversal_traits.result();
}
@ -738,7 +1162,7 @@ public:
typename Primitive::Id hint_primitive = m_primitives[0].id();
using namespace CGAL::internal::AABB_tree;
typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
Projection_traits<AABBTraits> projection_traits(hint,hint_primitive);
Projection_traits<AABBTraits> projection_traits(hint,hint_primitive,m_traits);
this->traversal(query, projection_traits);
return projection_traits.closest_point();
}
@ -793,7 +1217,7 @@ public:
CGAL_precondition(!empty());
using namespace CGAL::internal::AABB_tree;
typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
Projection_traits<AABBTraits> projection_traits(hint.first,hint.second);
Projection_traits<AABBTraits> projection_traits(hint.first,hint.second,m_traits);
this->traversal(query, projection_traits);
return projection_traits.closest_point_and_primitive();
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@ -16,7 +16,7 @@
// $Id$
//
//
// Author(s) : Pierre Alliez, Stephane Tayeb
// Author(s) : Sebastien Loriot
//
//******************************************************************************
// File Description :
@ -26,44 +26,52 @@
#ifndef CGAL_AABB_TRIANGLE_PRIMITIVE_H_
#define CGAL_AABB_TRIANGLE_PRIMITIVE_H_
#include <CGAL/AABB_primitive.h>
#include <CGAL/property_map.h>
namespace CGAL {
template <class GeomTraits, class Iterator>
class AABB_triangle_primitive
{
public:
// types
typedef Iterator Id; // Id type
typedef typename GeomTraits::Point_3 Point; // point type
typedef typename GeomTraits::Triangle_3 Datum; // datum type
namespace internal {
template <class Iterator>
struct Point_from_triangle_3_iterator_property_map{
//classical typedefs
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<Iterator>::value_type >::Kernel GeomTraits;
typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type;
typedef const typename GeomTraits::Point_3& reference;
typedef boost::readable_property_map_tag category;
};
//get function for property map
template <class Iterator>
inline
typename Point_from_triangle_3_iterator_property_map<Iterator>::reference
get(Point_from_triangle_3_iterator_property_map<Iterator>,Iterator it)
{
return it->vertex(0);
}
}//namespace internal
private:
// member data
Id m_it; // iterator
Datum m_datum; // 3D triangle
// constructor
public:
AABB_triangle_primitive() {}
AABB_triangle_primitive(Id it)
: m_it(it)
{
m_datum = *it; // copy triangle
}
AABB_triangle_primitive(const AABB_triangle_primitive& primitive)
{
m_datum = primitive.datum();
m_it = primitive.id();
}
public:
Id& id() { return m_it; }
const Id& id() const { return m_it; }
Datum& datum() { return m_datum; }
const Datum& datum() const { return m_datum; }
/// Returns a point on the primitive
Point reference_point() const { return m_datum.vertex(0); }
};
template < class Iterator,
class cache_datum=Tag_false>
class AABB_triangle_primitive : public AABB_primitive< Iterator,
Input_iterator_property_map<Iterator>,
internal::Point_from_triangle_3_iterator_property_map<Iterator>,
Tag_true,
cache_datum >
{
typedef AABB_primitive< Iterator,
Input_iterator_property_map<Iterator>,
internal::Point_from_triangle_3_iterator_property_map<Iterator>,
Tag_true,
cache_datum > Base;
public:
// constructors
AABB_triangle_primitive(Iterator it) : Base(it){}
static typename Base::Shared_data construct_shared_data() {return typename Base::Shared_data();}
};
} // end namespace CGAL

View File

@ -64,7 +64,8 @@ public:
template<typename ConstPrimitiveIterator>
void expand(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
const std::size_t range);
const std::size_t range,
const AABBTraits&);
/**
* @brief General traversal query
@ -124,12 +125,13 @@ template<typename ConstPrimitiveIterator>
void
AABB_node<Tr>::expand(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond,
const std::size_t range)
const std::size_t range,
const Tr& traits)
{
m_bbox = AABB_traits().compute_bbox_object()(first, beyond);
m_bbox = traits.compute_bbox_object()(first, beyond);
// sort primitives along longest axis aabb
AABB_traits().sort_primitives_object()(first, beyond, m_bbox);
traits.sort_primitives_object()(first, beyond, m_bbox);
switch(range)
{
@ -140,14 +142,14 @@ AABB_node<Tr>::expand(ConstPrimitiveIterator first,
case 3:
m_p_left_child = &(*first);
m_p_right_child = static_cast<Node*>(this)+1;
right_child().expand(first+1, beyond, 2);
right_child().expand(first+1, beyond, 2,traits);
break;
default:
const std::size_t new_range = range/2;
m_p_left_child = static_cast<Node*>(this) + 1;
m_p_right_child = static_cast<Node*>(this) + new_range;
left_child().expand(first, first + new_range, new_range);
right_child().expand(first + new_range, beyond, range - new_range);
left_child().expand(first, first + new_range, new_range,traits);
right_child().expand(first + new_range, beyond, range - new_range,traits);
}
}

View File

@ -81,8 +81,8 @@ public:
#endif
Result;
public:
First_intersection_traits()
: m_result()
First_intersection_traits(const AABBTraits& traits)
: m_result(), m_traits(traits)
{}
bool go_further() const {
@ -91,12 +91,12 @@ public:
void intersection(const Query& query, const Primitive& primitive)
{
m_result = AABBTraits().intersection_object()(query, primitive);
m_result = m_traits.intersection_object()(query, primitive);
}
bool do_intersect(const Query& query, const Node& node) const
{
return AABBTraits().do_intersect_object()(query, node.bbox());
return m_traits.do_intersect_object()(query, node.bbox());
}
Result result() const { return m_result; }
@ -106,6 +106,7 @@ public:
private:
Result m_result;
const AABBTraits& m_traits;
};
@ -125,8 +126,8 @@ class Listing_intersection_traits
typedef ::CGAL::AABB_node<AABBTraits> Node;
public:
Listing_intersection_traits(Output_iterator out_it)
: m_out_it(out_it) {}
Listing_intersection_traits(Output_iterator out_it, const AABBTraits& traits)
: m_out_it(out_it), m_traits(traits) {}
bool go_further() const { return true; }
@ -147,11 +148,12 @@ public:
bool do_intersect(const Query& query, const Node& node) const
{
return AABBTraits().do_intersect_object()(query, node.bbox());
return m_traits.do_intersect_object()(query, node.bbox());
}
private:
Output_iterator m_out_it;
const AABBTraits& m_traits;
};
@ -171,14 +173,14 @@ class Listing_primitive_traits
typedef ::CGAL::AABB_node<AABBTraits> Node;
public:
Listing_primitive_traits(Output_iterator out_it)
: m_out_it(out_it) {}
Listing_primitive_traits(Output_iterator out_it, const AABBTraits& traits)
: m_out_it(out_it), m_traits(traits) {}
bool go_further() const { return true; }
void intersection(const Query& query, const Primitive& primitive)
{
if( AABBTraits().do_intersect_object()(query, primitive) )
if( m_traits.do_intersect_object()(query, primitive) )
{
*m_out_it++ = primitive.id();
}
@ -186,11 +188,12 @@ public:
bool do_intersect(const Query& query, const Node& node) const
{
return AABBTraits().do_intersect_object()(query, node.bbox());
return m_traits.do_intersect_object()(query, node.bbox());
}
private:
Output_iterator m_out_it;
const AABBTraits& m_traits;
};
@ -210,15 +213,16 @@ class First_primitive_traits
typedef ::CGAL::AABB_node<AABBTraits> Node;
public:
First_primitive_traits()
First_primitive_traits(const AABBTraits& traits)
: m_is_found(false)
, m_result() {}
, m_result()
, m_traits(traits) {}
bool go_further() const { return !m_is_found; }
void intersection(const Query& query, const Primitive& primitive)
{
if( AABBTraits().do_intersect_object()(query, primitive) )
if( m_traits.do_intersect_object()(query, primitive) )
{
m_result = boost::optional<typename Primitive::Id>(primitive.id());
m_is_found = true;
@ -227,7 +231,7 @@ public:
bool do_intersect(const Query& query, const Node& node) const
{
return AABBTraits().do_intersect_object()(query, node.bbox());
return m_traits.do_intersect_object()(query, node.bbox());
}
boost::optional<typename Primitive::Id> result() const { return m_result; }
@ -236,6 +240,7 @@ public:
private:
bool m_is_found;
boost::optional<typename Primitive::Id> m_result;
const AABBTraits& m_traits;
};
/**
@ -254,27 +259,28 @@ class Do_intersect_traits
typedef ::CGAL::AABB_node<AABBTraits> Node;
public:
Do_intersect_traits()
: m_is_found(false)
Do_intersect_traits(const AABBTraits& traits)
: m_is_found(false), m_traits(traits)
{}
bool go_further() const { return !m_is_found; }
void intersection(const Query& query, const Primitive& primitive)
{
if( AABBTraits().do_intersect_object()(query, primitive) )
if( m_traits.do_intersect_object()(query, primitive) )
m_is_found = true;
}
bool do_intersect(const Query& query, const Node& node) const
{
return AABBTraits().do_intersect_object()(query, node.bbox());
return m_traits.do_intersect_object()(query, node.bbox());
}
bool is_intersection_found() const { return m_is_found; }
private:
bool m_is_found;
const AABBTraits& m_traits;
};
@ -295,16 +301,18 @@ class Projection_traits
public:
Projection_traits(const Point& hint,
const typename Primitive::Id& hint_primitive)
const typename Primitive::Id& hint_primitive,
const AABBTraits& traits)
: m_closest_point(hint),
m_closest_primitive(hint_primitive)
m_closest_primitive(hint_primitive),
m_traits(traits)
{}
bool go_further() const { return true; }
void intersection(const Point& query, const Primitive& primitive)
{
Point new_closest_point = AABBTraits().closest_point_object()
Point new_closest_point = m_traits.closest_point_object()
(query, primitive, m_closest_point);
if(new_closest_point != m_closest_point)
{
@ -315,7 +323,7 @@ public:
bool do_intersect(const Point& query, const Node& node) const
{
return AABBTraits().compare_distance_object()
return m_traits.compare_distance_object()
(query, node.bbox(), m_closest_point) == CGAL::SMALLER;
}
@ -328,6 +336,7 @@ public:
private:
Point m_closest_point;
typename Primitive::Id m_closest_primitive;
const AABBTraits& m_traits;
};
}}} // end namespace CGAL::internal::AABB_tree

View File

@ -0,0 +1,39 @@
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://sloriot@scm.gforge.inria.fr/svn/cgal/branches/features/AABB_tree-one_primitive_per_object-sloriot/AABB_tree/include/CGAL/AABB_triangle_primitive.h $
// $Id: AABB_triangle_primitive.h 69127 2012-05-14 16:10:00Z sloriot $
//
//
// Author(s) : Sebastien Loriot
//
//******************************************************************************
// File Description :
//
//******************************************************************************
#ifndef CGAL_INTERNAL_AABB_TREE_HAS_NESTED_TYPE_SHARED_DATA_H
#define CGAL_INTERNAL_AABB_TREE_HAS_NESTED_TYPE_SHARED_DATA_H
#include <boost/mpl/has_xxx.hpp>
namespace CGAL{
namespace internal{
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Shared_data,Shared_data,false)
} } //namespace CGAL
#endif //CGAL_INTERNAL_AABB_TREE_HAS_NESTED_TYPE_SHARED_DATA_H

View File

@ -0,0 +1,68 @@
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://sloriot@scm.gforge.inria.fr/svn/cgal/branches/features/AABB_tree-one_primitive_per_object-sloriot/AABB_tree/include/CGAL/AABB_tree.h $
// $Id: AABB_tree.h 69132 2012-05-15 08:46:42Z sloriot $
//
//
// Author(s) : Sébastien Loriot
#ifndef CGAL_INTERNAL_AABB_TREE_PRIMITIVE_HELPER
#define CGAL_INTERNAL_AABB_TREE_PRIMITIVE_HELPER
#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
#include <boost/mpl/has_xxx.hpp>
namespace CGAL{
namespace internal{
//for backward compatibility: if Datum_reference and Point_reference are not defined in the primitive
//(using auto would solve the pb)
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Datum_reference,Datum_reference,false)
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Point_reference,Point_reference,false)
template<class Primitive,bool has_nested_type=Has_nested_type_Datum_reference<Primitive>::value>
struct Datum_result_type{ typedef typename Primitive::Datum_reference type; };
template<class Primitive>
struct Datum_result_type<Primitive,false>{ typedef typename Primitive::Datum type; };
template<class Primitive,bool has_nested_type=Has_nested_type_Point_reference<Primitive>::value>
struct Point_result_type{ typedef typename Primitive::Point_reference type; };
template<class Primitive>
struct Point_result_type<Primitive,false>{ typedef typename Primitive::Point type; };
//helper controlling whether extra data should be stored in the AABB_tree traits class
template <class AABBTraits, bool has_shared_data=Has_nested_type_Shared_data<typename AABBTraits::Primitive>::value>
struct Primitive_helper;
template <class AABBTraits>
struct Primitive_helper<AABBTraits,true>{
static typename Datum_result_type<typename AABBTraits::Primitive>::type get_datum(const typename AABBTraits::Primitive& p,const AABBTraits& traits)
{
return p.datum(traits.shared_data());
}
static typename Point_result_type<typename AABBTraits::Primitive>::type get_reference_point(const typename AABBTraits::Primitive& p,const AABBTraits& traits) {
return p.reference_point(traits.shared_data());
}
};
template <class AABBTraits>
struct Primitive_helper<AABBTraits,false>{
static typename Datum_result_type<typename AABBTraits::Primitive>::type get_datum(const typename AABBTraits::Primitive& p,const AABBTraits&) {return p.datum();}
static typename Point_result_type<typename AABBTraits::Primitive>::type get_reference_point(const typename AABBTraits::Primitive& p,const AABBTraits&) {return p.reference_point();}
};
} } //namespace CGAL::internal
#endif //CGAL_INTERNAL_AABB_TREE_PRIMITIVE_HELPER

View File

@ -27,8 +27,9 @@
#include <CGAL/Cartesian.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include <CGAL/AABB_polyhedron_segment_primitive.h>
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
#include <CGAL/AABB_HalfedgeGraph_segment_primitive.h>
#include <CGAL/internal/AABB_tree/Primitive_helper.h>
#include <boost/mem_fn.hpp>
@ -215,7 +216,7 @@ struct Primitive_generator {};
template<class K, class Polyhedron>
struct Primitive_generator<SEGMENT, K, Polyhedron>
{
typedef CGAL::AABB_polyhedron_segment_primitive<K,Polyhedron> Primitive;
typedef CGAL::AABB_HalfedgeGraph_segment_primitive<Polyhedron> Primitive;
typedef typename Polyhedron::Edge_iterator iterator;
iterator begin(Polyhedron& p) { return p.edges_begin(); }
@ -225,7 +226,7 @@ struct Primitive_generator<SEGMENT, K, Polyhedron>
template<class K, class Polyhedron>
struct Primitive_generator<TRIANGLE, K, Polyhedron>
{
typedef CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
typedef typename Polyhedron::Facet_iterator iterator;
iterator begin(Polyhedron& p) { return p.facets_begin(); }
@ -331,16 +332,18 @@ class Naive_implementations
typedef typename Traits::Point_and_primitive_id Point_and_primitive_id;
typedef boost::optional<Object_and_primitive_id> Intersection_result;
const Traits& m_traits;
public:
Naive_implementations(const Traits& traits):m_traits(traits){}
template<typename Query>
bool do_intersect(const Query& query, Polyhedron& p) const
{
Polyhedron_primitive_iterator it = Pr_generator().begin(p);
for ( ; it != Pr_generator().end(p) ; ++it )
{
if ( Traits().do_intersect_object()(query, Pr(it) ) )
if ( m_traits.do_intersect_object()(query, Pr(it) ) )
return true;
}
@ -356,7 +359,7 @@ public:
Polyhedron_primitive_iterator it = Pr_generator().begin(p);
for ( ; it != Pr_generator().end(p) ; ++it )
{
if ( Traits().do_intersect_object()(query, Pr(it) ) )
if ( m_traits.do_intersect_object()(query, Pr(it) ) )
++result;
}
@ -371,7 +374,7 @@ public:
Polyhedron_primitive_iterator it = Pr_generator().begin(p);
for ( ; it != Pr_generator().end(p) ; ++it )
{
if ( Traits().do_intersect_object()(query, Pr(it) ) )
if ( m_traits.do_intersect_object()(query, Pr(it) ) )
*out++ = Pr(it).id();
}
@ -391,7 +394,7 @@ public:
intersection = Traits().intersection_object()(query, Pr(it));
#else
boost::optional< typename Traits::template Intersection_and_primitive_id<Query>::Type >
intersection = Traits().intersection_object()(query, Pr(it));
intersection = m_traits.intersection_object()(query, Pr(it));
#endif
if ( intersection )
*out++ = *intersection;
@ -408,11 +411,11 @@ public:
assert ( it != Pr_generator().end(p) );
// Get a point on the primitive
Point closest_point = Pr(it).reference_point();
Point closest_point = CGAL::internal::Primitive_helper<Traits>::get_reference_point(Pr(it),m_traits);
for ( ; it != Pr_generator().end(p) ; ++it )
{
closest_point = Traits().closest_point_object()(query, Pr(it), closest_point);
closest_point = m_traits.closest_point_object()(query, Pr(it), closest_point);
}
return closest_point;
@ -427,12 +430,12 @@ public:
// Get a point on the primitive
Pr closest_primitive = Pr(it);
Point closest_point = closest_primitive.reference_point();
Point closest_point = CGAL::internal::Primitive_helper<Traits>::get_reference_point(closest_primitive,m_traits);
for ( ; it != Pr_generator().end(p) ; ++it )
{
Pr tmp_pr(it);
Point tmp_pt = Traits().closest_point_object()(query, tmp_pr, closest_point);
Point tmp_pt = m_traits.closest_point_object()(query, tmp_pr, closest_point);
if ( tmp_pt != closest_point )
{
closest_point = tmp_pt;
@ -469,7 +472,7 @@ public:
Tree_vs_naive(Tree& tree, Polyhedron& p)
: m_tree(tree)
, m_polyhedron(p)
, m_naive()
, m_naive(m_tree.traits())
, m_naive_time(0)
, m_tree_time(0) {}

View File

@ -37,7 +37,7 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
template <class K>
int test()
@ -55,7 +55,7 @@ int test()
ifs >> polyhedron;
// construct tree from facets
typedef typename CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
typedef typename CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
typedef typename CGAL::AABB_traits<K,Primitive> Traits;
typedef typename CGAL::AABB_tree<Traits> Tree;
typedef typename Tree::Object_and_primitive_id Object_and_primitive_id;
@ -137,7 +137,9 @@ int main()
return EXIT_SUCCESS;
}
/***EMACS SETTINGS***/
/* Local Variables: */
/* tab-width: 2 */
/* End: */

View File

@ -35,7 +35,7 @@
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/AABB_polyhedron_segment_primitive.h>
#include "AABB_test_util.h"

View File

@ -35,7 +35,7 @@
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include <CGAL/spatial_sort.h>

View File

@ -31,7 +31,6 @@
#include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include "AABB_test_util.h"

View File

@ -37,7 +37,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include "AABB_test_util.h"

View File

@ -37,7 +37,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include "AABB_test_util.h"

View File

@ -39,7 +39,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include "AABB_test_util.h"

View File

@ -38,7 +38,6 @@
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
#include "AABB_test_util.h"

View File

@ -6,6 +6,7 @@ typedef CGAL::Homogeneous<CGAL::Gmpz> Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
int main() {
debugthread=0;
Nef_polyhedron N0(Nef_polyhedron::EMPTY);
Nef_polyhedron N1(Nef_polyhedron::COMPLETE);

View File

@ -0,0 +1,137 @@
// Copyright (c) 2012 GeometryFactory (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sebastien Loriot
//
#ifndef CGAL_POLYHEDRON_SIMPLEX_PROPERTY_MAP_H
#define CGAL_POLYHEDRON_SIMPLEX_PROPERTY_MAP_H
#include <CGAL/property_map.h>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/if.hpp>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/properties_Polyhedron_3.h>
namespace CGAL{
//property map
template <class Polyhedron>
struct Triangle_from_facet_handle_property_map{
Triangle_from_facet_handle_property_map(Polyhedron* = NULL){}
//classical typedefs
typedef typename boost::mpl::if_<
typename boost::is_const<Polyhedron>::type,
typename Polyhedron::Facet_const_handle,
typename Polyhedron::Facet_handle >::type key_type;
typedef typename Polyhedron::Traits::Kernel::Triangle_3 value_type;
typedef value_type reference;
typedef boost::readable_property_map_tag category;
};
//get function for property map
template <class Polyhedron>
inline
typename Polyhedron::Traits::Kernel::Triangle_3
get(Triangle_from_facet_handle_property_map<Polyhedron>,
typename Triangle_from_facet_handle_property_map<Polyhedron>::key_type f)
{
typedef typename Polyhedron::Traits::Kernel Kernel;
CGAL_precondition(f->halfedge() == f->halfedge()->next()->next()->next());
const typename Kernel::Point_3& a = f->halfedge()->vertex()->point();
const typename Kernel::Point_3& b = f->halfedge()->next()->vertex()->point();
const typename Kernel::Point_3& c = f->halfedge()->next()->next()->vertex()->point();
return typename Kernel::Triangle_3(a,b,c);
}
template <class HalfedgeGraph>
struct Segment_from_edge_descriptor_property_map{
Segment_from_edge_descriptor_property_map(const HalfedgeGraph* g= NULL):m_graph( const_cast<HalfedgeGraph*>(g) ){}
//classical typedefs
typedef typename boost::property_traits< typename boost::property_map< HalfedgeGraph, vertex_point_t>::type >::value_type Point;
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
typedef typename Kernel_traits<Point>::Kernel::Segment_3 value_type;
typedef value_type reference;
typedef boost::readable_property_map_tag category;
//data
HalfedgeGraph* m_graph;
};
//get function for property map
template <class HalfedgeGraph>
inline
typename Segment_from_edge_descriptor_property_map<HalfedgeGraph>::value_type
get(Segment_from_edge_descriptor_property_map<HalfedgeGraph> pmap,
typename Segment_from_edge_descriptor_property_map<HalfedgeGraph>::key_type h)
{
typedef typename boost::property_traits< typename boost::property_map< HalfedgeGraph, vertex_point_t>::type >::value_type Point;
typedef typename Kernel_traits<Point>::Kernel Kernel;
const Point& a = boost::source(h,*pmap.m_graph)->point();
const Point& b = boost::target(h,*pmap.m_graph)->point();
return typename Kernel::Segment_3(a,b);
}
//property map to access a point from a facet handle
template <class Polyhedron>
struct One_point_from_facet_handle_property_map{
One_point_from_facet_handle_property_map(Polyhedron* = NULL){}
//classical typedefs
typedef typename boost::mpl::if_<
typename boost::is_const<Polyhedron>::type,
typename Polyhedron::Facet_const_handle,
typename Polyhedron::Facet_handle >::type key_type;
typedef typename Polyhedron::Traits::Kernel::Point_3 value_type;
typedef const value_type& reference;
typedef boost::lvalue_property_map_tag category;
};
//get function for property map
template <class Polyhedron>
inline
typename One_point_from_facet_handle_property_map<Polyhedron>::reference
get(One_point_from_facet_handle_property_map<Polyhedron>,
typename One_point_from_facet_handle_property_map<Polyhedron>::key_type f)
{
return f->halfedge()->vertex()->point();
}
//property map to access a point from an edge
template <class HalfedgeGraph>
struct Source_point_from_edge_descriptor{
Source_point_from_edge_descriptor(const HalfedgeGraph* g= NULL):m_graph( const_cast<HalfedgeGraph*>(g) ){}
//classical typedefs
typedef typename boost::property_traits< typename boost::property_map< HalfedgeGraph, vertex_point_t>::type >::value_type value_type;
typedef typename boost::property_traits< typename boost::property_map< HalfedgeGraph, vertex_point_t>::type >::reference reference;
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
typedef boost::readable_property_map_tag category;
//data
HalfedgeGraph* m_graph;
};
//get function for property map
template <class HalfedgeGraph>
inline
typename Source_point_from_edge_descriptor<HalfedgeGraph>::reference
get(Source_point_from_edge_descriptor<HalfedgeGraph> pmap,
typename boost::graph_traits<HalfedgeGraph>::edge_descriptor h)
{
return boost::source(h,*pmap.m_graph)->point();
}
} //namespace CGAL
#endif //CGAL_POLYHEDRON_SIMPLEX_PROPERTY_MAP_H