Add an overload of insert_in_hole() in class Regular_triangulation_3 to ensure that hidden points are properly treated.

This commit is contained in:
Stéphane Tayeb 2010-08-04 15:36:38 +00:00
parent f7731fc15e
commit ca4f9f11e8
2 changed files with 83 additions and 1 deletions

View File

@ -87,7 +87,7 @@ traits class argument and calling \ccc{insert(first,last)}.}
\ccHeading{Insertion}
\ccThree{Vertex_handle}{dt.insertxx}{}
The following methods, which already exist in triangulations, are
The following methods, which already exist in \ccc{Triangulation_3}, are
overloaded to ensure the property that all power spheres are regular.
\ccMethod{Vertex_handle insert(const Weighted_point & p,
@ -130,6 +130,36 @@ before the insertions (it may be negative due to hidden points).
\ccPrecond{The \ccc{value_type} of \ccc{first} and \ccc{last} is
\ccc{Point}.}}
The following methods, which already exist in \ccc{Triangulation_3}, are
overloaded to ensure that hidden points are well created and maintained.
\ccMethod{template <class CellIt>
Vertex_handle insert_in_hole(Point p, CellIt cell_begin, CellIt cell_end,
Cell_handle begin, int i);}
{Creates a new vertex by starring a hole. It takes an iterator range
[\ccc{cell_begin}; \ccc{cell_end}[ of \ccc{Cell_handle}s which specifies
a hole: a set of connected cells (resp. facets in dimension 2) which is
star-shaped wrt \ccc{p}.
(\ccc{begin}, \ccc{i}) is a facet (resp. an edge) on the boundary of the hole,
that is, \ccc{begin} belongs to the set of cells (resp. facets) previously
described, and \ccc{begin->neighbor(i)} does not. Then this function deletes
all the cells (resp. facets) describing the hole, creates a new vertex
\ccc{v}, and for each facet (resp. edge) on the boundary of the hole, creates
a new cell (resp. facet) with \ccc{v} as vertex. Then \ccc{v->set_point(p)}
is called and \ccc{v} is returned.\\
If the hole contains interior vertices, each of them is hidden by the insertion
of \ccc{p} and is stored in the new cell which contains it.
\ccPrecond{\ccVar.\ccc{dimension()} $\geq 2$, the set of cells (resp. facets in
dimension 2) is connected, not empty, its boundary is connected, and \ccc{p}
lies inside the hole, which is star-shaped wrt \ccc{p}}.}
\ccMethod{template <class CellIt>
Vertex_handle insert_in_hole(Point p, CellIt cell_begin, CellIt cell_end,
Cell_handle begin, int i, Vertex_handle newv);}
{ Same as above, except that \ccc{newv} will be used as the new vertex, which
must have been allocated previously with e.g. \ccc{create_vertex}.}
\ccHeading{Removal}
\ccMethod{void remove(Vertex_handle v);}

View File

@ -182,6 +182,16 @@ public:
Vertex_handle insert(const Weighted_point & p, Locate_type lt,
Cell_handle c, int li, int);
template <class CellIt>
Vertex_handle
insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
Cell_handle begin, int i);
template <class CellIt>
Vertex_handle
insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
Cell_handle begin, int i, Vertex_handle newv);
template <class OutputIteratorBoundaryFacets,
class OutputIteratorCells,
@ -1216,6 +1226,48 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int lj)
return insert_in_conflict(p, lt,c,li,lj, tester, hidden_point_visitor);
}
template < class Gt, class Tds >
template <class CellIt>
typename Regular_triangulation_3<Gt,Tds>::Vertex_handle
Regular_triangulation_3<Gt,Tds>::
insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
Cell_handle begin, int i)
{
CGAL_triangulation_precondition(cell_begin != cell_end);
hidden_point_visitor.process_cells_in_conflict(cell_begin,cell_end);
Vertex_handle v =
Tr_Base::insert_in_hole(p, cell_begin, cell_end, begin, i);
// Store the hidden points in their new cells and hide vertices that
// have to be hidden
hidden_point_visitor.reinsert_vertices(v);
return v;
}
template < class Gt, class Tds >
template <class CellIt>
typename Regular_triangulation_3<Gt,Tds>::Vertex_handle
Regular_triangulation_3<Gt,Tds>::
insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
Cell_handle begin, int i, Vertex_handle newv)
{
CGAL_triangulation_precondition(cell_begin != cell_end);
hidden_point_visitor.process_cells_in_conflict(cell_begin,cell_end);
Vertex_handle v =
Tr_Base::insert_in_hole(p, cell_begin, cell_end, begin, i, newv);
// Store the hidden points in their new cells and hide vertices that
// have to be hidden
hidden_point_visitor.reinsert_vertices(v);
return v;
}
template <class Gt, class Tds >
template <class RegularTriangulation_3>
class Regular_triangulation_3<Gt, Tds>::Vertex_remover {