mirror of https://github.com/CGAL/cgal
- Adds is_edge(Vertex_handle u, Vertex_handle v) in TDS.
- Adds incident_cells() and incident_vertices() templated by output iterators. - various improvements.
This commit is contained in:
parent
e3e3528f21
commit
3b79035c4d
|
|
@ -4,6 +4,9 @@ Version 1.90 (?? September 01)
|
|||
- New star_hole(Vertex_handle, cell_begin, cell_end, Cell_handle, int) in TDS.
|
||||
- New Get_one_output_iterator.
|
||||
- create_star_[23] are back ans faster.
|
||||
- Adds is_edge(Vertex_handle u, Vertex_handle v) in TDS.
|
||||
- Adds incident_cells() and incident_vertices() templated by output iterators.
|
||||
- various improvements.
|
||||
|
||||
Version 1.89 (18 September 01)
|
||||
- Finite_vertex_iterator -> Finite_vertices_iterator, idem for cell, facet and
|
||||
|
|
|
|||
|
|
@ -190,6 +190,9 @@ counted.}
|
|||
{Tests whether \ccc{(u,v)} is an edge of \ccVar. If the edge is found,
|
||||
it computes a cell \ccc{c} having this edge and the indices \ccc{i}
|
||||
and \ccc{j} of the vertices \ccc{u} and \ccc{v}, in this order.}
|
||||
\ccGlue
|
||||
\ccMethod{bool is_edge(Vertex_handle u, Vertex_handle v) const;}
|
||||
{Tests whether \ccc{(u,v)} is an edge of \ccVar.}
|
||||
|
||||
\ccMethod{ bool is_facet(Cell* c, int i) const;}
|
||||
{Tests whether \ccc{(c,i)} is a facet of \ccVar. Answers \ccc{false} when
|
||||
|
|
@ -465,7 +468,7 @@ into the triangulation data structure.}
|
|||
\ccGlue
|
||||
\ccMethod{Vertex_iterator vertices_end() const;}{}
|
||||
|
||||
\ccThree{Facet_circulator}{tds.incident_cells}{}
|
||||
\ccThree{Facet_circulator}{tds.inciden__cells}{}
|
||||
|
||||
\ccMethod{Cell_circulator incident_cells(const Edge & e) const;}
|
||||
{Starts at an arbitrary cell incident to \ccc{e}.
|
||||
|
|
@ -513,21 +516,17 @@ adjacent vertices of a given vertex}
|
|||
|
||||
\ccThree{void_circulator}{tds.facets_begin()toto}{}
|
||||
|
||||
\ccMethod{void incident_cells(Vertex* v, set<Cell*> & cells,
|
||||
Cell* c = NULL ) const;}
|
||||
{Computes the set \ccc{cells} of all cells incident to \ccc{v}. If
|
||||
\ccVar.\ccc{dimension()} $<3$ then the set is empty. The optional
|
||||
argument \ccc{c} will be used for initializing the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)} and
|
||||
the optional argument \ccc{c} is a cell having \ccc{v} as a vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_cells (Vertex_handle v, OutputIterator cells) const;}
|
||||
{Copies the \ccc{Cell_handle}s of all cells incident to \ccc{v} to the output
|
||||
iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
\ccMethod{void incident_vertices(Vertex* v,
|
||||
set<Vertex*> & vertices, Cell* c = NULL ) const;}
|
||||
{Computes the set \ccc{vertices} of all vertices incident to \ccc{v}. If
|
||||
\ccVar.\ccc{number_of_vertices()} $<2$ then the set is empty. The optional
|
||||
argument \ccc{c} will be used for finding a first vertex of the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)} and
|
||||
the optional argument \ccc{c} is a cell having \ccc{v} as a vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_vertices (Vertex_handle v, OutputIterator vertices) const;}
|
||||
{Copies the \ccc{Vertex_handle}s of all vertices incident to \ccc{v} to the
|
||||
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
|
||||
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
\begin{ccAdvanced}
|
||||
\ccHeading{Checking}
|
||||
|
|
|
|||
|
|
@ -816,47 +816,20 @@ Cell_handle start, int f) const;}
|
|||
|
||||
\ccHeading{Traversal of the incident cells and the adjacent vertices
|
||||
of a given vertex}
|
||||
\ccThree{bool}{t.incident_cells()}{}
|
||||
\ccThree{bool}{t.inciden__cells()}{}
|
||||
|
||||
\ccMethod{void incident_cells(Vertex_handle v,
|
||||
set<Cell_handle> & cells, Cell_handle c = NULL ) const;}
|
||||
{Computes the set \ccc{cells} of all cells incident to \ccc{v}. If
|
||||
\ccVar.\ccc{dimension()} $<3$ then the returned set is empty. The optional
|
||||
argument \ccc{c} will be used for initializing the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\
|
||||
and the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_cells (Vertex_handle v, OutputIterator cells) const;}
|
||||
{Copies the \ccc{Cell_handle}s of all cells incident to \ccc{v} to the output
|
||||
iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
%\ccMethod{void incident_cells(Vertex_handle v,
|
||||
% set<Cell*> & cells, Cell_handle c = NULL ) const;}
|
||||
%{Computes the set \ccc{cells} of all cells incident to \ccc{v}. If
|
||||
%\ccVar.\ccc{dimension()} $<3$ then the returned set is empty. The optional
|
||||
%argument \ccc{c} will be used for initializing the set.\\
|
||||
%\textit{This method computes a set of \ccc{Cell*}, whereas it should
|
||||
%logically compute a set of \ccc{Cell_handle}. This is due to
|
||||
%compilation problems with sets of \ccc{Cell_handle}. However, the user
|
||||
%can recover a \ccc{Cell_handle} for each element of the set by using
|
||||
%the method \ccc{handle()} defined for the \ccc{Cell} type.}
|
||||
%\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\
|
||||
%and the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_vertices (Vertex_handle v, OutputIterator vertices) const;}
|
||||
{Copies the \ccc{Vertex_handle}s of all vertices incident to \ccc{v} to the
|
||||
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
|
||||
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
\ccMethod{void incident_vertices(Vertex_handle v,
|
||||
set<Vertex_handle> & vertices, Cell_handle c = NULL ) const;}
|
||||
{Computes the set \ccc{vertices} of all vertices adjacent to \ccc{v}. If
|
||||
\ccVar.\ccc{number_of_vertices()} $<1$ then the set is empty. The optional
|
||||
argument \ccc{c} will be used for finding a first vertex of the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\ and
|
||||
the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
|
||||
%\ccMethod{void incident_vertices(Vertex_handle v,
|
||||
% set<Vertex*> & vertices,
|
||||
% Cell_handle c = NULL ) const;}
|
||||
%{Computes the set \ccc{vertices} of all vertices adjacent to \ccc{v}. If
|
||||
%\ccVar.\ccc{number_of_vertices()} $<1$ then the set is empty. The optional
|
||||
%argument \ccc{c} will be used for finding a first vertex of the set.\\
|
||||
%\textit{An analogous remark as for the previous method holds on the
|
||||
%types within the set.}
|
||||
%\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\ and
|
||||
%the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
|
||||
\begin{ccAdvanced}
|
||||
\ccHeading{Checking}
|
||||
|
|
|
|||
|
|
@ -190,6 +190,9 @@ counted.}
|
|||
{Tests whether \ccc{(u,v)} is an edge of \ccVar. If the edge is found,
|
||||
it computes a cell \ccc{c} having this edge and the indices \ccc{i}
|
||||
and \ccc{j} of the vertices \ccc{u} and \ccc{v}, in this order.}
|
||||
\ccGlue
|
||||
\ccMethod{bool is_edge(Vertex_handle u, Vertex_handle v) const;}
|
||||
{Tests whether \ccc{(u,v)} is an edge of \ccVar.}
|
||||
|
||||
\ccMethod{ bool is_facet(Cell* c, int i) const;}
|
||||
{Tests whether \ccc{(c,i)} is a facet of \ccVar. Answers \ccc{false} when
|
||||
|
|
@ -465,7 +468,7 @@ into the triangulation data structure.}
|
|||
\ccGlue
|
||||
\ccMethod{Vertex_iterator vertices_end() const;}{}
|
||||
|
||||
\ccThree{Facet_circulator}{tds.incident_cells}{}
|
||||
\ccThree{Facet_circulator}{tds.inciden__cells}{}
|
||||
|
||||
\ccMethod{Cell_circulator incident_cells(const Edge & e) const;}
|
||||
{Starts at an arbitrary cell incident to \ccc{e}.
|
||||
|
|
@ -513,21 +516,17 @@ adjacent vertices of a given vertex}
|
|||
|
||||
\ccThree{void_circulator}{tds.facets_begin()toto}{}
|
||||
|
||||
\ccMethod{void incident_cells(Vertex* v, set<Cell*> & cells,
|
||||
Cell* c = NULL ) const;}
|
||||
{Computes the set \ccc{cells} of all cells incident to \ccc{v}. If
|
||||
\ccVar.\ccc{dimension()} $<3$ then the set is empty. The optional
|
||||
argument \ccc{c} will be used for initializing the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)} and
|
||||
the optional argument \ccc{c} is a cell having \ccc{v} as a vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_cells (Vertex_handle v, OutputIterator cells) const;}
|
||||
{Copies the \ccc{Cell_handle}s of all cells incident to \ccc{v} to the output
|
||||
iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
\ccMethod{void incident_vertices(Vertex* v,
|
||||
set<Vertex*> & vertices, Cell* c = NULL ) const;}
|
||||
{Computes the set \ccc{vertices} of all vertices incident to \ccc{v}. If
|
||||
\ccVar.\ccc{number_of_vertices()} $<2$ then the set is empty. The optional
|
||||
argument \ccc{c} will be used for finding a first vertex of the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)} and
|
||||
the optional argument \ccc{c} is a cell having \ccc{v} as a vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_vertices (Vertex_handle v, OutputIterator vertices) const;}
|
||||
{Copies the \ccc{Vertex_handle}s of all vertices incident to \ccc{v} to the
|
||||
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
|
||||
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
\begin{ccAdvanced}
|
||||
\ccHeading{Checking}
|
||||
|
|
|
|||
|
|
@ -816,47 +816,20 @@ Cell_handle start, int f) const;}
|
|||
|
||||
\ccHeading{Traversal of the incident cells and the adjacent vertices
|
||||
of a given vertex}
|
||||
\ccThree{bool}{t.incident_cells()}{}
|
||||
\ccThree{bool}{t.inciden__cells()}{}
|
||||
|
||||
\ccMethod{void incident_cells(Vertex_handle v,
|
||||
set<Cell_handle> & cells, Cell_handle c = NULL ) const;}
|
||||
{Computes the set \ccc{cells} of all cells incident to \ccc{v}. If
|
||||
\ccVar.\ccc{dimension()} $<3$ then the returned set is empty. The optional
|
||||
argument \ccc{c} will be used for initializing the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\
|
||||
and the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_cells (Vertex_handle v, OutputIterator cells) const;}
|
||||
{Copies the \ccc{Cell_handle}s of all cells incident to \ccc{v} to the output
|
||||
iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
%\ccMethod{void incident_cells(Vertex_handle v,
|
||||
% set<Cell*> & cells, Cell_handle c = NULL ) const;}
|
||||
%{Computes the set \ccc{cells} of all cells incident to \ccc{v}. If
|
||||
%\ccVar.\ccc{dimension()} $<3$ then the returned set is empty. The optional
|
||||
%argument \ccc{c} will be used for initializing the set.\\
|
||||
%\textit{This method computes a set of \ccc{Cell*}, whereas it should
|
||||
%logically compute a set of \ccc{Cell_handle}. This is due to
|
||||
%compilation problems with sets of \ccc{Cell_handle}. However, the user
|
||||
%can recover a \ccc{Cell_handle} for each element of the set by using
|
||||
%the method \ccc{handle()} defined for the \ccc{Cell} type.}
|
||||
%\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\
|
||||
%and the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
\ccMethod{template <class OutputIterator>
|
||||
void incident_vertices (Vertex_handle v, OutputIterator vertices) const;}
|
||||
{Copies the \ccc{Vertex_handle}s of all vertices incident to \ccc{v} to the
|
||||
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
|
||||
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
|
||||
|
||||
\ccMethod{void incident_vertices(Vertex_handle v,
|
||||
set<Vertex_handle> & vertices, Cell_handle c = NULL ) const;}
|
||||
{Computes the set \ccc{vertices} of all vertices adjacent to \ccc{v}. If
|
||||
\ccVar.\ccc{number_of_vertices()} $<1$ then the set is empty. The optional
|
||||
argument \ccc{c} will be used for finding a first vertex of the set.
|
||||
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\ and
|
||||
the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
|
||||
%\ccMethod{void incident_vertices(Vertex_handle v,
|
||||
% set<Vertex*> & vertices,
|
||||
% Cell_handle c = NULL ) const;}
|
||||
%{Computes the set \ccc{vertices} of all vertices adjacent to \ccc{v}. If
|
||||
%\ccVar.\ccc{number_of_vertices()} $<1$ then the set is empty. The optional
|
||||
%argument \ccc{c} will be used for finding a first vertex of the set.\\
|
||||
%\textit{An analogous remark as for the previous method holds on the
|
||||
%types within the set.}
|
||||
%\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccc{v} is a vertex of \ccVar\ and
|
||||
%the optional argument \ccc{c} is a cell having \ccc{v} as vertex.}}
|
||||
|
||||
\begin{ccAdvanced}
|
||||
\ccHeading{Checking}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <CGAL/Triangulation_short_names_3.h>
|
||||
#include <CGAL/Triangulation_utils_3.h>
|
||||
|
|
@ -965,25 +965,17 @@ make_hole_3D_ear( Vertex_handle v,
|
|||
{
|
||||
CGAL_triangulation_expensive_precondition( ! test_dim_down(v) );
|
||||
|
||||
typedef std::set<Cell_handle> Hole_cells;
|
||||
Hole_cells cells;
|
||||
incident_cells( v, cells );
|
||||
incident_cells(v, std::back_inserter(hole));
|
||||
|
||||
Cell_handle opp_cit;
|
||||
Vertex_handle vi;
|
||||
|
||||
for (typename Hole_cells::iterator cit = cells.begin();
|
||||
cit != cells.end(); ++cit) {
|
||||
for (typename std::vector<Cell_handle>::iterator cit = hole.begin();
|
||||
cit != hole.end(); ++cit) {
|
||||
int indv = (*cit)->index(v);
|
||||
opp_cit = (*cit)->neighbor( indv );
|
||||
hole.push_back(*cit);
|
||||
Cell_handle opp_cit = (*cit)->neighbor( indv );
|
||||
boundhole.push_back(Facet( opp_cit, opp_cit->index(*cit)) );
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
if ( i != indv ) {
|
||||
vi = (*cit)->vertex(i);
|
||||
vi->set_cell( opp_cit );
|
||||
}
|
||||
if ( i != indv )
|
||||
(*cit)->vertex(i)->set_cell(opp_cit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -784,17 +784,17 @@ public:
|
|||
void
|
||||
incident_cells(Vertex_handle v,
|
||||
std::set<Cell_handle> & cells,
|
||||
Cell_handle c = NULL ) const
|
||||
Cell_handle c = NULL ) const
|
||||
{
|
||||
// Obsolete ?
|
||||
bool THIS_FUNCTION_IS_DEPRECATED;
|
||||
_tds.incident_cells(v, cells, c);
|
||||
}
|
||||
|
||||
template <class OutIt>
|
||||
template <class OutputIterator>
|
||||
void
|
||||
incident_cells(Vertex_handle v, OutIt outcells) const
|
||||
incident_cells(Vertex_handle v, OutputIterator cells) const
|
||||
{
|
||||
_tds.incident_cells(v, outcells);
|
||||
_tds.incident_cells(v, cells);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -802,9 +802,17 @@ public:
|
|||
std::set<Vertex_handle> & vertices,
|
||||
Cell_handle c = NULL ) const
|
||||
{
|
||||
bool THIS_FUNCTION_IS_DEPRECATED;
|
||||
_tds.incident_vertices(v, vertices, c);
|
||||
}
|
||||
|
||||
template <class OutputIterator>
|
||||
void
|
||||
incident_vertices(Vertex_handle v, OutputIterator vertices) const
|
||||
{
|
||||
_tds.incident_vertices(v, vertices);
|
||||
}
|
||||
|
||||
// CHECKING
|
||||
bool is_valid(bool verbose = false, int level = 0) const;
|
||||
|
||||
|
|
@ -1117,13 +1125,7 @@ Triangulation_3<GT,Tds>::
|
|||
is_edge(Vertex_handle u, Vertex_handle v,
|
||||
Cell_handle & c, int & i, int & j) const
|
||||
{
|
||||
CGAL_triangulation_expensive_precondition( _tds.is_vertex(u) &&
|
||||
_tds.is_vertex(v) );
|
||||
Cell_handle cstar;
|
||||
bool b = _tds.is_edge(u, v, cstar, i, j);
|
||||
if (b)
|
||||
c = cstar;
|
||||
return b;
|
||||
return _tds.is_edge(u, v, c, i, j);
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
|
|
@ -1132,14 +1134,7 @@ Triangulation_3<GT,Tds>::
|
|||
is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
|
||||
Cell_handle & c, int & i, int & j, int & k) const
|
||||
{
|
||||
CGAL_triangulation_expensive_precondition( _tds.is_vertex(u) &&
|
||||
_tds.is_vertex(v) &&
|
||||
_tds.is_vertex(w) );
|
||||
Cell_handle cstar;
|
||||
bool b = _tds.is_facet(u, v, w, cstar, i, j, k);
|
||||
if (b)
|
||||
c = cstar;
|
||||
return b;
|
||||
return _tds.is_facet(u, v, w, c, i, j, k);
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
|
|
@ -1158,15 +1153,7 @@ is_cell(Vertex_handle u, Vertex_handle v,
|
|||
Vertex_handle w, Vertex_handle t,
|
||||
Cell_handle & c, int & i, int & j, int & k, int & l) const
|
||||
{
|
||||
CGAL_triangulation_expensive_precondition( _tds.is_vertex(u) &&
|
||||
_tds.is_vertex(v) &&
|
||||
_tds.is_vertex(w) &&
|
||||
_tds.is_vertex(t) );
|
||||
Cell_handle cstar;
|
||||
bool b = _tds.is_cell(u, v, w, t, cstar, i, j, k, l);
|
||||
if (b)
|
||||
c = cstar;
|
||||
return b;
|
||||
return _tds.is_cell(u, v, w, t, c, i, j, k, l);
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
|
|
@ -1176,16 +1163,8 @@ is_cell(Vertex_handle u, Vertex_handle v,
|
|||
Vertex_handle w, Vertex_handle t,
|
||||
Cell_handle & c) const
|
||||
{
|
||||
CGAL_triangulation_expensive_precondition( _tds.is_vertex(u) &&
|
||||
_tds.is_vertex(v) &&
|
||||
_tds.is_vertex(w) &&
|
||||
_tds.is_vertex(t) );
|
||||
int i,j,k,l;
|
||||
Cell_handle cstar;
|
||||
bool b = _tds.is_cell(u, v, w, t, cstar, i, j, k, l);
|
||||
if (b)
|
||||
c = cstar;
|
||||
return b;
|
||||
return _tds.is_cell(u, v, w, t, c, i, j, k, l);
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
|
|
|
|||
|
|
@ -219,8 +219,8 @@ public:
|
|||
cell_container().release_element(&*c);
|
||||
}
|
||||
|
||||
template <class It>
|
||||
void delete_cells(It begin, It end)
|
||||
template <class InputIterator>
|
||||
void delete_cells(InputIterator begin, InputIterator end)
|
||||
{
|
||||
for(; begin != end; ++begin)
|
||||
delete_cell((*begin)->handle());
|
||||
|
|
@ -232,6 +232,7 @@ public:
|
|||
bool is_edge(Cell_handle c, int i, int j) const;
|
||||
bool is_edge(Vertex_handle u, Vertex_handle v, Cell_handle & c,
|
||||
int & i, int & j) const;
|
||||
bool is_edge(Vertex_handle u, Vertex_handle v) const;
|
||||
bool is_facet(Cell_handle c, int i) const;
|
||||
bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
|
||||
Cell_handle & c, int & i, int & j, int & k) const;
|
||||
|
|
@ -450,39 +451,113 @@ public:
|
|||
|
||||
// around a vertex
|
||||
private:
|
||||
class Incident_tester {
|
||||
Vertex_handle _v;
|
||||
public :
|
||||
Incident_tester(Vertex_handle v) : _v(v) {}
|
||||
bool operator()(Cell_handle c) const
|
||||
{ return c->has_vertex(v); }
|
||||
};
|
||||
|
||||
private:
|
||||
// TODO : This should be reimplemented. Using find_conflict is overkill...
|
||||
template <class OutIt>
|
||||
template <class OutputIterator>
|
||||
void
|
||||
incident_cells(Vertex_handle v, OutIt outcells) const
|
||||
incident_cells_3(Vertex_handle v, Cell_handle c, OutputIterator cells) const
|
||||
{
|
||||
CGAL_triangulation_precondition(dimension() == 3);
|
||||
|
||||
// Flag values :
|
||||
// 1 : incident cell already visited
|
||||
// 0 : unknown
|
||||
c->set_in_conflict_flag(1);
|
||||
*cells++ = c;
|
||||
|
||||
for (int i=0; i<4; ++i) {
|
||||
if (c->vertex(i) == v)
|
||||
continue;
|
||||
Cell_handle next = c->neighbor(i);
|
||||
if (next->get_in_conflict_flag() != 0)
|
||||
continue;
|
||||
incident_cells_3(v, next, cells);
|
||||
}
|
||||
}
|
||||
|
||||
template <class OutputIterator>
|
||||
void
|
||||
incident_cells_2(Vertex_handle v, Cell_handle c, OutputIterator cells) const
|
||||
{
|
||||
CGAL_triangulation_precondition(dimension() == 2);
|
||||
|
||||
// Flag values :
|
||||
// 1 : incident cell already visited
|
||||
// 0 : unknown
|
||||
c->set_in_conflict_flag(1);
|
||||
*cells++ = c;
|
||||
|
||||
for (int i=0; i<3; ++i) {
|
||||
if (c->vertex(i) == v)
|
||||
continue;
|
||||
Cell_handle next = c->neighbor(i);
|
||||
if (next->get_in_conflict_flag() != 0)
|
||||
continue;
|
||||
incident_cells_2(v, next, cells);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
// TODO : The 2 following functions need to be documented...
|
||||
template <class OutputIterator>
|
||||
void
|
||||
incident_cells(Vertex_handle v, OutputIterator cells) const
|
||||
{
|
||||
CGAL_triangulation_precondition( v != NULL );
|
||||
CGAL_triangulation_expensive_precondition( is_vertex(v) );
|
||||
|
||||
if ( dimension() < 3 )
|
||||
return;
|
||||
|
||||
std::vector<Facet> facets;
|
||||
std::vector<Cell_handle > cells;
|
||||
facets.reserve(64);
|
||||
cells.reserve(64);
|
||||
find_conflicts_3(v->cell(), Incident_tester(v), facets, cells);
|
||||
for(typename std::vector<Facet>::iterator fit = facets.begin();
|
||||
fit != facets.end(); ++fit)
|
||||
fit->first->set_in_conflict_flag(0);
|
||||
for(typename std::vector<Cell_handle >::iterator cit = cells.begin();
|
||||
cit != cells.end(); ++cit) {
|
||||
*cit->set_in_conflict_flag(0);
|
||||
*outcells++ = *cit;
|
||||
std::vector<Cell_handle> tmp_cells;
|
||||
tmp_cells.reserve(64);
|
||||
incident_cells_3(v, v->cell(), std::back_inserter(tmp_cells));
|
||||
|
||||
for(typename std::vector<Cell_handle>::iterator cit = tmp_cells.begin();
|
||||
cit != tmp_cells.end(); ++cit) {
|
||||
(*cit)->set_in_conflict_flag(0);
|
||||
*cells++ = *cit;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
template <class OutputIterator>
|
||||
void
|
||||
incident_vertices(Vertex_handle v, OutputIterator vertices) const
|
||||
{
|
||||
CGAL_triangulation_precondition( v != NULL );
|
||||
CGAL_triangulation_expensive_precondition( is_vertex(v) );
|
||||
|
||||
if ( number_of_vertices() < 2 )
|
||||
return;
|
||||
|
||||
if ( dimension() < 2 )
|
||||
return;
|
||||
|
||||
// Get the incident cells.
|
||||
|
||||
std::vector<Cell_handle> tmp_cells;
|
||||
tmp_cells.reserve(64);
|
||||
if (dimension() == 3)
|
||||
incident_cells_3(v, v->cell(), std::back_inserter(tmp_cells));
|
||||
else
|
||||
incident_cells_2(v, v->cell(), std::back_inserter(tmp_cells));
|
||||
|
||||
std::vector<Vertex_handle> tmp_vertices;
|
||||
tmp_vertices.reserve(dimension()*tmp_cells.size());
|
||||
|
||||
for(typename std::vector<Cell_handle>::iterator cit = tmp_cells.begin();
|
||||
cit != tmp_cells.end(); ++cit) {
|
||||
(*cit)->set_in_conflict_flag(0);
|
||||
// Put all incident vertices in tmp_vertices.
|
||||
// They are counted several times.
|
||||
for (int j=0; j<=dimension(); ++j)
|
||||
if ((*cit)->vertex(j) != v)
|
||||
tmp_vertices.push_back((*cit)->vertex(j));
|
||||
}
|
||||
|
||||
// Now sort and output the vertices.
|
||||
std::sort(tmp_vertices.begin(), tmp_vertices.end());
|
||||
std::unique_copy(tmp_vertices.begin(), tmp_vertices.end(), vertices);
|
||||
}
|
||||
|
||||
void
|
||||
incident_cells(Vertex_handle v, std::set<Cell_handle> & cells,
|
||||
Cell_handle c = NULL ) const;
|
||||
|
|
@ -757,15 +832,33 @@ Triangulation_data_structure_3<Vb,Cb>::
|
|||
is_edge(Vertex_handle u, Vertex_handle v, Cell_handle &c, int &i, int &j) const
|
||||
// returns false when dimension <1 or when indices wrong
|
||||
{
|
||||
if (u==v)
|
||||
return false;
|
||||
CGAL_triangulation_expensive_precondition( is_vertex(u) && is_vertex(v) );
|
||||
|
||||
for(Cell_iterator cit = cell_container().begin(); cit != cells_end(); ++cit)
|
||||
if (cit->has_vertex(u,i) && cit->has_vertex(v,j)) {
|
||||
c = cit->handle();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (u==v)
|
||||
return false;
|
||||
|
||||
std::vector<Cell_handle> cells;
|
||||
cells.reserve(64);
|
||||
incident_cells(u, std::back_inserter(cells));
|
||||
|
||||
for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
|
||||
cit != cells.end(); ++cit)
|
||||
if ((*cit)->has_vertex(v, j)) {
|
||||
c = *cit;
|
||||
i = c->index(u);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template < class Vb, class Cb>
|
||||
bool
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
is_edge(Vertex_handle u, Vertex_handle v) const
|
||||
{
|
||||
Cell_handle c;
|
||||
int i, j;
|
||||
return is_edge(u, v, c, i, j);
|
||||
}
|
||||
|
||||
template < class Vb, class Cb>
|
||||
|
|
@ -793,18 +886,27 @@ is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
|
|||
Cell_handle & c, int & i, int & j, int & k) const
|
||||
// returns false when dimension <2 or when indices wrong
|
||||
{
|
||||
if ( (u==v) || (u==w) || (v==w) ) return false;
|
||||
Facet_iterator it = facets_begin();
|
||||
while ( it != facets_end() ) {
|
||||
if ( ( ((*it).first)->has_vertex(u,i) )
|
||||
&& ( ((*it).first)->has_vertex(v,j) )
|
||||
&& ( ((*it).first)->has_vertex(w,k) ) ) {
|
||||
c = (*it).first;
|
||||
return true;
|
||||
CGAL_triangulation_expensive_precondition( is_vertex(u) &&
|
||||
is_vertex(v) &&
|
||||
is_vertex(w) );
|
||||
|
||||
if ( u==v || u==w || v==w )
|
||||
return false;
|
||||
if (dimension() < 2)
|
||||
return false;
|
||||
|
||||
std::vector<Cell_handle> cells;
|
||||
cells.reserve(64);
|
||||
incident_cells(u, std::back_inserter(cells));
|
||||
|
||||
for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
|
||||
cit != cells.end(); ++cit)
|
||||
if ((*cit)->has_vertex(v, j) && (*cit)->has_vertex(w, k)) {
|
||||
c = *cit;
|
||||
i = c->index(u);
|
||||
return true;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
template < class Vb, class Cb>
|
||||
|
|
@ -837,18 +939,27 @@ is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w, Vertex_handle t,
|
|||
Cell_handle & c, int & i, int & j, int & k, int & l) const
|
||||
// returns false when dimension <3
|
||||
{
|
||||
if ( (u==v) || (u==w) || (u==t) || (v==w) || (v==t) || (w==t) )
|
||||
CGAL_triangulation_expensive_precondition( is_vertex(u) &&
|
||||
is_vertex(v) &&
|
||||
is_vertex(w) &&
|
||||
is_vertex(t) );
|
||||
|
||||
if ( u==v || u==w || u==t || v==w || v==t || w==t )
|
||||
return false;
|
||||
|
||||
std::vector<Cell_handle> cells;
|
||||
cells.reserve(64);
|
||||
incident_cells(u, std::back_inserter(cells));
|
||||
|
||||
for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
|
||||
cit != cells.end(); ++cit)
|
||||
if ((*cit)->has_vertex(v, j) && (*cit)->has_vertex(w, k) &&
|
||||
(*cit)->has_vertex(t, l)) {
|
||||
c = *cit;
|
||||
i = c->index(u);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
for(Cell_iterator it = cells_begin(); it != cells_end(); ++it) {
|
||||
if ( ( it->has_vertex(u,i) )
|
||||
&& ( it->has_vertex(v,j) )
|
||||
&& ( it->has_vertex(w,k) )
|
||||
&& ( it->has_vertex(t,l) ) ) {
|
||||
c = it->handle();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template < class Vb, class Cb>
|
||||
|
|
@ -858,17 +969,9 @@ is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w, Vertex_handle t)
|
|||
const
|
||||
// returns false when dimension <3
|
||||
{
|
||||
if ( (u==v) || (u==w) || (u==t) || (v==w) || (v==t) || (w==t) )
|
||||
return false;
|
||||
for(Cell_iterator it = cells_begin(); it != cells_end(); ++it) {
|
||||
if ( it->has_vertex(u) &&
|
||||
it->has_vertex(v) &&
|
||||
it->has_vertex(w) &&
|
||||
it->has_vertex(t) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
Cell_handle c;
|
||||
int i, j, k, l;
|
||||
return is_cell(u, v, w, t, c, i, j, k, l);
|
||||
}
|
||||
|
||||
template < class Vb, class Cb>
|
||||
|
|
@ -968,9 +1071,8 @@ flip( Cell_handle c, int i )
|
|||
|
||||
// checks that the facet is flippable,
|
||||
// ie the future edge does not already exist
|
||||
std::set<Vertex_handle> setc;
|
||||
incident_vertices( c->vertex(i), setc );
|
||||
if ( setc.find( n->vertex(in) ) != setc.end() ) return false;
|
||||
if (is_edge(c->vertex(i), n->vertex(in)))
|
||||
return false;
|
||||
|
||||
flip_really(c,i,n,in);
|
||||
return true;
|
||||
|
|
@ -992,13 +1094,8 @@ flip_flippable( Cell_handle c, int i )
|
|||
|
||||
// checks that the facet is flippable,
|
||||
// ie the future edge does not already exist
|
||||
typedef std::set<Vertex_handle> set_of_vertices;
|
||||
CGAL_triangulation_expensive_precondition_code( set_of_vertices setc; );
|
||||
CGAL_triangulation_expensive_precondition_code
|
||||
( incident_vertices( c->vertex(i), setc ); );
|
||||
CGAL_triangulation_expensive_precondition
|
||||
( ( setc.find( n->vertex(in) ) == setc.end() ) );
|
||||
|
||||
CGAL_triangulation_expensive_precondition( !is_edge(c->vertex(i),
|
||||
n->vertex(in)));
|
||||
flip_really(c,i,n,in);
|
||||
}
|
||||
|
||||
|
|
@ -1808,6 +1905,7 @@ Triangulation_data_structure_3<Vb,Cb>::
|
|||
incident_cells(Vertex_handle v, std::set<Cell_handle> & cells,
|
||||
Cell_handle c) const
|
||||
{
|
||||
bool THIS_FUNCTION_IS_DEPRECATED;
|
||||
CGAL_triangulation_precondition( v != NULL );
|
||||
CGAL_triangulation_expensive_precondition( is_vertex(v) );
|
||||
|
||||
|
|
@ -1823,18 +1921,19 @@ incident_cells(Vertex_handle v, std::set<Cell_handle> & cells,
|
|||
return; // c was already found
|
||||
|
||||
cells.insert( c );
|
||||
|
||||
|
||||
for ( int j=0; j<4; j++ )
|
||||
if ( j != c->index(v) )
|
||||
incident_cells( v, cells, c->neighbor(j) );
|
||||
}
|
||||
|
||||
|
||||
template <class Vb, class Cb >
|
||||
void
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
incident_vertices(Vertex_handle v, std::set<Vertex_handle> & vertices,
|
||||
Cell_handle c) const
|
||||
{
|
||||
bool THIS_FUNCTION_IS_DEPRECATED;
|
||||
CGAL_triangulation_precondition( v != NULL );
|
||||
CGAL_triangulation_expensive_precondition( is_vertex(v) );
|
||||
|
||||
|
|
|
|||
|
|
@ -105,18 +105,13 @@ _test_circulator( const Triangulation &T )
|
|||
// } while (cc != cc0);
|
||||
// }
|
||||
|
||||
std::set<Cell_handle > cells ;
|
||||
std::set<Vertex_handle > vertices ;
|
||||
std::vector<Cell_handle> cells;
|
||||
std::vector<Vertex_handle > vertices;
|
||||
|
||||
Vertex_iterator vit;
|
||||
// for (vit=T.vertices_begin(); vit!=T.vertices_end() ; vit++)
|
||||
{
|
||||
vit=T.vertices_begin();
|
||||
T.incident_cells(&*vit,cells);
|
||||
T.incident_cells(&*vit,cells,vit->cell());
|
||||
T.incident_vertices(&*vit, vertices);
|
||||
T.incident_vertices(&*vit, vertices,vit->cell());
|
||||
}
|
||||
Vertex_handle vh = T.vertices_begin()->handle();
|
||||
|
||||
T.incident_cells(vh,std::back_inserter(cells));
|
||||
T.incident_vertices(vh, std::back_inserter(vertices));
|
||||
|
||||
Facet_circulator fc, fc0;
|
||||
int i,j;
|
||||
|
|
|
|||
|
|
@ -139,21 +139,18 @@ _test_cls_tds_3( const Tds &)
|
|||
|
||||
cdone = tds6.cells_end();
|
||||
|
||||
std::set< Vertex_handle > set_of_vertices;
|
||||
|
||||
for ( cit = tds6.cells_begin(); cit != cdone; cit++ ) {
|
||||
// NOTE : the triangulation is modified during loop
|
||||
// --> the cell_iterator does not mean a lot
|
||||
for ( i=0; i<4; i++ ) {
|
||||
std::set< Vertex_handle > set_of_vertices;
|
||||
tds6.incident_vertices( (&(*cit))->vertex(i), set_of_vertices );
|
||||
if ( set_of_vertices.find
|
||||
( (&(*cit))->neighbor(i)->vertex
|
||||
( (&(*cit))->neighbor(i)->index( &(*cit) ) )
|
||||
)
|
||||
tds6.incident_vertices( cit->vertex(i), std::inserter(set_of_vertices,
|
||||
set_of_vertices.begin() ) );
|
||||
if ( set_of_vertices.find ( cit->neighbor(i)->vertex
|
||||
( cit->neighbor(i)->index( cit->handle() ) ) )
|
||||
== set_of_vertices.end() ) {
|
||||
nbflips++;
|
||||
tds6.flip_flippable( &(*cit), i );
|
||||
tds6.flip_flippable( cit->handle(), i );
|
||||
assert(tds6.is_valid());
|
||||
// if ( tds6.flip( &(*cit), i ) ) {
|
||||
// tds6.is_valid(true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue