File indexing completed on 2026-05-02 08:22:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _BRepMesh_Edge_HeaderFile
0015 #define _BRepMesh_Edge_HeaderFile
0016
0017 #include <Standard.hxx>
0018 #include <BRepMesh_DegreeOfFreedom.hxx>
0019 #include <BRepMesh_OrientedEdge.hxx>
0020 #include <Standard_HashUtils.hxx>
0021
0022
0023 class BRepMesh_Edge : public BRepMesh_OrientedEdge
0024 {
0025 public:
0026
0027 BRepMesh_Edge()
0028 : BRepMesh_OrientedEdge(),
0029 myMovability(BRepMesh_Deleted)
0030 {
0031 }
0032
0033
0034 BRepMesh_Edge(const Standard_Integer theFirstNode,
0035 const Standard_Integer theLastNode,
0036 const BRepMesh_DegreeOfFreedom theMovability)
0037 : BRepMesh_OrientedEdge(theFirstNode, theLastNode),
0038 myMovability(theMovability)
0039 {
0040 }
0041
0042
0043 BRepMesh_DegreeOfFreedom Movability() const { return myMovability; }
0044
0045
0046
0047 void SetMovability(const BRepMesh_DegreeOfFreedom theMovability) { myMovability = theMovability; }
0048
0049
0050
0051
0052 Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
0053 {
0054 return BRepMesh_OrientedEdge::IsEqual(theOther);
0055 }
0056
0057
0058
0059
0060 Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
0061 {
0062 if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
0063 return Standard_False;
0064
0065 return IsSameOrientation(theOther)
0066 || (FirstNode() == theOther.LastNode() && LastNode() == theOther.FirstNode());
0067 }
0068
0069
0070 Standard_Boolean operator==(const BRepMesh_Edge& Other) const { return IsEqual(Other); }
0071
0072 private:
0073 BRepMesh_DegreeOfFreedom myMovability;
0074 };
0075
0076 namespace std
0077 {
0078 template <>
0079 struct hash<BRepMesh_Edge>
0080 {
0081 size_t operator()(const BRepMesh_Edge& theEdge) const noexcept
0082 {
0083 union Combination {
0084 unsigned short Arr[2];
0085 uint32_t Hash;
0086
0087 } aCombination;
0088
0089 aCombination.Arr[0] = static_cast<unsigned short>(theEdge.FirstNode());
0090 aCombination.Arr[1] = static_cast<unsigned short>(theEdge.LastNode());
0091 if (aCombination.Arr[0] > aCombination.Arr[1])
0092 {
0093 std::swap(aCombination.Arr[0], aCombination.Arr[1]);
0094 }
0095 return static_cast<size_t>(aCombination.Hash);
0096 }
0097 };
0098 }
0099
0100 #endif