Merge branch 'halfedge_loop_range' into 'master'

Halfedge loop range

See merge request OpenMesh/OpenMesh!277
This commit is contained in:
Jan Möbius
2020-08-12 11:58:16 +02:00
4 changed files with 30 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
<b>Core</b> <b>Core</b>
<ul> <ul>
<li>Add filtered range that stores reference instead of copy if the filter is not an rvalue reference</li> <li>Add filtered range that stores reference instead of copy if the filter is not an rvalue reference</li>
<li>Add halfedge loop range corresponding to hl_iter()</li>
</ul> </ul>
<b>Build System</b> <b>Build System</b>

View File

@@ -1230,6 +1230,13 @@ public:
FaceHandle, FaceHandle,
&PolyConnectivity::cff_begin, &PolyConnectivity::cff_begin,
&PolyConnectivity::cff_end>> ConstFaceFaceRange; &PolyConnectivity::cff_end>> ConstFaceFaceRange;
typedef CirculatorRange<CirculatorRangeTraitT<
PolyConnectivity,
ConstHalfedgeLoopIter,
HalfedgeHandle,
HalfedgeHandle,
&PolyConnectivity::chl_begin,
&PolyConnectivity::chl_end>> ConstHalfedgeLoopRange;
/** /**
* @return The vertices adjacent to the specified vertex * @return The vertices adjacent to the specified vertex
@@ -1285,6 +1292,12 @@ public:
*/ */
ConstFaceFaceRange ff_range(FaceHandle _fh) const; ConstFaceFaceRange ff_range(FaceHandle _fh) const;
/**
* @return The halfedges in the face
* as a range object suitable for C++11 range based for loops.
*/
ConstHalfedgeLoopRange hl_range(HalfedgeHandle _heh) const;
//@} //@}
//=========================================================================== //===========================================================================

View File

@@ -164,6 +164,11 @@ inline PolyConnectivity::ConstFaceFaceRange PolyConnectivity::ff_range(FaceHandl
return ConstFaceFaceRange(*this, _fh); return ConstFaceFaceRange(*this, _fh);
} }
inline PolyConnectivity::ConstHalfedgeLoopRange PolyConnectivity::hl_range(HalfedgeHandle _heh) const {
return ConstHalfedgeLoopRange(*this, _heh);
}
inline PolyConnectivity::VertexIter PolyConnectivity::vertices_begin() inline PolyConnectivity::VertexIter PolyConnectivity::vertices_begin()
@@ -804,6 +809,14 @@ SmartVertexHandle::outgoing_halfedges() const
return mesh()->voh_range(*this); return mesh()->voh_range(*this);
} }
inline PolyConnectivity::ConstHalfedgeLoopRange
SmartHalfedgeHandle::loop() const
{
assert(mesh() != nullptr);
return mesh()->hl_range(*this);
}
inline PolyConnectivity::ConstFaceVertexRange SmartFaceHandle::vertices() const inline PolyConnectivity::ConstFaceVertexRange SmartFaceHandle::vertices() const
{ {
assert(mesh() != nullptr); assert(mesh() != nullptr);

View File

@@ -123,6 +123,9 @@ struct OPENMESHDLLEXPORT SmartHalfedgeHandle : public SmartBaseHandle, HalfedgeH
/// Returns incident face of halfedge /// Returns incident face of halfedge
SmartFaceHandle face() const; SmartFaceHandle face() const;
/// Returns a range of halfedges in the face of the halfedge (or along the boundary) (PolyConnectivity::hl_range())
PolyConnectivity::ConstHalfedgeLoopRange loop() const;
/// Returns true iff the halfedge is on the boundary (i.e. it has no corresponding face) /// Returns true iff the halfedge is on the boundary (i.e. it has no corresponding face)
bool is_boundary() const; bool is_boundary() const;
}; };