1 // Created on: 1998-08-26
2 // Created by: Julia GERASIMOVA
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Adaptor3d_CurveOnSurface.hxx>
19 #include <Adaptor3d_HCurveOnSurface.hxx>
20 #include <BRep_Builder.hxx>
21 #include <BRep_CurveRepresentation.hxx>
22 #include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
23 #include <BRep_TEdge.hxx>
24 #include <BRep_Tool.hxx>
25 #include <BRep_TVertex.hxx>
26 #include <BRepAdaptor_HCurve.hxx>
27 #include <BRepAdaptor_HCurve2d.hxx>
28 #include <BRepAdaptor_HSurface.hxx>
29 #include <BRepFill_CurveConstraint.hxx>
30 #include <BRepFill_EdgeFaceAndOrder.hxx>
31 #include <BRepFill_FaceAndOrder.hxx>
32 #include <BRepFill_Filling.hxx>
33 #include <BRepLib.hxx>
34 #include <BRepLib_MakeEdge.hxx>
35 #include <BRepLib_MakeEdge2d.hxx>
36 #include <BRepLib_MakeFace.hxx>
37 #include <BRepLib_MakeWire.hxx>
38 #include <BRepTools.hxx>
39 #include <BRepTools_WireExplorer.hxx>
40 #include <Geom2d_BezierCurve.hxx>
41 #include <Geom2d_TrimmedCurve.hxx>
42 #include <Geom2dAdaptor_HCurve.hxx>
43 #include <Geom_BSplineSurface.hxx>
44 #include <GeomAdaptor_HSurface.hxx>
45 #include <GeomAPI_ProjectPointOnSurf.hxx>
46 #include <GeomPlate_CurveConstraint.hxx>
47 #include <GeomPlate_MakeApprox.hxx>
48 #include <GeomPlate_PlateG0Criterion.hxx>
49 #include <GeomPlate_PointConstraint.hxx>
50 #include <GeomProjLib.hxx>
52 #include <Precision.hxx>
53 #include <Standard_ConstructionError.hxx>
54 #include <Standard_OutOfRange.hxx>
55 #include <StdFail_NotDone.hxx>
56 #include <TColGeom2d_HArray1OfCurve.hxx>
57 #include <TColgp_Array1OfPnt2d.hxx>
58 #include <TColgp_SequenceOfPnt.hxx>
59 #include <TColgp_SequenceOfXY.hxx>
60 #include <TColStd_HArray1OfReal.hxx>
63 #include <TopoDS_Edge.hxx>
64 #include <TopoDS_Face.hxx>
65 #include <TopoDS_Shape.hxx>
66 #include <TopoDS_Vertex.hxx>
67 #include <TopoDS_Wire.hxx>
68 #include <TopTools_ListIteratorOfListOfShape.hxx>
69 #include <Geom_Surface.hxx>
71 static gp_Vec MakeFinVec( const TopoDS_Wire aWire, const TopoDS_Vertex aVertex )
73 TopoDS_Vertex Vfirst, Vlast, Origin;
74 BRepTools_WireExplorer Explo( aWire );
75 for (; Explo.More(); Explo.Next())
77 TopExp::Vertices( Explo.Current(), Vfirst, Vlast );
78 if (Vfirst.IsSame( aVertex ))
83 if (Vlast.IsSame( aVertex ))
89 return gp_Vec( BRep_Tool::Pnt( Origin ), BRep_Tool::Pnt( aVertex ) );
92 static TopoDS_Wire WireFromList(TopTools_ListOfShape& Edges)
95 TopoDS_Edge anEdge = TopoDS::Edge(Edges.First());
99 while (!Edges.IsEmpty())
101 TopoDS_Wire CurWire = MW.Wire();
102 TopoDS_Vertex V1, V2;
103 TopExp::Vertices(CurWire, V1, V2);
104 TopTools_ListIteratorOfListOfShape itl(Edges);
105 for (; itl.More(); itl.Next())
107 anEdge = TopoDS::Edge(itl.Value());
108 TopoDS_Vertex V3, V4;
109 TopExp::Vertices(anEdge, V3, V4);
110 if (V1.IsSame(V3) || V1.IsSame(V4) ||
111 V2.IsSame(V3) || V2.IsSame(V4))
121 //=======================================================================
122 //function : Constructor
124 //======================================================================
125 BRepFill_Filling::BRepFill_Filling( const Standard_Integer Degree,
126 const Standard_Integer NbPtsOnCur,
127 const Standard_Integer NbIter,
128 const Standard_Boolean Anisotropie,
129 const Standard_Real Tol2d,
130 const Standard_Real Tol3d,
131 const Standard_Real TolAng,
132 const Standard_Real TolCurv,
133 const Standard_Integer MaxDeg,
134 const Standard_Integer MaxSegments )
137 myNbPtsOnCur = NbPtsOnCur;
139 myAnisotropie = Anisotropie;
147 myMaxSegments = MaxSegments;
149 myIsInitFaceGiven = Standard_False;
151 myIsDone = Standard_False;
154 //=======================================================================
155 //function : SetConstrParam
157 //======================================================================
158 void BRepFill_Filling::SetConstrParam( const Standard_Real Tol2d,
159 const Standard_Real Tol3d,
160 const Standard_Real TolAng,
161 const Standard_Real TolCurv )
169 //=======================================================================
170 //function : SetResolParam
172 //======================================================================
173 void BRepFill_Filling::SetResolParam( const Standard_Integer Degree,
174 const Standard_Integer NbPtsOnCur,
175 const Standard_Integer NbIter,
176 const Standard_Boolean Anisotropie )
179 myNbPtsOnCur = NbPtsOnCur;
181 myAnisotropie = Anisotropie;
184 //=======================================================================
185 //function : SetApproxParam
187 //======================================================================
188 void BRepFill_Filling::SetApproxParam( const Standard_Integer MaxDeg,
189 const Standard_Integer MaxSegments )
192 myMaxSegments = MaxSegments;
195 //=======================================================================
196 //function : LoadInitSurface
198 //======================================================================
199 void BRepFill_Filling::LoadInitSurface( const TopoDS_Face& aFace )
202 myIsInitFaceGiven = Standard_True;
205 //=======================================================================
207 //purpose : adds an edge as a constraint
208 //======================================================================
209 Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
210 const GeomAbs_Shape Order,
211 const Standard_Boolean IsBound )
213 TopoDS_Face NullFace;
214 BRepFill_EdgeFaceAndOrder EdgeFaceAndOrder( anEdge, NullFace, Order );
217 myBoundary.Append( EdgeFaceAndOrder );
218 TopTools_ListOfShape EmptyList;
219 myOldNewMap.Bind(anEdge, EmptyList);
220 return myBoundary.Length();
224 myConstraints.Append( EdgeFaceAndOrder );
225 return (myBoundary.Length() + myFreeConstraints.Length() + myConstraints.Length());
229 //=======================================================================
231 //purpose : adds an edge with supporting face as a constraint
232 //======================================================================
233 Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
234 const TopoDS_Face& Support,
235 const GeomAbs_Shape Order,
236 const Standard_Boolean IsBound )
238 BRepFill_EdgeFaceAndOrder EdgeFaceAndOrder( anEdge, Support, Order );
241 myBoundary.Append( EdgeFaceAndOrder );
242 TopTools_ListOfShape EmptyList;
243 myOldNewMap.Bind(anEdge, EmptyList);
244 return myBoundary.Length();
248 myConstraints.Append( EdgeFaceAndOrder );
249 return (myBoundary.Length() + myFreeConstraints.Length() + myConstraints.Length());
253 //=======================================================================
255 //purpose : adds a "free constraint": face without edge
256 //======================================================================
257 Standard_Integer BRepFill_Filling::Add( const TopoDS_Face& Support,
258 const GeomAbs_Shape Order )
260 BRepFill_FaceAndOrder FaceAndOrder( Support, Order );
261 myFreeConstraints.Append( FaceAndOrder );
262 return (myBoundary.Length() + myFreeConstraints.Length());
265 //=======================================================================
267 //purpose : adds a point constraint
268 //======================================================================
269 Standard_Integer BRepFill_Filling::Add( const gp_Pnt& Point )
271 Handle( GeomPlate_PointConstraint ) aPC = new GeomPlate_PointConstraint( Point, GeomAbs_C0, myTol3d );
272 myPoints.Append( aPC );
273 return (myBoundary.Length() + myFreeConstraints.Length() + myConstraints.Length() + myPoints.Length());
276 //=======================================================================
278 //purpose : adds a point constraint on a face
279 //======================================================================
280 Standard_Integer BRepFill_Filling::Add( const Standard_Real U,
281 const Standard_Real V,
282 const TopoDS_Face& Support,
283 const GeomAbs_Shape Order )
285 Handle( BRepAdaptor_HSurface ) HSurf = new BRepAdaptor_HSurface();
286 HSurf->ChangeSurface().Initialize( Support );
287 Handle( GeomPlate_PointConstraint ) aPC =
288 new GeomPlate_PointConstraint( U, V, BRep_Tool::Surface( HSurf->ChangeSurface().Face() ), Order,
289 myTol3d, myTolAng, myTolCurv );
290 myPoints.Append( aPC );
291 return (myBoundary.Length() + myFreeConstraints.Length() + myConstraints.Length() + myPoints.Length());
295 //=======================================================================
296 //function : AddConstraints
298 //======================================================================
299 void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints )
303 GeomAbs_Shape CurOrder;
305 Handle(GeomPlate_CurveConstraint) Constr;
307 for (i = 1; i <= SeqOfConstraints.Length(); i++)
309 CurEdge = SeqOfConstraints(i).myEdge;
310 CurFace = SeqOfConstraints(i).myFace;
311 CurOrder = SeqOfConstraints(i).myOrder;
313 if (CurFace.IsNull()) {
314 if (CurOrder == GeomAbs_C0) {
315 Handle( BRepAdaptor_HCurve ) HCurve = new BRepAdaptor_HCurve();
316 HCurve->ChangeCurve().Initialize( CurEdge );
317 const Handle(Adaptor3d_HCurve)& aHCurve = HCurve; // to avoid ambiguity
318 Constr = new BRepFill_CurveConstraint(aHCurve,
323 else { // Pas de representation Topologique
324 // On prend une representation Geometrique : au pif !
325 Handle( Geom_Surface ) Surface;
326 Handle( Geom2d_Curve ) C2d;
329 BRep_Tool::CurveOnSurface( CurEdge, C2d, Surface, loc, f, l);
330 if (Surface.IsNull()) {
331 Standard_Failure::Raise( "Add" );
334 Surface = Handle(Geom_Surface)::DownCast(Surface->Copy());
335 Surface->Transform(loc.Transformation());
336 Handle( GeomAdaptor_HSurface ) Surf = new GeomAdaptor_HSurface(Surface);
337 Handle( Geom2dAdaptor_HCurve ) Curve2d = new Geom2dAdaptor_HCurve(C2d);
339 Adaptor3d_CurveOnSurface CurvOnSurf( Curve2d, Surf );
340 Handle (Adaptor3d_HCurveOnSurface) HCurvOnSurf = new Adaptor3d_HCurveOnSurface( CurvOnSurf );
342 Constr = new GeomPlate_CurveConstraint(HCurvOnSurf,
352 Handle( BRepAdaptor_HSurface ) Surf = new BRepAdaptor_HSurface();
353 Surf->ChangeSurface().Initialize( CurFace );
354 Handle( BRepAdaptor_HCurve2d ) Curve2d = new BRepAdaptor_HCurve2d();
355 Curve2d->ChangeCurve2d().Initialize( CurEdge, CurFace );
356 // If CurEdge has no 2d representation on CurFace,
357 // there will be exception "Attempt to access to null object"
358 // in this initialization (null pcurve).
359 Adaptor3d_CurveOnSurface CurvOnSurf( Curve2d, Surf );
360 Handle (Adaptor3d_HCurveOnSurface) HCurvOnSurf = new Adaptor3d_HCurveOnSurface( CurvOnSurf );
362 Constr = new BRepFill_CurveConstraint( HCurvOnSurf,
369 if (myIsInitFaceGiven)
371 Handle( Geom2d_Curve ) Curve2d;
372 Standard_Real FirstPar, LastPar;
373 Curve2d = BRep_Tool::CurveOnSurface( CurEdge, myInitFace, FirstPar, LastPar );
374 if (! Curve2d.IsNull())
376 Curve2d = new Geom2d_TrimmedCurve( Curve2d, FirstPar, LastPar );
377 Constr->SetCurve2dOnSurf( Curve2d );
380 myBuilder.Add( Constr );
384 //=======================================================================
385 //function : BuildWires
387 //======================================================================
388 void BRepFill_Filling::BuildWires( TopTools_ListOfShape& EdgeList, TopTools_ListOfShape& WireList )
390 TopTools_ListIteratorOfListOfShape Itl;
391 Standard_Integer i, j;
393 while (! EdgeList.IsEmpty())
396 TopoDS_Edge FirstEdge = TopoDS::Edge(EdgeList.First());
398 EdgeList.RemoveFirst();
399 TopoDS_Vertex V_wire[2], V_edge[2];
403 TopoDS_Wire CurWire = MW.Wire();
404 TopExp::Vertices(CurWire, V_wire[0], V_wire[1]);
405 Standard_Boolean found = Standard_False;
406 for (Itl.Initialize( EdgeList ); Itl.More(); Itl.Next())
408 TopoDS_Edge CurEdge = TopoDS::Edge(Itl.Value());
409 TopExp::Vertices(CurEdge, V_edge[0], V_edge[1]);
410 for (i = 0; i < 2; i++)
412 for (j = 0; j < 2; j++)
413 if (V_wire[i].IsSame(V_edge[j]))
416 EdgeList.Remove(Itl);
417 found = Standard_True;
426 if (!found) //try to find geometric coincidence
429 P_wire[0] = BRep_Tool::Pnt(V_wire[0]);
430 P_wire[1] = BRep_Tool::Pnt(V_wire[1]);
431 for (Itl.Initialize( EdgeList ); Itl.More(); Itl.Next())
433 TopoDS_Edge CurEdge = TopoDS::Edge(Itl.Value());
434 TopExp::Vertices(CurEdge, V_edge[0], V_edge[1]);
435 for (i = 0; i < 2; i++)
437 for (j = 0; j < 2; j++)
439 Standard_Real aDist = P_wire[i].Distance(BRep_Tool::Pnt(V_edge[j]));
440 if (aDist < BRep_Tool::Tolerance(V_wire[i]) &&
441 aDist < BRep_Tool::Tolerance(V_edge[j]))
444 myOldNewMap(CurEdge).Append(MW.Edge());
445 EdgeList.Remove(Itl);
446 found = Standard_True;
457 if (!found) //end of current wire, begin next wire
459 WireList.Append( MW.Wire() );
463 } //end of while (! EdgeList.IsEmpty())
466 //=======================================================================
467 //function : FindExtremitiesOfHoles
469 //======================================================================
470 void BRepFill_Filling::FindExtremitiesOfHoles(const TopTools_ListOfShape& WireList,
471 TopTools_SequenceOfShape& VerSeq ) const
473 TopTools_SequenceOfShape WireSeq;
474 TopTools_ListIteratorOfListOfShape Itl(WireList);
475 for (; Itl.More(); Itl.Next())
476 WireSeq.Append(Itl.Value());
479 theWire = TopoDS::Wire(WireSeq(1));
482 if (BRep_Tool::IsClosed(theWire))
485 TopoDS_Vertex Vfirst, Vlast;
486 TopExp::Vertices( theWire, Vfirst, Vlast );
488 if (Vfirst.IsSame(Vlast))
490 // The Wire is closed indeed despite its
491 // being not detected earlier.
496 gp_Vec FinVec = MakeFinVec( theWire, Vlast );
497 TopoDS_Vertex theVertex = Vlast;
498 VerSeq.Append( Vlast );
500 while (! WireSeq.IsEmpty())
502 TopoDS_Vertex MinVtx;
503 Standard_Integer i, MinInd = 1;
504 Standard_Boolean IsLast = Standard_False;
505 Standard_Real MinAngle = M_PI;
507 for (i = 1; i <= WireSeq.Length(); i++)
509 const TopoDS_Wire& CurWire = TopoDS::Wire( WireSeq(i) );
510 TopExp::Vertices( CurWire, Vfirst, Vlast );
512 Standard_Real angle =
513 FinVec.Angle(gp_Vec(BRep_Tool::Pnt(theVertex), BRep_Tool::Pnt(Vfirst)));
514 if (angle < MinAngle)
519 IsLast = Standard_True;
521 angle = FinVec.Angle(gp_Vec(BRep_Tool::Pnt(theVertex), BRep_Tool::Pnt(Vlast)));
522 if (angle < MinAngle)
527 IsLast = Standard_False;
530 VerSeq.Append( MinVtx );
531 const TopoDS_Wire& MinWire = TopoDS::Wire(WireSeq(MinInd));
532 TopExp::Vertices( MinWire, Vfirst, Vlast );
535 FinVec = MakeFinVec( MinWire, Vlast );
540 FinVec = MakeFinVec( MinWire, Vfirst );
543 VerSeq.Append( theVertex );
544 WireSeq.Remove(MinInd);
546 TopExp::Vertices( theWire, Vfirst, Vlast );
547 VerSeq.Append( Vfirst );
550 //=======================================================================
552 //purpose : builds the resulting face
553 //======================================================================
554 void BRepFill_Filling::Build()
556 GeomPlate_BuildPlateSurface thebuild( myDegree, myNbPtsOnCur, myNbIter,
557 myTol2d, myTol3d, myTolAng, myTolCurv, myAnisotropie );
559 myBuilder = thebuild;
562 Standard_Integer i, j;
564 //Creating array of vertices: extremities of wires
565 TopTools_SequenceOfShape VerSeq;
567 //Building missing bounds
568 TopTools_ListOfShape EdgeList, WireList;
569 for (i = 1; i <= myBoundary.Length(); i++)
570 EdgeList.Append( myBoundary(i).myEdge );
572 BuildWires( EdgeList, WireList );
573 FindExtremitiesOfHoles( WireList, VerSeq );
575 //Searching for surfaces for missing bounds
576 for (j = 1; j <= myFreeConstraints.Length(); j++)
578 GeomAPI_ProjectPointOnSurf Projector;
579 Quantity_Parameter U1, V1, U2, V2;
581 CurFace = myFreeConstraints(j).myFace;
582 Handle( BRepAdaptor_HSurface ) HSurf = new BRepAdaptor_HSurface();
583 HSurf->ChangeSurface().Initialize( CurFace );
584 Handle( Geom_Surface ) CurSurface = BRep_Tool::Surface( HSurf->ChangeSurface().Face() );
585 //BRepTopAdaptor_FClass2d Classifier( CurFace, Precision::Confusion() );
587 for (i = 1; i <= VerSeq.Length(); i += 2)
589 const TopoDS_Vertex& FirstVtx = TopoDS::Vertex(VerSeq(i));
590 const TopoDS_Vertex& LastVtx = TopoDS::Vertex(VerSeq(i+1));
592 gp_Pnt FirstPnt = BRep_Tool::Pnt(FirstVtx);
593 Projector.Init( FirstPnt, CurSurface );
594 if (Projector.LowerDistance() > Precision::Confusion())
596 Projector.LowerDistanceParameters( U1, V1 );
599 State = Classifier.Perform(gp_Pnt2d( U1, V1 ),
600 ((HSurf->IsUPeriodic() || HSurf->IsVPeriodic())? Standard_True : Standard_False));
601 if (State == TopAbs_OUT || State == TopAbs_UNKNOWN)
605 gp_Pnt LastPnt = BRep_Tool::Pnt(LastVtx);
606 Projector.Init( LastPnt, CurSurface );
607 if (Projector.LowerDistance() > Precision::Confusion())
609 Projector.LowerDistanceParameters( U2, V2 );
612 State = Classifier.Perform(gp_Pnt2d( U2, V2 ),
613 ((HSurf->IsUPeriodic() || HSurf->IsVPeriodic())? Standard_True : Standard_False));
614 if (State == TopAbs_OUT || State == TopAbs_UNKNOWN)
618 //Making the constraint
619 TColgp_Array1OfPnt2d Points( 1, 2 );
620 Points(1) = gp_Pnt2d( U1, V1 );
621 Points(2) = gp_Pnt2d( U2, V2 );
622 Handle( Geom2d_BezierCurve ) Line2d = new Geom2d_BezierCurve( Points );
623 TopoDS_Edge E = BRepLib_MakeEdge( Line2d, CurSurface, FirstVtx, LastVtx );
624 Add( E, CurFace, myFreeConstraints(j).myOrder );
625 VerSeq.Remove( i, i+1 );
627 } //for (i = 1; i <= VerSeq.Length(); i += 2)
628 } //for (j = 1; j <= myFreeConstraints.Length(); j++)
630 //Load initial surface to myBuilder if it is given
631 if (myIsInitFaceGiven)
633 Handle( BRepAdaptor_HSurface ) HSurfInit = new BRepAdaptor_HSurface();
634 HSurfInit->ChangeSurface().Initialize( myInitFace );
635 myBuilder.LoadInitSurface( BRep_Tool::Surface( HSurfInit->ChangeSurface().Face() ) );
638 //Adding constraints to myBuilder
639 AddConstraints( myBoundary );
640 myBuilder.SetNbBounds( myBoundary.Length() );
641 AddConstraints( myConstraints );
642 for (i = 1; i <= myPoints.Length(); i++)
643 myBuilder.Add( myPoints(i) );
646 if (myBuilder.IsDone())
647 myIsDone = Standard_True;
650 myIsDone = Standard_False;
654 Handle( GeomPlate_Surface ) GPlate = myBuilder.Surface();
655 Handle( Geom_BSplineSurface ) Surface;
657 Standard_Real dmax = 1.1 * myBuilder.G0Error(); //???????????
658 //Standard_Real dmax = myTol3d;
659 if (! myIsInitFaceGiven)
661 Standard_Real seuil; //?????
663 TColgp_SequenceOfXY S2d;
664 TColgp_SequenceOfXYZ S3d;
665 myBuilder.Disc2dContour(4,S2d);
666 myBuilder.Disc3dContour(4,0,S3d);
667 seuil = Max( myTol3d, 10*myBuilder.G0Error() ); //????????
668 GeomPlate_PlateG0Criterion Criterion( S2d, S3d, seuil );
669 GeomPlate_MakeApprox Approx( GPlate, Criterion, myTol3d, myMaxSegments, myMaxDeg );
670 Surface = Approx.Surface();
674 GeomPlate_MakeApprox Approx( GPlate, myTol3d, myMaxSegments, myMaxDeg, dmax, 0 ); //?????????????
675 //GeomConvert_ApproxSurface Approx( GPlate, myTol3d, GeomAbs_C1, GeomAbs_C1, myMaxDeg, myMaxDeg, myMaxSegments, 1 );
676 //Approx.Dump( cout );
677 Surface = Approx.Surface();
680 //Build the final wire and final face
681 TopTools_ListOfShape FinalEdges;
682 Handle(TColGeom2d_HArray1OfCurve) CurvesOnPlate = myBuilder.Curves2d();
684 for (i = 1; i <= myBoundary.Length(); i++)
686 const TopoDS_Edge& InitEdge = myBoundary(i).myEdge;
687 TopoDS_Edge anEdge = InitEdge;
688 if (!myOldNewMap(anEdge).IsEmpty())
689 anEdge = TopoDS::Edge( myOldNewMap(anEdge).First() );
690 Handle(Geom2d_Curve) aCurveOnPlate = CurvesOnPlate->Value(i);
692 TopoDS_Edge NewEdge = TopoDS::Edge(anEdge.EmptyCopied());
694 TopoDS_Vertex V1, V2;
695 TopExp::Vertices(anEdge, V1, V2, Standard_True); //with orientation
696 BB.UpdateVertex(V1, dmax);
697 BB.UpdateVertex(V2, dmax);
701 BB.UpdateEdge(NewEdge, aCurveOnPlate, Surface, Loc, dmax);
702 //BRepLib::SameRange(NewEdge);
703 BRepLib::SameParameter(NewEdge, dmax, Standard_True);
704 FinalEdges.Append(NewEdge);
705 myOldNewMap(InitEdge).Clear();
706 myOldNewMap(InitEdge).Append(NewEdge);
709 TopoDS_Wire FinalWire = WireFromList(FinalEdges);
710 if (!(FinalWire.Closed()))
711 Standard_Failure::Raise("Wire is not closed");
713 myFace = BRepLib_MakeFace( Surface, FinalWire );
716 //=======================================================================
719 //======================================================================
720 Standard_Boolean BRepFill_Filling::IsDone() const
725 //=======================================================================
727 //purpose : returns the result
728 //======================================================================
729 TopoDS_Face BRepFill_Filling::Face() const
734 //=======================================================================
735 //function : Generated
736 //purpose : returns the new edge (first in list) made from old edge "S"
737 //=======================================================================
738 const TopTools_ListOfShape& BRepFill_Filling::Generated(const TopoDS_Shape& S)
742 if (myOldNewMap.IsBound(S))
743 myGenerated.Append(myOldNewMap(S));
748 //==========================================================================
750 //purpose : returns maximum distance from boundary to the resulting surface
751 //==========================================================================
752 Standard_Real BRepFill_Filling::G0Error() const
754 return myBuilder.G0Error();
757 //=======================================================================
759 //purpose : returns maximum angle between the resulting surface
760 // and constraint surfaces at boundaries
761 //======================================================================
762 Standard_Real BRepFill_Filling::G1Error() const
764 return myBuilder.G1Error();
767 //=======================================================================
769 //purpose : returns maximum difference of curvature between
770 // the resulting surface and constraint surfaces at boundaries
771 //======================================================================
772 Standard_Real BRepFill_Filling::G2Error() const
774 return myBuilder.G2Error();
777 //==========================================================================
779 //purpose : returns maximum distance between the constraint number Index
780 // and the resulting surface
781 //==========================================================================
782 Standard_Real BRepFill_Filling::G0Error( const Standard_Integer Index )
784 return myBuilder.G0Error( Index );
787 //==========================================================================
789 //purpose : returns maximum angle between the constraint number Index
790 // and the resulting surface
791 //==========================================================================
792 Standard_Real BRepFill_Filling::G1Error( const Standard_Integer Index )
794 return myBuilder.G1Error( Index );
797 //==========================================================================
799 //purpose : returns maximum difference of curvature between
800 // the constraint number Index and the resulting surface
801 //==========================================================================
802 Standard_Real BRepFill_Filling::G2Error( const Standard_Integer Index )
804 return myBuilder.G2Error( Index );