1 // Copyright (C) 2007-2021 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, or (at your option) any later version.
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 : GEOMAlgo_AlgoTools.cxx
24 // Author : Peter KURNEV
26 #include <GEOMAlgo_AlgoTools.hxx>
29 #include <gp_Pnt2d.hxx>
30 #include <gp_Dir2d.hxx>
31 #include <Bnd_Box.hxx>
33 #include <Geom2d_Curve.hxx>
34 #include <Geom2d_TrimmedCurve.hxx>
35 #include <Geom2d_Line.hxx>
36 #include <Geom2d_TrimmedCurve.hxx>
38 #include <Geom2dHatch_Intersector.hxx>
39 #include <Geom2dHatch_Hatcher.hxx>
41 #include <Geom2dAdaptor_Curve.hxx>
42 #include <HatchGen_Domain.hxx>
44 #include <Geom_Curve.hxx>
45 #include <Geom_Surface.hxx>
47 #include <GeomAdaptor_Surface.hxx>
49 #include <GeomAPI_ProjectPointOnSurf.hxx>
50 #include <GeomAPI_ProjectPointOnCurve.hxx>
52 #include <Poly_Triangulation.hxx>
54 #include <TopAbs_Orientation.hxx>
56 #include <TopLoc_Location.hxx>
59 #include <TopoDS_Iterator.hxx>
60 #include <TopoDS_Face.hxx>
61 #include <TopoDS_Edge.hxx>
63 #include <TopExp_Explorer.hxx>
65 #include <BRep_Tool.hxx>
66 #include <BRep_Builder.hxx>
68 #include <BRepTools.hxx>
69 #include <BRepBndLib.hxx>
70 #include <BRepMesh_IncrementalMesh.hxx>
72 #include <IntTools_Tools.hxx>
74 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
75 #include <TopTools_ListOfShape.hxx>
77 #include <TopTools_ListIteratorOfListOfShape.hxx>
78 #include <TopTools_IndexedMapOfShape.hxx>
79 #include <TopAbs_ShapeEnum.hxx>
81 #include <IntTools_Tools.hxx>
83 #include <BOPTools_AlgoTools3D.hxx>
84 #include <BOPTools_AlgoTools2D.hxx>
86 #include <GEOMAlgo_PassKeyShape.hxx>
90 void GetCount(const TopoDS_Shape& aS,
91 Standard_Integer& iCnt);
93 void CopySource(const TopoDS_Shape& aS,
94 TopTools_IndexedDataMapOfShapeShape& aMapSS,
97 //=======================================================================
98 //function : CopyShape
100 //=======================================================================
101 void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
104 TopTools_IndexedDataMapOfShapeShape aMapSS;
106 CopySource(aS, aMapSS, aSC);
108 //=======================================================================
109 //function : CopyShape
111 //=======================================================================
112 void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
114 TopTools_IndexedDataMapOfShapeShape& aMapSS)
116 CopySource(aS, aMapSS, aSC);
118 //=======================================================================
119 //function : CopySource
121 //=======================================================================
122 void CopySource(const TopoDS_Shape& aS,
123 TopTools_IndexedDataMapOfShapeShape& aMapSS,
126 Standard_Boolean bFree;
134 if (aMapSS.Contains(aS)) {
135 aSC=aMapSS.ChangeFromKey(aS);
136 aSC.Orientation(aS.Orientation());
140 aSC=aS.EmptyCopied();
145 aSC.Free(Standard_True);
147 if (aT==TopAbs_EDGE){
148 TopAbs_Orientation aOr;
150 aOr=aS.Orientation();
151 if(aOr==TopAbs_INTERNAL) {
152 aSF.Orientation(TopAbs_FORWARD);
156 for (; aIt.More(); aIt.Next()) {
159 const TopoDS_Shape& aSx=aIt.Value();
161 CopySource (aSx, aMapSS, aSCx);
163 aSCx.Orientation(aSx.Orientation());
168 //=======================================================================
169 //function : FaceNormal
171 //=======================================================================
172 void GEOMAlgo_AlgoTools::FaceNormal (const TopoDS_Face& aF,
173 const Standard_Real U,
174 const Standard_Real V,
179 Handle(Geom_Surface) aSurface;
181 aSurface=BRep_Tool::Surface(aF);
182 aSurface->D1 (U, V, aPnt, aD1U, aD1V);
183 aN=aD1U.Crossed(aD1V);
185 if (aF.Orientation() == TopAbs_REVERSED){
190 //=======================================================================
191 //function : BuildPCurveForEdgeOnFace
193 //=======================================================================
194 Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace
195 (const TopoDS_Edge& aEold,
196 const TopoDS_Edge& aEnew,
197 const TopoDS_Face& aF,
198 const Handle(IntTools_Context)& aCtx)
200 Standard_Boolean bIsClosed, bUClosed, bHasOld;
201 Standard_Integer iRet, aNbPoints;
202 Standard_Real aTS, aTS1, aTS2, aT, aT1, aT2, aScPr, aTol;
203 Standard_Real aU, aV, aUS1, aVS1, aUS2, aVS2;
205 gp_Pnt2d aP2DS1, aP2DS2, aP2D;
206 gp_Vec2d aV2DS1, aV2DS2;
207 Handle(Geom2d_Curve) aC2D, aC2DS1, aC2DS2;
208 Handle(Geom_Surface) aS;
213 bHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol);
218 // Try to copy PCurve from old edge to the new one.
219 iRet = BOPTools_AlgoTools2D::AttachExistingPCurve(aEold, aEnew, aF, aCtx);
222 // Do PCurve using projection algorithm.
225 // The PCurve is attached successfully.
229 BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aEnew, aF);
230 aC2D=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2);
236 bIsClosed=BRep_Tool::IsClosed(aEold, aF);
243 // 1. bUClosed - direction of closeness
246 aES.Orientation(TopAbs_FORWARD);
247 aC2DS1=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
249 aES.Orientation(TopAbs_REVERSED);
250 aC2DS2=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
252 aTS=IntTools_Tools::IntermediatePoint(aTS1, aTS2);
254 aC2DS1->D1(aTS, aP2DS1, aV2DS1);
255 aC2DS2->D1(aTS, aP2DS2, aV2DS2);
257 gp_Vec2d aV2DS12(aP2DS1, aP2DS2);
258 gp_Dir2d aD2DS12(aV2DS12);
259 const gp_Dir2d& aD2DX=gp::DX2d();
262 bUClosed=Standard_True;
263 if (fabs(aScPr) < aTol) {
267 // 2. aP2D - point on curve aC2D, that corresponds to aP2DS1
268 aP2DS1.Coord(aUS1, aVS1);
269 aP2DS2.Coord(aUS2, aVS2);
271 aS=BRep_Tool::Surface(aF);
272 aS->D0(aUS1, aVS1, aP);
274 GeomAPI_ProjectPointOnCurve& aProjPC=aCtx->ProjPC(aEnew);
277 aNbPoints=aProjPC.NbPoints();
283 aT=aProjPC.LowerDistanceParameter();
286 // 3. Build the second 2D curve
287 Standard_Boolean bRevOrder;
288 gp_Vec2d aV2DT, aV2D;
289 Handle(Geom2d_Curve) aC2Dnew;
290 Handle(Geom2d_TrimmedCurve) aC2DTnew;
293 aC2D->D1(aT, aP2D, aV2D);
296 aC2Dnew=Handle(Geom2d_Curve)::DownCast(aC2D->Copy());
297 aC2DTnew = new Geom2d_TrimmedCurve(aC2Dnew, aT1, aT2);
300 if (!bUClosed) { // V Closed
301 if (fabs(aV-aVS2)<aTol) {
306 if (fabs(aU-aUS2)<aTol) {
311 aC2DTnew->Translate(aV2DT);
313 // 4 Order the 2D curves
314 bRevOrder=Standard_False;
317 bRevOrder=!bRevOrder;
320 // 5. Update the edge
321 aTol=BRep_Tool::Tolerance(aEnew);
323 aBB.UpdateEdge(aEnew, aC2D, aC2DTnew, aF, aTol);
326 aBB.UpdateEdge(aEnew, aC2DTnew, aC2D , aF, aTol);
331 //////////////////////////////////////////////////////////////////////////
332 //=======================================================================
333 // function: MakeContainer
335 //=======================================================================
336 void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType,
342 case TopAbs_COMPOUND:{
344 aBB.MakeCompound(aC);
349 case TopAbs_COMPSOLID:{
350 TopoDS_CompSolid aCS;
351 aBB.MakeCompSolid(aCS);
358 aBB.MakeSolid(aSolid);
366 aBB.MakeShell(aShell);
382 //=======================================================================
383 //function : IsUPeriodic
385 //=======================================================================
386 Standard_Boolean GEOMAlgo_AlgoTools::IsUPeriodic(const Handle(Geom_Surface) &aS)
388 Standard_Boolean bRet;
389 GeomAbs_SurfaceType aType;
390 GeomAdaptor_Surface aGAS;
393 aType=aGAS.GetType();
394 bRet=(aType==GeomAbs_Cylinder||
395 aType==GeomAbs_Cone ||
396 aType==GeomAbs_Sphere);
401 //=======================================================================
402 //function : RefinePCurveForEdgeOnFace
404 //=======================================================================
405 void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
406 const TopoDS_Face& aF,
407 const Standard_Real aUMin,
408 const Standard_Real aUMax)
410 Standard_Real aT1, aT2, aTx, aUx, aTol;
412 Handle(Geom_Surface) aS;
413 Handle(Geom2d_Curve) aC2D;
416 aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
417 if (!aC2D.IsNull()) {
418 if (BRep_Tool::IsClosed(aE, aF)) {
421 aTx=IntTools_Tools::IntermediatePoint(aT1, aT2);
424 if (aUx < aUMin || aUx > aUMax) {
426 Handle(Geom2d_Curve) aC2Dx;
428 aTol=BRep_Tool::Tolerance(aE);
429 aBB.UpdateEdge(aE, aC2Dx, aF, aTol);
433 //=======================================================================
434 //function :IsSplitToReverse
436 //=======================================================================
437 Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse
438 (const TopoDS_Edge& aEF1,
439 const TopoDS_Edge& aEF2,
440 const Handle(IntTools_Context)& aContext)
442 Standard_Boolean aFlag;
443 Standard_Real aT1, aT2, aScPr, a, b;
448 Handle(Geom_Curve)aC1=BRep_Tool::Curve(aEF1, a, b);
449 aT1=IntTools_Tools::IntermediatePoint(a, b);
451 aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF1, aT1, aV1);
454 return Standard_False;
459 aFlag=aContext->ProjectPointOnEdge(aP, aEF2, aT2);
461 return Standard_False;
464 aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF2, aT2, aV2);
466 return Standard_False;
477 //=======================================================================
478 //function : ProjectPointOnShape
480 //=======================================================================
481 Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape
483 const TopoDS_Shape& aS,
485 const Handle(IntTools_Context)& aCtx)
487 Standard_Boolean bIsDone = Standard_False;
489 TopAbs_ShapeEnum aType;
491 aType = aS.ShapeType();
496 const TopoDS_Edge& aE2 = TopoDS::Edge(aS);
498 if (BRep_Tool::Degenerated(aE2)) { // jfa
499 return Standard_True;
503 Handle(Geom_Curve) aC3D = BRep_Tool::Curve (aE2, f, l);
505 return Standard_True;
507 bIsDone = aCtx->ProjectPointOnEdge(aP1, aE2, aT2);
513 GEOMAlgo_AlgoTools::PointOnEdge(aE2, aT2, aP2);
519 const TopoDS_Face& aF2 = TopoDS::Face(aS);
520 GeomAPI_ProjectPointOnSurf& aProj = aCtx->ProjPS(aF2);
523 bIsDone = aProj.IsDone();
528 aP2 = aProj.NearestPoint();
538 //=======================================================================
539 //function : PointOnEdge
541 //=======================================================================
542 void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
545 Standard_Real aTx, aT1, aT2;
547 BRep_Tool::Curve(aE, aT1, aT2);
548 aTx=IntTools_Tools::IntermediatePoint(aT1, aT2);
549 GEOMAlgo_AlgoTools::PointOnEdge(aE, aTx, aP3D);
551 //=======================================================================
552 //function : PointOnEdge
554 //=======================================================================
555 void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
556 const Standard_Real aT,
559 Standard_Real aT1, aT2;
560 Handle(Geom_Curve) aC3D;
562 aC3D=BRep_Tool::Curve(aE, aT1, aT2);
565 //=======================================================================
566 //function : PointOnFace
568 //=======================================================================
569 void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
570 const Standard_Real aU,
571 const Standard_Real aV,
574 Handle(Geom_Surface) aS;
576 aS=BRep_Tool::Surface(aF);
577 aS->D0(aU, aV, aP3D);
579 //=======================================================================
580 //function : PointOnFace
582 //=======================================================================
583 void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
586 Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax;
588 BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
590 aU=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
591 aV=IntTools_Tools::IntermediatePoint(aVMin, aVMax);
593 GEOMAlgo_AlgoTools::PointOnFace(aF, aU, aV, aP3D);
595 //=======================================================================
596 //function : PointOnShape
598 //=======================================================================
599 void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape& aS,
602 TopAbs_ShapeEnum aType;
604 aP3D.SetCoord(99.,99.,99.);
605 aType=aS.ShapeType();
608 const TopoDS_Edge& aE=TopoDS::Edge(aS);
609 GEOMAlgo_AlgoTools::PointOnEdge(aE, aP3D);
614 const TopoDS_Face& aF=TopoDS::Face(aS);
615 GEOMAlgo_AlgoTools::PointOnFace(aF, aP3D);
623 //=======================================================================
624 //function : FindSDShapes
626 //=======================================================================
627 Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
628 (const TopoDS_Shape& aE1,
629 const TopTools_ListOfShape& aLE,
630 const Standard_Real aTol,
631 TopTools_ListOfShape& aLESD,
632 const Handle(IntTools_Context)& aCtx)
634 Standard_Boolean bIsDone;
635 Standard_Real aTol2, aD2;
637 TopTools_ListIteratorOfListOfShape aIt;
640 GEOMAlgo_AlgoTools::PointOnShape(aE1, aP1);
643 for (; aIt.More(); aIt.Next()) {
644 const TopoDS_Shape& aE2=aIt.Value();
645 if (aE2.IsSame(aE1)) {
649 bIsDone=GEOMAlgo_AlgoTools::ProjectPointOnShape(aP1, aE2, aP2, aCtx);
652 continue; // jfa BUG 20361
654 aD2=aP1.SquareDistance(aP2);
663 //=======================================================================
664 //function : FindSDShapes
666 //=======================================================================
667 Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
668 (const TopTools_ListOfShape& aLE,
669 const Standard_Real aTol,
670 TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
671 const Handle(IntTools_Context)& aCtx)
673 Standard_Integer aNbE, aNbEProcessed, aNbESD, iErr;
674 TopTools_ListOfShape aLESD;
675 TopTools_ListIteratorOfListOfShape aIt, aIt1;
676 TopTools_IndexedMapOfShape aMProcessed;
677 TopAbs_ShapeEnum aType;
684 return 0; // Nothing to do
688 aNbEProcessed=aMProcessed.Extent();
689 if (aNbEProcessed==aNbE) {
694 for (; aIt.More(); aIt.Next()) {
695 const TopoDS_Shape& aS=aIt.Value();
697 if (aMProcessed.Contains(aS)) {
701 aType=aS.ShapeType();
702 if (aType==TopAbs_EDGE) {
703 const TopoDS_Edge& aE=TopoDS::Edge(aS);
704 if (BRep_Tool::Degenerated(aE)) {
711 iErr=GEOMAlgo_AlgoTools::FindSDShapes(aS, aLE, aTol, aLESD, aCtx);
716 aNbESD=aLESD.Extent();
723 aIt1.Initialize(aLESD);
724 for (; aIt1.More(); aIt1.Next()) {
725 const TopoDS_Shape& aE1=aIt1.Value();
726 aMProcessed.Add(aE1);
732 //=======================================================================
733 //function : RefineSDShapes
735 //=======================================================================
736 Standard_Integer GEOMAlgo_AlgoTools::RefineSDShapes
737 (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE,
738 const Standard_Real aTol,
739 const Handle(IntTools_Context)& aCtx)
741 Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd;
742 TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd;
746 aNbE=aMPKLE.Extent();
747 for (i=1; i<=aNbE; ++i) {
748 TopTools_ListOfShape& aLSDE=aMPKLE.ChangeFromIndex(i);
751 iErr=GEOMAlgo_AlgoTools::FindSDShapes(aLSDE, aTol, aMEE, aCtx);
758 continue; // nothing to do
761 for (j=1; j<=aNbEE; ++j) {
762 TopTools_ListOfShape& aLEE=aMEE.ChangeFromIndex(j);
769 const TopoDS_Shape& aE1=aLEE.First();
770 aMEToAdd.Add(aE1, aLEE);
775 aNbToAdd=aMEToAdd.Extent();
780 for (i=1; i<=aNbToAdd; ++i) {
781 GEOMAlgo_PassKeyShape aPKE1;
783 const TopoDS_Shape& aE1=aMEToAdd.FindKey(i);
784 const TopTools_ListOfShape& aLE=aMEToAdd(i);
786 aPKE1.SetShapes(aE1);
787 aMPKLE.Add(aPKE1, aLE);
792 //=======================================================================
793 //function : BuildTriangulation
795 //=======================================================================
797 GEOMAlgo_AlgoTools::BuildTriangulation (const TopoDS_Shape& theShape)
799 // calculate deflection
800 Standard_Real aDeviationCoefficient = 0.001;
803 BRepBndLib::Add(theShape, B);
804 Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
805 B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
807 Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
808 Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
809 Standard_Real aHLRAngle = 0.349066;
811 // build triangulation
812 BRepMesh_IncrementalMesh Inc (theShape, aDeflection, Standard_False, aHLRAngle);
814 // check triangulation
815 bool isTriangulation = true;
817 TopExp_Explorer exp (theShape, TopAbs_FACE);
820 TopLoc_Location aTopLoc;
821 Handle(Poly_Triangulation) aTRF;
822 aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
824 isTriangulation = false;
827 else // no faces, try edges
829 TopExp_Explorer expe (theShape, TopAbs_EDGE);
831 isTriangulation = false;
834 TopLoc_Location aLoc;
835 Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
837 isTriangulation = false;
841 return isTriangulation;
844 //=======================================================================
845 //function : IsCompositeShape
847 //=======================================================================
848 Standard_Boolean GEOMAlgo_AlgoTools::IsCompositeShape(const TopoDS_Shape& aS)
850 Standard_Boolean bRet;
851 Standard_Integer iCnt;
860 //=======================================================================
861 //function : GetCount
863 //=======================================================================
864 void GetCount(const TopoDS_Shape& aS,
865 Standard_Integer& iCnt)
868 TopAbs_ShapeEnum aTS;
872 if (aTS==TopAbs_SHAPE) {
875 if (aTS!=TopAbs_COMPOUND) {
881 for (; aIt.More(); aIt.Next()) {
882 const TopoDS_Shape& aSx=aIt.Value();
886 //=======================================================================
887 //function : PntInFace
889 //=======================================================================
890 Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
894 Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
895 Standard_Integer iErr, aIx, aNbDomains, i;
896 Standard_Real aUMin, aUMax, aVMin, aVMax;
897 Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT;
898 Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
899 gp_Dir2d aD2D (0., 1.);
902 Handle(Geom2d_Curve) aC2D;
903 Handle(Geom2d_TrimmedCurve) aCT2D;
904 Handle(Geom2d_Line) aL2D;
905 Handle(Geom_Surface) aS;
906 TopAbs_Orientation aOrE;
908 TopExp_Explorer aExp;
913 aTolTangfIntr=1.e-10;
915 Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
916 Geom2dHatch_Hatcher aHatcher(aIntr,
917 aTolHatch2D, aTolHatch3D,
918 Standard_True, Standard_False);
924 aFF.Orientation (TopAbs_FORWARD);
926 aS=BRep_Tool::Surface(aFF);
927 BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
930 aExp.Init (aFF, TopAbs_EDGE);
931 for (; aExp.More() ; aExp.Next()) {
932 const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
933 aOrE=aE.Orientation();
935 aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
936 if (aC2D.IsNull() ) {
940 if (fabs(aU1-aU2) < aEpsT) {
945 aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
946 aHatcher.AddElement(aCT2D, aOrE);
947 }// for (; aExp.More() ; aExp.Next()) {
950 aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
951 aP2D.SetCoord(aUx, 0.);
952 aL2D=new Geom2d_Line (aP2D, aD2D);
953 Geom2dAdaptor_Curve aHCur(aL2D);
955 aIx=aHatcher.AddHatching(aHCur) ;
959 bIsDone=aHatcher.TrimDone(aIx);
965 aHatcher.ComputeDomains(aIx);
966 bIsDone=aHatcher.IsDone(aIx);
974 aNbDomains=aHatcher.NbDomains(aIx);
981 const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
982 bHasFirstPoint=aDomain.HasFirstPoint();
983 if (!bHasFirstPoint) {
988 aV1=aDomain.FirstPoint().Parameter();
990 bHasSecondPoint=aDomain.HasSecondPoint();
991 if (!bHasSecondPoint) {
996 aV2=aDomain.SecondPoint().Parameter();
998 aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
1000 aS->D0(aUx, aVx, aPx);
1002 theP2D.SetCoord(aUx, aVx);