File indexing completed on 2026-10-02 09:12:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _IntPolyh_Triangle_HeaderFile
0018 #define _IntPolyh_Triangle_HeaderFile
0019
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <Bnd_Box.hxx>
0022 #include <IntPolyh_ArrayOfPoints.hxx>
0023 #include <IntPolyh_ArrayOfTriangles.hxx>
0024 #include <IntPolyh_ArrayOfEdges.hxx>
0025
0026
0027
0028 class IntPolyh_Triangle
0029 {
0030 public:
0031 DEFINE_STANDARD_ALLOC
0032
0033
0034 IntPolyh_Triangle()
0035 : myHasIntersection(false),
0036 myIsIntersectionPossible(true),
0037 myIsDegenerated(false),
0038 myDeflection(0.0)
0039 {
0040 myPoints[0] = -1;
0041 myPoints[1] = -1;
0042 myPoints[2] = -1;
0043 myEdges[0] = -1;
0044 myEdges[1] = -1;
0045 myEdges[2] = -1;
0046 myEdgesOrientations[0] = 0;
0047 myEdgesOrientations[1] = 0;
0048 myEdgesOrientations[2] = 0;
0049 }
0050
0051
0052 IntPolyh_Triangle(const int thePoint1, const int thePoint2, const int thePoint3)
0053 : myHasIntersection(false),
0054 myIsIntersectionPossible(true),
0055 myIsDegenerated(false),
0056 myDeflection(0.0)
0057 {
0058 myPoints[0] = thePoint1;
0059 myPoints[1] = thePoint2;
0060 myPoints[2] = thePoint3;
0061 myEdges[0] = -1;
0062 myEdges[1] = -1;
0063 myEdges[2] = -1;
0064 myEdgesOrientations[0] = 0;
0065 myEdgesOrientations[1] = 0;
0066 myEdgesOrientations[2] = 0;
0067 }
0068
0069
0070 int FirstPoint() const { return myPoints[0]; }
0071
0072
0073 int SecondPoint() const { return myPoints[1]; }
0074
0075
0076 int ThirdPoint() const { return myPoints[2]; }
0077
0078
0079 int FirstEdge() const { return myEdges[0]; }
0080
0081
0082 int FirstEdgeOrientation() const { return myEdgesOrientations[0]; }
0083
0084
0085 int SecondEdge() const { return myEdges[1]; }
0086
0087
0088 int SecondEdgeOrientation() const { return myEdgesOrientations[1]; }
0089
0090
0091 int ThirdEdge() const { return myEdges[2]; }
0092
0093
0094 int ThirdEdgeOrientation() const { return myEdgesOrientations[2]; }
0095
0096
0097 double Deflection() const { return myDeflection; }
0098
0099
0100 bool IsIntersectionPossible() const { return myIsIntersectionPossible; }
0101
0102
0103 bool HasIntersection() const { return myHasIntersection; }
0104
0105
0106 bool IsDegenerated() const { return myIsDegenerated; }
0107
0108
0109 void SetFirstPoint(const int thePoint) { myPoints[0] = thePoint; }
0110
0111
0112 void SetSecondPoint(const int thePoint) { myPoints[1] = thePoint; }
0113
0114
0115 void SetThirdPoint(const int thePoint) { myPoints[2] = thePoint; }
0116
0117
0118 void SetFirstEdge(const int theEdge, const int theEdgeOrientation)
0119 {
0120 myEdges[0] = theEdge;
0121 myEdgesOrientations[0] = theEdgeOrientation;
0122 }
0123
0124
0125 void SetSecondEdge(const int theEdge, const int theEdgeOrientation)
0126 {
0127 myEdges[1] = theEdge;
0128 myEdgesOrientations[1] = theEdgeOrientation;
0129 }
0130
0131
0132 void SetThirdEdge(const int theEdge, const int theEdgeOrientation)
0133 {
0134 myEdges[2] = theEdge;
0135 myEdgesOrientations[2] = theEdgeOrientation;
0136 }
0137
0138
0139 void SetDeflection(const double theDeflection) { myDeflection = theDeflection; }
0140
0141
0142 void SetIntersectionPossible(const bool theIP) { myIsIntersectionPossible = theIP; }
0143
0144
0145 void SetIntersection(const bool theInt) { myHasIntersection = theInt; }
0146
0147
0148 void SetDegenerated(const bool theDegFlag) { myIsDegenerated = theDegFlag; }
0149
0150
0151 int GetEdgeNumber(const int theEdgeIndex) const
0152 {
0153 return ((theEdgeIndex >= 1 && theEdgeIndex <= 3) ? myEdges[theEdgeIndex - 1] : 0);
0154 }
0155
0156
0157 void SetEdge(const int theEdgeIndex, const int theEdgeNumber)
0158 {
0159 if (theEdgeIndex >= 1 && theEdgeIndex <= 3)
0160 {
0161 myEdges[theEdgeIndex - 1] = theEdgeNumber;
0162 }
0163 }
0164
0165
0166 int GetEdgeOrientation(const int theEdgeIndex) const
0167 {
0168 return ((theEdgeIndex >= 1 && theEdgeIndex <= 3) ? myEdgesOrientations[theEdgeIndex - 1] : 0);
0169 }
0170
0171
0172 void SetEdgeOrientation(const int theEdgeIndex, const int theEdgeOrientation)
0173 {
0174 if (theEdgeIndex >= 1 && theEdgeIndex <= 3)
0175 {
0176 myEdgesOrientations[theEdgeIndex - 1] = theEdgeOrientation;
0177 }
0178 }
0179
0180
0181 Standard_EXPORT double ComputeDeflection(const occ::handle<Adaptor3d_Surface>& theSurface,
0182 const IntPolyh_ArrayOfPoints& thePoints);
0183
0184
0185 Standard_EXPORT int GetNextTriangle(const int theTriangle,
0186 const int theEdgeNum,
0187 const IntPolyh_ArrayOfEdges& TEdges) const;
0188
0189
0190 Standard_EXPORT void MiddleRefinement(const int theTriangleNumber,
0191 const occ::handle<Adaptor3d_Surface>& theSurface,
0192 IntPolyh_ArrayOfPoints& TPoints,
0193 IntPolyh_ArrayOfTriangles& TTriangles,
0194 IntPolyh_ArrayOfEdges& TEdges);
0195
0196
0197
0198 Standard_EXPORT void MultipleMiddleRefinement(const double theRefineCriterion,
0199 const Bnd_Box& theBox,
0200 const int theTriangleNumber,
0201 const occ::handle<Adaptor3d_Surface>& theSurface,
0202 IntPolyh_ArrayOfPoints& TPoints,
0203 IntPolyh_ArrayOfTriangles& TTriangles,
0204 IntPolyh_ArrayOfEdges& TEdges);
0205
0206
0207 Standard_EXPORT void LinkEdges2Triangle(const IntPolyh_ArrayOfEdges& TEdges,
0208 const int theEdge1,
0209 const int theEdge2,
0210 const int theEdge3);
0211
0212
0213 Standard_EXPORT void SetEdgeAndOrientation(const IntPolyh_Edge& theEdge, const int theEdgeIndex);
0214
0215
0216 Standard_EXPORT const Bnd_Box& BoundingBox(const IntPolyh_ArrayOfPoints& thePoints);
0217
0218
0219 Standard_EXPORT void Dump(const int v) const;
0220
0221 private:
0222 int myPoints[3];
0223 int myEdges[3];
0224 int myEdgesOrientations[3];
0225 bool myHasIntersection : 1;
0226 bool myIsIntersectionPossible : 1;
0227 bool myIsDegenerated : 1;
0228 double myDeflection;
0229 Bnd_Box myBox;
0230 };
0231
0232 #endif