File indexing completed on 2025-01-18 10:03:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _BRepExtrema_ProximityValueTool_HeaderFile
0017 #define _BRepExtrema_ProximityValueTool_HeaderFile
0018
0019 #include <BRepExtrema_ProximityDistTool.hxx>
0020 #include <BRepExtrema_TriangleSet.hxx>
0021 #include <NCollection_CellFilter.hxx>
0022 #include <Precision.hxx>
0023
0024 typedef NCollection_Vector<gp_XYZ> VectorOfPoint;
0025
0026
0027
0028
0029
0030
0031 class BRepExtrema_VertexInspector : public NCollection_CellFilter_InspectorXYZ
0032 {
0033 public:
0034 typedef Standard_Integer Target;
0035
0036
0037 BRepExtrema_VertexInspector()
0038 : myTol (Precision::SquareConfusion()),
0039 myIsNeedAdd (Standard_True)
0040 {}
0041
0042
0043 void Add (const gp_XYZ& thePnt)
0044 {
0045 myPoints.Append (thePnt);
0046 }
0047
0048
0049 void SetTol (const Standard_Real theTol)
0050 {
0051 myTol = theTol;
0052 }
0053
0054
0055 void SetCurrent (const gp_XYZ& theCurPnt)
0056 {
0057 myCurrent = theCurPnt;
0058 myIsNeedAdd = Standard_True;
0059 }
0060
0061 Standard_Boolean IsNeedAdd()
0062 {
0063 return myIsNeedAdd;
0064 }
0065
0066
0067 Standard_EXPORT NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
0068
0069 private:
0070 Standard_Real myTol;
0071 Standard_Boolean myIsNeedAdd;
0072 VectorOfPoint myPoints;
0073 gp_XYZ myCurrent;
0074 };
0075
0076 typedef NCollection_CellFilter<BRepExtrema_VertexInspector> BRepExtrema_CellFilter;
0077 typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088 class BRepExtrema_ProximityValueTool
0089 {
0090
0091 public:
0092
0093
0094 Standard_EXPORT BRepExtrema_ProximityValueTool();
0095
0096
0097 Standard_EXPORT BRepExtrema_ProximityValueTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
0098 const Handle(BRepExtrema_TriangleSet)& theSet2,
0099 const BRepExtrema_ShapeList& theShapeList1,
0100 const BRepExtrema_ShapeList& theShapeList2);
0101
0102 public:
0103
0104
0105 Standard_EXPORT void LoadTriangleSets (const Handle (BRepExtrema_TriangleSet)& theSet1,
0106 const Handle (BRepExtrema_TriangleSet)& theSet2);
0107
0108
0109 Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
0110 const BRepExtrema_ShapeList& theShapeList2);
0111
0112
0113
0114 Standard_EXPORT void SetNbSamplePoints (const Standard_Integer theSamples1 = 0,
0115 const Standard_Integer theSamples2 = 0);
0116
0117
0118 Standard_EXPORT void Perform (Standard_Real& theTolerance);
0119
0120
0121 Standard_Boolean IsDone() const { return myIsDone; }
0122
0123
0124 void MarkDirty() { myIsDone = Standard_False; }
0125
0126
0127 Standard_Real Distance() const { return myDistance; }
0128
0129
0130 void ProximityPoints(gp_Pnt& thePoint1, gp_Pnt& thePoint2) const
0131 {
0132 thePoint1 = myPnt1;
0133 thePoint2 = myPnt2;
0134 }
0135
0136
0137 void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
0138 {
0139 thePointStatus1 = myPntStatus1;
0140 thePointStatus2 = myPntStatus2;
0141 }
0142
0143 private:
0144
0145
0146 Standard_Boolean getInfoForRefinement (const TopoDS_Shape& theShapes,
0147 TopAbs_ShapeEnum& theShapeType,
0148 Standard_Integer& theNbNodes,
0149 Standard_Real& theStep);
0150
0151
0152 Standard_Real computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
0153 const Standard_Integer theNbSamples1,
0154 const BVH_Array3d& theAddVertices1,
0155 const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
0156 const Handle(BRepExtrema_TriangleSet)& theSet2,
0157 const BRepExtrema_ShapeList& theShapeList1,
0158 const BRepExtrema_ShapeList& theShapeList2,
0159 BVH_Vec3d& thePoint1,
0160 BVH_Vec3d& thePoint2,
0161 ProxPnt_Status& thePointStatus1,
0162 ProxPnt_Status& thePointStatus2) const;
0163
0164
0165 Standard_Boolean getShapesAdditionalVertices();
0166
0167
0168 Standard_Boolean getEdgeAdditionalVertices (const TopoDS_Edge& theEdge,
0169 const Standard_Real theStep,
0170 BVH_Array3d& theAddVertices,
0171 NCollection_Vector<ProxPnt_Status>& theAddStatuses);
0172
0173
0174 Standard_Boolean getFaceAdditionalVertices (const TopoDS_Face& theFace,
0175 const Standard_Real theStep,
0176 BVH_Array3d& theAddVertices,
0177 NCollection_Vector<ProxPnt_Status>& theAddStatuses);
0178
0179
0180
0181 void doRecurTrgSplit (const gp_Pnt (&theTrg)[3],
0182 const ProxPnt_Status (&theEdgesStatus)[3],
0183 const Standard_Real theTol,
0184 const Standard_Real theStep,
0185 BVH_Array3d& theAddVertices,
0186 NCollection_Vector<ProxPnt_Status>& theAddStatuses);
0187 private:
0188
0189
0190 Handle(BRepExtrema_TriangleSet) mySet1;
0191
0192 Handle(BRepExtrema_TriangleSet) mySet2;
0193
0194
0195 BRepExtrema_ShapeList myShapeList1;
0196
0197 BRepExtrema_ShapeList myShapeList2;
0198
0199
0200 TopoDS_Shape myShape1;
0201
0202 TopoDS_Shape myShape2;
0203
0204 BVH_Array3d myAddVertices1;
0205 BVH_Array3d myAddVertices2;
0206
0207 NCollection_Vector<ProxPnt_Status> myAddStatus1;
0208 NCollection_Vector<ProxPnt_Status> myAddStatus2;
0209
0210 Standard_Boolean myIsInitS1;
0211 Standard_Boolean myIsInitS2;
0212
0213 Standard_Boolean myIsRefinementRequired1;
0214 Standard_Boolean myIsRefinementRequired2;
0215
0216 Standard_Integer myNbNodes1;
0217 Standard_Integer myNbNodes2;
0218
0219 Standard_Real myStep1;
0220 Standard_Real myStep2;
0221
0222 BRepExtrema_CellFilter myCells;
0223 BRepExtrema_VertexInspector myInspector;
0224
0225 TopAbs_ShapeEnum myShapeType1;
0226 TopAbs_ShapeEnum myShapeType2;
0227
0228 Standard_Real myDistance;
0229 Standard_Boolean myIsDone;
0230
0231 Standard_Integer myNbSamples1;
0232 Standard_Integer myNbSamples2;
0233
0234
0235 gp_Pnt myPnt1, myPnt2;
0236
0237
0238 ProxPnt_Status myPntStatus1, myPntStatus2;
0239
0240 };
0241
0242 #endif