- New function degree(v).

This commit is contained in:
Sylvain Pion 2001-09-27 16:06:12 +00:00
parent d0578874d6
commit 07beca8227
8 changed files with 36 additions and 5 deletions

View File

@ -1,3 +1,6 @@
Version 1.94 (?? September 01)
- New function degree(v).
Version 1.93 (27 September 01)
- Use CGAL/iterator.h.
- New function TDS::create_face() to prepare for the merge TDS_2/TDS_3.

View File

@ -75,12 +75,9 @@ int main()
T.insert(Point(-1,0,1));
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) {
std::vector<Delaunay::Vertex_handle> adjacent;
T.incident_vertices( vit->handle(), std::back_inserter(adjacent));
if (adjacent.size() == 6)
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
if (T.degree(vit->handle()) == 6)
vit->color = CGAL::RED;
}
std::cout << " Visualization of T" << std::endl;
gv.set_wired(true);

View File

@ -529,6 +529,10 @@ iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\ccMethod{unsigned int degree(Vertex_handle v) const;}
{Returns the degree of a vertex, that is, the number of incident vertices.
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\begin{ccAdvanced}
\ccHeading{Checking}

View File

@ -830,6 +830,9 @@ iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\ccMethod{unsigned int degree(Vertex_handle v) const;}
{Returns the degree of a vertex, that is, the number of incident vertices.
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\begin{ccAdvanced}
\ccHeading{Checking}

View File

@ -529,6 +529,10 @@ iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\ccMethod{unsigned int degree(Vertex_handle v) const;}
{Returns the degree of a vertex, that is, the number of incident vertices.
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\begin{ccAdvanced}
\ccHeading{Checking}

View File

@ -830,6 +830,9 @@ iterator \ccc{cells}. If \ccVar.\ccc{dimension()} $<3$, then do nothing.
output iterator \ccc{vertices}. If \ccVar.\ccc{dimension()} $<2$, then do
nothing. \ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\ccMethod{unsigned int degree(Vertex_handle v) const;}
{Returns the degree of a vertex, that is, the number of incident vertices.
\ccPrecond{\ccc{v} $\neq$ \ccc{NULL}, \ccVar.\ccc{is_vertex(v)}.}}
\begin{ccAdvanced}
\ccHeading{Checking}

View File

@ -809,6 +809,11 @@ public:
_tds.incident_vertices(v, vertices);
}
unsigned int degree(Vertex_handle v) const
{
return _tds.degree(v);
}
// CHECKING
bool is_valid(bool verbose = false, int level = 0) const;

View File

@ -578,6 +578,8 @@ public:
incident_vertices(Vertex_handle v, std::set<Vertex_handle> & vertices,
Cell_handle c = NULL ) const;
unsigned int degree(Vertex_handle v) const;
// CHECKING
bool is_valid(bool verbose = false, int level = 0) const;
@ -1974,6 +1976,16 @@ incident_vertices(Vertex_handle v, std::set<Vertex_handle> & vertices,
incident_vertices( v, vertices, c->neighbor(j) );
}
template <class Vb, class Cb >
unsigned int
Triangulation_data_structure_3<Vb,Cb>::
degree(Vertex_handle v) const
{
std::vector<Vertex_handle> V;
incident_vertices(v, std::back_inserter(V));
return V.size();
}
template <class Vb, class Cb >
bool
Triangulation_data_structure_3<Vb,Cb>::