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