From c800446073dc1f2ba69c0608330e06d6f94e0d78 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Tue, 11 Aug 2020 16:35:13 +0200 Subject: [PATCH 1/2] add missing range version of halfedge loop iterator --- src/OpenMesh/Core/Mesh/PolyConnectivity.hh | 13 +++++++++++++ .../Core/Mesh/PolyConnectivity_inline_impl.hh | 13 +++++++++++++ src/OpenMesh/Core/Mesh/SmartHandles.hh | 3 +++ 3 files changed, 29 insertions(+) diff --git a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh index e1a27338..dcacd197 100644 --- a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh +++ b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh @@ -1230,6 +1230,13 @@ public: FaceHandle, &PolyConnectivity::cff_begin, &PolyConnectivity::cff_end>> ConstFaceFaceRange; + typedef CirculatorRange> ConstHalfedgeLoopRange; /** * @return The vertices adjacent to the specified vertex @@ -1285,6 +1292,12 @@ public: */ 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; + //@} //=========================================================================== diff --git a/src/OpenMesh/Core/Mesh/PolyConnectivity_inline_impl.hh b/src/OpenMesh/Core/Mesh/PolyConnectivity_inline_impl.hh index 1e45ee74..c813faa2 100644 --- a/src/OpenMesh/Core/Mesh/PolyConnectivity_inline_impl.hh +++ b/src/OpenMesh/Core/Mesh/PolyConnectivity_inline_impl.hh @@ -164,6 +164,11 @@ inline PolyConnectivity::ConstFaceFaceRange PolyConnectivity::ff_range(FaceHandl return ConstFaceFaceRange(*this, _fh); } +inline PolyConnectivity::ConstHalfedgeLoopRange PolyConnectivity::hl_range(HalfedgeHandle _heh) const { + return ConstHalfedgeLoopRange(*this, _heh); +} + + inline PolyConnectivity::VertexIter PolyConnectivity::vertices_begin() @@ -804,6 +809,14 @@ SmartVertexHandle::outgoing_halfedges() const 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 { assert(mesh() != nullptr); diff --git a/src/OpenMesh/Core/Mesh/SmartHandles.hh b/src/OpenMesh/Core/Mesh/SmartHandles.hh index 094a699f..2fd0af68 100644 --- a/src/OpenMesh/Core/Mesh/SmartHandles.hh +++ b/src/OpenMesh/Core/Mesh/SmartHandles.hh @@ -123,6 +123,9 @@ struct OPENMESHDLLEXPORT SmartHalfedgeHandle : public SmartBaseHandle, HalfedgeH /// Returns incident face of halfedge 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) bool is_boundary() const; }; From 787c00f3d262fc9c8361dff9c0f63d3f6890c798 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Tue, 11 Aug 2020 16:51:47 +0200 Subject: [PATCH 2/2] update docu --- Doc/changelog.docu | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index da6b4742..4d890368 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -17,6 +17,7 @@ Core
  • Add filtered range that stores reference instead of copy if the filter is not an rvalue reference
  • +
  • Add halfedge loop range corresponding to hl_iter()
Build System