Remove face_degree; Fix warnings

This commit is contained in:
Andreas Fabri 2017-05-11 11:35:42 +02:00 committed by Maxime Gimeno
parent 897a377344
commit 2e4524e11f
4 changed files with 18 additions and 32 deletions

View File

@ -777,29 +777,6 @@ void clear(FaceGraph& g)
CGAL_postcondition(num_faces(g) == 0);
}
/**
* \ingroup PkgBGLHelperFct
*
* returns the degree of the face with halfedge `hd`
*
* @tparam FaceGraph model of `FaceGraph`
*
* @param hd a halfedge of the face of interest
* @param g the graph containing `hd`
*
**/
template <typename FaceGraph>
typename boost::graph_traits<FaceGraph>::degree_size_type
face_degree(typename boost::graph_traits<FaceGraph>::halfedge_descriptor hd, const FaceGraph& g)
{
typename boost::graph_traits<FaceGraph>::degree_size_type res = 0;
typename boost::graph_traits<FaceGraph>::halfedge_descriptor done = hd;
do {
++res;
hd = next(hd,g);
}while(! (hd == done));
return res;
}
} // namespace CGAL

View File

@ -154,7 +154,8 @@ public Q_SLOTS:
if(active_handle_type == Active_handle::VERTEX || active_handle_type == Active_handle::PATH)
{
#ifdef USE_SURFACE_MESH
std::size_t h = reinterpret_cast<std::size_t>(void_ptr);
typedef boost::graph_traits<FaceGraph>::vertices_size_type size_type;
size_type h = reinterpret_cast<size_type>(void_ptr);
process_selection( static_cast<fg_vertex_descriptor>(h) );
#else
process_selection( static_cast<Polyhedron::Vertex*>(void_ptr)->halfedge()->vertex() );
@ -169,7 +170,8 @@ public Q_SLOTS:
|| active_handle_type == Active_handle::CONNECTED_COMPONENT)
{
#ifdef USE_SURFACE_MESH
std::size_t h = reinterpret_cast<std::size_t>(void_ptr);
typedef boost::graph_traits<FaceGraph>::faces_size_type size_type;
size_type h = reinterpret_cast<size_type>(void_ptr);
process_selection( static_cast<fg_face_descriptor>(h) );
#else
process_selection( static_cast<Polyhedron::Facet*>(void_ptr)->halfedge()->facet() );
@ -183,7 +185,8 @@ public Q_SLOTS:
if(active_handle_type == Active_handle::EDGE)
{
#ifdef USE_SURFACE_MESH
std::size_t h = reinterpret_cast<std::size_t>(void_ptr);
typedef boost::graph_traits<FaceGraph>::edges_size_type size_type;
size_type h = reinterpret_cast<size_type>(void_ptr);
process_selection( static_cast<fg_edge_descriptor>(h) );
#else
process_selection( edge(static_cast<Polyhedron::Halfedge*>(void_ptr)->opposite()->opposite(), *poly_item->polyhedron()) );

View File

@ -191,7 +191,8 @@ public Q_SLOTS:
// slots are called by signals of surface_mesh_item
void sm_vertex_has_been_selected(void* v)
{
std::size_t h = reinterpret_cast<std::size_t>(v);
typedef boost::graph_traits<SMesh>::vertices_size_type size_type;
size_type h = reinterpret_cast<size_type>(v);
is_active=true;
if(active_handle_type == Active_handle::VERTEX || active_handle_type == Active_handle::PATH)
process_selection( sm_vertex_descriptor(h) );
@ -199,7 +200,8 @@ public Q_SLOTS:
}
void sm_facet_has_been_selected(void* v)
{
std::size_t h = reinterpret_cast<std::size_t>(v);
typedef boost::graph_traits<SMesh>::vertices_size_type size_type;
size_type h = reinterpret_cast<size_type>(v);
is_active=true;
if (active_handle_type == Active_handle::FACET
|| active_handle_type == Active_handle::CONNECTED_COMPONENT)
@ -208,7 +210,8 @@ public Q_SLOTS:
}
void sm_edge_has_been_selected(void* v)
{
std::size_t h = reinterpret_cast<std::size_t>(v);
typedef boost::graph_traits<SMesh>::edges_size_type size_type;
size_type h = reinterpret_cast<size_type>(v);
is_active=true;
if(active_handle_type == Active_handle::EDGE)
process_selection(sm_edge_descriptor(h) );

View File

@ -10,6 +10,7 @@
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <boost/range.hpp>
#include <exception>
#include <functional>
@ -1176,9 +1177,9 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::set<fg_edge_de
}
//Join vertex
case 0:
if(CGAL::face_degree(halfedge(ed, *polyhedron()), *polyhedron()) < 4
if(boost::distance(CGAL::halfedges_around_face(halfedge(ed, *polyhedron()), *polyhedron())) < 4
||
CGAL::face_degree(opposite(halfedge(ed, *polyhedron()),*polyhedron()),*polyhedron())< 4)
boost::distance(CGAL::halfedges_around_face(opposite(halfedge(ed, *polyhedron()),*polyhedron()),*polyhedron()))< 4)
{
d->tempInstructions("Edge not selected: the incident facets must have a degree of at least 4.",
"Select the edge with extremities you want to join.");
@ -1258,7 +1259,9 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::set<fg_edge_de
case 6:
//check preconditions
if(CGAL::face_degree(halfedge(ed, *polyhedron()),*polyhedron()) == 3 && CGAL::face_degree(opposite(halfedge(ed, *polyhedron()),*polyhedron()),*polyhedron()) == 3)
if(boost::distance(CGAL::halfedges_around_face(halfedge(ed, *polyhedron()),*polyhedron())) == 3
&&
boost::distance(CGAL::halfedges_around_face(opposite(halfedge(ed, *polyhedron()),*polyhedron()),*polyhedron())) == 3)
{
CGAL::Euler::flip_edge(halfedge(ed, *polyhedron()), *polyhedron());
polyhedron_item()->invalidateOpenGLBuffers();