- Added Delaunay_3::vertices_in_conflict().

This commit is contained in:
Sylvain Pion 2003-12-17 18:57:59 +00:00
parent b6cce3efa7
commit b1d644e703
5 changed files with 82 additions and 15 deletions

View File

@ -1,8 +1,9 @@
Version 1.185 (? December 03)
Version 1.185 (17 December 03)
- Triangulation_hierarchy_3 : move the global "const int" parameters to
nested enums (equivalent to static const int).
- New types size_type and difference_type (like HDS and standard containers),
and the functions number_of*() and degree() now return size_type.
- Added Delaunay_3::vertices_in_conflict().
Version 1.184 (4 December 03)
- Get rid of CGAL_NULL_TMPL_ARGS.

View File

@ -250,6 +250,18 @@ Returns the \ccc{Triple} composed of the resulting output iterators.
with \ccc{p}.}
}
\ccMethod{template <class OutputIterator>
OutputIterator
vertices_in_conflict(Point p, Cell_handle c,
OutputIterator res);}
{Similar to \ccc{find_conflicts()}, but reports the vertices which are on the
boundary of the conflict hole of \ccc{p}, in the output iterator \ccc{res}.
Returns the resulting output iterator.
\ccPrecond{\ccVar.\ccc{dimension()} $\geq 2$, and \ccc{c} is in conflict
with \ccc{p}.}
}
\ccHeading{Voronoi diagram}
\ccIndexMainItem{Voronoi diagram}

View File

@ -250,6 +250,18 @@ Returns the \ccc{Triple} composed of the resulting output iterators.
with \ccc{p}.}
}
\ccMethod{template <class OutputIterator>
OutputIterator
vertices_in_conflict(Point p, Cell_handle c,
OutputIterator res);}
{Similar to \ccc{find_conflicts()}, but reports the vertices which are on the
boundary of the conflict hole of \ccc{p}, in the output iterator \ccc{res}.
Returns the resulting output iterator.
\ccPrecond{\ccVar.\ccc{dimension()} $\geq 2$, and \ccc{c} is in conflict
with \ccc{p}.}
}
\ccHeading{Voronoi diagram}
\ccIndexMainItem{Voronoi diagram}

View File

@ -256,14 +256,40 @@ public:
OutputIteratorCells,
Emptyset_iterator> t = find_conflicts(p, c, bfit, cit,
Emptyset_iterator());
return std::make_pair(t.first, t.second);
return std::make_pair(t.first, t.second);
}
void
make_canonical(Vertex_triple& t) const;
Vertex_triple
make_vertex_triple(const Facet& f) const;
// Returns the vertices on the boundary of the conflict hole.
template <class OutputIterator>
OutputIterator
vertices_in_conflict(const Point&p, Cell_handle c, OutputIterator res) const
{
CGAL_triangulation_precondition(dimension() >= 2);
// Get the facets on the boundary of the hole.
std::vector<Facet> facets;
find_conflicts(p, c, std::back_inserter(facets),
Emptyset_iterator(), Emptyset_iterator());
// Then extract uniquely the vertices.
std::set<Vertex_handle> vertices;
if (dimension() == 3) {
for (typename std::vector<Facet>::const_iterator i = facets.begin();
i != facets.end(); ++i) {
vertices.insert(i->first->vertex((i->second+1)&3));
vertices.insert(i->first->vertex((i->second+2)&3));
vertices.insert(i->first->vertex((i->second+3)&3));
}
} else {
for (typename std::vector<Facet>::const_iterator i = facets.begin();
i != facets.end(); ++i) {
vertices.insert(i->first->vertex(cw(i->second)));
vertices.insert(i->first->vertex(ccw(i->second)));
}
}
return std::copy(vertices.begin(), vertices.end(), res);
}
// We return bool only for backward compatibility (it's always true).
// The documentation mentions void.
@ -286,6 +312,11 @@ private:
void make_hole_2D(Vertex_handle v, std::list<Edge_2D> & hole);
void fill_hole_delaunay_2D(std::list<Edge_2D> & hole);
void make_canonical(Vertex_triple& t) const;
Vertex_triple
make_vertex_triple(const Facet& f) const;
void remove_3D(Vertex_handle v);
void remove_3D_new(Vertex_handle v);

View File

@ -429,10 +429,11 @@ _test_cls_delaunay_3(const Triangulation &)
assert(Tfromfile.number_of_vertices() == 22);
}
// Testing find_conflicts() + insert_in_hole()
// Testing find_conflicts(), vertices_in_conflict(), insert_in_hole()
// FIXME : Note that we do not test the version of find_conflicts()
// which returns the internal facets too...
std::cout << " Constructor13 (find_conflicts/insert_in_hole)" << std::endl;
std::cout << " Testing find_conflicts/vertices_in_conflict/insert_in_hole"
<< std::endl;
Cls T3_13;
for (i=0; i<22; ++i) {
if (T3_13.dimension() < 2)
@ -448,12 +449,22 @@ _test_cls_delaunay_3(const Triangulation &)
T3_13.insert_outside_affine_hull(q[i]);
continue;
}
// Get the cells in conflicts.
std::vector<Cell_handle> V;
Facet facet;
T3_13.find_conflicts(q[i], c, CGAL::Oneset_iterator<Facet>(facet),
std::back_inserter(V));
T3_13.insert_in_hole(q[i], V.begin(), V.end(), facet.first, facet.second);
// Get the stuff in conflicts.
std::vector<Cell_handle> C;
std::vector<Facet> F;
std::vector<Vertex_handle> V;
T3_13.vertices_in_conflict(q[i], c, std::back_inserter(V));
T3_13.find_conflicts(q[i], c, std::back_inserter(F),
std::back_inserter(C));
if (T3_13.dimension() == 3)
assert(F.size() == 2*V.size() - 4); // Euler relation.
if (T3_13.dimension() == 2)
assert(F.size() == V.size());
T3_13.insert_in_hole(q[i], C.begin(), C.end(),
F.begin()->first, F.begin()->second);
}
}
assert(T3_13.is_valid());