#include <Standard_Macro.hxx>
#include <BRepMesh_DegreeOfFreedom.hxx>
-//! Light weighted structure representing link of the mesh.
-class BRepMesh_Edge
+//! Light weighted structure representing simple link.
+class BRepMesh_OrientedEdge
{
public:
DEFINE_STANDARD_ALLOC
-
+
//! Default constructor.
- Standard_EXPORT BRepMesh_Edge()
- : myFirstNode (-1),
- myLastNode (-1),
- myMovability(BRepMesh_Deleted)
+ Standard_EXPORT BRepMesh_OrientedEdge()
+ : myFirstNode(-1),
+ myLastNode(-1)
{
}
- //! Contructs a link beetween two vertices.
- Standard_EXPORT BRepMesh_Edge(const Standard_Integer theFirstNode,
- const Standard_Integer theLastNode,
- const BRepMesh_DegreeOfFreedom theMovability)
- : myFirstNode (theFirstNode),
- myLastNode (theLastNode),
- myMovability(theMovability)
+ //! Constructs a link between two vertices.
+ Standard_EXPORT BRepMesh_OrientedEdge(
+ const Standard_Integer theFirstNode,
+ const Standard_Integer theLastNode)
+ : myFirstNode(theFirstNode),
+ myLastNode(theLastNode)
{
}
{
return myLastNode;
}
-
+
+ //! Returns hash code for this edge.
+ //! @param theUpper upper index in the container.
+ //! @return hash code.
+ Standard_EXPORT Standard_Integer HashCode(const Standard_Integer theUpper) const
+ {
+ return ::HashCode(myFirstNode + myLastNode, theUpper);
+ }
+
+ //! Checks this and other edge for equality.
+ //! @param theOther edge to be checked against this one.
+ //! @retrun TRUE if edges have the same orientation, FALSE if not.
+ inline Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
+ {
+ return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
+ }
+
+ //! Alias for IsEqual.
+ Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
+ {
+ return IsEqual(Other);
+ }
+
+private:
+
+ Standard_Integer myFirstNode;
+ Standard_Integer myLastNode;
+};
+
+//! Light weighted structure representing link of the mesh.
+class BRepMesh_Edge : public BRepMesh_OrientedEdge
+{
+public:
+
+ //! Default constructor.
+ Standard_EXPORT BRepMesh_Edge()
+ : BRepMesh_OrientedEdge(),
+ myMovability(BRepMesh_Deleted)
+ {
+ }
+
+ //! Constructs a link between two vertices.
+ Standard_EXPORT BRepMesh_Edge(
+ const Standard_Integer theFirstNode,
+ const Standard_Integer theLastNode,
+ const BRepMesh_DegreeOfFreedom theMovability)
+ : BRepMesh_OrientedEdge(theFirstNode, theLastNode),
+ myMovability(theMovability)
+ {
+ }
+
//! Returns movability flag of the Link.
inline BRepMesh_DegreeOfFreedom Movability() const
{
return myMovability;
}
-
+
//! Sets movability flag of the Link.
//! \param theMovability flag to be set.
inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
{
myMovability = theMovability;
}
-
- //! Returns hash code for this edge.
- //! \param theUpper upper index in the container.
- //! \return hash code.
- Standard_EXPORT Standard_Integer HashCode(const Standard_Integer theUpper) const
- {
- return ::HashCode(myFirstNode + myLastNode, theUpper);
- }
-
+
//! Checks if the given edge and this one have the same orientation.
//! \param theOther edge to be checked against this one.
//! \retrun TRUE if edges have the same orientation, FALSE if not.
inline Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
{
- return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
+ return BRepMesh_OrientedEdge::IsEqual(theOther);
}
-
+
//! Checks for equality with another edge.
//! \param theOther edge to be checked against this one.
//! \return TRUE if equal, FALSE if not.
inline Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
{
- if (myMovability == BRepMesh_Deleted ||
- theOther.myMovability == BRepMesh_Deleted)
- {
+ if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
return Standard_False;
- }
- return IsSameOrientation(theOther) ||
- (myFirstNode == theOther.myLastNode && myLastNode == theOther.myFirstNode);
+ return IsSameOrientation(theOther) ||
+ (FirstNode() == theOther.LastNode() && LastNode() == theOther.FirstNode());
}
//! Alias for IsEqual.
private:
- Standard_Integer myFirstNode;
- Standard_Integer myLastNode;
BRepMesh_DegreeOfFreedom myMovability;
};
+inline Standard_Integer HashCode(const BRepMesh_OrientedEdge& theEdge,
+ const Standard_Integer theUpper)
+{
+ return theEdge.HashCode(theUpper);
+}
+
inline Standard_Integer HashCode(const BRepMesh_Edge& theEdge,
const Standard_Integer theUpper)
{