File indexing completed on 2026-10-29 09:18:39
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 : myMovability(BRepMesh_Deleted)
0029 {
0030 }
0031
0032
0033 BRepMesh_Edge(const int theFirstNode,
0034 const int theLastNode,
0035 const BRepMesh_DegreeOfFreedom theMovability)
0036 : BRepMesh_OrientedEdge(theFirstNode, theLastNode),
0037 myMovability(theMovability)
0038 {
0039 }
0040
0041
0042 BRepMesh_DegreeOfFreedom Movability() const { return myMovability; }
0043
0044
0045
0046 void SetMovability(const BRepMesh_DegreeOfFreedom theMovability) { myMovability = theMovability; }
0047
0048
0049
0050
0051 bool IsSameOrientation(const BRepMesh_Edge& theOther) const
0052 {
0053 return BRepMesh_OrientedEdge::IsEqual(theOther);
0054 }
0055
0056
0057
0058
0059 bool IsEqual(const BRepMesh_Edge& theOther) const
0060 {
0061 if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
0062 return false;
0063
0064 return IsSameOrientation(theOther)
0065 || (FirstNode() == theOther.LastNode() && LastNode() == theOther.FirstNode());
0066 }
0067
0068
0069 bool operator==(const BRepMesh_Edge& Other) const { return IsEqual(Other); }
0070
0071 private:
0072 BRepMesh_DegreeOfFreedom myMovability;
0073 };
0074
0075 namespace std
0076 {
0077 template <>
0078 struct hash<BRepMesh_Edge>
0079 {
0080 size_t operator()(const BRepMesh_Edge& theEdge) const noexcept
0081 {
0082 union Combination {
0083 unsigned short Arr[2];
0084 uint32_t Hash;
0085
0086 } aCombination;
0087
0088 aCombination.Arr[0] = static_cast<unsigned short>(theEdge.FirstNode());
0089 aCombination.Arr[1] = static_cast<unsigned short>(theEdge.LastNode());
0090 if (aCombination.Arr[0] > aCombination.Arr[1])
0091 {
0092 std::swap(aCombination.Arr[0], aCombination.Arr[1]);
0093 }
0094 return static_cast<size_t>(aCombination.Hash);
0095 }
0096 };
0097 }
0098
0099 #endif