File indexing completed on 2025-01-18 10:04:10
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
0029 class IntPolyh_Triangle
0030 {
0031 public:
0032
0033 DEFINE_STANDARD_ALLOC
0034
0035
0036 IntPolyh_Triangle() :
0037 myHasIntersection(Standard_False),
0038 myIsIntersectionPossible(Standard_True),
0039 myIsDegenerated(Standard_False),
0040 myDeflection(0.0)
0041 {
0042 myPoints[0] = -1;
0043 myPoints[1] = -1;
0044 myPoints[2] = -1;
0045 myEdges[0] = -1;
0046 myEdges[1] = -1;
0047 myEdges[2] = -1;
0048 myEdgesOrientations[0] = 0;
0049 myEdgesOrientations[1] = 0;
0050 myEdgesOrientations[2] = 0;
0051 }
0052
0053
0054 IntPolyh_Triangle(const Standard_Integer thePoint1,
0055 const Standard_Integer thePoint2,
0056 const Standard_Integer thePoint3)
0057 :
0058 myHasIntersection(Standard_False),
0059 myIsIntersectionPossible(Standard_True),
0060 myIsDegenerated(Standard_False),
0061 myDeflection(0.0)
0062 {
0063 myPoints[0] = thePoint1;
0064 myPoints[1] = thePoint2;
0065 myPoints[2] = thePoint3;
0066 myEdges[0] = -1;
0067 myEdges[1] = -1;
0068 myEdges[2] = -1;
0069 myEdgesOrientations[0] = 0;
0070 myEdgesOrientations[1] = 0;
0071 myEdgesOrientations[2] = 0;
0072 }
0073
0074
0075 Standard_Integer FirstPoint() const
0076 {
0077 return myPoints[0];
0078 }
0079
0080 Standard_Integer SecondPoint() const
0081 {
0082 return myPoints[1];
0083 }
0084
0085 Standard_Integer ThirdPoint() const
0086 {
0087 return myPoints[2];
0088 }
0089
0090 Standard_Integer FirstEdge() const
0091 {
0092 return myEdges[0];
0093 }
0094
0095 Standard_Integer FirstEdgeOrientation() const
0096 {
0097 return myEdgesOrientations[0];
0098 }
0099
0100 Standard_Integer SecondEdge() const
0101 {
0102 return myEdges[1];
0103 }
0104
0105 Standard_Integer SecondEdgeOrientation() const
0106 {
0107 return myEdgesOrientations[1];
0108 }
0109
0110 Standard_Integer ThirdEdge() const
0111 {
0112 return myEdges[2];
0113 }
0114
0115 Standard_Integer ThirdEdgeOrientation() const
0116 {
0117 return myEdgesOrientations[2];
0118 }
0119
0120 Standard_Real Deflection() const
0121 {
0122 return myDeflection;
0123 }
0124
0125 Standard_Boolean IsIntersectionPossible() const
0126 {
0127 return myIsIntersectionPossible;
0128 }
0129
0130 Standard_Boolean HasIntersection() const
0131 {
0132 return myHasIntersection;
0133 }
0134
0135 Standard_Boolean IsDegenerated() const
0136 {
0137 return myIsDegenerated;
0138 }
0139
0140 void SetFirstPoint(const Standard_Integer thePoint)
0141 {
0142 myPoints[0] = thePoint;
0143 }
0144
0145 void SetSecondPoint(const Standard_Integer thePoint)
0146 {
0147 myPoints[1] = thePoint;
0148 }
0149
0150 void SetThirdPoint(const Standard_Integer thePoint)
0151 {
0152 myPoints[2] = thePoint;
0153 }
0154
0155 void SetFirstEdge(const Standard_Integer theEdge,
0156 const Standard_Integer theEdgeOrientation)
0157 {
0158 myEdges[0] = theEdge;
0159 myEdgesOrientations[0] = theEdgeOrientation;
0160 }
0161
0162 void SetSecondEdge(const Standard_Integer theEdge,
0163 const Standard_Integer theEdgeOrientation)
0164 {
0165 myEdges[1] = theEdge;
0166 myEdgesOrientations[1] = theEdgeOrientation;
0167 }
0168
0169 void SetThirdEdge(const Standard_Integer theEdge,
0170 const Standard_Integer theEdgeOrientation)
0171 {
0172 myEdges[2] = theEdge;
0173 myEdgesOrientations[2] = theEdgeOrientation;
0174 }
0175
0176 void SetDeflection(const Standard_Real theDeflection)
0177 {
0178 myDeflection = theDeflection;
0179 }
0180
0181 void SetIntersectionPossible(const Standard_Boolean theIP)
0182 {
0183 myIsIntersectionPossible = theIP;
0184 }
0185
0186 void SetIntersection(const Standard_Boolean theInt)
0187 {
0188 myHasIntersection = theInt;
0189 }
0190
0191 void SetDegenerated(const Standard_Boolean theDegFlag)
0192 {
0193 myIsDegenerated = theDegFlag;
0194 }
0195
0196 Standard_Integer GetEdgeNumber(const Standard_Integer theEdgeIndex) const
0197 {
0198 return ((theEdgeIndex >= 1 && theEdgeIndex <= 3) ? myEdges[theEdgeIndex - 1] : 0);
0199 }
0200
0201 void SetEdge(const Standard_Integer theEdgeIndex,
0202 const Standard_Integer theEdgeNumber)
0203 {
0204 if (theEdgeIndex >= 1 && theEdgeIndex <= 3) {
0205 myEdges[theEdgeIndex - 1] = theEdgeNumber;
0206 }
0207 }
0208
0209 Standard_Integer GetEdgeOrientation(const Standard_Integer theEdgeIndex) const
0210 {
0211 return ((theEdgeIndex >= 1 && theEdgeIndex <= 3) ?
0212 myEdgesOrientations[theEdgeIndex - 1] : 0);
0213 }
0214
0215 void SetEdgeOrientation(const Standard_Integer theEdgeIndex,
0216 const Standard_Integer theEdgeOrientation)
0217 {
0218 if (theEdgeIndex >= 1 && theEdgeIndex <= 3) {
0219 myEdgesOrientations[theEdgeIndex - 1] = theEdgeOrientation;
0220 }
0221 }
0222
0223
0224 Standard_EXPORT Standard_Real ComputeDeflection(const Handle(Adaptor3d_Surface)& theSurface,
0225 const IntPolyh_ArrayOfPoints& thePoints);
0226
0227
0228 Standard_EXPORT Standard_Integer GetNextTriangle(const Standard_Integer theTriangle,
0229 const Standard_Integer theEdgeNum,
0230 const IntPolyh_ArrayOfEdges& TEdges) const;
0231
0232
0233 Standard_EXPORT void MiddleRefinement(const Standard_Integer theTriangleNumber,
0234 const Handle(Adaptor3d_Surface)& theSurface,
0235 IntPolyh_ArrayOfPoints& TPoints,
0236 IntPolyh_ArrayOfTriangles& TTriangles,
0237 IntPolyh_ArrayOfEdges& TEdges);
0238
0239
0240
0241 Standard_EXPORT void MultipleMiddleRefinement(const Standard_Real theRefineCriterion,
0242 const Bnd_Box& theBox,
0243 const Standard_Integer theTriangleNumber,
0244 const Handle(Adaptor3d_Surface)& theSurface,
0245 IntPolyh_ArrayOfPoints& TPoints,
0246 IntPolyh_ArrayOfTriangles& TTriangles,
0247 IntPolyh_ArrayOfEdges& TEdges);
0248
0249
0250 Standard_EXPORT void LinkEdges2Triangle(const IntPolyh_ArrayOfEdges& TEdges,
0251 const Standard_Integer theEdge1,
0252 const Standard_Integer theEdge2,
0253 const Standard_Integer theEdge3);
0254
0255
0256 Standard_EXPORT void SetEdgeAndOrientation(const IntPolyh_Edge& theEdge,
0257 const Standard_Integer theEdgeIndex);
0258
0259
0260 Standard_EXPORT const Bnd_Box& BoundingBox(const IntPolyh_ArrayOfPoints& thePoints);
0261
0262
0263 Standard_EXPORT void Dump (const Standard_Integer v) const;
0264
0265 protected:
0266
0267 private:
0268
0269 Standard_Integer myPoints[3];
0270 Standard_Integer myEdges[3];
0271 Standard_Integer myEdgesOrientations[3];
0272 Standard_Boolean myHasIntersection:1;
0273 Standard_Boolean myIsIntersectionPossible:1;
0274 Standard_Boolean myIsDegenerated:1;
0275 Standard_Real myDeflection;
0276 Bnd_Box myBox;
0277
0278 };
0279
0280 #endif