improve name of helper class containing status access functions and implement is_boundary in the same way

This commit is contained in:
Max Lyon
2020-10-15 13:49:07 +02:00
parent f6781e2506
commit d0aef334c0

View File

@@ -77,7 +77,7 @@ private:
/// Base class for all smart handle types that contains status related methods
template <typename HandleType>
class SmartBaseHandleStatus
class SmartHandleStatusPredicates
{
public:
/// Returns true iff the handle is marked as feature
@@ -96,8 +96,17 @@ public:
bool deleted() const;
};
/// Base class for all smart handle types that contains status related methods
template <typename HandleType>
class SmartHandleBoundaryPredicate
{
public:
/// Returns true iff the handle is boundary
bool is_boundary() const;
};
/// Smart version of VertexHandle contains a pointer to the corresponding mesh and allows easier access to navigation methods
struct OPENMESHDLLEXPORT SmartVertexHandle : public SmartBaseHandle, VertexHandle, SmartBaseHandleStatus<SmartVertexHandle>
struct OPENMESHDLLEXPORT SmartVertexHandle : public SmartBaseHandle, VertexHandle, SmartHandleStatusPredicates<SmartVertexHandle>, SmartHandleBoundaryPredicate<SmartVertexHandle>
{
explicit SmartVertexHandle(int _idx=-1, const PolyConnectivity* _mesh = nullptr) : SmartBaseHandle(_mesh), VertexHandle(_idx) {}
@@ -121,13 +130,11 @@ struct OPENMESHDLLEXPORT SmartVertexHandle : public SmartBaseHandle, VertexHandl
/// Returns valence of the vertex
uint valence() const;
/// Returns true iff the vertex is incident to a boundary halfedge
bool is_boundary() const;
/// Returns true iff (the mesh at) the vertex is two-manifold ?
bool is_manifold() const;
};
struct OPENMESHDLLEXPORT SmartHalfedgeHandle : public SmartBaseHandle, HalfedgeHandle, SmartBaseHandleStatus<SmartHalfedgeHandle>
struct OPENMESHDLLEXPORT SmartHalfedgeHandle : public SmartBaseHandle, HalfedgeHandle, SmartHandleStatusPredicates<SmartHalfedgeHandle>, SmartHandleBoundaryPredicate<SmartHalfedgeHandle>
{
explicit SmartHalfedgeHandle(int _idx=-1, const PolyConnectivity* _mesh = nullptr) : SmartBaseHandle(_mesh), HalfedgeHandle(_idx) {}
@@ -148,12 +155,9 @@ struct OPENMESHDLLEXPORT SmartHalfedgeHandle : public SmartBaseHandle, HalfedgeH
/// 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;
};
struct OPENMESHDLLEXPORT SmartEdgeHandle : public SmartBaseHandle, EdgeHandle, SmartBaseHandleStatus<SmartEdgeHandle>
struct OPENMESHDLLEXPORT SmartEdgeHandle : public SmartBaseHandle, EdgeHandle, SmartHandleStatusPredicates<SmartEdgeHandle>, SmartHandleBoundaryPredicate<SmartEdgeHandle>
{
explicit SmartEdgeHandle(int _idx=-1, const PolyConnectivity* _mesh = nullptr) : SmartBaseHandle(_mesh), EdgeHandle(_idx) {}
@@ -173,12 +177,9 @@ struct OPENMESHDLLEXPORT SmartEdgeHandle : public SmartBaseHandle, EdgeHandle, S
SmartVertexHandle v0() const;
/// Shorthand for vertex(1)
SmartVertexHandle v1() const;
/// Returns true iff the edge lies on the boundary (i.e. one of the halfedges is boundary)
bool is_boundary() const;
};
struct OPENMESHDLLEXPORT SmartFaceHandle : public SmartBaseHandle, FaceHandle, SmartBaseHandleStatus<SmartFaceHandle>
struct OPENMESHDLLEXPORT SmartFaceHandle : public SmartBaseHandle, FaceHandle, SmartHandleStatusPredicates<SmartFaceHandle>, SmartHandleBoundaryPredicate<SmartFaceHandle>
{
explicit SmartFaceHandle(int _idx=-1, const PolyConnectivity* _mesh = nullptr) : SmartBaseHandle(_mesh), FaceHandle(_idx) {}
@@ -196,8 +197,6 @@ struct OPENMESHDLLEXPORT SmartFaceHandle : public SmartBaseHandle, FaceHandle, S
/// Returns the valence of the face
uint valence() const;
/// Returns true iff the face lies at the boundary (i.e. one of the edges is boundary)
bool is_boundary() const;
};
@@ -231,7 +230,7 @@ template <> struct SmartHandle<FaceHandle> { using type = SmartFaceHandle;
template <typename HandleType>
inline bool SmartBaseHandleStatus<HandleType>::feature() const
inline bool SmartHandleStatusPredicates<HandleType>::feature() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
@@ -239,7 +238,7 @@ inline bool SmartBaseHandleStatus<HandleType>::feature() const
}
template <typename HandleType>
inline bool SmartBaseHandleStatus<HandleType>::selected() const
inline bool SmartHandleStatusPredicates<HandleType>::selected() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
@@ -247,7 +246,7 @@ inline bool SmartBaseHandleStatus<HandleType>::selected() const
}
template <typename HandleType>
inline bool SmartBaseHandleStatus<HandleType>::tagged() const
inline bool SmartHandleStatusPredicates<HandleType>::tagged() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
@@ -255,7 +254,7 @@ inline bool SmartBaseHandleStatus<HandleType>::tagged() const
}
template <typename HandleType>
inline bool SmartBaseHandleStatus<HandleType>::tagged2() const
inline bool SmartHandleStatusPredicates<HandleType>::tagged2() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
@@ -263,7 +262,7 @@ inline bool SmartBaseHandleStatus<HandleType>::tagged2() const
}
template <typename HandleType>
inline bool SmartBaseHandleStatus<HandleType>::locked() const
inline bool SmartHandleStatusPredicates<HandleType>::locked() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
@@ -271,7 +270,7 @@ inline bool SmartBaseHandleStatus<HandleType>::locked() const
}
template <typename HandleType>
inline bool SmartBaseHandleStatus<HandleType>::hidden() const
inline bool SmartHandleStatusPredicates<HandleType>::hidden() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
@@ -279,13 +278,21 @@ inline bool SmartBaseHandleStatus<HandleType>::hidden() const
}
template <typename HandleType>
inline bool SmartBaseHandleStatus<HandleType>::deleted() const
inline bool SmartHandleStatusPredicates<HandleType>::deleted() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
return handle.mesh()->status(handle).deleted();
}
template <typename HandleType>
inline bool SmartHandleBoundaryPredicate<HandleType>::is_boundary() const
{
const auto& handle = static_cast<const HandleType&>(*this);
assert(handle.mesh() != nullptr);
return handle.mesh()->is_boundary(handle);
}
inline SmartHalfedgeHandle SmartVertexHandle::out() const
{
assert(mesh() != nullptr);
@@ -308,12 +315,6 @@ inline uint SmartVertexHandle::valence() const
return mesh()->valence(*this);
}
inline bool SmartVertexHandle::is_boundary() const
{
assert(mesh() != nullptr);
return mesh()->is_boundary(*this);
}
inline bool SmartVertexHandle::is_manifold() const
{
assert(mesh() != nullptr);
@@ -362,12 +363,6 @@ inline SmartFaceHandle SmartHalfedgeHandle::face() const
return make_smart(mesh()->face_handle(*this), mesh());
}
inline bool SmartHalfedgeHandle::is_boundary() const
{
assert(mesh() != nullptr);
return mesh()->is_boundary(*this);
}
inline SmartHalfedgeHandle SmartEdgeHandle::halfedge(unsigned int _i) const
{
assert(mesh() != nullptr);
@@ -409,12 +404,6 @@ inline SmartVertexHandle SmartEdgeHandle::v1() const
return v(1);
}
inline bool SmartEdgeHandle::is_boundary() const
{
assert(mesh() != nullptr);
return mesh()->is_boundary(*this);
}
inline SmartHalfedgeHandle SmartFaceHandle::halfedge() const
{
assert(mesh() != nullptr);
@@ -427,11 +416,6 @@ inline uint SmartFaceHandle::valence() const
return mesh()->valence(*this);
}
inline bool SmartFaceHandle::is_boundary() const
{
assert(mesh() != nullptr);
return mesh()->is_boundary(*this);
}
//=============================================================================
} // namespace OpenMesh
//=============================================================================