mirror of https://github.com/CGAL/cgal
Merge pull request #3639 from sgiraudot/OTR-Fix_copy_star-GF
OTR: Fix validity of triangulation
This commit is contained in:
commit
5cc356a888
|
|
@ -921,6 +921,22 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool check_validity_test () const
|
||||
{
|
||||
for(Finite_faces_iterator it = Base::finite_faces_begin();
|
||||
it != Base::finite_faces_end(); it++)
|
||||
{
|
||||
typename Traits_::Orientation s
|
||||
= orientation(it->vertex(0)->point(),
|
||||
it->vertex(1)->point(),
|
||||
it->vertex(2)->point());
|
||||
if (s != LEFT_TURN)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// COLLAPSE //
|
||||
|
||||
// (s,a,b) + (s,b,c) -> (s,a,c) + (a,b,c)
|
||||
|
|
|
|||
|
|
@ -606,19 +606,34 @@ public:
|
|||
ok = copy.make_collapsible(copy_edge, copy_hull.begin(),
|
||||
copy_hull.end(), m_verbose);
|
||||
if (!ok) {
|
||||
// std::cerr << "simulation: failed (make collapsible)" << std::endl;
|
||||
if (m_verbose > 1)
|
||||
std::cerr << "simulation: failed (make collapsible)" << std::endl;
|
||||
return false;
|
||||
}
|
||||
ok = copy.check_validity_test();
|
||||
if (!ok) {
|
||||
if (m_verbose > 1)
|
||||
std::cerr << "simulation: failed (validity test)" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ok = copy.check_kernel_test(copy_edge);
|
||||
if (!ok) {
|
||||
std::cerr << "simulation: failed (kernel test)" << std::endl;
|
||||
if (m_verbose > 1)
|
||||
std::cerr << "simulation: failed (kernel test)" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
copy.collapse(copy_edge, m_verbose);
|
||||
|
||||
ok = copy.check_validity_test();
|
||||
if (!ok) {
|
||||
if (m_verbose > 1)
|
||||
std::cerr << "simulation: failed (validity test)" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
Sample_vector samples;
|
||||
m_dt.collect_samples_from_vertex(s, samples, false);
|
||||
|
||||
|
|
@ -926,6 +941,9 @@ public:
|
|||
|
||||
// edge must not be pinned or have cyclic target
|
||||
Edge copy_star(const Edge& edge, Triangulation& copy) {
|
||||
copy.tds().clear();
|
||||
Vertex_handle vinf = copy.tds().create_vertex();
|
||||
copy.set_infinite_vertex (vinf);
|
||||
copy.tds().set_dimension(2);
|
||||
copy.infinite_vertex()->pinned() = true;
|
||||
|
||||
|
|
@ -944,10 +962,9 @@ public:
|
|||
{
|
||||
Vertex_handle v = vcirc;
|
||||
CGAL_assertion(v!=m_dt.infinite_vertex());
|
||||
if (cvmap.find(v) == cvmap.end()) {
|
||||
Vertex_handle cv = copy.tds().create_vertex();
|
||||
cvmap[v] = copy_vertex(v, cv);
|
||||
}
|
||||
CGAL_assertion (cvmap.find(v) == cvmap.end());
|
||||
Vertex_handle cv = copy.tds().create_vertex();
|
||||
cvmap[v] = copy_vertex(v, cv);
|
||||
}
|
||||
|
||||
// copy faces
|
||||
|
|
@ -994,7 +1011,9 @@ public:
|
|||
{
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
Vertex_handle v0i = f0->vertex(i);
|
||||
CGAL_assertion (vmap.find(v0i) != vmap.end());
|
||||
Vertex_handle v1i = vmap[v0i];
|
||||
CGAL_assertion (v1i != Vertex_handle());
|
||||
f1->set_vertex(i, v1i);
|
||||
v1i->set_face(f1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue