File indexing completed on 2025-01-18 10:03:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _BRepMesh_Vertex_HeaderFile
0016 #define _BRepMesh_Vertex_HeaderFile
0017
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <gp_XY.hxx>
0021 #include <BRepMesh_DegreeOfFreedom.hxx>
0022 #include <Precision.hxx>
0023
0024
0025
0026
0027 class BRepMesh_Vertex
0028 {
0029 public:
0030
0031 DEFINE_STANDARD_ALLOC
0032
0033
0034 BRepMesh_Vertex()
0035 : myLocation3d(0),
0036 myMovability(BRepMesh_Free)
0037 {
0038 }
0039
0040
0041
0042
0043
0044 BRepMesh_Vertex(const gp_XY& theUV,
0045 const Standard_Integer theLocation3d,
0046 const BRepMesh_DegreeOfFreedom theMovability)
0047 {
0048 Initialize(theUV, theLocation3d, theMovability);
0049 }
0050
0051
0052
0053
0054
0055 BRepMesh_Vertex(const Standard_Real theU,
0056 const Standard_Real theV,
0057 const BRepMesh_DegreeOfFreedom theMovability)
0058 : myUV(theU, theV),
0059 myLocation3d(0),
0060 myMovability(theMovability)
0061 {}
0062
0063
0064
0065
0066
0067 void Initialize(const gp_XY& theUV,
0068 const Standard_Integer theLocation3d,
0069 const BRepMesh_DegreeOfFreedom theMovability)
0070 {
0071 myUV = theUV;
0072 myLocation3d = theLocation3d;
0073 myMovability = theMovability;
0074 }
0075
0076
0077 const gp_XY& Coord() const
0078 {
0079 return myUV;
0080 }
0081
0082
0083 gp_XY& ChangeCoord()
0084 {
0085 return myUV;
0086 }
0087
0088
0089 Standard_Integer Location3d() const
0090 {
0091 return myLocation3d;
0092 }
0093
0094
0095 BRepMesh_DegreeOfFreedom Movability() const
0096 {
0097 return myMovability;
0098 }
0099
0100
0101 void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
0102 {
0103 myMovability = theMovability;
0104 }
0105
0106
0107
0108
0109 Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
0110 {
0111 if (myMovability == BRepMesh_Deleted ||
0112 theOther.myMovability == BRepMesh_Deleted)
0113 {
0114 return Standard_False;
0115 }
0116
0117 return (myUV.IsEqual(theOther.myUV, Precision::PConfusion()));
0118 }
0119
0120
0121 Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
0122 {
0123 return IsEqual(Other);
0124 }
0125
0126 private:
0127
0128 gp_XY myUV;
0129 Standard_Integer myLocation3d;
0130 BRepMesh_DegreeOfFreedom myMovability;
0131 };
0132
0133 namespace std
0134 {
0135 template <>
0136 struct hash<BRepMesh_Vertex>
0137 {
0138 size_t operator()(const BRepMesh_Vertex& theVertex) const noexcept
0139 {
0140 return std::hash<double>{}((Floor(1e5 * theVertex.Coord().X()) * Floor(1e5 * theVertex.Coord().Y())));
0141 }
0142 };
0143 }
0144
0145 #endif