diff --git a/Triangulation/doc_tex/Triangulation/triangulation.tex b/Triangulation/doc_tex/Triangulation/triangulation.tex index d8f575d27d8..8e1710887ea 100644 --- a/Triangulation/doc_tex/Triangulation/triangulation.tex +++ b/Triangulation/doc_tex/Triangulation/triangulation.tex @@ -18,7 +18,7 @@ singular of which is \textbf{simplex}). % A simplex $s\in S$ is \textbf{maximal} if it is not a proper subset of some other set in $S$. The simplicial complex is \textbf{pure} %(or \textbf{homogeneous}) -if all the maximal simplices have the same cardinality, \emph{i.e.}, they have the same +if all the maximal simplices have the same cardinality, i.e., they have the same number of vertices. In the sequel, we will call these maximal simplices \textbf{(full) cells}. A \textbf{face} of a simplex is a subset of it. @@ -138,7 +138,7 @@ It always holds that $-2\leq\cd\leq\ad$ and $0<\ad$. In a first approximation, a \tds\ can be viewed as a \emph{triangulation} of the topological sphere $\sphere^\cd$, -\emph{i.e.}, its faces can be embedded to form a partition of +i.e., its faces can be embedded to form a partition of $\sphere^\cd$ into $\cd$-simplices. When a \tds\ is used as the combinatorial part of a geometric triangulation, one special vertex of the \tds\ plays the role of the \textbf{vertex at @@ -463,58 +463,26 @@ insertion} When using a cell type containing additional custom information, it may be useful to get an efficient access to the cells that are going to be erased upon the insertion of a new point in the Delaunay triangulation, and to the newly -created cells. The code example below shows how one can have efficient +created cells. The second part of code example below shows how one can have efficient access to both the conflict zone and the created cells, while still retaining an efficient update of the Delaunay triangulation. -(\textbf{Remark}: the code below will not compile unless you provide the -missing \ccc{typedef}s and variables declarations.) +\ccIncludeExampleCode{Triangulation/triangulation.cpp} -\begin{ccExampleCode} -Delaunay_triangulation t; -Vertex_handle v; -// Conflict zones in dimension 0 or 1 are pretty boring. -assert( 2 <= t.current_dimension() ); - -// We insert the points stored in the vector |points|. -for( pit = points.begin(); pit != points.end(); ++pit ) -{ - Face f = t.make_empty_face(); - Facet ft; - Full_cell_handle c; - Locate_type lt; - - c = t.locate(*pit, lt, f, ft, v); - - if( lt == Delaunay_triangulation::ON_VERTEX - || lt == Delaunay_triangulation::OUTSIDE_AFFINE_HULL ) - { - // There is, a priori, no full_cell of interest here. - v = t.insert(*pit, lt, f, ft, s); - } - else - { - typedef std::vector Full_cells; - Full_cells zone, new_full_cells; - std::back_insert_iterator out(zone); - Facet ftc = t.compute_conflict_zone(*pit, s, out); - /*----------------------------------------------------\ - | Here, do something with the conflict zone cells | - | stored in |zone|. | - | DO NOT MODIFY the vector |zone|. | - \----------------------------------------------------*/ - out = std::back_inserter(new_full_cells); - v = t.insert_in_hole(p, zone.begin(), zone.end(), ftc, out); - /*----------------------------------------------------\ - | Here, do something with the newly created cells | - | stored in |new_full_cells|. | - \----------------------------------------------------*/ - } -} -\end{ccExampleCode} \section{Complexity and Performances} +The current implementation locate points by walking in the +triangulation, and sort the points with spatial sort to insert a +set of points. Thus the theoretical complexity are +$O(n\log n)$ for inserting $n$ random points and $O(n^{\frac{1}{\cd}}$ +for inserting one point in a triangulation of $n$ random points. + +The actual timing are the following: + +% insert here the table produce by script in directory benchmark +% (code to be done) ! + \note{todo} This section will be completed, when the code will be fully ready (and diff --git a/Triangulation/doc_tex/Triangulation_ref/DelaunayTriangulationTraits.tex b/Triangulation/doc_tex/Triangulation_ref/DelaunayTriangulationTraits.tex index 38c3b201398..f70c034c639 100644 --- a/Triangulation/doc_tex/Triangulation_ref/DelaunayTriangulationTraits.tex +++ b/Triangulation/doc_tex/Triangulation_ref/DelaunayTriangulationTraits.tex @@ -37,7 +37,7 @@ to its bounded side. \ccc{Point_dimension_d(*it)} is $D$ for all \ccc{it} in \ccc{[start,end)}. \ccc{Point_dimension_d(p)} is also $D$ The points in range -\ccc{[start,end)} must be affinely independent, \emph{i.e.,} the simplex must +\ccc{[start,end)} must be affinely independent, i.e., the simplex must not be flat.} \ccNestedType{In_flat_side_of_oriented_sphere_d}{A predicate object that must @@ -63,7 +63,7 @@ points used to construct \ccc{orient}. \ccc{Point_dimension_d(*it)} is $D$ for all \ccc{it} in \ccc{[start,end)}. \ccc{Point_dimension_d(p)} is also $D$. The points in range -\ccc{[start,end)} must be affinely independent, \emph{i.e.,} the simplex must +\ccc{[start,end)} must be affinely independent, {i.e.,} the simplex must not be flat. } @@ -76,7 +76,7 @@ not be flat. % constructs the center of the sphere circumscribing the points in % the range \ccc{R=[start, end)}. \ccPrecond The number of points in the range % must be equal to one more than the dimension of the Euclidean space the points -% live in, \emph{i.e.}, \ccc{std::distance(start,end)} is equal to \ccc{start->dimension()+1}.} +% live in, {i.e.}, \ccc{std::distance(start,end)} is equal to \ccc{start->dimension()+1}.} \ccCreation diff --git a/Triangulation/doc_tex/Triangulation_ref/Delaunay_triangulation.tex b/Triangulation/doc_tex/Triangulation_ref/Delaunay_triangulation.tex index 488517d51ad..a325a11ff41 100644 --- a/Triangulation/doc_tex/Triangulation_ref/Delaunay_triangulation.tex +++ b/Triangulation/doc_tex/Triangulation_ref/Delaunay_triangulation.tex @@ -133,7 +133,7 @@ must be in conflict with the full cell \ccc{c}.} \ccMethod{bool conflict(const Point & p, Full_cell_const_handle c) const;}{Returns \ccc{true} if and only if the point \ccc{p} is in (Delaunay) -conflict with cell \ccc{c} (\emph{i.e.}, the circumscribing ball of +conflict with cell \ccc{c} ({i.e.}, the circumscribing ball of $c$ contains $p$ in its interior). } diff --git a/Triangulation/doc_tex/Triangulation_ref/RegularTriangulationTraits.tex b/Triangulation/doc_tex/Triangulation_ref/RegularTriangulationTraits.tex index a2add9406bd..1cf0dd39645 100644 --- a/Triangulation/doc_tex/Triangulation_ref/RegularTriangulationTraits.tex +++ b/Triangulation/doc_tex/Triangulation_ref/RegularTriangulationTraits.tex @@ -33,7 +33,7 @@ unbounded side of \ccc{S}. If the simplex is negatively oriented, the correspondance is inverted. \\ The range's size must of course be one more than the dimension of the Euclidean space the points live in: \ccPrecond \ccc{std::distance(start,end)==start->dimension()+1}. The points in range -\ccc{[start,end)} must be affinely independent, \emph{i.e.,} the simplex must +\ccc{[start,end)} must be affinely independent, {i.e.,} the simplex must not be flat.} \ccNestedType{Side_of_oriented_orthogonal_subphere_d}{A predicate object that @@ -50,7 +50,7 @@ range \ccc{[start,end)}) living in a same affine subspace.\\ instance of the predicate around as long as one is sure that the affine subspace Aff doesn't change. \ccPrecond \ccc{std::distance(start,end)>=3} and \ccc{std::distance(start,end)<=start->dimension()+1}. The points in range -\ccc{[start,end)} must be affinely independent in Aff, \emph{i.e.,} the +\ccc{[start,end)} must be affinely independent in Aff, {i.e.,} the simplex must not be flat in Aff.} \ccCreation diff --git a/Triangulation/doc_tex/Triangulation_ref/Triangulation.tex b/Triangulation/doc_tex/Triangulation_ref/Triangulation.tex index c64af002cc8..444426f6631 100644 --- a/Triangulation/doc_tex/Triangulation_ref/Triangulation.tex +++ b/Triangulation/doc_tex/Triangulation_ref/Triangulation.tex @@ -229,7 +229,7 @@ should always return \ccGlobalScope\ccc{POSITIVE}. \ccMethod{template< typename OutputIterator > OutputIterator incident_full_cells(Vertex_const_handle v, OutputIterator out) const;} {Insert in \ccc{out} all the cells that are incident to the vertex -\ccc{v}, \emph{i.e.}, the cells that have the \ccc{Vertex v} as a vertex. +\ccc{v}, {i.e.}, the cells that have the \ccc{Vertex v} as a vertex. Returns the (modified) output iterator. %\ccPrecond\ccc{is_full_cell(f.full_cell())}. } @@ -237,7 +237,7 @@ Returns the (modified) output iterator. \ccMethod{template< typename OutputIterator > OutputIterator incident_full_cells(const Face & f, OutputIterator out) const;} {Insert in \ccc{out} all the cells that are incident to the face \ccc{f}, -\emph{i.e.}, the cells that have the \ccc{Face f} as a subface. +{i.e.}, the cells that have the \ccc{Face f} as a subface. Returns the (probably modified) output iterator. %\ccPrecond\ccc{is_full_cell(f.full_cell())}. } @@ -405,7 +405,7 @@ the \ccc{query} point is returned. \end{itemize}} \ccMethod{Vertex_handle collapse_face(const Point & p, const Face & f);} {Contracts the \ccc{Face f} to a single vertex at position \ccc{p}. Returns a handle to that vertex. \ccPrecond The contracted triangulation must be valid -(\emph{i.e.}, be a triangulation of a sphere of dimension +({i.e.}, be a triangulation of a sphere of dimension \ccVar.\ccc{current_dimension()}).} \end{ccAdvanced} diff --git a/Triangulation/doc_tex/Triangulation_ref/TriangulationDSVertex.tex b/Triangulation/doc_tex/Triangulation_ref/TriangulationDSVertex.tex index d972973b5fe..bd8beaa172b 100644 --- a/Triangulation/doc_tex/Triangulation_ref/TriangulationDSVertex.tex +++ b/Triangulation/doc_tex/Triangulation_ref/TriangulationDSVertex.tex @@ -48,7 +48,7 @@ incident cell. \ccPrecond \ccc{c} must not be the default-constructed \ccMethod{bool is_valid(bool verbose=false, int level=0) const;}{Performs any desired test on a vertex. Al least, checks that the pointer to an incident -cell is not the default constructed handle (\emph{i.e.}, is not +cell is not the default constructed handle ({i.e.}, is not \ccc{NULL}). The parameter \ccc{level} is not used, but can be used in derived classes.} diff --git a/Triangulation/doc_tex/Triangulation_ref/TriangulationDataStructure.tex b/Triangulation/doc_tex/Triangulation_ref/TriangulationDataStructure.tex index b69048a4909..4d1f63a3e16 100644 --- a/Triangulation/doc_tex/Triangulation_ref/TriangulationDataStructure.tex +++ b/Triangulation/doc_tex/Triangulation_ref/TriangulationDataStructure.tex @@ -191,12 +191,12 @@ All the good cells are outputted into the last argument \ccc{out}.} \ccMethod{template< typename OutputIterator > OutputIterator incident_full_cells(Vertex_handle v, OutputIterator out) const;} {Insert in \ccc{out} all the cells that are incident to the vertex -\ccc{v}, \emph{i.e.}, the full cells that have the \ccc{Vertex v} as a vertex. +\ccc{v}, {i.e.}, the full cells that have the \ccc{Vertex v} as a vertex. Returns the (modified) output iterator.} \ccMethod{template< typename OutputIterator > OutputIterator incident_full_cells(const Face & f, OutputIterator out) const;} {Insert in \ccc{out} all the cells that are incident to the face \ccc{f}, -\emph{i.e.}, the full cells that have the \ccc{Face f} as a subface. +{i.e.}, the full cells that have the \ccc{Face f} as a subface. Returns the (probably modified) output iterator. %\ccPrecond\ccc{is_full_cell(f.full_cell())}. } @@ -450,7 +450,7 @@ what you are doing. \ccMethod{Vertex_handle collapse_face(const Face & f);} {Contracts the \ccc{Face f} to a single vertex. Returns a handle to that vertex. \ccPrecond -The contracted triangulation must be valid (\emph{i.e.}, be a triangulation of +The contracted triangulation must be valid ({i.e.}, be a triangulation of a sphere of dimension \ccVar.\ccc{current_dimension()}).} \ccMethod{void remove_decrease_dimension(Vertex_handle v, Vertex_handle diff --git a/Triangulation/doc_tex/Triangulation_ref/TriangulationFace.tex b/Triangulation/doc_tex/Triangulation_ref/TriangulationFace.tex index 7478b758cb7..94fa1237d5d 100644 --- a/Triangulation/doc_tex/Triangulation_ref/TriangulationFace.tex +++ b/Triangulation/doc_tex/Triangulation_ref/TriangulationFace.tex @@ -6,7 +6,7 @@ A \ccRefName\ simply describes a \ccc{k}-face \ccc{f} in a triangulation. It gives access to a handle to a full cell \ccc{c} containing the face \ccc{f} in its boundary, as well as the indices of the vertices of \ccc{f} in \ccc{c}. It must hold that \ccc{f} is a \textbf{proper} face of cell -\ccc{c}, \emph{i.e.}, the dimension of \ccc{f} is strictly less than +\ccc{c}, {i.e.}, the dimension of \ccc{f} is strictly less than the dimension of \ccc{c}. \ccTypes diff --git a/Triangulation/doc_tex/Triangulation_ref/TriangulationVertex.tex b/Triangulation/doc_tex/Triangulation_ref/TriangulationVertex.tex index 1de5e28a3c3..afbccd2d032 100644 --- a/Triangulation/doc_tex/Triangulation_ref/TriangulationVertex.tex +++ b/Triangulation/doc_tex/Triangulation_ref/TriangulationVertex.tex @@ -49,11 +49,11 @@ concepts) when the \ccc{TriangulationVertex} is used in the class \ccHeading{Input/Output} \ccFunction{istream & operator>>(istream & is, TriangulationVertex & v);}% -{Inputs the non-combinatorial information given by the vertex, \emph{i.e.}, +{Inputs the non-combinatorial information given by the vertex, {i.e.}, the point and other possible information.} \ccFunction{ostream & operator<<(ostream & os, const TriangulationVertex & v);}% -{Outputs the non-combinatorial information given by the vertex, \emph{i.e.}, +{Outputs the non-combinatorial information given by the vertex, {i.e.}, the point and other possible information.} \ccSeeAlso diff --git a/Triangulation/doc_tex/Triangulation_ref/Triangulation_ds_vertex.tex b/Triangulation/doc_tex/Triangulation_ref/Triangulation_ds_vertex.tex index 2313e5e7b66..73998713b48 100644 --- a/Triangulation/doc_tex/Triangulation_ref/Triangulation_ds_vertex.tex +++ b/Triangulation/doc_tex/Triangulation_ref/Triangulation_ds_vertex.tex @@ -9,7 +9,7 @@ TDSFullCell>}. This class does not contain any geometric information but only combinatorial (adjacency) information. Thus, if the \ccc{Triangulation_data_structure} is used as a parameter of a (embedded) \ccc{Triangulation}, then its vertex template parameter -has to fulfill additional geometric requirements, \emph{i.e.}, it has to be a +has to fulfill additional geometric requirements, {i.e.}, it has to be a model of the refined concept \ccc{TriangulationVertex}. This class can be used directly or can serve as a base to derive other classes diff --git a/Triangulation/doc_tex/Triangulation_ref/Triangulation_full_cell.tex b/Triangulation/doc_tex/Triangulation_ref/Triangulation_full_cell.tex index 64c393d396a..1d26d102aec 100644 --- a/Triangulation/doc_tex/Triangulation_ref/Triangulation_full_cell.tex +++ b/Triangulation/doc_tex/Triangulation_ref/Triangulation_full_cell.tex @@ -59,12 +59,12 @@ The parameter \ccc{t} is passed to the \ccc{Data} constructor.} \ccHeading{Input/Output} \ccFunction{istream & operator>>(istream & is, Triangulation_full_cell & v);}% -{Inputs the non-combinatorial information given by the cell, \emph{i.e.}, +{Inputs the non-combinatorial information given by the cell, {i.e.}, the point and other possible information. The data of type \ccc{Data} is \textbf{also} read.} \ccFunction{ostream & operator<<(ostream & os, const Triangulation_full_cell & v);}% -{Outputs the non-combinatorial information given by the cell, \emph{i.e.}, +{Outputs the non-combinatorial information given by the cell, {i.e.}, the point and other possible information. The data of type \ccc{Data} is \textbf{also} written.} diff --git a/Triangulation/doc_tex/Triangulation_ref/Triangulation_vertex.tex b/Triangulation/doc_tex/Triangulation_ref/Triangulation_vertex.tex index d4d08bd2867..40b7f849a0a 100644 --- a/Triangulation/doc_tex/Triangulation_ref/Triangulation_vertex.tex +++ b/Triangulation/doc_tex/Triangulation_ref/Triangulation_vertex.tex @@ -67,12 +67,12 @@ passed to the \ccc{Data} constructor.} \ccHeading{Input/Output} \ccFunction{istream & operator>>(istream & is, Triangulation_vertex & v);}% -{Inputs the non-combinatorial information given by the vertex, \emph{i.e.}, +{Inputs the non-combinatorial information given by the vertex, {i.e.}, the point and other possible information. The data of type \ccc{Data} is \textbf{also} read.} \ccFunction{ostream & operator<<(ostream & os, const Triangulation_vertex & v);}% -{Outputs the non-combinatorial information given by the vertex, \emph{i.e.}, +{Outputs the non-combinatorial information given by the vertex, {i.e.}, the point and other possible information. The data of type \ccc{Data} is \textbf{also} written.} diff --git a/Triangulation/examples/Triangulation/delaunay.cpp b/Triangulation/examples/Triangulation/delaunay.cpp index 770b0d67913..c9926671c2c 100644 --- a/Triangulation/examples/Triangulation/delaunay.cpp +++ b/Triangulation/examples/Triangulation/delaunay.cpp @@ -1,5 +1,5 @@ #include -#include +//#include #include #include #include @@ -8,35 +8,29 @@ #include #include #include +const int D=5; -typedef CGAL::Cartesian_d K; -/* +typedef CGAL::Cartesian_d K;//D; +//typedef CGAL::Filtered_kernel_d K; typedef CGAL::Triangulation_ds_vertex< void > TDS_vertex; typedef CGAL::Triangulation_vertex< K, int, TDS_vertex > Vertex; typedef CGAL::Triangulation_ds_full_cell < void, CGAL::TDS_full_cell_default_storage_policy > TDS_cell; typedef CGAL::Triangulation_full_cell< K, int, TDS_cell > Cell; typedef CGAL::Triangulation_data_structure< - // CGAL::Ambient_dimension< K::Point_d >::type , Vertex, Cell > TDS; - CGAL::Dynamic_dimension_tag<5> , Vertex, Cell > TDS; -typedef CGAL::Delaunay_triangulation T; -*/ -typedef CGAL::Triangulation_data_structure< - CGAL::Dynamic_dimension_tag<5> > TDS; + CGAL::Dimension_tag , Vertex, Cell > TDS; typedef CGAL::Delaunay_triangulation T; int main(int argc, char **argv) { - int D = 5; if( argc > 1 )D = atoi(argv[1]); // space dimension - int N = 100; if( argc > 2 )N = atoi(argv[2]); // number of points + int N = 100; if( argc > 2 )N = atoi(argv[1]); // number of points CGAL::Timer cost; // timer // Instanciate a random point generator - CGAL::Random rng; + CGAL::Random rng(0); typedef CGAL::Random_points_in_cube_d Random_points_iterator; Random_points_iterator rand_it(D, 1.0, rng); - // Generate N random points std::vector points; CGAL::copy_n(rand_it, N, std::back_inserter(points)); @@ -50,5 +44,32 @@ int main(int argc, char **argv) t.insert(points.begin(), points.end()); std::cout << " done in "< Full_cells; + Full_cells zone, new_full_cells; + std::back_insert_iterator out(zone); + c = t.locate(*++rand_it, lt, f, ft, v); + T::Facet ftc = t.compute_conflict_zone(*rand_it, c, out); + std::cout< "<data() = zone.size(); + } + std::cout << " done in "< -#include #include #include #include