Merge branch 'smart_handle_improvement' into 'master'

let opposite_face_handle and find_halfedge return smart handles

See merge request OpenMesh/OpenMesh!247
This commit is contained in:
Jan Möbius
2020-01-29 20:38:54 +01:00
2 changed files with 12 additions and 7 deletions

View File

@@ -54,8 +54,7 @@ const PolyConnectivity::FaceHandle PolyConnectivity::InvalidFaceHandle;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
PolyConnectivity::HalfedgeHandle SmartHalfedgeHandle PolyConnectivity::find_halfedge(VertexHandle _start_vh, VertexHandle _end_vh ) const
PolyConnectivity::find_halfedge(VertexHandle _start_vh, VertexHandle _end_vh ) const
{ {
assert(_start_vh.is_valid() && _end_vh.is_valid()); assert(_start_vh.is_valid() && _end_vh.is_valid());
@@ -63,7 +62,7 @@ PolyConnectivity::find_halfedge(VertexHandle _start_vh, VertexHandle _end_vh ) c
if (to_vertex_handle(*voh_it) == _end_vh) if (to_vertex_handle(*voh_it) == _end_vh)
return *voh_it; return *voh_it;
return InvalidHalfedgeHandle; return make_smart(InvalidHalfedgeHandle, this);
} }
@@ -99,6 +98,14 @@ bool PolyConnectivity::is_manifold(VertexHandle _vh) const
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
SmartFaceHandle PolyConnectivity::opposite_face_handle(HalfedgeHandle _heh) const
{
return face_handle(make_smart(opposite_halfedge_handle(_heh), this));
}
//-----------------------------------------------------------------------------
void PolyConnectivity::adjust_outgoing_halfedge(VertexHandle _vh) void PolyConnectivity::adjust_outgoing_halfedge(VertexHandle _vh)
{ {
for (ConstVertexOHalfedgeIter vh_it=cvoh_iter(_vh); vh_it.is_valid(); ++vh_it) for (ConstVertexOHalfedgeIter vh_it=cvoh_iter(_vh); vh_it.is_valid(); ++vh_it)

View File

@@ -611,7 +611,6 @@ public:
inline SmartEdgeHandle edge_handle(SmartHalfedgeHandle _heh) const; inline SmartEdgeHandle edge_handle(SmartHalfedgeHandle _heh) const;
inline SmartFaceHandle face_handle(SmartHalfedgeHandle _heh) const; inline SmartFaceHandle face_handle(SmartHalfedgeHandle _heh) const;
//@} //@}
/** \name Begin and end iterators /** \name Begin and end iterators
@@ -1359,8 +1358,7 @@ public:
// --- shortcuts --- // --- shortcuts ---
/// returns the face handle of the opposite halfedge /// returns the face handle of the opposite halfedge
inline FaceHandle opposite_face_handle(HalfedgeHandle _heh) const inline SmartFaceHandle opposite_face_handle(HalfedgeHandle _heh) const;
{ return face_handle(opposite_halfedge_handle(_heh)); }
// --- misc --- // --- misc ---
@@ -1370,7 +1368,7 @@ public:
void adjust_outgoing_halfedge(VertexHandle _vh); void adjust_outgoing_halfedge(VertexHandle _vh);
/// Find halfedge from _vh0 to _vh1. Returns invalid handle if not found. /// Find halfedge from _vh0 to _vh1. Returns invalid handle if not found.
HalfedgeHandle find_halfedge(VertexHandle _start_vh, VertexHandle _end_vh) const; SmartHalfedgeHandle find_halfedge(VertexHandle _start_vh, VertexHandle _end_vh) const;
/// Vertex valence /// Vertex valence
uint valence(VertexHandle _vh) const; uint valence(VertexHandle _vh) const;
/// Face valence /// Face valence