1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: NMTTools_PaveFiller_6.cxx
23 // Created: Fri Dec 19 10:27:31 2003
24 // Author: Peter KURNEV
26 #include <NMTTools_PaveFiller.ixx>
28 #include <Precision.hxx>
30 #include <TColStd_IndexedMapOfInteger.hxx>
31 #include <TColStd_MapOfInteger.hxx>
32 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
33 #include <TColStd_DataMapOfIntegerListOfInteger.hxx>
34 #include <TColStd_ListOfInteger.hxx>
35 #include <TColStd_ListIteratorOfListOfInteger.hxx>
36 #include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
39 #include <Geom_TrimmedCurve.hxx>
40 #include <Geom2d_TrimmedCurve.hxx>
41 #include <Geom2d_Curve.hxx>
42 #include <GeomAdaptor_Curve.hxx>
43 #include <GeomAdaptor_Surface.hxx>
44 #include <Geom_Surface.hxx>
46 #include <BndLib_Add3dCurve.hxx>
48 #include <TopoDS_Face.hxx>
50 #include <TopoDS_Compound.hxx>
51 #include <TopoDS_Vertex.hxx>
52 #include <TopoDS_Edge.hxx>
56 #include <BRepLib.hxx>
57 #include <BRep_Builder.hxx>
58 #include <BRep_Tool.hxx>
59 #include <BRepBndLib.hxx>
61 #include <TopTools_IndexedMapOfShape.hxx>
62 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
63 #include <TopTools_ListOfShape.hxx>
64 #include <TopTools_ListIteratorOfListOfShape.hxx>
66 #include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
67 #include <BOPTColStd_IndexedDataMapOfIntegerInteger.hxx>
69 #include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
70 #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
71 #include <BooleanOperations_OnceExplorer.hxx>
72 #include <BooleanOperations_ShapesDataStructure.hxx>
74 #include <IntTools_SequenceOfPntOn2Faces.hxx>
75 #include <IntTools_SequenceOfCurves.hxx>
76 #include <IntTools_FaceFace.hxx>
77 #include <IntTools_Tools.hxx>
78 #include <IntTools_ShrunkRange.hxx>
79 #include <IntTools_Context.hxx>
81 #include <BOPTools_CArray1OfSSInterference.hxx>
82 #include <BOPTools_VSInterference.hxx>
83 #include <BOPTools_ESInterference.hxx>
84 #include <BOPTools_SSInterference.hxx>
85 #include <BOPTools_ListOfPaveBlock.hxx>
86 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
87 #include <BOPTools_PaveBlock.hxx>
88 #include <BOPTools_ListIteratorOfListOfPave.hxx>
89 #include <BOPTools_Tools.hxx>
90 #include <BOPTools_PaveBlockIterator.hxx>
91 #include <BOPTools_Tools2D.hxx>
92 #include <BOPTools_Tools3D.hxx>
94 #include <NMTDS_Iterator.hxx>
95 #include <NMTDS_ShapesDataStructure.hxx>
96 #include <NMTDS_InterfPool.hxx>
98 #include <NMTTools_Tools.hxx>
99 #include <NMTTools_IndexedDataMapOfShapePaveBlock.hxx>
100 #include <NMTTools_CommonBlock.hxx>
101 #include <NMTTools_CommonBlockAPI.hxx>
102 #include <NMTTools_ListOfCommonBlock.hxx>
103 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
104 #include <NMTTools_DataMapOfIntegerListOfPaveBlock.hxx>
105 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
106 #include <NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx>
107 #include <NMTTools_MapOfPaveBlock.hxx>
108 #include <NMTTools_MapIteratorOfMapOfPaveBlock.hxx>
109 #include <NMTTools_FaceInfo.hxx>
110 #include <NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx>
113 Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
114 IntTools_Context& aCtx);
116 //=======================================================================
117 // function: PerformFF
119 //=======================================================================
120 void NMTTools_PaveFiller::PerformFF()
122 myIsDone=Standard_False;
124 Standard_Boolean bToApproxC3d, bToApproxC2dOnS1, bToApproxC2dOnS2, bIsDone;
125 Standard_Boolean bJustAdd;
126 Standard_Integer n1, n2, anIndexIn, nF1, nF2, aBlockLength, aNbFFs;
127 Standard_Integer aNbCurves, aNbPoints;
128 Standard_Real anApproxTol, aTolR3D, aTolR2D;
129 BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMapWhat, aMapWith;
130 IntTools_SequenceOfPntOn2Faces aPnts;
131 IntTools_SequenceOfCurves aCvs;
133 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
135 // F/F Interferences [BooleanOperations_SurfaceSurface]
136 myDSIt->Initialize(TopAbs_FACE, TopAbs_FACE);
138 // BlockLength correction
139 aNbFFs=myDSIt->BlockLength();
140 aBlockLength=aFFs.BlockLength();
141 if (aNbFFs > aBlockLength) {
142 aFFs.SetBlockLength(aNbFFs);
145 for (; myDSIt->More(); myDSIt->Next()) {
146 myDSIt->Current(n1, n2, bJustAdd);
158 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
159 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
162 bToApproxC3d = mySectionAttribute.Approximation();
163 bToApproxC2dOnS1 = mySectionAttribute.PCurveOnS1();
164 bToApproxC2dOnS2 = mySectionAttribute.PCurveOnS2();
168 IntTools_FaceFace aFF;
170 aFF.SetParameters (bToApproxC3d, bToApproxC2dOnS1,
171 bToApproxC2dOnS2, anApproxTol);
173 aFF.Perform(aF1, aF2);
175 bIsDone=aFF.IsDone();
178 BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts);
179 anIndexIn=aFFs.Append(anInterf);
183 aTolR3D=aFF.TolReached3d();
184 aTolR2D=aFF.TolReached2d();
185 if (aTolR3D < 1.e-7){
189 aFF.PrepareLines3D();
191 const IntTools_SequenceOfCurves& aCvsX=aFF.Lines();
192 const IntTools_SequenceOfPntOn2Faces& aPntsX=aFF.Points();
194 aNbCurves=aCvsX.Length();
195 aNbPoints=aPntsX.Length();
197 if (!aNbCurves && !aNbPoints) {
198 BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts);
199 anIndexIn=aFFs.Append(anInterf);
204 BOPTools_SSInterference anInterf (nF1, nF2, aTolR3D, aTolR2D, aCvsX, aPntsX);
205 anIndexIn=aFFs.Append(anInterf);
208 }// for (; myDSIt.More(); myDSIt.Next())
210 myIsDone=Standard_True;
213 //=======================================================================
214 // function: MakeBlocks
216 //=======================================================================
217 void NMTTools_PaveFiller::MakeBlocks()
219 myIsDone=Standard_False;
221 Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided;
222 Standard_Boolean bIsMicroEdge, bHasES;
223 Standard_Integer i, aNbFFs, nF1, nF2;
224 Standard_Integer nV1, nV2, j, aNbCurves;
225 Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion();
226 TopoDS_Face aF1, aF2;
227 NMTTools_IndexedDataMapOfShapePaveBlock aMEPB;
228 BooleanOperations_IndexedDataMapOfShapeInteger aMapEI;
229 BOPTools_ListIteratorOfListOfPaveBlock anIt;
231 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
235 // 1. Make Section Edges from intersection curves
236 // between each pair of faces
237 aNbFFs=aFFs.Extent();
244 for (i=1; i<=aNbFFs; ++i) {
245 BOPTools_ListOfPaveBlock aLPB;
246 TColStd_MapOfInteger aMVStick;
247 TopTools_ListOfShape aLSE;
248 TColStd_ListOfInteger aLNE;
249 BOPTools_PaveSet aPSF;
250 NMTTools_MapOfPaveBlock aMPBX;
251 TColStd_MapIteratorOfMapOfInteger aItMI;
252 NMTTools_MapIteratorOfMapOfPaveBlock aItMPB;
254 BOPTools_SSInterference& aFFi=aFFs(i);
257 aFFi.Indices(nF1, nF2);
258 aF1=*((TopoDS_Face*)(&myDS->Shape(nF1)));
259 aF2=*((TopoDS_Face*)(&myDS->Shape(nF2)));
261 SharedEdges(nF1, nF2, aLNE, aLSE);
262 aFFi.SetSharedEdges(aLNE);
265 const NMTTools_FaceInfo& aFI1=myFaceInfo.Find(nF1);
266 const NMTTools_FaceInfo& aFI2=myFaceInfo.Find(nF2);
268 const TColStd_MapOfInteger& aMVOn1=aFI1.VerticesOn();
269 const TColStd_MapOfInteger& aMVIn1=aFI1.VerticesIn();
270 const TColStd_MapOfInteger& aMVOn2=aFI2.VerticesOn();
271 const TColStd_MapOfInteger& aMVIn2=aFI2.VerticesIn();
273 for (j=0; j<2; ++j) {
274 const TColStd_MapOfInteger& aMV1=(!j) ? aMVOn1 :aMVIn1;
275 aItMI.Initialize(aMV1);
276 for (; aItMI.More(); aItMI.Next()) {
278 if (aMVOn2.Contains(nV1) || aMVIn2.Contains(nV1)) {
285 const NMTTools_MapOfPaveBlock& aMPBIn1=aFI1.PaveBlocksIn();
286 const NMTTools_MapOfPaveBlock& aMPBOn1=aFI1.PaveBlocksOn();
287 const NMTTools_MapOfPaveBlock& aMPBIn2=aFI2.PaveBlocksIn();
288 const NMTTools_MapOfPaveBlock& aMPBOn2=aFI2.PaveBlocksOn();
291 for (j=0; j<4; ++j) {
292 NMTTools_MapOfPaveBlock *pMPB;
295 pMPB=((NMTTools_MapOfPaveBlock*)&aMPBIn1);
298 pMPB=((NMTTools_MapOfPaveBlock*)&aMPBOn1);
301 pMPB=((NMTTools_MapOfPaveBlock*)&aMPBIn2);
304 pMPB=((NMTTools_MapOfPaveBlock*)&aMPBOn2);
307 const NMTTools_MapOfPaveBlock& aMPB=*pMPB;
308 aItMPB.Initialize(aMPB);
309 for (; aItMPB.More(); aItMPB.Next()) {
310 const BOPTools_PaveBlock& aPB=aItMPB.Key();
311 if (aMPBX.Add(aPB)) {
317 aFFi.AppendBlock(aPB);
324 BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
325 aNbCurves=aSCvs.Length();
330 aTolR3D=aFFi.TolR3D();
331 aTol2D=(aTolR3D < 1.e-3) ? 1.e-3 : aTolR3D;
333 CorrectTolR3D(aFFi, aMVStick, aTolR3D);
335 PrepareSetForFace (nF1, nF2, aLPB, aPSF);
337 // Put Paves On Curves
338 for (j=1; j<=aNbCurves; ++j) {
339 BOPTools_Curve& aBC=aSCvs(j);
340 const IntTools_Curve& aC=aBC.Curve();
342 Handle(Geom_Curve) aC3D = aC.Curve();
344 PutPaveOnCurve (aPSF, aTolR3D, aBC);
347 // Put bounding paves on curves
348 for (j=1; j<=aNbCurves; ++j) {
349 BOPTools_Curve& aBC=aSCvs(j);
350 PutBoundPaveOnCurve (aBC, aFFi);
353 // Pave Blocks on Curves
354 bHasES=Standard_False;
355 for (j=1; j<=aNbCurves; ++j) {
356 BOPTools_Curve& aBC=aSCvs(j);
357 const IntTools_Curve& aIC= aBC.Curve();
358 BOPTools_PaveSet& aPaveSet=aBC.Set();
360 BOPTools_PaveBlockIterator aPBIter(0, aPaveSet);
361 for (; aPBIter.More(); aPBIter.Next()) {
362 BOPTools_PaveBlock& aPBNew=aPBIter.Value();
363 aPBNew.SetCurve(aIC);
364 aPBNew.SetFace1(nF1);
365 aPBNew.SetFace2(nF2);
367 nV1=aPBNew.Pave1().Index();
368 nV2=aPBNew.Pave2().Index();
369 aT1=aPBNew.Pave1().Param();
370 aT2=aPBNew.Pave2().Param();
372 if((nV1==nV2) && (Abs(aT2 - aT1) < aTolPPC)) {
373 continue;// mkk ft ???
377 bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D);
378 if (bIsExistingPaveBlock) {
382 bIsCoincided=CheckCoincidence(aPBNew, aLPB);
388 bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLSE, aTolR3D);
389 if (bIsExistingPaveBlock) {
393 // Checking of validity in 2D
395 bIsValidIn2D=myContext.IsValidBlockForFaces(aT1, aT2, aIC, aF1, aF2, aTol2D);
404 const TopoDS_Vertex aV1=TopoDS::Vertex(myDS->Shape(nV1));
405 const TopoDS_Vertex aV2=TopoDS::Vertex(myDS->Shape(nV2));
410 myContext.IsVertexOnLine(aV1, aIC, aTolR3D, aT);
411 BOPTools_Tools::UpdateVertex (aIC, aT, aV1);
413 myContext.IsVertexOnLine(aV2, aIC, aTolR3D, aT);
414 BOPTools_Tools::UpdateVertex (aIC, aT, aV2);
417 BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES);
419 NMTTools_Tools::UpdateEdge (aES, aTolR3D);
420 bIsMicroEdge=IsMicroEdge(aES, myContext);
426 Handle(Geom2d_Curve) aC2D1, aC2D2;
428 aC2D1=aIC.FirstCurve2d();
429 aC2D2=aIC.SecondCurve2d();
431 NMTTools_Tools::MakePCurve(aES, aF1, aC2D1);
432 NMTTools_Tools::MakePCurve(aES, aF2, aC2D2);
435 aMEPB.Add(aES, aPBNew);
438 bHasES=Standard_True;
439 }// for (; aPBIter.More(); aPBIter.Next())
440 } // end of for (j=1; j<=aNbCurves; ++j)
443 myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
446 }// for (i=1; i<=aNbFFs; ++i)
447 //=============================================================
449 // II. Post treatment
451 // Input data: aMEPB, aMapEI
452 // Result : section edges in myDS
454 Standard_Integer aNbSE;
456 aNbSE=aMEPB.Extent();
458 // there is nothing to do here
463 TopoDS_Compound aCompound;
465 // 1. Make compound from SE
466 aBB.MakeCompound(aCompound);
467 for (i=1; i<=aNbSE; ++i) {
468 const TopoDS_Shape& aSE=aMEPB.FindKey(i);
469 aBB.Add(aCompound, aSE);
473 // 2. Intersect SE using auxiliary Filler
474 NMTTools_PaveFiller tPF;
476 tPF.SetCompositeShape(aCompound);
483 tPF.myPavePool.Resize (tPF.myNbEdges);
491 tPF.myCommonBlockPool.Resize (tPF.myNbEdges);
492 tPF.mySplitShapesPool.Resize (tPF.myNbEdges);
493 tPF.myPavePoolNew .Resize (tPF.myNbEdges);
495 tPF.PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
496 tPF.PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
500 tPF.RefinePavePool ();
502 tPF.myPavePoolNew.Destroy();
504 tPF.MakeSplitEdges();
505 tPF.UpdateCommonBlocks();
507 // 3. Treatment of the result of intersection
509 Standard_Integer aNbOld, aNbLines, aNbPB, mV1, mV2, nE, mE, iFF;
510 TopAbs_ShapeEnum aType;
511 BOPTools_ListIteratorOfListOfPaveBlock aIt;
512 BOPTColStd_IndexedDataMapOfIntegerInteger aMNewOld;
514 const NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
515 const BOPTools_SplitShapesPool& aSSP=tPF.mySplitShapesPool;
516 const NMTTools_CommonBlockPool& aCBP=tPF.myCommonBlockPool;
518 aNbLines=tDS.NumberOfInsertedShapes();
519 aNbOld=tDS.NumberOfShapesOfTheObject();
521 // 3.1 Links between indices in tDS and DS (kept in aMNewOld)
523 // 3.1.1.Old vertices [ links ]
524 for (i=1; i<=aNbOld; ++i) {
525 const TopoDS_Shape& aV=tDS.Shape(i);
526 aType=aV.ShapeType();
527 if (aType!=TopAbs_VERTEX) {
531 for (j=1; j<=aNbSE; ++j) {
532 const BOPTools_PaveBlock& aPBSE=aMEPB(j);
533 nV1=aPBSE.Pave1().Index();
534 const TopoDS_Shape aV1=myDS->Shape(nV1);//mpv
535 if (aV1.IsSame(aV)) {
536 aMNewOld.Add(i, nV1);
539 nV2=aPBSE.Pave2().Index();
540 const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv
541 if (aV2.IsSame(aV)) {
542 aMNewOld.Add(i, nV2);
548 // 3.1.2. New vertices [ links ]
549 i=tDS.NumberOfSourceShapes()+1;
550 for (; i<=aNbLines; ++i) {
551 const TopoDS_Shape& aV=tDS.Shape(i);
552 aType=aV.ShapeType();
553 if (aType!=TopAbs_VERTEX) {
557 // Insert new vertex in myDS
558 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
559 myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
560 nV1=myDS->NumberOfInsertedShapes();
562 aMNewOld.Add(i, nV1);
565 // 3.2. Treatment of section edges (SE)
566 for (i=1; i<=aNbOld; ++i) {
567 const TopoDS_Shape& aE=tDS.Shape(i);
568 aType=aE.ShapeType();
569 if (aType!=TopAbs_EDGE) {
573 // block of section edge that we already have for this SE
574 BOPTools_PaveBlock& aPBSE=aMEPB.ChangeFromKey(aE);
576 // Corresponding FF-interference
577 iFF=aMapEI.FindFromKey(aE);
578 BOPTools_SSInterference& aFFi=aFFs(iFF);
579 BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
581 BOPTools_Curve& aBC=aSCvs(1);
583 const BOPTools_ListOfPaveBlock& aLPB=aSSP(tDS.RefEdge(i));
587 // no pave blocks -> use aPBSE and whole edge aE
588 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
590 nV1=aPBSE.Pave1().Index();
591 const TopoDS_Shape aV1=myDS->Shape(nV1);//mpv
592 nV2=aPBSE.Pave2().Index();
593 const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv
595 anASSeq.SetNewSuccessor(nV1);
596 anASSeq.SetNewOrientation(aV1.Orientation());
597 anASSeq.SetNewSuccessor(nV2);
598 anASSeq.SetNewOrientation(aV2.Orientation());
600 myDS->InsertShapeAndAncestorsSuccessors(aE, anASSeq);
601 nE=myDS->NumberOfInsertedShapes();
604 aBC.AppendNewBlock(aPBSE);
612 const NMTTools_ListOfCommonBlock& aLCB=aCBP(tDS.RefEdge(i));
613 NMTTools_CommonBlockAPI aCBAPI(aLCB);
615 aIt.Initialize(aLPB);
616 for (; aIt.More(); aIt.Next()) {
617 BOPTools_PaveBlock aPB=aIt.Value();
619 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));
620 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));
622 if (aCBAPI.IsCommonBlock(aPB)) {
623 // it can be Common Block
624 Standard_Real aTolEx;
625 Handle(Geom2d_Curve) aC2D1, aC2D2;
626 TopoDS_Face aF1FWD, aF2FWD;
628 NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
629 //const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
631 aPB=aCB.PaveBlock1();
632 mE=aPB.Edge(); // index of edge in tDS
633 const TopoDS_Edge& aEx=TopoDS::Edge(tDS.Shape(mE));
634 aTolEx=BRep_Tool::Tolerance(aEx);
637 aF1FWD.Orientation(TopAbs_FORWARD);
639 aF2FWD.Orientation(TopAbs_FORWARD);
641 NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1);
642 NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2);
643 NMTTools_Tools::UpdateEdge (aEx, aTolEx);
644 } //if (aCBAPI.IsCommonBlock(aPB))
647 mE=aPB.Edge(); // index of edge in tDS
648 const TopoDS_Shape& aSp=tDS.Shape(mE);
650 const BOPTools_Pave& aPave1=aPB.Pave1();
652 mV1=aPave1.Index(); // index in tDS
653 nV1=aMNewOld.FindFromKey(mV1); // index in myDS
654 const TopoDS_Shape aV1=myDS->Shape(nV1);//mpv
656 const BOPTools_Pave& aPave2=aPB.Pave2();
659 nV2=aMNewOld.FindFromKey(mV2);
660 const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv
662 if (!aMNewOld.Contains(mE)) {
663 // add new SE to the myDS
664 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
666 anASSeq.SetNewSuccessor(nV1);
667 anASSeq.SetNewOrientation(aV1.Orientation());
669 anASSeq.SetNewSuccessor(nV2);
670 anASSeq.SetNewOrientation(aV2.Orientation());
672 myDS->InsertShapeAndAncestorsSuccessors(aSp, anASSeq);
673 nE=myDS->NumberOfInsertedShapes();
675 aMNewOld.Add(mE, nE);
678 nE=aMNewOld.FindFromKey(mE);
681 BOPTools_PaveBlock aPBx;
682 BOPTools_Pave aP1, aP2;
698 aBC.AppendNewBlock(aPBx);
699 }// for (; aIt.More(); aIt.Next())
700 }// for (i=1; i<=aNbOld; ++i)
702 myIsDone=Standard_True;
705 //=======================================================================
706 // function: MakePCurves
708 //=======================================================================
709 void NMTTools_PaveFiller::MakePCurves()
711 Standard_Integer i, aNb, nF1, nF2, nE;
712 Standard_Integer aNbCB, aNbF, nSp, nF;
713 TopAbs_ShapeEnum aType;
714 TopoDS_Face aF1FWD, aF2FWD;
715 TColStd_ListIteratorOfListOfInteger aItF;
716 BOPTools_ListIteratorOfListOfPaveBlock anIt;
717 NMTTools_ListIteratorOfListOfCommonBlock aItCB;
719 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
722 for (i=1; i<=aNb; i++) {
723 BOPTools_SSInterference& aFF=aFFs(i);
724 aFF.Indices(nF1, nF2);
726 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
727 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
730 aF1FWD.Orientation(TopAbs_FORWARD);
732 aF2FWD.Orientation(TopAbs_FORWARD);
734 // In, On parts processing
735 const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks();
737 anIt.Initialize(aLPBInOn);
738 for (; anIt.More(); anIt.Next()) {
739 const BOPTools_PaveBlock& aPB=anIt.Value();
741 const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv
743 BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
744 BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
747 // Check common blocks between edges and faces
748 // Build P-Curves if they were not built in previos block.
749 // The main case is :arguments for e.g aEdge, aFace -> no FFs,
750 // but p-curves are needed.
752 aNb=myDS->NumberOfShapesOfTheObject();
753 for (i=1; i<=aNb; ++i) {
754 const TopoDS_Shape& aS=myDS->Shape(i);
755 aType=aS.ShapeType();
757 if (aType!=TopAbs_EDGE) {
760 const TopoDS_Edge& aE=TopoDS::Edge(aS);
762 if (BRep_Tool::Degenerated(aE)) {
766 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i));
772 aItCB.Initialize(aLCB);
773 for (; aItCB.More(); aItCB.Next()) {
774 const NMTTools_CommonBlock& aCB=aItCB.Value();
775 const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1();
777 const TColStd_ListOfInteger& aLF=aCB.Faces();
784 const TopoDS_Edge aSp=TopoDS::Edge(myDS->Shape(nSp));//mpv
786 aItF.Initialize(aLF);
787 for (; aItF.More(); aItF.Next()) {
789 aF1FWD=TopoDS::Face(myDS->Shape(nF));
790 aF1FWD.Orientation(TopAbs_FORWARD);
792 BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aSp, aF1FWD);
793 } // for (; aItCB.More(); aItCB.Next()) {
794 }//if (aS.ShapeType()==TopAbs_EDGE) {
798 //=======================================================================
799 // function: IsExistingPaveBlock
801 //=======================================================================
802 Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew,
803 const BOPTools_ListOfPaveBlock& aLPBR,
804 const Standard_Real aTolR3D)
806 Standard_Boolean bFlag;
807 Standard_Integer nVNew1, nVNew2, nV1, nV2, iC;
808 BOPTools_ListIteratorOfListOfPaveBlock anIt;
810 bFlag=Standard_False;
811 nVNew1=aPBNew.Pave1().Index();
812 nVNew2=aPBNew.Pave2().Index();
814 anIt.Initialize(aLPBR);
815 for (; anIt.More(); anIt.Next()) {
816 const BOPTools_PaveBlock& aPBR=anIt.Value();
817 nV1=aPBR.Pave1().Index();
818 nV2=aPBR.Pave2().Index();
819 if (nVNew1==nV1 || nVNew1==nV2 || nVNew2==nV1 || nVNew2==nV2) {
821 iC=CheckIntermediatePoint(aPBNew, aPBR, aTolR3D);
830 //=======================================================================
831 // function: IsExistingPaveBlock
833 //=======================================================================
834 Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew,
835 const TopTools_ListOfShape& aLSE,
836 const Standard_Real aTolR3D)
838 Standard_Boolean bFlag;
839 Standard_Integer aNbSE, iC;
840 Standard_Real aTolE, aTol;
841 TopTools_ListIteratorOfListOfShape anIt;
843 bFlag=Standard_False;
850 anIt.Initialize(aLSE);
851 for (; anIt.More(); anIt.Next()) {
852 const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
853 aTolE=BRep_Tool::Tolerance(aE);
858 iC=CheckIntermediatePoint(aPBNew, aE, aTol);
866 //=======================================================================
867 // function: CheckIntermediatePoint
869 //=======================================================================
870 Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,
871 const BOPTools_PaveBlock& aPBR,
872 const Standard_Real aTolC)
874 Standard_Integer iVM, nE2;
877 const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv
878 iVM=CheckIntermediatePoint(aPB, aE2, aTolC);
883 //=======================================================================
884 // function: CheckIntermediatePoint
886 //=======================================================================
887 Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,
888 const TopoDS_Edge& aE2,
889 const Standard_Real aTolC)
891 Standard_Real aT11, aT12, aTM, aTmp;
892 Standard_Integer iVM;
898 const BOPTools_Pave& aPave11=aPB.Pave1();
899 aT11=aPave11.Param();
901 const BOPTools_Pave& aPave12=aPB.Pave2();
902 aT12=aPave12.Param();
904 aTM=IntTools_Tools::IntermediatePoint (aT11, aT12);
906 const IntTools_Curve& aIC=aPB.Curve();
909 aBB.MakeVertex (aVM, aPM, aTolC);
911 iVM=myContext.ComputeVE(aVM, aE2, aTmp);
916 //=======================================================================
917 // function: PutBoundPaveOnCurve
919 //=======================================================================
920 void NMTTools_PaveFiller::PutBoundPaveOnCurve(BOPTools_Curve& aBC,
921 BOPTools_SSInterference& aFFi)
923 Standard_Boolean bHasBounds, bVF;
924 Standard_Integer nF1, nF2;
925 Standard_Real aT1, aT2, aTolR3D;
928 const IntTools_Curve& aIC=aBC.Curve();
929 bHasBounds=aIC.HasBounds ();
935 aIC.Bounds (aT1, aT2, aP1, aP2);
938 aFFi.Indices(nF1, nF2);
939 aTolR3D=aFFi.TolR3D();
941 const TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));//mpv
942 const TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));//mpv
944 bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
946 PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi);
949 bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
951 PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi);
955 //=======================================================================
956 // function: PutBoundPaveOnCurve
958 //=======================================================================
959 void NMTTools_PaveFiller::PutBoundPaveOnCurve(const gp_Pnt& aP,
960 const Standard_Real aT,
962 BOPTools_SSInterference& aFFi)
964 Standard_Boolean bFound1, bFound2;
966 Standard_Real aTolV=aFFi.TolR3D();
968 BOPTools_Pave aPave1, aPave2, aPave;
969 BOPTools_PaveSet& aCPS=aBC.Set();
970 BOPTools_PaveSet& aFFiPS=aFFi.NewPaveSet();
971 const IntTools_Curve& aIC=aBC.Curve();
973 bFound1=FindPave(aP, aTolV, aCPS , aPave1);
974 bFound2=FindPave(aP, aTolV, aFFiPS, aPave2);
976 if (!bFound1 && !bFound2) {
977 TopoDS_Vertex aNewVertex;
978 BOPTools_Tools::MakeNewVertex(aP, aTolV, aNewVertex);
980 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
981 myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
982 nV=myDS->NumberOfInsertedShapes();
987 aFFiPS.Append(aPave);
989 // Append Techno Vertex to the Curve
990 TColStd_ListOfInteger& aTVs=aBC.TechnoVertices();
993 if (bFound1 && !bFound2) {
997 aFFiPS.Append(aPave);
999 const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv
1000 BOPTools_Tools::UpdateVertex (aIC, aT, aV);
1003 if (!bFound1 && bFound2) {
1009 const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv
1010 BOPTools_Tools::UpdateVertex (aIC, aT, aV);
1014 //=======================================================================
1015 // function: FindPave
1017 //=======================================================================
1018 Standard_Boolean NMTTools_PaveFiller::FindPave(const gp_Pnt& aP,
1019 const Standard_Real aTolPV,
1020 const BOPTools_PaveSet& aPS,
1021 BOPTools_Pave& aPave)
1023 Standard_Integer nV;
1024 Standard_Boolean bIsVertex=Standard_False;
1026 const BOPTools_ListOfPave& aLP=aPS.Set();
1027 BOPTools_ListIteratorOfListOfPave anIt(aLP);
1028 for (; anIt.More(); anIt.Next()) {
1029 const BOPTools_Pave& aPC=anIt.Value();
1031 const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv
1032 bIsVertex=IntTools_Tools::IsVertex (aP, aTolPV, aV);
1041 //=======================================================================
1042 // function: PrepareSetForFace
1044 //=======================================================================
1045 void NMTTools_PaveFiller::PrepareSetForFace(const Standard_Integer ,//nF1,
1046 const Standard_Integer ,//nF2,
1047 const BOPTools_ListOfPaveBlock& aLPBC,
1048 BOPTools_PaveSet& aPSF)
1050 Standard_Integer nV1, nV2;
1051 TColStd_MapOfInteger aMap;
1052 BOPTools_ListIteratorOfListOfPaveBlock anIt;
1054 anIt.Initialize(aLPBC);
1055 for (; anIt.More(); anIt.Next()) {
1056 const BOPTools_PaveBlock& aPB=anIt.Value();
1057 const BOPTools_Pave& aPave1=aPB.Pave1();
1059 if (!aMap.Contains(nV1)) {
1061 aPSF.Append(aPave1);
1063 const BOPTools_Pave& aPave2=aPB.Pave2();
1065 if (!aMap.Contains(nV2)) {
1067 aPSF.Append(aPave2);
1072 //=======================================================================
1073 // function: CheckCoincidence
1075 //=======================================================================
1076 Standard_Boolean NMTTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPBNew,
1077 const BOPTools_ListOfPaveBlock& aLPBFF)
1079 Standard_Boolean bRet;
1081 Standard_Integer nV11, nV12, nV21, nV22, iVV, iVE, nE2;
1082 Standard_Integer iV, iCount, iCountExt;
1083 BOPTools_ListIteratorOfListOfPaveBlock anIt;
1085 const BOPTools_Pave& aPave11=aPBNew.Pave1();
1086 nV11=aPave11.Index();
1087 const TopoDS_Vertex& aV11=TopoDS::Vertex(myDS->Shape(nV11));
1090 const BOPTools_Pave& aPave12=aPBNew.Pave2();
1091 nV12=aPave12.Index();
1092 const TopoDS_Vertex& aV12=TopoDS::Vertex(myDS->Shape(nV12));
1096 anIt.Initialize(aLPBFF);
1097 for (; anIt.More(); anIt.Next()) {
1100 const BOPTools_PaveBlock& aPBR=anIt.Value();
1102 const BOPTools_Pave& aPave21=aPBR.Pave1();
1103 nV21=aPave21.Index();
1106 const BOPTools_Pave& aPave22=aPBR.Pave2();
1107 nV22=aPave22.Index();
1109 if (nV11==nV21 || nV11==nV22 || nV12==nV21 || nV12==nV22) {
1116 const TopoDS_Vertex& aV21=TopoDS::Vertex(myDS->Shape(nV21));
1117 const TopoDS_Vertex& aV22=TopoDS::Vertex(myDS->Shape(nV22));
1118 const TopoDS_Edge& aE2=TopoDS::Edge(myDS->Shape(nE2));
1122 iVV=IntTools_Tools::ComputeVV (aV11, aV21);
1126 if (iCount>iCountExt) {
1131 iVV=IntTools_Tools::ComputeVV (aV11, aV22);
1135 if (iCount>iCountExt) {
1141 iVE=myContext.ComputeVE (aV11, aE2, aTE);
1144 if (iCount>iCountExt) {
1151 iVV=IntTools_Tools::ComputeVV (aV12, aV21);
1155 if (iCount>iCountExt) {
1160 iVV=IntTools_Tools::ComputeVV (aV12, aV22);
1164 if (iCount>iCountExt) {
1170 iVE=myContext.ComputeVE (aV12, aE2, aTE);
1173 if (iCount>iCountExt) {
1179 bRet=(Standard_Boolean)(iCount>iCountExt);
1183 //=======================================================================
1184 //function : IsMicroEdge
1186 //=======================================================================
1187 Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
1188 IntTools_Context& aCtx)
1190 Standard_Boolean bRet;
1191 Standard_Integer iErr;
1192 Standard_Real aT1, aT2, aTmp;
1193 Handle(Geom_Curve) aC3D;
1194 TopoDS_Vertex aV1, aV2;
1197 bRet=(BRep_Tool::Degenerated(aE) ||
1198 !BRep_Tool::IsGeometric(aE));
1203 aC3D=BRep_Tool::Curve(aE, aT1, aT2);
1204 TopExp::Vertices(aE, aV1, aV2);
1205 aT1=BRep_Tool::Parameter(aV1, aE);
1206 aT2=BRep_Tool::Parameter(aV2, aE);
1215 IntTools_ShrunkRange aSR (aE, aV1, aV2, aR, aCtx);
1216 iErr=aSR.ErrorStatus();
1221 //=======================================================================
1222 // function: PutPaveOnCurve
1224 //=======================================================================
1225 void NMTTools_PaveFiller::PutPaveOnCurve(const BOPTools_PaveSet& aPaveSet,
1226 const Standard_Real aTolR3D,
1227 BOPTools_Curve& aBC)
1229 Standard_Integer nV;
1230 Standard_Boolean bIsVertexOnLine;
1232 BOPTools_ListIteratorOfListOfPave anIt;
1234 GeomAdaptor_Curve aGAC;
1236 const IntTools_Curve& aC=aBC.Curve();
1237 Handle (Geom_Curve) aC3D= aC.Curve();
1239 BndLib_Add3dCurve::Add(aGAC, aTolR3D, aBBC);
1241 const BOPTools_ListOfPave& aLP=aPaveSet.Set();
1242 anIt.Initialize(aLP);
1243 for (; anIt.More(); anIt.Next()) {
1244 const BOPTools_Pave& aPave=anIt.Value();
1247 const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));
1250 BRepBndLib::Add(aV, aBBV);
1251 if (aBBC.IsOut(aBBV)){
1255 bIsVertexOnLine=myContext.IsVertexOnLine(aV, aC, aTolR3D, aT);
1258 if (bIsVertexOnLine) {
1259 BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface);
1260 BOPTools_PaveSet& aPS=aBC.Set();
1261 aPS.Append(aPaveNew);
1263 //modified by NIZNHY-PKV Thu Apr 22 10:36:45 2010f
1264 //BOPTools_Tools::UpdateVertex (aC, aT, aV);
1265 //modified by NIZNHY-PKV Thu Apr 22 10:36:48 2010t
1269 //modified by NIZNHY-PKV Tue Feb 08 12:24:35 2011f
1271 //=======================================================================
1272 //function : FillFaceInfo
1274 //=======================================================================
1275 void NMTTools_PaveFiller::FillFaceInfo()
1277 Standard_Integer i, aNbS, aNbFFs, nF, aNbVFs, aNbEFs, j, n1, n2, nX, aNbF;
1278 TopAbs_ShapeEnum aType;
1280 TColStd_ListIteratorOfListOfInteger aItF;
1281 BOPTools_ListIteratorOfListOfPaveBlock anItPB;
1282 NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo aItMFI;
1283 NMTTools_ListIteratorOfListOfCommonBlock aItCB;
1287 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
1288 BOPTools_CArray1OfVSInterference& aVFs=myIP->VSInterferences();
1289 BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
1291 aNbFFs=aFFs.Extent();
1297 for (i=1; i<=aNbFFs; ++i) {
1298 NMTTools_FaceInfo aFI;
1300 BOPTools_SSInterference& aFFi=aFFs(i);
1301 aFFi.Indices(n1, n2);
1302 myFaceInfo.Bind(n1, aFI);
1303 myFaceInfo.Bind(n2, aFI);
1307 aNbS=myDS->NumberOfShapesOfTheObject();
1308 for (i=1; i<=aNbS; ++i) {
1310 aType=aS.ShapeType();
1311 if (aType==TopAbs_EDGE) {
1312 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i));
1313 aItCB.Initialize(aLCB);
1314 for (; aItCB.More(); aItCB.Next()) {
1315 const NMTTools_CommonBlock& aCB=aItCB.Value();
1316 const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1();
1317 const TColStd_ListOfInteger& aLF=aCB.Faces();
1323 aItF.Initialize(aLF);
1324 for (; aItF.More(); aItF.Next()) {
1326 if (!myFaceInfo.IsBound(nF)) {
1330 NMTTools_FaceInfo& aFI=myFaceInfo.ChangeFind(nF);
1331 aFI.ChangePaveBlocksIn().Add(aPB1);
1333 n1=aPB1.Pave1().Index();
1334 n2=aPB1.Pave2().Index();
1335 aFI.ChangeVerticesIn().Add(n1);
1336 aFI.ChangeVerticesIn().Add(n2);
1339 }// if (aType==TopAbs_EDGE) {
1340 else if (aType==TopAbs_FACE) {
1341 if (!myFaceInfo.IsBound(i)) {
1345 BOPTools_ListOfPaveBlock aLPBOn;
1348 NMTTools_FaceInfo& aFI=myFaceInfo.ChangeFind(nF);
1350 RealSplitsFace(nF, aLPBOn);
1352 anItPB.Initialize(aLPBOn);
1353 for (; anItPB.More(); anItPB.Next()) {
1354 const BOPTools_PaveBlock &aPB=anItPB.Value();
1355 aFI.ChangePaveBlocksOn().Add(aPB);
1357 n1=aPB.Pave1().Index();
1358 n2=aPB.Pave2().Index();
1359 aFI.ChangeVerticesOn().Add(n1);
1360 aFI.ChangeVerticesOn().Add(n2);
1363 }// else if (aType==TopAbs_FACE) {
1364 }// for (i=1; i<=aNbS; ++i) {
1367 aItMFI.Initialize(myFaceInfo);
1368 for (; aItMFI.More(); aItMFI.Next()) {
1370 NMTTools_FaceInfo& aFI=*((NMTTools_FaceInfo*)&aItMFI.Value());
1376 aNbVFs=aVFs.Extent();
1377 for (j=1; j<=aNbVFs; ++j) {
1378 BOPTools_VSInterference& aVFj=aVFs(j);
1379 aVFj.Indices(n1, n2);
1381 aFI.ChangeVerticesIn().Add(n2);
1384 aFI.ChangeVerticesIn().Add(n1);
1386 }// for (j=1; j<=aNbVFs; ++j) {
1389 aNbEFs=aEFs.Extent();
1390 for (j=1; j<=aNbEFs; ++j) {
1391 BOPTools_ESInterference& aEFj=aEFs(j);
1392 aEFj.Indices(n1, n2);
1393 if (!(nF==n1 || nF==n2)) {
1403 aType=aS.ShapeType();
1404 if (aType!=TopAbs_VERTEX) {
1408 aFI.ChangeVerticesIn().Add(nX);
1409 }// for (j=1; j<=aNbEFs; ++j) {
1410 }// for (; aItMFI.More(); aItMFI.Next()) {
1414 #include <gp_Pnt.hxx>
1415 #include <gp_Dir.hxx>
1416 #include <gp_Vec.hxx>
1417 #include <GeomAPI_ProjectPointOnSurf.hxx>
1418 //=======================================================================
1419 //function : CorrectTolR3D
1420 //purpose : Attempt to correct the value of tolerance aTolR3D for
1421 // the intersection curve in order to
1422 // compel it to pass through the sticks.
1424 // 2. The are based on B-Spline surfaces;
1425 // 1. There is at least the one intersection curve;
1426 // 2. The faces have stick vertices to catch the curve;
1427 // 3. The intersection angle is rather small (0.7-7 deg)
1429 //=======================================================================
1430 void NMTTools_PaveFiller::CorrectTolR3D(const BOPTools_SSInterference& aFF,
1431 const TColStd_MapOfInteger& aMVStick,
1432 Standard_Real& aTolR3D)
1435 Standard_Boolean bHasBounds;
1436 Standard_Integer i, nF[2], nV, aNbCurves;
1437 Standard_Real aT1, aT2, aU, aV, aT, aA, aTolV, aTolVmax;
1438 Standard_Real aTolR, aTolTresh, aAmin, aAmax;
1439 TColStd_MapIteratorOfMapOfInteger aIt;
1440 gp_Pnt aP, aP1, aP2;
1443 Handle(Geom_Surface) aS[2];
1444 Handle(Geom_Curve) aC3D;
1445 GeomAdaptor_Surface aGAS;
1446 GeomAbs_SurfaceType aType;
1450 aAmin=0.012;// 0.7-7 deg
1453 if (!aMVStick.Extent()) {
1457 BOPTools_SSInterference& aFFi=*((BOPTools_SSInterference*)&aFF);
1458 BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
1459 aNbCurves=aSCvs.Length();
1464 aFFi.Indices(nF[0], nF[1]);
1465 for (i=0; i<2; ++i) {
1466 aF[i]=*((TopoDS_Face*)(&myDS->Shape(nF[i])));
1467 aS[i]=BRep_Tool::Surface(aF[i]);
1469 aType=aGAS.GetType();
1470 if (aType!=GeomAbs_BSplineSurface) {
1475 BOPTools_Curve& aBC=aSCvs(1);
1476 const IntTools_Curve& aIC=aBC.Curve();
1477 bHasBounds=aIC.HasBounds();
1482 aIC.Bounds (aT1, aT2, aP1, aP2);
1483 aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
1487 for (i=0; i<2; ++i) {
1488 GeomAPI_ProjectPointOnSurf& aPPS=myContext.ProjPS(aF[i]);
1490 aPPS.LowerDistanceParameters(aU, aV);
1491 BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]);
1494 aA=aDN[0].Angle(aDN[1]);
1500 if (aA<aAmin || aA>aAmax) {
1505 aIt.Initialize(aMVStick);
1506 for (; aIt.More(); aIt.Next()) {
1508 const TopoDS_Vertex& aV=*((TopoDS_Vertex*)(&myDS->Shape(nV)));
1509 aTolV=BRep_Tool::Tolerance(aV);
1510 if (aTolV>aTolVmax) {
1517 if (aTolR<aTolTresh) {
1521 //modified by NIZNHY-PKV Tue Feb 08 12:24:56 2011t