1 // Created on: 1998-12-29
2 // Created by: Joelle CHAUVET
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.
19 #include <BRepFill_NSections.ixx>
21 #include <BRepFill.hxx>
22 #include <BRepTools_WireExplorer.hxx>
23 #include <BRep_Builder.hxx>
24 #include <BRep_Tool.hxx>
25 #include <BRepAdaptor_Curve.hxx>
26 #include <BRepLProp.hxx>
28 #include <BRepLib_MakeWire.hxx>
29 #include <BRepLib_MakeEdge.hxx>
32 #include <TopoDS_Vertex.hxx>
33 #include <TopoDS_Wire.hxx>
35 #include <Geom_Curve.hxx>
36 #include <Geom_Line.hxx>
37 #include <Geom_TrimmedCurve.hxx>
38 #include <Geom_BSplineCurve.hxx>
39 #include <Geom_Conic.hxx>
40 #include <GeomFill_UniformSection.hxx>
41 #include <GeomFill_EvolvedSection.hxx>
42 #include <GeomFill_HArray1OfSectionLaw.hxx>
43 #include <GeomFill_NSections.hxx>
44 #include <TColGeom_SequenceOfCurve.hxx>
45 #include <GeomFill_SectionGenerator.hxx>
46 #include <GeomFill_Line.hxx>
47 #include <GeomFill_AppSurf.hxx>
48 #include <GeomConvert.hxx>
49 #include <GeomConvert_ApproxCurve.hxx>
50 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
51 #include <Geom_BSplineSurface.hxx>
52 #include <BSplCLib.hxx>
54 #include <TColgp_HArray1OfPnt.hxx>
55 #include <TColStd_HArray1OfReal.hxx>
56 #include <TColStd_HArray1OfInteger.hxx>
57 #include <Geom_BezierCurve.hxx>
58 #include <TopTools_Array1OfShape.hxx>
60 #include <Precision.hxx>
63 static Standard_Boolean Affich = 0;
67 #include <DrawTrSurf.hxx>
72 //=======================================================================
73 //function : EdgeToBSpline
74 //purpose : auxiliary -- get curve from edge and convert it to bspline
75 // parameterized from 0 to 1
76 //=======================================================================
78 // NOTE: this code duplicates the same function in BRepOffsetAPI_ThruSections.cxx
79 static Handle(Geom_BSplineCurve) EdgeToBSpline (const TopoDS_Edge& theEdge)
81 Handle(Geom_BSplineCurve) aBSCurve;
82 if (BRep_Tool::Degenerated(theEdge)) {
83 // degenerated edge : construction of a point curve
84 TColStd_Array1OfReal aKnots (1,2);
88 TColStd_Array1OfInteger aMults (1,2);
92 TColgp_Array1OfPnt aPoles(1,2);
94 TopExp::Vertices(theEdge,vl,vf);
95 aPoles(1) = BRep_Tool::Pnt(vf);
96 aPoles(2) = BRep_Tool::Pnt(vl);
98 aBSCurve = new Geom_BSplineCurve (aPoles, aKnots, aMults, 1);
102 // get the curve of the edge
103 TopLoc_Location aLoc;
104 Standard_Real aFirst, aLast;
105 Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aLoc, aFirst, aLast);
107 // convert its part used by edge to bspline; note that if edge curve is bspline,
108 // conversion made via trimmed curve is still needed -- it will copy it, segment
109 // as appropriate, and remove periodicity if it is periodic (deadly for approximator)
110 Handle(Geom_TrimmedCurve) aTrimCurve = new Geom_TrimmedCurve (aCurve, aFirst, aLast);
112 // special treatment of conic curve
113 if (aTrimCurve->BasisCurve()->IsKind(STANDARD_TYPE(Geom_Conic)))
115 GeomConvert_ApproxCurve anAppr (aTrimCurve, Precision::Confusion(), GeomAbs_C1, 16, 14);
116 if (anAppr.HasResult())
117 aBSCurve = anAppr.Curve();
121 if (aBSCurve.IsNull())
122 aBSCurve = GeomConvert::CurveToBSplineCurve (aTrimCurve);
124 // apply transformation if needed
125 if (! aLoc.IsIdentity())
126 aBSCurve->Transform (aLoc.Transformation());
128 // reparameterize to [0,1]
129 TColStd_Array1OfReal aKnots (1, aBSCurve->NbKnots());
130 aBSCurve->Knots (aKnots);
131 BSplCLib::Reparametrize (0., 1., aKnots);
132 aBSCurve->SetKnots (aKnots);
135 // reverse curve if edge is reversed
136 if (theEdge.Orientation() == TopAbs_REVERSED)
142 //=======================================================================
143 //function : totalsurf
145 //=======================================================================
147 static Handle(Geom_BSplineSurface) totalsurf(const TopTools_Array2OfShape& shapes,
148 const Standard_Integer NbSects,
149 const Standard_Integer NbEdges,
150 const TColStd_SequenceOfReal& params,
151 const Standard_Boolean w1Point,
152 const Standard_Boolean w2Point,
153 const Standard_Boolean uClosed,
154 const Standard_Boolean vClosed,
155 const Standard_Real myPres3d)
157 Standard_Integer i,j,jdeb=1,jfin=NbSects;
161 GeomFill_SectionGenerator section;
162 Handle(Geom_BSplineSurface) surface;
163 Handle(Geom_BSplineCurve) BS, BS1;
167 edge = TopoDS::Edge(shapes.Value(1,1));
168 TopExp::Vertices(edge,vl,vf);
169 TColgp_Array1OfPnt Extremities(1,2);
170 Extremities(1) = BRep_Tool::Pnt(vf);
171 Extremities(2) = BRep_Tool::Pnt(vl);
172 TColStd_Array1OfReal Bounds(1,2);
175 TColStd_Array1OfInteger Mult(1,2);
178 Handle(Geom_BSplineCurve) BSPoint
179 = new Geom_BSplineCurve(Extremities,Bounds,Mult, 1);
180 section.AddCurve(BSPoint);
187 for (j=jdeb; j<=jfin; j++) {
189 // case of looping sections
190 if (j==jfin && vClosed) {
191 section.AddCurve(BS1);
195 // read the first edge to initialise CompBS;
196 TopoDS_Edge aPrevEdge = TopoDS::Edge (shapes.Value(1,j));
197 Handle(Geom_BSplineCurve) curvBS = EdgeToBSpline (aPrevEdge);
200 GeomConvert_CompCurveToBSplineCurve CompBS(curvBS);
202 for (i=2; i<=NbEdges; i++) {
204 TopoDS_Edge aNextEdge = TopoDS::Edge (shapes.Value(i,j));
205 curvBS = EdgeToBSpline (aNextEdge);
210 Standard_Boolean Bof = TopExp::CommonVertex(aPrevEdge, aNextEdge, ComV);
211 if (Bof) epsV = BRep_Tool::Tolerance(ComV);
212 else epsV = Precision::Confusion();
213 Bof = CompBS.Add(curvBS, epsV, Standard_True, Standard_False, 1);
214 if (!Bof) Bof = CompBS.Add(curvBS, 200*epsV,
215 Standard_True, Standard_False, 1);
217 // remember previous edge
218 aPrevEdge = aNextEdge;
221 // return the final section
222 BS = CompBS.BSplineCurve();
223 section.AddCurve(BS);
225 // case of looping sections
226 if (j==jdeb && vClosed) {
234 edge = TopoDS::Edge(shapes.Value(NbEdges,NbSects));
235 TopExp::Vertices(edge,vl,vf);
236 TColgp_Array1OfPnt Extremities(1,2);
237 Extremities(1) = BRep_Tool::Pnt(vf);
238 Extremities(2) = BRep_Tool::Pnt(vl);
239 TColStd_Array1OfReal Bounds(1,2);
242 TColStd_Array1OfInteger Mult(1,2);
245 Handle(Geom_BSplineCurve) BSPoint
246 = new Geom_BSplineCurve(Extremities,Bounds,Mult,1);
247 section.AddCurve(BSPoint);
250 Handle(TColStd_HArray1OfReal) HPar
251 = new TColStd_HArray1OfReal(1,params.Length());
252 for (i=1; i<=params.Length(); i++) {
253 HPar->SetValue(i,params(i));
255 section.SetParam(HPar);
256 section.Perform(Precision::PConfusion());
257 Handle(GeomFill_Line) line = new GeomFill_Line(NbSects);
258 Standard_Integer nbIt = 0, degmin = 2, degmax = 6;
259 Standard_Boolean knownP = Standard_True;
260 GeomFill_AppSurf anApprox(degmin, degmax, myPres3d, myPres3d, nbIt, knownP);
261 Standard_Boolean SpApprox = Standard_True;
262 anApprox.Perform(line, section, SpApprox);
263 Standard_Boolean uperiodic = uClosed;
264 Standard_Boolean vperiodic = vClosed;
265 Standard_Integer nup = anApprox.SurfPoles().ColLength(),
266 nvp = anApprox.SurfPoles().RowLength();
267 TColStd_Array1OfInteger Umults(1,anApprox.SurfUKnots().Length());
268 Umults = anApprox.SurfUMults();
269 TColStd_Array1OfInteger Vmults(1,anApprox.SurfVKnots().Length());
270 Vmults = anApprox.SurfVMults();
273 Standard_Integer nbuk = anApprox.SurfUKnots().Length();
280 Standard_Integer nbvk = anApprox.SurfVKnots().Length();
286 TColgp_Array2OfPnt poles (1, nup, 1, nvp);
287 TColStd_Array2OfReal weights(1, nup, 1, nvp);
288 for (j = 1; j <= nvp; j++) {
289 for (i = 1; i <= nup; i++) {
290 poles(i, j) = anApprox.SurfPoles()(i,j);
291 weights(i, j) = anApprox.SurfWeights()(i,j);
295 // To create non-rational surface if possible
296 Standard_Real TolEps = 1.e-13;
297 Standard_Boolean Vrational = Standard_False, Urational = Standard_False;
298 for (j = 1; j <= weights.UpperCol(); j++)
300 for (i = 1; i <= weights.UpperRow()-1; i++)
302 //Standard_Real signeddelta = weights(i,j) - weights(i+1,j);
303 Standard_Real delta = Abs( weights(i,j) - weights(i+1,j) );
304 // Standard_Real eps = Epsilon( Abs(weights(i,j)) );
305 if (delta > TolEps/* || delta > 3.*eps*/)
307 Vrational = Standard_True;
311 for (i = 1; i <= weights.UpperRow(); i++)
313 for (j = 1; j <= weights.UpperCol()-1; j++)
315 //Standard_Real signeddelta = weights(i,j) - weights(i,j+1);
316 Standard_Real delta = Abs( weights(i,j) - weights(i,j+1) );
317 // Standard_Real eps = Epsilon( Abs(weights(i,j)) );
318 if (delta > TolEps/* || delta > 3.*eps*/)
320 Urational = Standard_True;
324 if (!Vrational && !Urational)
326 Standard_Real theWeight = weights(1,1);
327 for (i = 1; i <= weights.UpperRow(); i++)
328 for (j = 1; j <= weights.UpperCol(); j++)
329 weights(i,j) = theWeight;
333 new Geom_BSplineSurface(poles, weights,
334 anApprox.SurfUKnots(), anApprox.SurfVKnots(),
336 anApprox.UDegree(), anApprox.VDegree(),
337 uperiodic, vperiodic);
343 //=======================================================================
346 //=======================================================================
348 BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
349 const Standard_Boolean Build)
355 TColStd_SequenceOfReal par;
357 for (Standard_Integer i=1;i<=S.Length();i++) {
364 //=======================================================================
366 //purpose : WSeq + Param
367 //=======================================================================
369 BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
370 const GeomFill_SequenceOfTrsf& Transformations,
371 const TColStd_SequenceOfReal & P,
372 const Standard_Real VF,
373 const Standard_Real VL,
374 const Standard_Boolean Build)
380 Standard_Integer NBSECT = 0;
381 for (Standard_Integer i=1;i<=S.Length();i++) {
384 sprintf(name,"WIRE_%d",NBSECT);
385 DBRep::Set(name,TopoDS::Wire(S.Value(i)));
390 Standard_Boolean ok = Standard_True;
391 for (Standard_Integer iseq=1;iseq<P.Length();iseq++) {
392 ok = ok && (P.Value(iseq)<P.Value(iseq+1));
397 myTrsfs = Transformations;
404 //=======================================================================
406 //purpose : Create a table of GeomFill_SectionLaw
407 //=======================================================================
408 void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
409 const Standard_Boolean Build)
411 BRepTools_WireExplorer wexp;
412 // Class BRep_Tool without fields and without Constructor :
415 Standard_Integer ii, NbEdge, jj, NbSects = P.Length();
416 Standard_Integer ideb = 1, ifin = NbSects;
417 Standard_Boolean wClosed, w1Point = Standard_True,
418 w2Point = Standard_True;
419 Standard_Real First, Last;
422 // Check if the start and end wires are punctual
423 W = TopoDS::Wire(myShapes(1));
424 for (wexp.Init(W); wexp.More(); wexp.Next())
425 // w1Point = w1Point && B.Degenerated(wexp.Current());
426 w1Point = w1Point && BRep_Tool::Degenerated(wexp.Current());
428 W = TopoDS::Wire(myShapes(NbSects));
429 for (wexp.Init(W); wexp.More(); wexp.Next())
430 // w2Point = w2Point && B.Degenerated(wexp.Current());
431 w2Point = w2Point && BRep_Tool::Degenerated(wexp.Current());
434 // Check if the start and end wires are identical
435 vclosed = myShapes(1).IsSame(myShapes(NbSects));
437 // Count the number of non-degenerated edges
438 W = TopoDS::Wire(myShapes(ideb));
439 for (NbEdge=0, wexp.Init(W); wexp.More(); wexp.Next())
440 // if (! B.Degenerated(wexp.Current())) NbEdge++;
441 if (! BRep_Tool::Degenerated(wexp.Current())) NbEdge++;
443 myEdges = new (TopTools_HArray2OfShape) (1, NbEdge, 1, NbSects);
446 uclosed = Standard_True;
447 for (jj=ideb;jj<=ifin;jj++){
449 W = TopoDS::Wire(myShapes(jj));
451 for (ii=1, wexp.Init(W); ii<=NbEdge ; wexp.Next(), ii++) {
454 // if ( ! B.Degenerated(E)) {
455 if ( ! BRep_Tool::Degenerated(E)) {
456 myEdges->SetValue(ii,jj, E);
460 // Is the law closed by U ?
462 wClosed = W.Closed();
464 // if unsure about the flag, make check
465 TopoDS_Edge Edge1, Edge2;
467 Edge1 = TopoDS::Edge (myEdges->Value(NbEdge,jj));
468 Edge2 = TopoDS::Edge (myEdges->Value(1,jj));
470 if ( Edge1.Orientation() == TopAbs_REVERSED) {
471 V1 = TopExp::FirstVertex(Edge1);
474 V1 = TopExp::LastVertex(Edge1);
476 if ( Edge2.Orientation() == TopAbs_REVERSED) {
477 V2 = TopExp::LastVertex(Edge2);
480 V2 = TopExp::FirstVertex(Edge2);
483 wClosed = Standard_True;
486 BRepAdaptor_Curve Curve1(Edge1);
487 BRepAdaptor_Curve Curve2(Edge2);
488 Standard_Real U1 = BRep_Tool::Parameter(V1,Edge1);
489 Standard_Real U2 = BRep_Tool::Parameter(V2,Edge2);
490 Standard_Real Eps = BRep_Tool::Tolerance(V2) +
491 BRep_Tool::Tolerance(V1);
493 wClosed = Curve1.Value(U1).IsEqual(Curve2.Value(U2), Eps);
496 if (!wClosed) uclosed = Standard_False;
499 // point sections at end
501 W = TopoDS::Wire(myShapes(1));
504 for (ii=1; ii<=NbEdge ; ii++) {
505 myEdges->SetValue(ii, 1, E);
510 W = TopoDS::Wire(myShapes(NbSects));
513 for (ii=1; ii<=NbEdge ; ii++) {
514 myEdges->SetValue(ii, NbSects, E);
519 myLaws = new (GeomFill_HArray1OfSectionLaw) (1, NbEdge);
521 Standard_Real tol = Precision::Confusion();
522 mySurface = totalsurf(myEdges->Array2(),myShapes.Length(),NbEdge,
523 myParams,w1Point,w2Point,uclosed,vclosed,tol);
525 // Increase the degree so that the position D2
526 // on GeomFill_NSections could be correct
527 // see comments in GeomFill_NSections
528 if (mySurface->VDegree()<2) {
529 mySurface->IncreaseDegree(mySurface->UDegree(),2);
533 char* name = new char[100];
534 sprintf(name,"Ref_Surf");
535 DrawTrSurf::Set(name,mySurface);
541 for (ii=1; ii<=NbEdge ; ii++) {
542 TColGeom_SequenceOfCurve NC;
544 for (jj=1;jj<=NbSects;jj++) {
545 E = TopoDS::Edge (myEdges->Value(ii,jj));
546 Handle(Geom_Curve) C;
547 // if (B.Degenerated(E)) {
548 if (BRep_Tool::Degenerated(E)) {
550 TopExp::Vertices(E,vl,vf);
551 TColgp_Array1OfPnt Extremities(1,2);
552 Extremities(1) = BRep_Tool::Pnt(vf);
553 Extremities(2) = BRep_Tool::Pnt(vl);
554 TColStd_Array1OfReal Bounds(1,2);
557 TColStd_Array1OfInteger Mult(1,2);
560 Handle(Geom_BSplineCurve) BSPoint
561 = new Geom_BSplineCurve(Extremities,Bounds,Mult,1);
565 C = BRep_Tool::Curve(E,First,Last);
567 if (E.Orientation() == TopAbs_REVERSED) {
569 Handle(Geom_Curve) CBis;
570 CBis = C->Reversed(); // To avoid the spoiling of the topology
571 aux = C->ReversedParameter(First);
572 First = C->ReversedParameter(Last);
576 if ((ii>1) || (!BRep_Tool::IsClosed(E)) ) { // Cut C
577 Handle(Geom_TrimmedCurve) TC =
578 new (Geom_TrimmedCurve) (C,First, Last);
581 // otherwise preserve the integrity of the curve
586 Standard_Real Ufirst = ii-1;
587 Standard_Real Ulast = ii;
588 myLaws->ChangeValue(ii) = new (GeomFill_NSections)(NC, myTrsfs, myParams,
599 //=======================================================================
600 //function : IsVertex
602 //=======================================================================
603 Standard_Boolean BRepFill_NSections::IsVertex() const
605 return Standard_False;
608 //=======================================================================
609 //function : IsConstant
611 //=======================================================================
612 Standard_Boolean BRepFill_NSections::IsConstant() const
614 return Standard_False;
617 //=======================================================================
620 //=======================================================================
622 BRepFill_NSections::Vertex(const Standard_Integer Index,
623 const Standard_Real Param) const
630 if (Index <= myEdges->ColLength()) {
631 Handle(Geom_BSplineCurve) Curve
632 = Handle(Geom_BSplineCurve)::DownCast(myLaws->Value(Index)->
633 BSplineSurface()->VIso(Param));
634 Standard_Real first = Curve ->FirstParameter();
636 B.UpdateVertex(V, P, Precision::Confusion());
638 else if (Index == myEdges->ColLength()+1) {
639 Handle(Geom_BSplineCurve) Curve
640 = Handle(Geom_BSplineCurve)::DownCast(myLaws->Value(Index-1)->
641 BSplineSurface()->VIso(Param));
642 Standard_Real last = Curve ->LastParameter();
644 B.UpdateVertex(V, P, Precision::Confusion());
651 ///=======================================================================
652 //function : VertexTol
653 //purpose : Evaluate the hole between 2 edges of the section
654 //=======================================================================
655 Standard_Real BRepFill_NSections::VertexTol(const Standard_Integer Index,
656 const Standard_Real Param) const
658 Standard_Real Tol = Precision::Confusion();
659 Standard_Integer I1, I2;
660 if ( (Index==0) || (Index==myEdges->ColLength()) ) {
661 if (!uclosed) return Tol; //The least possible error
662 I1 = myEdges->ColLength();
670 Handle(GeomFill_SectionLaw) Loi;
671 Standard_Integer NbPoles, NbKnots, Degree;
672 Handle(TColgp_HArray1OfPnt) Poles;
673 Handle(TColStd_HArray1OfReal) Knots, Weigth;
674 Handle(TColStd_HArray1OfInteger) Mults;
675 Handle(Geom_BSplineCurve) BS;
678 Loi = myLaws->Value(I1);
679 Loi->SectionShape( NbPoles, NbKnots, Degree);
680 Poles = new (TColgp_HArray1OfPnt) (1, NbPoles);
681 Weigth = new (TColStd_HArray1OfReal) (1, NbPoles);
682 Loi->D0(Param, Poles->ChangeArray1(), Weigth->ChangeArray1());
683 Knots = new (TColStd_HArray1OfReal) (1, NbKnots);
684 Loi->Knots(Knots->ChangeArray1());
685 Mults = new (TColStd_HArray1OfInteger) (1, NbKnots);
686 Loi->Mults(Mults->ChangeArray1());
687 BS = new (Geom_BSplineCurve) (Poles->Array1(),
693 PFirst = BS->Value( Knots->Value(Knots->Length()) );
695 Loi = myLaws->Value(I2);
696 Loi->SectionShape( NbPoles, NbKnots, Degree);
697 Poles = new (TColgp_HArray1OfPnt) (1, NbPoles);
698 Weigth = new (TColStd_HArray1OfReal) (1, NbPoles);
699 Loi->D0(Param, Poles->ChangeArray1(), Weigth->ChangeArray1());
700 Knots = new (TColStd_HArray1OfReal) (1, NbKnots);
701 Loi->Knots(Knots->ChangeArray1());
702 Mults = new (TColStd_HArray1OfInteger) (1, NbKnots);
703 Loi->Mults(Mults->ChangeArray1());
704 BS = new (Geom_BSplineCurve) (Poles->Array1(),
710 Tol += PFirst.Distance(BS->Value( Knots->Value(1)));
714 //=======================================================================
715 //function : ConcatenedLaw
717 //=======================================================================
719 Handle(GeomFill_SectionLaw) BRepFill_NSections::ConcatenedLaw() const
721 Handle(GeomFill_SectionLaw) Law;
722 if (myLaws->Length() == 1)
723 return myLaws->Value(1);
725 Standard_Real Ufirst, Ulast, Vfirst, Vlast;
726 mySurface->Bounds(Ufirst, Ulast, Vfirst, Vlast);
727 TColGeom_SequenceOfCurve NCompo;
729 for (Standard_Integer jj=1; jj<=myShapes.Length(); jj++) {
730 NCompo.Append(mySurface->VIso(myParams(jj)));
732 Law = new (GeomFill_NSections)(NCompo, myTrsfs, myParams,
740 //=======================================================================
741 //function : Continuity
743 //=======================================================================
744 GeomAbs_Shape BRepFill_NSections::Continuity(const Standard_Integer Index,
745 const Standard_Real TolAngular) const
749 GeomAbs_Shape cont_jj;
750 GeomAbs_Shape cont = GeomAbs_C0;
752 for (jj=1; jj<=myShapes.Length(); jj++) {
754 TopoDS_Edge Edge1, Edge2;
755 if ( (Index==0) || (Index==myEdges->ColLength()) ) {
756 if (!uclosed) return GeomAbs_C0; //The least possible error
758 Edge1 = TopoDS::Edge (myEdges->Value(myEdges->ColLength(),jj));
759 Edge2 = TopoDS::Edge (myEdges->Value(1,jj));
762 Edge1 = TopoDS::Edge (myEdges->Value(Index,jj));
763 Edge2 = TopoDS::Edge (myEdges->Value(Index+1,jj));
767 if ( Edge1.Orientation() == TopAbs_REVERSED) {
768 V1 = TopExp::FirstVertex(Edge1);
771 V1 = TopExp::LastVertex(Edge1);
773 if ( Edge2.Orientation() == TopAbs_REVERSED) {
774 V2 = TopExp::LastVertex(Edge2);
777 V2 = TopExp::FirstVertex(Edge2);
780 if (BRep_Tool::Degenerated(Edge1) || BRep_Tool::Degenerated(Edge2))
781 cont_jj = GeomAbs_CN;
784 Standard_Real U1 = BRep_Tool::Parameter(V1,Edge1);
785 Standard_Real U2 = BRep_Tool::Parameter(V2,Edge2);
786 BRepAdaptor_Curve Curve1(Edge1);
787 BRepAdaptor_Curve Curve2(Edge2);
788 Standard_Real Eps = BRep_Tool::Tolerance(V2) +
789 BRep_Tool::Tolerance(V1);
790 cont_jj = BRepLProp::Continuity(Curve1,Curve2,U1,U2, Eps, TolAngular);
793 if (jj==1) cont = cont_jj;
794 if (cont>cont_jj) cont = cont_jj;
801 //=======================================================================
804 //=======================================================================
805 void BRepFill_NSections::D0(const Standard_Real V, TopoDS_Shape& S)
809 Standard_Integer ii, NbEdge = myLaws->Length();
810 for (ii=1; ii<=NbEdge ; ii++) {
811 Handle(Geom_BSplineCurve) Curve
812 = Handle(Geom_BSplineCurve)::DownCast(myLaws->Value(ii)->BSplineSurface()->VIso(V));
813 Standard_Real first = Curve ->FirstParameter(),
814 last = Curve ->LastParameter();
815 TopoDS_Edge E = BRepLib_MakeEdge(Curve,first,last);
818 TopAbs_Orientation Orien = TopAbs_FORWARD;
819 TopoDS_Shape aLocalShape = MW.Wire().Oriented(Orien);
820 S = TopoDS::Wire(aLocalShape);
821 // S = TopoDS::Wire(MW.Wire().Oriented(Orien));