File indexing completed on 2026-10-28 09:15:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _BOPTools_AlgoTools_HeaderFile
0019 #define _BOPTools_AlgoTools_HeaderFile
0020
0021 #include <Standard.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 #include <Standard_Handle.hxx>
0024
0025 #include <Standard_Boolean.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <Standard_Real.hxx>
0028 #include <NCollection_List.hxx>
0029 #include <BOPTools_CoupleOfShape.hxx>
0030 #include <BOPTools_ConnexityBlock.hxx>
0031 #include <NCollection_BaseAllocator.hxx>
0032 #include <TopAbs_State.hxx>
0033 #include <TopAbs_ShapeEnum.hxx>
0034 #include <TopoDS_Shape.hxx>
0035 #include <TopTools_ShapeMapHasher.hxx>
0036 #include <NCollection_IndexedDataMap.hxx>
0037 #include <NCollection_IndexedMap.hxx>
0038 #include <NCollection_Map.hxx>
0039 #include <Precision.hxx>
0040 class TopoDS_Vertex;
0041 class gp_Pnt;
0042 class IntTools_Curve;
0043 class TopoDS_Edge;
0044 class TopoDS_Face;
0045 class TopoDS_Shape;
0046 class IntTools_Context;
0047 class TopoDS_Solid;
0048 class IntTools_Range;
0049 class TopoDS_Shell;
0050 class Message_Report;
0051
0052
0053
0054
0055
0056
0057
0058
0059 class BOPTools_AlgoTools
0060 {
0061 public:
0062 DEFINE_STANDARD_ALLOC
0063
0064 public:
0065
0066
0067
0068
0069
0070 static double DTolerance() { return 1.e-12; }
0071
0072 public:
0073
0074
0075
0076
0077 Standard_EXPORT static int ComputeVV(const TopoDS_Vertex& theV,
0078 const gp_Pnt& theP,
0079 const double theTolP);
0080
0081
0082
0083
0084
0085 Standard_EXPORT static int ComputeVV(const TopoDS_Vertex& theV1,
0086 const TopoDS_Vertex& theV2,
0087 const double theFuzz = Precision::Confusion());
0088
0089 public:
0090
0091
0092 Standard_EXPORT static void MakeVertex(const NCollection_List<TopoDS_Shape>& theLV,
0093 TopoDS_Vertex& theV);
0094
0095
0096 Standard_EXPORT static void MakeNewVertex(const gp_Pnt& aP1,
0097 const double aTol,
0098 TopoDS_Vertex& aNewVertex);
0099
0100
0101 Standard_EXPORT static void MakeNewVertex(const TopoDS_Vertex& aV1,
0102 const TopoDS_Vertex& aV2,
0103 TopoDS_Vertex& aNewVertex);
0104
0105
0106
0107 Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1,
0108 const double aP1,
0109 const TopoDS_Edge& aE2,
0110 const double aP2,
0111 TopoDS_Vertex& aNewVertex);
0112
0113
0114
0115 Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1,
0116 const double aP1,
0117 const TopoDS_Face& aF2,
0118 TopoDS_Vertex& aNewVertex);
0119
0120 public:
0121
0122
0123
0124 Standard_EXPORT static void UpdateVertex(const IntTools_Curve& aIC,
0125 const double aT,
0126 const TopoDS_Vertex& aV);
0127
0128
0129
0130
0131 Standard_EXPORT static void UpdateVertex(const TopoDS_Edge& aE,
0132 const double aT,
0133 const TopoDS_Vertex& aV);
0134
0135
0136
0137
0138 Standard_EXPORT static void UpdateVertex(const TopoDS_Vertex& aVF, const TopoDS_Vertex& aVN);
0139
0140 public:
0141
0142 Standard_EXPORT static void MakeEdge(const IntTools_Curve& theCurve,
0143 const TopoDS_Vertex& theV1,
0144 const double theT1,
0145 const TopoDS_Vertex& theV2,
0146 const double theT2,
0147 const double theTolR3D,
0148 TopoDS_Edge& theE);
0149
0150
0151 Standard_EXPORT static TopoDS_Edge CopyEdge(const TopoDS_Edge& theEdge);
0152
0153
0154
0155 Standard_EXPORT static void MakeSplitEdge(const TopoDS_Edge& aE1,
0156 const TopoDS_Vertex& aV1,
0157 const double aP1,
0158 const TopoDS_Vertex& aV2,
0159 const double aP2,
0160 TopoDS_Edge& aNewEdge);
0161
0162
0163
0164 Standard_EXPORT static void MakeSectEdge(const IntTools_Curve& aIC,
0165 const TopoDS_Vertex& aV1,
0166 const double aP1,
0167 const TopoDS_Vertex& aV2,
0168 const double aP2,
0169 TopoDS_Edge& aNewEdge);
0170
0171 public:
0172
0173
0174
0175
0176
0177 Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint,
0178 const TopoDS_Solid& theSolid,
0179 const double theTol,
0180 const occ::handle<IntTools_Context>& theContext);
0181
0182
0183
0184
0185
0186
0187 Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex,
0188 const TopoDS_Solid& theSolid,
0189 const double theTol,
0190 const occ::handle<IntTools_Context>& theContext);
0191
0192
0193
0194
0195
0196
0197 Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge,
0198 const TopoDS_Solid& theSolid,
0199 const double theTol,
0200 const occ::handle<IntTools_Context>& theContext);
0201
0202
0203
0204
0205
0206
0207
0208 Standard_EXPORT static TopAbs_State ComputeState(
0209 const TopoDS_Face& theFace,
0210 const TopoDS_Solid& theSolid,
0211 const double theTol,
0212 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theBounds,
0213 const occ::handle<IntTools_Context>& theContext);
0214
0215
0216
0217
0218
0219
0220 Standard_EXPORT static TopAbs_State ComputeStateByOnePoint(
0221 const TopoDS_Shape& theShape,
0222 const TopoDS_Solid& theSolid,
0223 const double theTol,
0224 const occ::handle<IntTools_Context>& theContext);
0225
0226 public:
0227
0228
0229
0230
0231 Standard_EXPORT static bool GetFaceOff(const TopoDS_Edge& theEdge,
0232 const TopoDS_Face& theFace,
0233 NCollection_List<BOPTools_CoupleOfShape>& theLCEF,
0234 TopoDS_Face& theFaceOff,
0235 const occ::handle<IntTools_Context>& theContext);
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245 Standard_EXPORT static int IsInternalFace(const TopoDS_Face& theFace,
0246 const TopoDS_Edge& theEdge,
0247 const TopoDS_Face& theFace1,
0248 const TopoDS_Face& theFace2,
0249 const occ::handle<IntTools_Context>& theContext);
0250
0251
0252
0253
0254
0255
0256
0257
0258 Standard_EXPORT static int IsInternalFace(const TopoDS_Face& theFace,
0259 const TopoDS_Edge& theEdge,
0260 NCollection_List<TopoDS_Shape>& theLF,
0261 const occ::handle<IntTools_Context>& theContext);
0262
0263
0264
0265
0266
0267
0268 Standard_EXPORT static bool IsInternalFace(
0269 const TopoDS_Face& theFace,
0270 const TopoDS_Solid& theSolid,
0271 NCollection_IndexedDataMap<TopoDS_Shape,
0272 NCollection_List<TopoDS_Shape>,
0273 TopTools_ShapeMapHasher>& theMEF,
0274 const double theTol,
0275 const occ::handle<IntTools_Context>& theContext);
0276
0277 public:
0278
0279
0280 Standard_EXPORT static void MakePCurve(
0281 const TopoDS_Edge& theE,
0282 const TopoDS_Face& theF1,
0283 const TopoDS_Face& theF2,
0284 const IntTools_Curve& theCurve,
0285 const bool thePC1,
0286 const bool thePC2,
0287 const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0288
0289 public:
0290
0291 Standard_EXPORT static bool IsHole(const TopoDS_Shape& theW, const TopoDS_Shape& theF);
0292
0293 public:
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315 Standard_EXPORT static bool IsSplitToReverse(const TopoDS_Shape& theSplit,
0316 const TopoDS_Shape& theShape,
0317 const occ::handle<IntTools_Context>& theContext,
0318 int* theError = nullptr);
0319
0320
0321
0322
0323 Standard_EXPORT static bool IsSplitToReverseWithWarn(
0324 const TopoDS_Shape& theSplit,
0325 const TopoDS_Shape& theShape,
0326 const occ::handle<IntTools_Context>& theContext,
0327 const occ::handle<Message_Report>& theReport = nullptr);
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349 Standard_EXPORT static bool IsSplitToReverse(const TopoDS_Face& theSplit,
0350 const TopoDS_Face& theShape,
0351 const occ::handle<IntTools_Context>& theContext,
0352 int* theError = nullptr);
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374 Standard_EXPORT static bool IsSplitToReverse(const TopoDS_Edge& theSplit,
0375 const TopoDS_Edge& theShape,
0376 const occ::handle<IntTools_Context>& theContext,
0377 int* theError = nullptr);
0378
0379
0380
0381
0382
0383
0384
0385 Standard_EXPORT static int Sense(const TopoDS_Face& theF1,
0386 const TopoDS_Face& theF2,
0387 const occ::handle<IntTools_Context>& theContext);
0388
0389 public:
0390
0391
0392
0393
0394 Standard_EXPORT static void MakeConnexityBlock(
0395 NCollection_List<TopoDS_Shape>& theLS,
0396 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapAvoid,
0397 NCollection_List<TopoDS_Shape>& theLSCB,
0398 const occ::handle<NCollection_BaseAllocator>& theAllocator);
0399
0400
0401
0402
0403
0404 Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS,
0405 const TopAbs_ShapeEnum theConnectionType,
0406 const TopAbs_ShapeEnum theElementType,
0407 NCollection_List<TopoDS_Shape>& theLCB);
0408
0409
0410
0411
0412
0413
0414 Standard_EXPORT static void MakeConnexityBlocks(
0415 const TopoDS_Shape& theS,
0416 const TopAbs_ShapeEnum theConnectionType,
0417 const TopAbs_ShapeEnum theElementType,
0418 NCollection_List<NCollection_List<TopoDS_Shape>>& theLCB,
0419 NCollection_IndexedDataMap<TopoDS_Shape,
0420 NCollection_List<TopoDS_Shape>,
0421 TopTools_ShapeMapHasher>& theConnectionMap);
0422
0423
0424
0425
0426 Standard_EXPORT static void MakeConnexityBlocks(
0427 const NCollection_List<TopoDS_Shape>& theLS,
0428 const TopAbs_ShapeEnum theConnectionType,
0429 const TopAbs_ShapeEnum theElementType,
0430 NCollection_List<BOPTools_ConnexityBlock>& theLCB);
0431
0432 public:
0433
0434 Standard_EXPORT static void OrientEdgesOnWire(TopoDS_Shape& theWire);
0435
0436
0437 Standard_EXPORT static void OrientFacesOnShell(TopoDS_Shape& theShell);
0438
0439 public:
0440
0441
0442
0443
0444
0445 Standard_EXPORT static void CorrectTolerances(
0446 const TopoDS_Shape& theS,
0447 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapToAvoid,
0448 const double theTolMax = 0.0001,
0449 const bool theRunParallel = false);
0450
0451
0452
0453 Standard_EXPORT static void CorrectCurveOnSurface(
0454 const TopoDS_Shape& theS,
0455 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapToAvoid,
0456 const double theTolMax = 0.0001,
0457 const bool theRunParallel = false);
0458
0459
0460
0461 Standard_EXPORT static void CorrectPointOnCurve(
0462 const TopoDS_Shape& theS,
0463 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapToAvoid,
0464 const double theTolMax = 0.0001,
0465 const bool theRunParallel = false);
0466
0467
0468 Standard_EXPORT static void CorrectShapeTolerances(
0469 const TopoDS_Shape& theS,
0470 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapToAvoid,
0471 const bool theRunParallel = false);
0472
0473 public:
0474
0475 Standard_EXPORT static bool AreFacesSameDomain(const TopoDS_Face& theF1,
0476 const TopoDS_Face& theF2,
0477 const occ::handle<IntTools_Context>& theContext,
0478 const double theFuzz = Precision::Confusion());
0479
0480 public:
0481
0482
0483
0484
0485 Standard_EXPORT static bool GetEdgeOff(const TopoDS_Edge& theEdge,
0486 const TopoDS_Face& theFace,
0487 TopoDS_Edge& theEdgeOff);
0488
0489
0490
0491
0492
0493 Standard_EXPORT static bool GetEdgeOnFace(const TopoDS_Edge& theEdge,
0494 const TopoDS_Face& theFace,
0495 TopoDS_Edge& theEdgeOnF);
0496
0497 public:
0498
0499
0500 Standard_EXPORT static void CorrectRange(const TopoDS_Edge& aE1,
0501 const TopoDS_Edge& aE2,
0502 const IntTools_Range& aSR,
0503 IntTools_Range& aNewSR);
0504
0505
0506
0507 Standard_EXPORT static void CorrectRange(const TopoDS_Edge& aE,
0508 const TopoDS_Face& aF,
0509 const IntTools_Range& aSR,
0510 IntTools_Range& aNewSR);
0511
0512 public:
0513
0514
0515
0516 Standard_EXPORT static bool IsMicroEdge(const TopoDS_Edge& theEdge,
0517 const occ::handle<IntTools_Context>& theContext,
0518 const bool theCheckSplittable = true);
0519
0520 public:
0521
0522 Standard_EXPORT static bool IsInvertedSolid(const TopoDS_Solid& theSolid);
0523
0524 public:
0525
0526 Standard_EXPORT static bool ComputeTolerance(const TopoDS_Face& theFace,
0527 const TopoDS_Edge& theEdge,
0528 double& theMaxDist,
0529 double& theMaxPar);
0530
0531 public:
0532
0533 Standard_EXPORT static void MakeContainer(const TopAbs_ShapeEnum theType, TopoDS_Shape& theShape);
0534
0535
0536 Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aEdge, const double aPrm, gp_Pnt& aP);
0537
0538
0539
0540 Standard_EXPORT static bool IsBlockInOnFace(const IntTools_Range& aShR,
0541 const TopoDS_Face& aF,
0542 const TopoDS_Edge& aE,
0543 const occ::handle<IntTools_Context>& aContext);
0544
0545
0546 Standard_EXPORT static void Dimensions(const TopoDS_Shape& theS, int& theDMin, int& theDMax);
0547
0548
0549
0550 Standard_EXPORT static int Dimension(const TopoDS_Shape& theS);
0551
0552
0553
0554
0555 Standard_EXPORT static void TreatCompound(
0556 const TopoDS_Shape& theS,
0557 NCollection_List<TopoDS_Shape>& theList,
0558 NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>* theMap = nullptr);
0559
0560
0561 Standard_EXPORT static bool IsOpenShell(const TopoDS_Shell& theShell);
0562 };
0563
0564 #endif