File indexing completed on 2026-09-19 09:29:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef Poly_CoherentNode_HeaderFile
0017 #define Poly_CoherentNode_HeaderFile
0018
0019 #include <gp_XYZ.hxx>
0020 #include <Poly_CoherentTriPtr.hxx>
0021 #include <Precision.hxx>
0022
0023 class NCollection_BaseAllocator;
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 class Poly_CoherentNode : public gp_XYZ
0037 {
0038 public:
0039
0040
0041
0042
0043
0044 inline Poly_CoherentNode()
0045 : gp_XYZ(0., 0., 0.),
0046 myTriangles(nullptr),
0047 myIndex(-1)
0048 {
0049 myUV[0] = Precision::Infinite();
0050 myUV[1] = Precision::Infinite();
0051 }
0052
0053
0054
0055
0056 inline Poly_CoherentNode(const gp_XYZ& thePnt)
0057 : gp_XYZ(thePnt),
0058 myTriangles(nullptr),
0059 myIndex(-1)
0060 {
0061 myUV[0] = Precision::Infinite();
0062 myUV[1] = Precision::Infinite();
0063 myNormal[0] = 0.f;
0064 myNormal[1] = 0.f;
0065 myNormal[2] = 0.f;
0066 }
0067
0068
0069
0070
0071 inline void SetUV(const double theU, const double theV)
0072 {
0073 myUV[0] = theU;
0074 myUV[1] = theV;
0075 }
0076
0077
0078
0079
0080 inline double GetU() const { return myUV[0]; }
0081
0082
0083
0084
0085 inline double GetV() const { return myUV[1]; }
0086
0087
0088
0089
0090 Standard_EXPORT void SetNormal(const gp_XYZ& theVector);
0091
0092
0093
0094
0095 inline bool HasNormal() const
0096 {
0097 return ((myNormal[0] * myNormal[0] + myNormal[1] * myNormal[1] + myNormal[2] * myNormal[2])
0098 > Precision::Confusion());
0099 }
0100
0101
0102
0103
0104 inline gp_XYZ GetNormal() const { return gp_XYZ(myNormal[0], myNormal[1], myNormal[2]); }
0105
0106
0107
0108
0109 inline void SetIndex(const int theIndex) { myIndex = theIndex; }
0110
0111
0112
0113
0114 inline int GetIndex() const { return myIndex; }
0115
0116
0117
0118
0119
0120 inline bool IsFreeNode() const noexcept { return myTriangles == nullptr; }
0121
0122
0123
0124
0125 Standard_EXPORT void Clear(const occ::handle<NCollection_BaseAllocator>&);
0126
0127
0128
0129
0130 Standard_EXPORT void AddTriangle(const Poly_CoherentTriangle& theTri,
0131 const occ::handle<NCollection_BaseAllocator>& theA);
0132
0133
0134
0135
0136 Standard_EXPORT bool RemoveTriangle(const Poly_CoherentTriangle& theTri,
0137 const occ::handle<NCollection_BaseAllocator>& theA);
0138
0139
0140
0141
0142 inline Poly_CoherentTriPtr::Iterator TriangleIterator() const { return *myTriangles; }
0143
0144 Standard_EXPORT void Dump(Standard_OStream& theStream) const;
0145
0146
0147
0148
0149
0150
0151 private:
0152
0153
0154 double myUV[2];
0155 Poly_CoherentTriPtr* myTriangles;
0156 int myIndex;
0157 float myNormal[3];
0158 };
0159
0160 #endif