mirror of https://github.com/CGAL/cgal
Merge pull request #3538 from maxGimeno/BGL-Fix_add_face-GF
BGL: Fix Euler::add_face()
This commit is contained in:
commit
0ec8873a37
|
|
@ -585,8 +585,16 @@ add_face(const VertexRange& vr, Graph& g)
|
||||||
|
|
||||||
std::vector<vertex_descriptor> vertices(vr.begin(), vr.end()); // quick and dirty copy
|
std::vector<vertex_descriptor> vertices(vr.begin(), vr.end()); // quick and dirty copy
|
||||||
unsigned int n = (unsigned int)vertices.size();
|
unsigned int n = (unsigned int)vertices.size();
|
||||||
|
//check that every vertex is unique
|
||||||
|
std::sort(vertices.begin(), vertices.end());
|
||||||
|
if(std::adjacent_find(vertices.begin(), vertices.end()) != vertices.end()){
|
||||||
|
return boost::graph_traits<Graph>::null_face();
|
||||||
|
}
|
||||||
|
std::copy(vr.begin(), vr.end(), vertices.begin());
|
||||||
// don't allow degenerated faces
|
// don't allow degenerated faces
|
||||||
CGAL_assertion(n > 2);
|
if(n <= 2){
|
||||||
|
return boost::graph_traits<Graph>::null_face();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<halfedge_descriptor> halfedges(n);
|
std::vector<halfedge_descriptor> halfedges(n);
|
||||||
std::vector<bool> is_new(n);
|
std::vector<bool> is_new(n);
|
||||||
|
|
|
||||||
|
|
@ -2551,6 +2551,11 @@ void
|
||||||
Surface_mesh<P>::
|
Surface_mesh<P>::
|
||||||
collect_garbage()
|
collect_garbage()
|
||||||
{
|
{
|
||||||
|
if (!has_garbage())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int i, i0, i1,
|
int i, i0, i1,
|
||||||
nV(num_vertices()),
|
nV(num_vertices()),
|
||||||
nE(num_edges()),
|
nE(num_edges()),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue