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_ProximityDistTool_HeaderFile
0017 #define _BRepExtrema_ProximityDistTool_HeaderFile
0018
0019 #include <BRepExtrema_ElementFilter.hxx>
0020 #include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
0021 #include <BRepExtrema_TriangleSet.hxx>
0022 #include <BVH_Distance.hxx>
0023 #include <BVH_Tools.hxx>
0024 #include <Poly_Triangulation.hxx>
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 class BRepExtrema_ProximityDistTool : public BVH_Distance <Standard_Real, 3, BVH_Vec3d,
0037 BRepExtrema_TriangleSet>
0038 {
0039 public:
0040
0041 typedef typename BVH_Tools<Standard_Real, 3>::BVH_PrjStateInTriangle BVH_PrjState;
0042
0043 enum ProxPnt_Status
0044 {
0045 ProxPnt_Status_BORDER,
0046 ProxPnt_Status_MIDDLE,
0047 ProxPnt_Status_UNKNOWN
0048 };
0049
0050 public:
0051
0052
0053
0054 struct PrjState
0055 {
0056 PrjState()
0057 : myTrgIdx (0),
0058 myPrjState (BVH_PrjState::BVH_PrjStateInTriangle_INNER),
0059 myNumberOfFirstNode (0),
0060 myNumberOfLastNode (0)
0061 {}
0062
0063 PrjState (const Standard_Integer theTrgIdx,
0064 const BVH_PrjState thePrjState,
0065 const Standard_Integer theNumberOfFirstNode,
0066 const Standard_Integer theNumberOfLastNode)
0067 : myTrgIdx (theTrgIdx),
0068 myPrjState (thePrjState),
0069 myNumberOfFirstNode (theNumberOfFirstNode),
0070 myNumberOfLastNode (theNumberOfLastNode)
0071 {}
0072
0073 Standard_Integer GetTrgIdx() const { return myTrgIdx; }
0074
0075 BVH_PrjState GetPrjState() const { return myPrjState; }
0076
0077 Standard_Integer GetNumberOfFirstNode() const { return myNumberOfFirstNode; }
0078
0079 Standard_Integer GetNumberOfLastNode() const { return myNumberOfLastNode; }
0080
0081 private:
0082
0083 Standard_Integer myTrgIdx;
0084 BVH_PrjState myPrjState;
0085 Standard_Integer myNumberOfFirstNode;
0086 Standard_Integer myNumberOfLastNode;
0087 };
0088
0089 public:
0090
0091
0092 Standard_EXPORT BRepExtrema_ProximityDistTool();
0093
0094
0095 Standard_EXPORT BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
0096 const Standard_Integer theNbSamples1,
0097 const BVH_Array3d& theAddVertices1,
0098 const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
0099 const Handle(BRepExtrema_TriangleSet)& theSet2,
0100 const BRepExtrema_ShapeList& theShapeList1,
0101 const BRepExtrema_ShapeList& theShapeList2);
0102
0103 public:
0104
0105
0106 Standard_EXPORT void LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
0107 const Handle(BRepExtrema_TriangleSet)& theSet2);
0108
0109
0110 Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
0111 const BRepExtrema_ShapeList& theShapeList2);
0112
0113
0114 void LoadAdditionalPointsFirstSet (const BVH_Array3d& theAddVertices1,
0115 const NCollection_Vector<ProxPnt_Status>& theAddStatus1);
0116
0117
0118 Standard_EXPORT void Perform();
0119
0120 public:
0121
0122
0123 Standard_EXPORT virtual Standard_Boolean RejectNode (const BVH_Vec3d& theCornerMin,
0124 const BVH_Vec3d& theCornerMax,
0125 Standard_Real& theMetric) const Standard_OVERRIDE;
0126
0127
0128 Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theSgmIdx,
0129 const Standard_Real&) Standard_OVERRIDE;
0130
0131 public:
0132
0133
0134 Standard_EXPORT static Standard_Boolean IsNodeOnBorder (const Standard_Integer theNodeIdx,
0135 const Handle (Poly_Triangulation)& theTr);
0136
0137
0138 Standard_EXPORT static Standard_Boolean IsEdgeOnBorder (const Standard_Integer theTrgIdx,
0139 const Standard_Integer theFirstEdgeNodeIdx,
0140 const Standard_Integer theSecondEdgeNodeIdx,
0141 const Handle (Poly_Triangulation)& theTr);
0142
0143 public:
0144
0145
0146 void ProximityPoints (BVH_Vec3d& thePoint1, BVH_Vec3d& thePoint2) const
0147 {
0148 thePoint1 = myPnt1;
0149 thePoint2 = myPnt2;
0150 }
0151
0152
0153 void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
0154 {
0155 thePointStatus1 = myPntStatus1;
0156 thePointStatus2 = myPntStatus2;
0157 }
0158
0159
0160 Standard_Real ProximityDistance() const { return myProxDist; }
0161
0162 protected:
0163
0164
0165 Standard_EXPORT Standard_Real ComputeDistance();
0166
0167
0168 Standard_EXPORT void DefineStatusProxPnt();
0169
0170 private:
0171
0172
0173 void goThroughtSet1 (const BVH_Array3d& aVertices1,
0174 const Standard_Boolean theIsAdditionalSet);
0175
0176
0177 void defineStatusProxPnt1();
0178
0179
0180 void defineStatusProxPnt2();
0181
0182 protected:
0183
0184 Standard_Real myMinDistance;
0185 BVH_Vec3d myMinDistPoint;
0186
0187 BVH_Vec3d myExtremaPoint;
0188
0189 Standard_Real myProxDist;
0190
0191
0192 BVH_Vec3d myPnt1, myPnt2;
0193
0194
0195 ProxPnt_Status myPntStatus1, myPntStatus2;
0196
0197 private:
0198
0199
0200 Handle(BRepExtrema_TriangleSet) mySet1;
0201
0202 Handle(BRepExtrema_TriangleSet) mySet2;
0203
0204
0205 BRepExtrema_ShapeList myShapeList1;
0206
0207 BRepExtrema_ShapeList myShapeList2;
0208
0209 Standard_Integer myNbSamples1;
0210
0211
0212 Standard_Integer myIsProxVtx1FromAddSet;
0213 BVH_Array3d myAddVertices1;
0214 NCollection_Vector<ProxPnt_Status> myAddStatus1;
0215
0216
0217 Standard_Integer myProxVtxIdx1;
0218
0219
0220 PrjState myProxPrjState;
0221
0222
0223 PrjState myExtPrjState;
0224
0225
0226 PrjState myMinPrjState;
0227
0228 };
0229
0230 #endif