1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <BOPTools_AlgoTools2D.ixx>
17 #include <Standard_NotImplemented.hxx>
18 #include <Precision.hxx>
22 #include <gp_Pnt2d.hxx>
24 #include <gp_Vec2d.hxx>
26 #include <Geom2d_Curve.hxx>
27 #include <Geom2d_Line.hxx>
28 #include <Geom2d_Circle.hxx>
29 #include <Geom2d_Ellipse.hxx>
30 #include <Geom2d_Parabola.hxx>
31 #include <Geom2d_Hyperbola.hxx>
32 #include <Geom2d_TrimmedCurve.hxx>
34 #include <Geom2dAdaptor.hxx>
36 #include <Geom_Curve.hxx>
37 #include <Geom_TrimmedCurve.hxx>
38 #include <Geom_Surface.hxx>
39 #include <Geom_Plane.hxx>
41 #include <GeomAdaptor_Surface.hxx>
42 #include <GeomAdaptor_Curve.hxx>
43 #include <GeomAdaptor_HCurve.hxx>
44 #include <GeomAdaptor_HSurface.hxx>
45 #include <Geom_Plane.hxx>
46 #include <Geom_RectangularTrimmedSurface.hxx>
48 #include <GeomProjLib.hxx>
50 #include <TopLoc_Location.hxx>
53 #include <ProjLib_ProjectedCurve.hxx>
55 #include <BRep_Tool.hxx>
56 #include <BRep_Builder.hxx>
57 #include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
58 #include <BRep_TEdge.hxx>
59 #include <BRep_CurveRepresentation.hxx>
60 #include <BRep_GCurve.hxx>
62 #include <BRepAdaptor_HSurface.hxx>
64 #include <BRepAdaptor_Curve.hxx>
65 #include <BRepAdaptor_Surface.hxx>
66 #include <BRepClass_FaceClassifier.hxx>
68 #include <BRepTools.hxx>
70 #include <BOPCol_IndexedMapOfShape.hxx>
72 #include <BOPTools.hxx>
73 #include <IntTools_Tools.hxx>
74 #include <gp_Cylinder.hxx>
75 #include <TopExp_Explorer.hxx>
76 #include <GeomInt.hxx>
79 Standard_Boolean CheckEdgeLength (const TopoDS_Edge& );
82 Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface(const TopoDS_Edge& ,
88 Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface(const TopoDS_Edge& ,
89 const Handle(Geom_Surface)& ,
90 const TopLoc_Location& ,
95 Standard_Real MaxToleranceEdge (const TopoDS_Face& );
97 //=======================================================================
98 //function : BuildPCurveForEdgeOnFace
100 //=======================================================================
101 void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
102 const TopoDS_Face& aF)
105 Handle(Geom2d_Curve) aC2D;
106 Standard_Real aTolPC, aTolFact, aTolEdge, aFirst, aLast;
108 Standard_Boolean aHasOld;
109 aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, aC2D,
117 BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC);
119 aTolEdge=BRep_Tool::Tolerance(aE);
121 aTolFact=Max(aTolEdge, aTolPC);
123 aBB.UpdateEdge(aE, aC2D, aF, aTolFact);
127 //=======================================================================
128 //function : EdgeTangent
130 //=======================================================================
131 Standard_Boolean BOPTools_AlgoTools2D::EdgeTangent
132 (const TopoDS_Edge& anEdge,
133 const Standard_Real aT,
136 Standard_Boolean isdgE;
137 Standard_Real first, last;
139 isdgE = BRep_Tool::Degenerated(anEdge);
141 return Standard_False;
143 if (!CheckEdgeLength(anEdge)) {
144 return Standard_False;
147 Handle(Geom_Curve) aC=BRep_Tool::Curve(anEdge, first, last);
149 aC->D1(aT, aP, aTau);
150 Standard_Real mod = aTau.Magnitude();
151 if(mod > gp::Resolution()) {
155 return Standard_False;
158 if (anEdge.Orientation() == TopAbs_REVERSED){
161 return Standard_True;
164 //=======================================================================
165 //function : PointOnOnSurface
167 //=======================================================================
168 void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE,
169 const TopoDS_Face& aF,
170 const Standard_Real aParameter,
175 Handle(Geom2d_Curve) aC2D;
176 Standard_Real aToler, aFirst, aLast;
178 BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
179 aFirst, aLast, aToler);
180 aC2D->D0(aParameter, aP2D);
186 //=======================================================================
187 //function : CurveOnSurface
189 //=======================================================================
190 void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
191 const TopoDS_Face& aF,
192 Handle(Geom2d_Curve)& aC2D,
193 Standard_Real& aToler)
195 Standard_Real aFirst, aLast;
197 BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
198 aFirst, aLast, aToler);
202 //=======================================================================
203 //function : CurveOnSurface
205 //=======================================================================
206 void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
207 const TopoDS_Face& aF,
208 Handle(Geom2d_Curve)& aC2D,
209 Standard_Real& aFirst,
210 Standard_Real& aLast,
211 Standard_Real& aToler)
213 Standard_Boolean aHasOld;
214 Handle(Geom2d_Curve) C2D;
216 aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, C2D,
224 BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler);
228 //=======================================================================
229 //function : HasCurveOnSurface
231 //=======================================================================
232 Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
233 (const TopoDS_Edge& aE,
234 const TopoDS_Face& aF,
235 Handle(Geom2d_Curve)& aC2D,
236 Standard_Real& aFirst,
237 Standard_Real& aLast,
238 Standard_Real& aToler)
240 Standard_Boolean aHasOld;
242 aToler=BRep_Tool::Tolerance(aE);
243 BRep_Tool::Range(aE, aFirst, aLast);
245 if((aLast - aFirst) < Precision::PConfusion()) {
246 return Standard_False;
249 aC2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast);
250 aHasOld=!aC2D.IsNull();
253 //=======================================================================
254 //function : HasCurveOnSurface
256 //=======================================================================
257 Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
258 (const TopoDS_Edge& aE,
259 const TopoDS_Face& aF)
262 Standard_Boolean bHasOld;
263 Handle(Geom2d_Curve) aC2D;
264 Standard_Real aFirst, aLast;
266 BRep_Tool::Range(aE, aFirst, aLast);
268 if((aLast - aFirst) < Precision::PConfusion()) {
269 return Standard_False;
272 aC2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast);
273 bHasOld=!aC2D.IsNull();
277 //=======================================================================
278 //function : AdjustPCurveOnFace
280 //=======================================================================
281 void BOPTools_AlgoTools2D::AdjustPCurveOnFace
282 (const TopoDS_Face& aF,
283 const Handle(Geom_Curve)& aC3D,
284 const Handle(Geom2d_Curve)& aC2D,
285 Handle(Geom2d_Curve)& aC2DA)
287 Standard_Real first, last;
289 first = aC3D -> FirstParameter();
290 last = aC3D -> LastParameter();
292 BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, first, last, aC2D, aC2DA);
294 //=======================================================================
295 //function : AdjustPCurveOnFace
297 //=======================================================================
298 void BOPTools_AlgoTools2D::AdjustPCurveOnFace
299 (const TopoDS_Face& aF,
300 const Standard_Real aFirst,
301 const Standard_Real aLast,
302 const Handle(Geom2d_Curve)& aC2D,
303 Handle(Geom2d_Curve)& aC2DA)
305 Standard_Boolean mincond, maxcond;
306 Standard_Real UMin, UMax, VMin, VMax, aT, u2, v2, du, dv, aDelta;
307 Standard_Real aUPeriod;
309 aDelta=Precision::PConfusion();
311 BRepAdaptor_Surface aBAS(aF, Standard_False);
313 BRepTools::UVBounds(aF, UMin, UMax, VMin, VMax);
315 aT =.5*(aFirst+aLast);
325 if (aBAS.IsUPeriodic()) {
326 aUPeriod = aBAS.UPeriod();
328 // a. try to clarify u2 using the precision (aDelta)
329 if (fabs(u2-UMin) < aDelta) {
332 else if (fabs(u2-UMin-aUPeriod) < aDelta) {
335 // b. compute du again using clarified value of u2
336 GeomInt::AdjustPeriodic(u2, UMin, UMax, aUPeriod, u2, du, 0.);
339 if (aBAS.GetType()==GeomAbs_Cylinder) {
340 Standard_Real aR, dFi, aTol;
342 gp_Cylinder aCylinder=aBAS.Cylinder();
343 aR=aCylinder.Radius();
344 aTol=MaxToleranceEdge(aF);
350 mincond = (UMin - u2 > dFi);
351 maxcond = (u2 - UMax > dFi);
352 if (mincond || maxcond) {
353 du = ( mincond ) ? aUPeriod : -aUPeriod;
361 if (aBAS.IsVPeriodic()) {
362 Standard_Real aVPeriod, aVm, aVr, aVmid, dVm, dVr;
364 aVPeriod = aBAS.VPeriod();
365 mincond = (VMin - v2 > aDelta);
366 maxcond = (v2 - VMax > aDelta);
368 if (mincond || maxcond) {
369 dv = ( mincond ) ? aVPeriod : -aVPeriod;
372 if ((VMax-VMin<aVPeriod) && dv) {
375 aVmid=0.5*(VMin+VMax);
385 //check the point with classifier
389 if (aBAS.IsUPeriodic()) {
390 aUPeriod = aBAS.UPeriod();
391 if ((UMax - UMin - 2*aDelta) > aUPeriod) {
392 if ((u > (UMin + aDelta + aUPeriod)) ||
393 (u < (UMax - aDelta - aUPeriod))) {
394 BRepClass_FaceClassifier aClassifier;
395 aClassifier.Perform(aF, gp_Pnt2d(u, v), aDelta);
396 TopAbs_State Status = aClassifier.State();
397 if (Status == TopAbs_OUT) {
398 du += (u > (UMin + aDelta + aUPeriod)) ? -aUPeriod : aUPeriod;
405 if (aBAS.IsVPeriodic()) {
406 Standard_Real aVPeriod = aBAS.VPeriod();
407 if ((VMax - VMin - 2*aDelta) > aVPeriod) {
408 if ((v > (VMin + aDelta + aVPeriod)) ||
409 (v < (VMax - aDelta - aVPeriod))) {
410 BRepClass_FaceClassifier aClassifier;
411 aClassifier.Perform(aF, gp_Pnt2d(u, v), aDelta);
412 TopAbs_State Status = aClassifier.State();
413 if (Status == TopAbs_OUT) {
414 dv += (v > (VMin + aDelta + aVPeriod)) ? -aVPeriod : aVPeriod;
420 // Translation if necessary
421 Handle(Geom2d_Curve) aC2Dx=aC2D;
423 if ( du != 0. || dv != 0.) {
424 Handle(Geom2d_Curve) PCT = Handle(Geom2d_Curve)::DownCast(aC2Dx->Copy());
425 gp_Vec2d aV2D(du,dv);
426 PCT->Translate(aV2D);
433 //=======================================================================
434 //function : IntermediatePoint
436 //=======================================================================
437 Standard_Real BOPTools_AlgoTools2D::IntermediatePoint
438 (const Standard_Real aFirst,
439 const Standard_Real aLast)
441 //define parameter division number as 10*e^(-PI) = 0.43213918
442 const Standard_Real PAR_T = 0.43213918;
444 aParm=(1.-PAR_T)*aFirst + PAR_T*aLast;
447 //=======================================================================
448 //function : IntermediatePoint
450 //=======================================================================
451 Standard_Real BOPTools_AlgoTools2D::IntermediatePoint
452 (const TopoDS_Edge& aE)
455 Standard_Real aT, aT1, aT2;
457 Handle(Geom_Curve)aC1=BRep_Tool::Curve(aE, aT1, aT2);
459 BRep_Tool::Range(aE, aT1, aT2);
461 aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
465 //=======================================================================
466 //function : BuildPCurveForEdgeOnPlane
468 //=======================================================================
469 void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane
470 (const TopoDS_Edge& aE,
471 const TopoDS_Face& aF)
473 Standard_Boolean bToUpdate;
474 Standard_Real aTolE, aT1, aT2;
475 Handle(Geom2d_Curve) aC2D;
478 aC2D=BRep_Tool_CurveOnSurface(aE, aF, aT1, aT2, bToUpdate);
480 aTolE=BRep_Tool::Tolerance(aE);
481 aBB.UpdateEdge(aE, aC2D, aF, aTolE);
484 //=======================================================================
485 // function: BuildPCurveForEdgesOnPlane
487 //=======================================================================
488 void BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane
489 (const BOPCol_ListOfShape& aLE,
490 const TopoDS_Face& aF)
492 BOPCol_ListIteratorOfListOfShape aIt;
495 for(; aIt.More(); aIt.Next()) {
496 const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());
497 BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (aE, aF);
500 //=======================================================================
503 //=======================================================================
504 void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
505 const TopoDS_Face& aF,
506 Handle(Geom2d_Curve)& aC2D,
507 Standard_Real& aFirst,
508 Standard_Real& aLast,
509 Standard_Real& aToler)
511 Standard_Boolean aLocIdentity;
512 Standard_Real f3d, l3d;
513 TopLoc_Location aLoc;
515 Handle(Geom2d_Curve) C2D;
518 C2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast);
525 Handle(Geom_Curve) C3D2, C3D;
526 C3D = BRep_Tool::Curve(aE, aLoc, f3d, l3d);
529 // aE has no 3D curve, so nothing is done
532 aLocIdentity=aLoc.IsIdentity();
538 C3D2 = Handle(Geom_Curve)::
539 DownCast(C3D->Transformed(aLoc.Transformation()));
543 aToler = BRep_Tool::Tolerance(aE);
544 BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler);
550 //=======================================================================
551 //function : MakePCurveOnFace
553 //=======================================================================
554 void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
555 const Handle(Geom_Curve)& aC3D,
556 Handle(Geom2d_Curve)& aC2D, //->
557 Standard_Real& TolReached2d)
559 Standard_Real aFirst, aLast;
561 aFirst = aC3D -> FirstParameter();
562 aLast = aC3D -> LastParameter();
566 BOPTools_AlgoTools2D::MakePCurveOnFace (aF, aC3D, aFirst,
567 aLast, aC2D, TolReached2d);
570 //=======================================================================
571 //function : MakePCurveOnFace
573 //=======================================================================
574 void BOPTools_AlgoTools2D::MakePCurveOnFace
575 (const TopoDS_Face& aF,
576 const Handle(Geom_Curve)& aC3D,
577 const Standard_Real aFirst,
578 const Standard_Real aLast,
579 Handle(Geom2d_Curve)& aC2D,
580 Standard_Real& TolReached2d)
583 Handle(Geom2d_Curve) aC2DA;
585 Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
586 GeomAdaptor_Surface aGAS(aS);
587 Handle(GeomAdaptor_HSurface) aBAHS=
588 new GeomAdaptor_HSurface(aGAS);
589 Handle(GeomAdaptor_HCurve) aBAHC =
590 new GeomAdaptor_HCurve(aC3D, aFirst, aLast);
592 //when the type of surface is GeomAbs_SurfaceOfRevolution
593 if (aGAS.GetType() == GeomAbs_SurfaceOfRevolution) {
594 Standard_Real aTR = 1.e-7;
595 ProjLib_ProjectedCurve aProj1(aBAHS, aBAHC, aTR);
596 BOPTools_AlgoTools2D::MakePCurveOfType(aProj1, aC2D);
597 aTolR = aProj1.GetTolerance();
599 ProjLib_ProjectedCurve aProjCurv(aBAHS, aBAHC);// 1
600 BOPTools_AlgoTools2D::MakePCurveOfType(aProjCurv, aC2D);
601 aTolR=aProjCurv.GetTolerance();
605 ProjLib_ProjectedCurve aProjCurvAgain(aBAHS, aBAHC, TolReached2d);// 2
606 BOPTools_AlgoTools2D::MakePCurveOfType(aProjCurvAgain, aC2D);
607 aTolR = aProjCurvAgain.GetTolerance();
610 Standard_Real aTR=0.0001;
611 ProjLib_ProjectedCurve aProj3(aBAHS, aBAHC, aTR);// 3
612 BOPTools_AlgoTools2D::MakePCurveOfType(aProj3, aC2D);
613 aTolR = aProj3.GetTolerance();
618 BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aFirst, aLast,
623 //=======================================================================
624 //function : MakePCurveOfType
626 //=======================================================================
627 void BOPTools_AlgoTools2D::MakePCurveOfType
628 (const ProjLib_ProjectedCurve& PC,
629 Handle(Geom2d_Curve)& C2D)
632 switch (PC.GetType()) {
635 C2D = new Geom2d_Line(PC.Line());
637 case GeomAbs_Circle :
638 C2D = new Geom2d_Circle(PC.Circle());
640 case GeomAbs_Ellipse :
641 C2D = new Geom2d_Ellipse(PC.Ellipse());
643 case GeomAbs_Parabola :
644 C2D = new Geom2d_Parabola(PC.Parabola());
646 case GeomAbs_Hyperbola :
647 C2D = new Geom2d_Hyperbola(PC.Hyperbola());
649 case GeomAbs_BSplineCurve :
652 case GeomAbs_BezierCurve :
653 case GeomAbs_OtherCurve :
655 Standard_NotImplemented::Raise
656 ("BOPTools_AlgoTools2D::MakePCurveOfType");
660 //=======================================================================
661 //function : CheckEdgeLength
663 //=======================================================================
664 Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E)
666 BRepAdaptor_Curve BC(E);
668 BOPCol_IndexedMapOfShape aM;
669 BOPTools::MapShapes(E, TopAbs_VERTEX, aM);
670 Standard_Integer i, anExtent, aN=10;
671 Standard_Real ln=0., d, t, f, l, dt;
672 anExtent=aM.Extent();
675 return Standard_True;
678 f = BC.FirstParameter();
679 l = BC.LastParameter();
683 for (i=1; i<=aN; i++) {
696 return (ln > Precision::Confusion());
698 //=======================================================================
699 //function : BRep_Tool_CurveOnSurface
701 //=======================================================================
702 Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface(const TopoDS_Edge& E,
703 const TopoDS_Face& F,
704 Standard_Real& First,
706 Standard_Boolean& bToUpdate)
709 const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
710 TopoDS_Edge aLocalEdge = E;
711 if (F.Orientation() == TopAbs_REVERSED) {
712 aLocalEdge.Reverse();
715 return BRep_Tool_CurveOnSurface(aLocalEdge,S,l,First,Last,bToUpdate);
717 //=======================================================================
718 //function : BRep_Tool_CurveOnSurface
720 //=======================================================================
721 Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface
722 (const TopoDS_Edge& E,
723 const Handle(Geom_Surface)& S,
724 const TopLoc_Location& L,
725 Standard_Real& First,
727 Standard_Boolean& bToUpdate)
729 static const Handle(Geom2d_Curve) nullPCurve;
730 bToUpdate=Standard_False;
731 TopLoc_Location loc = L.Predivided(E.Location());
732 Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
734 // find the representation
735 BRep_ListIteratorOfListOfCurveRepresentation itcr
736 ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
738 while (itcr.More()) {
739 const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
740 if (cr->IsCurveOnSurface(S,loc)) {
741 const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
742 GC->Range(First,Last);
743 if (GC->IsCurveOnClosedSurface() && Eisreversed)
744 return GC->PCurve2();
751 // for planar surface and 3d curve try a projection
752 // modif 21-05-97 : for RectangularTrimmedSurface, try a projection
753 Handle(Geom_Plane) GP;
754 Handle(Geom_RectangularTrimmedSurface) GRTS;
755 GRTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
757 GP = Handle(Geom_Plane)::DownCast(GRTS->BasisSurface());
759 GP = Handle(Geom_Plane)::DownCast(S);
760 //fin modif du 21-05-97
764 Handle(GeomAdaptor_HCurve) HC;
765 Handle(GeomAdaptor_HSurface) HS;
767 HC = new GeomAdaptor_HCurve();
768 HS = new GeomAdaptor_HSurface();
772 Standard_Real f, l;// for those who call with (u,u).
773 Handle(Geom_Curve) C3d =
774 BRep_Tool::Curve(E,/*LC,*/f,l); // transforming plane instead of curve
775 // we can loose scale factor of Curve transformation (eap 13 May 2002)
777 LC = L/*.Predivided(LC)*/;
779 if (C3d.IsNull()) return nullPCurve;
781 Handle(Geom_Plane) Plane = GP;
782 if (!LC.IsIdentity()) {
783 const gp_Trsf& T = LC.Transformation();
784 Handle(Geom_Geometry) GPT = GP->Transformed(T);
785 Plane = *((Handle(Geom_Plane)*)&GPT);
787 GeomAdaptor_Surface& GAS = HS->ChangeSurface();
790 Handle(Geom_Curve) ProjOnPlane =
791 GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l),
793 Plane->Position().Direction(),
796 GeomAdaptor_Curve& GAC = HC->ChangeCurve();
797 GAC.Load(ProjOnPlane);
799 ProjLib_ProjectedCurve Proj(HS,HC);
800 Handle(Geom2d_Curve) pc = Geom2dAdaptor::MakeCurve(Proj);
802 if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
803 Handle(Geom2d_TrimmedCurve) TC =
804 (*((Handle(Geom2d_TrimmedCurve)*)&pc));
805 pc = TC->BasisCurve();
809 bToUpdate=Standard_True;
816 //=======================================================================
817 //function : MaxToleranceEdge
819 //=======================================================================
820 Standard_Real MaxToleranceEdge (const TopoDS_Face& aF)
822 Standard_Real aTol, aTolMax;
823 TopExp_Explorer aExp;
826 aExp.Init(aF, TopAbs_EDGE);
827 for (; aExp.More(); aExp.Next()) {
828 const TopoDS_Edge& aE=*((TopoDS_Edge *)&aExp.Current());
829 aTol=BRep_Tool::Tolerance(aE);