mirror of https://github.com/CGAL/cgal
Add verbose to BGL::can_add_face
This commit is contained in:
parent
22c7de1d6a
commit
b72814fb2c
|
|
@ -585,8 +585,11 @@ add_edge(typename boost::graph_traits<Graph>::vertex_descriptor s,
|
|||
* checks whether a new face defined by a range of vertices (identified by their descriptors,
|
||||
* `boost::graph_traits<Graph>::%vertex_descriptor`) can be added.
|
||||
*/
|
||||
template <typename VertexRange,typename PMesh>
|
||||
bool can_add_face(const VertexRange& vrange, const PMesh& sm)
|
||||
template <typename VertexRange,
|
||||
typename PMesh>
|
||||
bool can_add_face(const VertexRange& vrange,
|
||||
const PMesh& sm,
|
||||
const bool verbose = false)
|
||||
{
|
||||
typedef typename boost::graph_traits<PMesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<PMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
|
@ -603,10 +606,16 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm)
|
|||
typename std::vector<vertex_descriptor>::iterator it = std::unique(f2.begin(),f2.end());
|
||||
|
||||
if((N > 0) && (it != f2.end())){
|
||||
if (verbose){
|
||||
std::cerr << "Cannot add face: face contains duplicate vertices." << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(N < 3){
|
||||
if (verbose){
|
||||
std::cerr << "Cannot add face: face must contain at least 3 vertices." << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -617,6 +626,9 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm)
|
|||
bool found;
|
||||
std::tie(hd,found) = halfedge(face[i],face[i+1],sm);
|
||||
if(found && (! is_border(hd,sm))){
|
||||
if (verbose){
|
||||
std::cerr << "Cannot add face: face contains an edge that is not a border halfedge." << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -627,6 +639,9 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm)
|
|||
}
|
||||
|
||||
if(! is_border(face[i],sm)){
|
||||
if (verbose){
|
||||
std::cerr << "Cannot add face: face contains a vertex that is not a border vertex." << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -648,8 +663,9 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm)
|
|||
|
||||
if ( halfedge_around_vertex == boost::graph_traits<PMesh>::null_halfedge() ||
|
||||
halfedge(previous_vertex,sm) == boost::graph_traits<PMesh>::null_halfedge()||
|
||||
halfedge(next_vertex,sm) == boost::graph_traits<PMesh>::null_halfedge()
|
||||
) continue;
|
||||
halfedge(next_vertex,sm) == boost::graph_traits<PMesh>::null_halfedge() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
halfedge_descriptor start=halfedge_around_vertex;
|
||||
//halfedges pointing to/running out from vertex indices[i]
|
||||
|
|
@ -694,7 +710,12 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm)
|
|||
if ( is_border(opposite(halfedge_around_vertex,sm),sm) ) break;
|
||||
}
|
||||
while (halfedge_around_vertex != prev_hd);
|
||||
if (halfedge_around_vertex == prev_hd) return false;
|
||||
if (halfedge_around_vertex == prev_hd) {
|
||||
if (verbose){
|
||||
std::cerr << "Cannot add face: halfedge_around_vertex == prev_hd" << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
start = halfedge_around_vertex;
|
||||
}
|
||||
}
|
||||
|
|
@ -703,7 +724,6 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* adds a new face defined by a range of vertices (identified by their descriptors,
|
||||
* `boost::graph_traits<Graph>::%vertex_descriptor`).
|
||||
|
|
|
|||
Loading…
Reference in New Issue