1 // Created on: 1995-01-27
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1995-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 <GeomInt_IntSS.hxx>
20 #include <Adaptor3d_TopolTool.hxx>
21 #include <Approx_CurveOnSurface.hxx>
23 #include <Extrema_ExtPS.hxx>
24 #include <Geom2dAdaptor.hxx>
25 #include <Geom2dAdaptor_Curve.hxx>
26 #include <Geom2dInt_GInter.hxx>
27 #include <Geom2d_Curve.hxx>
28 #include <Geom2d_Line.hxx>
29 #include <Geom2d_TrimmedCurve.hxx>
30 #include <GeomAdaptor.hxx>
31 #include <GeomAdaptor_HSurface.hxx>
32 #include <GeomInt.hxx>
33 #include <GeomInt_LineTool.hxx>
34 #include <GeomInt_WLApprox.hxx>
35 #include <GeomLib_Check2dBSplineCurve.hxx>
36 #include <GeomLib_CheckBSplineCurve.hxx>
37 #include <GeomProjLib.hxx>
38 #include <Geom_BSplineCurve.hxx>
39 #include <Geom_Circle.hxx>
40 #include <Geom_Ellipse.hxx>
41 #include <Geom_Hyperbola.hxx>
42 #include <Geom_Line.hxx>
43 #include <Geom_Parabola.hxx>
44 #include <Geom_TrimmedCurve.hxx>
45 #include <IntPatch_ALine.hxx>
46 #include <IntPatch_ALineToWLine.hxx>
47 #include <IntPatch_GLine.hxx>
48 #include <IntPatch_RLine.hxx>
49 #include <IntPatch_WLine.hxx>
50 #include <IntRes2d_IntersectionSegment.hxx>
51 #include <IntSurf_Quadric.hxx>
52 #include <Geom_Surface.hxx>
54 //=======================================================================
55 //function : AdjustUPeriodic
57 //=======================================================================
58 static void AdjustUPeriodic (const Handle(Geom_Surface)& aS, const Handle(Geom2d_Curve)& aC2D)
60 if (aC2D.IsNull() || !aS->IsUPeriodic())
63 const Standard_Real aEps=Precision::PConfusion();//1.e-9
64 const Standard_Real aEpsilon=Epsilon(10.);//1.77e-15
66 Standard_Real umin,umax,vmin,vmax;
67 aS->Bounds(umin,umax,vmin,vmax);
68 const Standard_Real aPeriod = aS->UPeriod();
70 const Standard_Real aT1=aC2D->FirstParameter();
71 const Standard_Real aT2=aC2D->LastParameter();
72 const Standard_Real aTx=aT1+0.467*(aT2-aT1);
73 const gp_Pnt2d aPx=aC2D->Value(aTx);
75 Standard_Real aUx=aPx.X();
76 if (fabs(aUx)<aEpsilon)
78 if (fabs(aUx-aPeriod)<aEpsilon)
82 while(aUx <(umin-aEps)) {
86 while(aUx>(umax+aEps)) {
92 gp_Vec2d aV2D(dU, 0.);
93 aC2D->Translate(aV2D);
97 //=======================================================================
98 //function : GetQuadric
100 //=======================================================================
101 static void GetQuadric(const Handle(GeomAdaptor_HSurface)& HS1, IntSurf_Quadric& quad1)
103 switch (HS1->Surface().GetType())
105 case GeomAbs_Plane: quad1.SetValue(HS1->Surface().Plane()); break;
106 case GeomAbs_Cylinder: quad1.SetValue(HS1->Surface().Cylinder()); break;
107 case GeomAbs_Cone: quad1.SetValue(HS1->Surface().Cone()); break;
108 case GeomAbs_Sphere: quad1.SetValue(HS1->Surface().Sphere()); break;
109 case GeomAbs_Torus: quad1.SetValue(HS1->Surface().Torus()); break;
110 default: Standard_ConstructionError::Raise("GeomInt_IntSS::MakeCurve");
114 //=======================================================================
115 //function : Parameters
117 //=======================================================================
118 static void Parameters( const Handle(GeomAdaptor_HSurface)& HS1,
119 const Handle(GeomAdaptor_HSurface)& HS2,
126 IntSurf_Quadric quad1,quad2;
128 GetQuadric(HS1, quad1);
129 GetQuadric(HS2, quad2);
131 quad1.Parameters(Ptref,U1,V1);
132 quad2.Parameters(Ptref,U2,V2);
135 //=======================================================================
136 //function : ParametersOfNearestPointOnSurface
138 //=======================================================================
139 static Standard_Boolean ParametersOfNearestPointOnSurface(const Extrema_ExtPS theExtr,
143 if(!theExtr.IsDone() || !theExtr.NbExt())
144 return Standard_False;
146 Standard_Integer anIndex = 1;
147 Standard_Real aMinSQDist = theExtr.SquareDistance(anIndex);
148 for(Standard_Integer i = 2; i <= theExtr.NbExt(); i++)
150 Standard_Real aSQD = theExtr.SquareDistance(i);
151 if (aSQD < aMinSQDist)
158 theExtr.Point(anIndex).Parameter(theU, theV);
160 return Standard_True;
163 //=======================================================================
164 //function : GetSegmentBoundary
166 //=======================================================================
167 static void GetSegmentBoundary( const IntRes2d_IntersectionSegment& theSegm,
168 const Handle(Geom2d_Curve)& theCurve,
169 GeomInt_VectorOfReal& theArrayOfParameters)
171 Standard_Real aU1 = theCurve->FirstParameter(), aU2 = theCurve->LastParameter();
173 if(theSegm.HasFirstPoint())
175 const IntRes2d_IntersectionPoint& anIPF = theSegm.FirstPoint();
176 aU1 = anIPF.ParamOnFirst();
179 if(theSegm.HasLastPoint())
181 const IntRes2d_IntersectionPoint& anIPL = theSegm.LastPoint();
182 aU2 = anIPL.ParamOnFirst();
185 theArrayOfParameters.Append(aU1);
186 theArrayOfParameters.Append(aU2);
189 //=======================================================================
190 //function : IntersectCurveAndBoundary
192 //=======================================================================
193 static void IntersectCurveAndBoundary(const Handle(Geom2d_Curve)& theC2d,
194 const Handle(Geom2d_Curve)* const theArrBounds,
195 const Standard_Integer theNumberOfCurves,
196 const Standard_Real theTol,
197 GeomInt_VectorOfReal& theArrayOfParameters)
202 Geom2dAdaptor_Curve anAC1(theC2d);
203 for(Standard_Integer aCurID = 0; aCurID < theNumberOfCurves; aCurID++)
205 if(theArrBounds[aCurID].IsNull())
208 Geom2dAdaptor_Curve anAC2(theArrBounds[aCurID]);
209 Geom2dInt_GInter anIntCC2d(anAC1, anAC2, theTol, theTol);
211 if(!anIntCC2d.IsDone() || anIntCC2d.IsEmpty())
214 for (Standard_Integer aPntID = 1; aPntID <= anIntCC2d.NbPoints(); aPntID++)
216 const Standard_Real aParam = anIntCC2d.Point(aPntID).ParamOnFirst();
217 theArrayOfParameters.Append(aParam);
220 for (Standard_Integer aSegmID = 1; aSegmID <= anIntCC2d.NbSegments(); aSegmID++)
222 GetSegmentBoundary(anIntCC2d.Segment(aSegmID), theC2d, theArrayOfParameters);
227 //=======================================================================
228 //function : isDegenerated
229 //purpose : Check if theAHC2d corresponds to a degenerated edge.
230 //=======================================================================
231 static Standard_Boolean isDegenerated(const Handle(GeomAdaptor_HSurface)& theGAHS,
232 const Handle(Adaptor2d_HCurve2d)& theAHC2d,
233 const Standard_Real theFirstPar,
234 const Standard_Real theLastPar)
236 const Standard_Real aSqTol = Precision::Confusion()*Precision::Confusion();
240 theAHC2d->D0(theFirstPar, aP2d);
241 theGAHS->D0(aP2d.X(), aP2d.Y(), aP1);
243 theAHC2d->D0(theLastPar, aP2d);
244 theGAHS->D0(aP2d.X(), aP2d.Y(), aP2);
246 if(aP1.SquareDistance(aP2) > aSqTol)
247 return Standard_False;
249 theAHC2d->D0(0.5*(theFirstPar+theLastPar), aP2d);
250 theGAHS->D0(aP2d.X(), aP2d.Y(), aP2);
252 if(aP1.SquareDistance(aP2) > aSqTol)
253 return Standard_False;
255 return Standard_True;
258 //=======================================================================
259 //function : MakeCurve
261 //=======================================================================
262 void GeomInt_IntSS::MakeCurve(const Standard_Integer Index,
263 const Handle(Adaptor3d_TopolTool) & dom1,
264 const Handle(Adaptor3d_TopolTool) & dom2,
265 const Standard_Real Tol,
266 const Standard_Boolean Approx,
267 const Standard_Boolean ApproxS1,
268 const Standard_Boolean ApproxS2)
271 Standard_Boolean myApprox1, myApprox2, myApprox;
272 Standard_Real Tolpc, myTolApprox;
274 Handle(Geom2d_BSplineCurve) H1;
275 Handle(Geom_Surface) aS1, aS2;
281 myTolApprox=0.0000001;
283 aS1=myHS1->ChangeSurface().Surface();
284 aS2=myHS2->ChangeSurface().Surface();
286 Handle(IntPatch_Line) L = myIntersector.Line(Index);
289 if(typl==IntPatch_Walking) {
290 Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast(L));
291 if(aWLine.IsNull()) {
298 myLConstruct.Perform(L);
299 if (!myLConstruct.IsDone() || myLConstruct.NbParts() <= 0) {
304 Standard_Integer i, j, aNbParts;
305 Standard_Real fprm, lprm;
306 Handle(Geom_Curve) newc;
309 //########################################
310 // Line, Parabola, Hyperbola
311 //########################################
313 case IntPatch_Parabola:
314 case IntPatch_Hyperbola: {
315 if (typl == IntPatch_Lin) {
316 newc=new Geom_Line (Handle(IntPatch_GLine)::DownCast(L)->Line());
318 else if (typl == IntPatch_Parabola) {
319 newc=new Geom_Parabola(Handle(IntPatch_GLine)::DownCast(L)->Parabola());
321 else if (typl == IntPatch_Hyperbola) {
322 newc=new Geom_Hyperbola (Handle(IntPatch_GLine)::DownCast(L)->Hyperbola());
325 aNbParts=myLConstruct.NbParts();
326 for (i=1; i<=aNbParts; i++) {
327 myLConstruct.Part(i, fprm, lprm);
329 if (!Precision::IsNegativeInfinite(fprm) &&
330 !Precision::IsPositiveInfinite(lprm)) {
331 Handle(Geom_TrimmedCurve) aCT3D=new Geom_TrimmedCurve(newc, fprm, lprm);
335 Handle (Geom2d_Curve) C2d;
336 BuildPCurves(fprm, lprm, Tolpc, myHS1->ChangeSurface().Surface(), newc, C2d);
337 if(Tolpc>myTolReached2d || myTolReached2d==0.) {
338 myTolReached2d=Tolpc;
340 slineS1.Append(new Geom2d_TrimmedCurve(C2d,fprm,lprm));
347 Handle (Geom2d_Curve) C2d;
348 BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
349 if(Tolpc>myTolReached2d || myTolReached2d==0.) {
350 myTolReached2d=Tolpc;
353 slineS2.Append(new Geom2d_TrimmedCurve(C2d,fprm,lprm));
358 } // if (!Precision::IsNegativeInfinite(fprm) && !Precision::IsPositiveInfinite(lprm))
361 GeomAbs_SurfaceType typS1 = myHS1->Surface().GetType();
362 GeomAbs_SurfaceType typS2 = myHS2->Surface().GetType();
363 if( typS1 == GeomAbs_SurfaceOfExtrusion ||
364 typS1 == GeomAbs_OffsetSurface ||
365 typS1 == GeomAbs_SurfaceOfRevolution ||
366 typS2 == GeomAbs_SurfaceOfExtrusion ||
367 typS2 == GeomAbs_OffsetSurface ||
368 typS2 == GeomAbs_SurfaceOfRevolution) {
374 Standard_Boolean bFNIt, bLPIt;
375 Standard_Real aTestPrm, dT=100.;
376 Standard_Real u1, v1, u2, v2, TolX;
378 bFNIt=Precision::IsNegativeInfinite(fprm);
379 bLPIt=Precision::IsPositiveInfinite(lprm);
383 if (bFNIt && !bLPIt) {
386 else if (!bFNIt && bLPIt) {
390 gp_Pnt ptref(newc->Value(aTestPrm));
392 TolX = Precision::Confusion();
393 Parameters(myHS1, myHS2, ptref, u1, v1, u2, v2);
394 ok = (dom1->Classify(gp_Pnt2d(u1, v1), TolX) != TopAbs_OUT);
396 ok = (dom2->Classify(gp_Pnt2d(u2,v2),TolX) != TopAbs_OUT);
404 }// end of for (i=1; i<=myLConstruct.NbParts(); i++)
405 }// case IntPatch_Lin: case IntPatch_Parabola: case IntPatch_Hyperbola:
408 //########################################
409 // Circle and Ellipse
410 //########################################
411 case IntPatch_Circle:
412 case IntPatch_Ellipse: {
414 if (typl == IntPatch_Circle) {
415 newc = new Geom_Circle
416 (Handle(IntPatch_GLine)::DownCast(L)->Circle());
419 newc = new Geom_Ellipse
420 (Handle(IntPatch_GLine)::DownCast(L)->Ellipse());
423 Standard_Real aPeriod, aRealEpsilon;
425 aRealEpsilon=RealEpsilon();
428 aNbParts=myLConstruct.NbParts();
430 for (i=1; i<=aNbParts; i++) {
431 myLConstruct.Part(i, fprm, lprm);
433 if (Abs(fprm) > aRealEpsilon || Abs(lprm-aPeriod) > aRealEpsilon) {
434 //==============================================
435 Handle(Geom_TrimmedCurve) aTC3D=new Geom_TrimmedCurve(newc,fprm,lprm);
439 fprm=aTC3D->FirstParameter();
440 lprm=aTC3D->LastParameter ();
443 Handle (Geom2d_Curve) C2d;
444 BuildPCurves(fprm,lprm,Tolpc,myHS1->ChangeSurface().Surface(),newc,C2d);
445 if(Tolpc>myTolReached2d || myTolReached2d==0.) {
446 myTolReached2d=Tolpc;
455 Handle (Geom2d_Curve) C2d;
456 BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
457 if(Tolpc>myTolReached2d || myTolReached2d==0) {
458 myTolReached2d=Tolpc;
465 //==============================================
466 } //if (Abs(fprm) > RealEpsilon() || Abs(lprm-2.*M_PI) > RealEpsilon())
468 else {// on regarde si on garde
471 if (Abs(fprm) < RealEpsilon() && Abs(lprm-2.*M_PI) < RealEpsilon()) {
472 Handle(Geom_TrimmedCurve) aTC3D=new Geom_TrimmedCurve(newc,fprm,lprm);
475 fprm=aTC3D->FirstParameter();
476 lprm=aTC3D->LastParameter ();
479 Handle (Geom2d_Curve) C2d;
480 BuildPCurves(fprm,lprm,Tolpc,myHS1->ChangeSurface().Surface(),newc,C2d);
481 if(Tolpc>myTolReached2d || myTolReached2d==0) {
482 myTolReached2d=Tolpc;
491 Handle (Geom2d_Curve) C2d;
492 BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
493 if(Tolpc>myTolReached2d || myTolReached2d==0) {
494 myTolReached2d=Tolpc;
505 Standard_Real aTwoPIdiv17, u1, v1, u2, v2, TolX;
507 aTwoPIdiv17=2.*M_PI/17.;
509 for (j=0; j<=17; j++) {
510 gp_Pnt ptref (newc->Value (j*aTwoPIdiv17));
511 TolX = Precision::Confusion();
513 Parameters(myHS1, myHS2, ptref, u1, v1, u2, v2);
514 ok = (dom1->Classify(gp_Pnt2d(u1,v1),TolX) != TopAbs_OUT);
516 ok = (dom2->Classify(gp_Pnt2d(u2,v2),TolX) != TopAbs_OUT);
520 //==============================================
522 Handle (Geom2d_Curve) C2d;
523 BuildPCurves(fprm, lprm, Tolpc, myHS1->ChangeSurface().Surface(), newc, C2d);
524 if(Tolpc>myTolReached2d || myTolReached2d==0) {
525 myTolReached2d=Tolpc;
534 Handle (Geom2d_Curve) C2d;
535 BuildPCurves(fprm, lprm, Tolpc,myHS2->ChangeSurface().Surface(), newc, C2d);
536 if(Tolpc>myTolReached2d || myTolReached2d==0) {
537 myTolReached2d=Tolpc;
546 }// end of for (Standard_Integer j=0; j<=17; j++)
547 }// end of else { on regarde si on garde
548 }// for (i=1; i<=myLConstruct.NbParts(); i++)
549 }// IntPatch_Circle: IntPatch_Ellipse
552 //########################################
554 //########################################
555 case IntPatch_Analytic: {
556 IntSurf_Quadric quad1,quad2;
558 GetQuadric(myHS1, quad1);
559 GetQuadric(myHS2, quad2);
561 IntPatch_ALineToWLine convert (quad1, quad2);
564 Handle(Geom2d_BSplineCurve) aH1, aH2;
566 aNbParts=myLConstruct.NbParts();
567 for (i=1; i<=aNbParts; i++) {
568 myLConstruct.Part(i, fprm, lprm);
569 Handle(IntPatch_WLine) WL =
570 convert.MakeWLine(Handle(IntPatch_ALine)::DownCast(L), fprm, lprm);
573 aH1 = MakeBSpline2d(WL, 1, WL->NbPnts(), Standard_True);
577 aH2 = MakeBSpline2d(WL, 1, WL->NbPnts(), Standard_False);
579 sline.Append(MakeBSpline(WL,1,WL->NbPnts()));
585 else { // myApprox=TRUE
586 GeomInt_WLApprox theapp3d;
587 Standard_Real tol2d = myTolApprox;
589 theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_True);
591 aNbParts=myLConstruct.NbParts();
592 for (i=1; i<=aNbParts; i++) {
593 myLConstruct.Part(i, fprm, lprm);
594 Handle(IntPatch_WLine) WL =
595 convert.MakeWLine(Handle(IntPatch_ALine):: DownCast(L),fprm,lprm);
597 theapp3d.Perform(myHS1,myHS2,WL,Standard_True,myApprox1,myApprox2, 1, WL->NbPnts());
598 if (!theapp3d.IsDone()) {
600 Handle(Geom2d_BSplineCurve) aH1, aH2;
603 aH1 = MakeBSpline2d(WL, 1, WL->NbPnts(), Standard_True);
607 aH2 = MakeBSpline2d(WL, 1, WL->NbPnts(), Standard_False);
609 sline.Append(MakeBSpline(WL,1,WL->NbPnts()));
615 if(myApprox1 || myApprox2) {
616 if( theapp3d.TolReached2d()>myTolReached2d || myTolReached2d==0) {
617 myTolReached2d = theapp3d.TolReached2d();
621 if( theapp3d.TolReached3d()>myTolReached3d || myTolReached3d==0) {
622 myTolReached3d = theapp3d.TolReached3d();
625 Standard_Integer aNbMultiCurves, nbpoles;
626 aNbMultiCurves=theapp3d.NbMultiCurves();
627 for (j=1; j<=aNbMultiCurves; j++) {
628 const AppParCurves_MultiBSpCurve& mbspc = theapp3d.Value(j);
630 nbpoles = mbspc.NbPoles();
631 TColgp_Array1OfPnt tpoles(1, nbpoles);
632 mbspc.Curve(1, tpoles);
633 Handle(Geom_BSplineCurve) BS=new Geom_BSplineCurve(tpoles,
635 mbspc.Multiplicities(),
638 GeomLib_CheckBSplineCurve Check(BS, myTolCheck, myTolAngCheck);
639 Check.FixTangent(Standard_True,Standard_True);
644 TColgp_Array1OfPnt2d tpoles2d(1,nbpoles);
645 mbspc.Curve(2,tpoles2d);
646 Handle(Geom2d_BSplineCurve) BS2=new Geom2d_BSplineCurve(tpoles2d,
648 mbspc.Multiplicities(),
651 GeomLib_Check2dBSplineCurve newCheck(BS2,myTolCheck,myTolAngCheck);
652 newCheck.FixTangent(Standard_True,Standard_True);
660 TColgp_Array1OfPnt2d tpoles2d(1, nbpoles);
661 Standard_Integer TwoOrThree;
662 TwoOrThree=myApprox1 ? 3 : 2;
663 mbspc.Curve(TwoOrThree, tpoles2d);
664 Handle(Geom2d_BSplineCurve) BS2 =new Geom2d_BSplineCurve(tpoles2d,
666 mbspc.Multiplicities(),
669 GeomLib_Check2dBSplineCurve newCheck(BS2,myTolCheck,myTolAngCheck);
670 newCheck.FixTangent(Standard_True,Standard_True);
678 }// for (j=1; j<=aNbMultiCurves; j++) {
679 }// else from if (!theapp3d.IsDone())
680 }// for (i=1; i<=aNbParts; i++) {
681 }// else { // myApprox=TRUE
682 }// case IntPatch_Analytic:
685 //########################################
687 //########################################
688 case IntPatch_Walking:{
689 Handle(IntPatch_WLine) WL =
690 Handle(IntPatch_WLine)::DownCast(L);
692 #ifdef GEOMINT_INTSS_DEBUG
697 Standard_Integer ifprm, ilprm;
700 aNbParts=myLConstruct.NbParts();
701 for (i=1; i<=aNbParts; i++) {
702 myLConstruct.Part(i, fprm, lprm);
703 ifprm=(Standard_Integer)fprm;
704 ilprm=(Standard_Integer)lprm;
706 Handle(Geom2d_BSplineCurve) aH1, aH2;
709 aH1 = MakeBSpline2d(WL, ifprm, ilprm, Standard_True);
712 aH2 = MakeBSpline2d(WL, ifprm, ilprm, Standard_False);
715 Handle(Geom_Curve) aBSp=MakeBSpline(WL, ifprm, ilprm);
724 Standard_Boolean bIsDecomposited;
725 Standard_Integer nbiter, aNbSeqOfL;
726 GeomInt_WLApprox theapp3d;
727 IntPatch_SequenceOfLine aSeqOfL;
728 Standard_Real tol2d, aTolSS;
732 theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, myHS1 != myHS2);
735 GeomInt_LineTool::DecompositionOfWLine(WL, myHS1, myHS2, aTolSS, myLConstruct, aSeqOfL);
737 aNbParts=myLConstruct.NbParts();
738 aNbSeqOfL=aSeqOfL.Length();
740 nbiter = (bIsDecomposited) ? aNbSeqOfL : aNbParts;
742 for(i = 1; i <= nbiter; i++) {
743 if(bIsDecomposited) {
744 WL = Handle(IntPatch_WLine)::DownCast(aSeqOfL.Value(i));
746 ilprm = WL->NbPnts();
749 myLConstruct.Part(i, fprm, lprm);
750 ifprm = (Standard_Integer)fprm;
751 ilprm = (Standard_Integer)lprm;
754 //-- Si une des surfaces est un plan , on approxime en 2d
755 //-- sur cette surface et on remonte les points 2d en 3d.
756 GeomAbs_SurfaceType typs1, typs2;
757 typs1 = myHS1->Surface().GetType();
758 typs2 = myHS2->Surface().GetType();
760 if(typs1 == GeomAbs_Plane) {
761 theapp3d.Perform(myHS1, myHS2, WL, Standard_False,
762 Standard_True, myApprox2,
765 else if(typs2 == GeomAbs_Plane) {
766 theapp3d.Perform(myHS1,myHS2,WL,Standard_False,
767 myApprox1,Standard_True,
773 if ((typs1==GeomAbs_BezierSurface || typs1==GeomAbs_BSplineSurface) &&
774 (typs2==GeomAbs_BezierSurface || typs2==GeomAbs_BSplineSurface)) {
776 theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_True);
777 //Standard_Boolean bUseSurfaces;
778 //bUseSurfaces=NotUseSurfacesForApprox(myFace1, myFace2, WL, ifprm, ilprm);
779 //if (bUseSurfaces) {
780 //theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, Standard_False);
785 theapp3d.Perform(myHS1,myHS2,WL,Standard_True,
790 if (!theapp3d.IsDone()) {
792 Handle(Geom2d_BSplineCurve) aH1, aH2;
794 Handle(Geom_Curve) aBSp=MakeBSpline(WL, ifprm, ilprm);
796 aH1 = MakeBSpline2d(WL, ifprm, ilprm, Standard_True);
799 aH2 = MakeBSpline2d(WL, ifprm, ilprm, Standard_False);
805 }//if (!theapp3d.IsDone())
808 if(myApprox1 || myApprox2 || (typs1==GeomAbs_Plane || typs2==GeomAbs_Plane)) {
809 if( theapp3d.TolReached2d()>myTolReached2d || myTolReached2d==0.) {
810 myTolReached2d = theapp3d.TolReached2d();
813 if(typs1==GeomAbs_Plane || typs2==GeomAbs_Plane) {
814 myTolReached3d = myTolReached2d;
816 else if( theapp3d.TolReached3d()>myTolReached3d || myTolReached3d==0.) {
817 myTolReached3d = theapp3d.TolReached3d();
820 Standard_Integer aNbMultiCurves, nbpoles;
822 aNbMultiCurves=theapp3d.NbMultiCurves();
823 for (j=1; j<=aNbMultiCurves; j++) {
824 if(typs1 == GeomAbs_Plane) {
825 const AppParCurves_MultiBSpCurve& mbspc = theapp3d.Value(j);
826 nbpoles = mbspc.NbPoles();
828 TColgp_Array1OfPnt2d tpoles2d(1,nbpoles);
829 TColgp_Array1OfPnt tpoles(1,nbpoles);
831 mbspc.Curve(1,tpoles2d);
832 const gp_Pln& Pln = myHS1->Surface().Plane();
835 for(ik = 1; ik<= nbpoles; ik++) {
837 ElSLib::Value(tpoles2d.Value(ik).X(),
838 tpoles2d.Value(ik).Y(),
842 Handle(Geom_BSplineCurve) BS =
843 new Geom_BSplineCurve(tpoles,
845 mbspc.Multiplicities(),
847 GeomLib_CheckBSplineCurve Check(BS,myTolCheck,myTolAngCheck);
848 Check.FixTangent(Standard_True, Standard_True);
853 Handle(Geom2d_BSplineCurve) BS1 =
854 new Geom2d_BSplineCurve(tpoles2d,
856 mbspc.Multiplicities(),
858 GeomLib_Check2dBSplineCurve Check1(BS1,myTolCheck,myTolAngCheck);
859 Check1.FixTangent(Standard_True,Standard_True);
861 AdjustUPeriodic (aS1, BS1);
870 mbspc.Curve(2, tpoles2d);
872 Handle(Geom2d_BSplineCurve) BS2 = new Geom2d_BSplineCurve(tpoles2d,
874 mbspc.Multiplicities(),
876 GeomLib_Check2dBSplineCurve newCheck(BS2,myTolCheck,myTolAngCheck);
877 newCheck.FixTangent(Standard_True,Standard_True);
879 AdjustUPeriodic (aS2, BS2);
886 }//if(typs1 == GeomAbs_Plane)
888 else if(typs2 == GeomAbs_Plane) {
889 const AppParCurves_MultiBSpCurve& mbspc = theapp3d.Value(j);
890 nbpoles = mbspc.NbPoles();
892 TColgp_Array1OfPnt2d tpoles2d(1,nbpoles);
893 TColgp_Array1OfPnt tpoles(1,nbpoles);
894 mbspc.Curve((myApprox1==Standard_True)? 2 : 1,tpoles2d);
895 const gp_Pln& Pln = myHS2->Surface().Plane();
898 for(ik = 1; ik<= nbpoles; ik++) {
900 ElSLib::Value(tpoles2d.Value(ik).X(),
901 tpoles2d.Value(ik).Y(),
906 Handle(Geom_BSplineCurve) BS=new Geom_BSplineCurve(tpoles,
908 mbspc.Multiplicities(),
910 GeomLib_CheckBSplineCurve Check(BS,myTolCheck,myTolAngCheck);
911 Check.FixTangent(Standard_True,Standard_True);
916 Handle(Geom2d_BSplineCurve) BS1=new Geom2d_BSplineCurve(tpoles2d,
918 mbspc.Multiplicities(),
920 GeomLib_Check2dBSplineCurve Check1(BS1,myTolCheck,myTolAngCheck);
921 Check1.FixTangent(Standard_True,Standard_True);
924 AdjustUPeriodic (aS2, BS1);
933 mbspc.Curve(1,tpoles2d);
934 Handle(Geom2d_BSplineCurve) BS2=new Geom2d_BSplineCurve(tpoles2d,
936 mbspc.Multiplicities(),
938 GeomLib_Check2dBSplineCurve Check2(BS2,myTolCheck,myTolAngCheck);
939 Check2.FixTangent(Standard_True,Standard_True);
942 AdjustUPeriodic (aS1, BS2);
949 } // else if(typs2 == GeomAbs_Plane)
951 else { // typs1!=GeomAbs_Plane && typs2!=GeomAbs_Plane
952 const AppParCurves_MultiBSpCurve& mbspc = theapp3d.Value(j);
953 nbpoles = mbspc.NbPoles();
954 TColgp_Array1OfPnt tpoles(1,nbpoles);
955 mbspc.Curve(1,tpoles);
956 Handle(Geom_BSplineCurve) BS=new Geom_BSplineCurve(tpoles,
958 mbspc.Multiplicities(),
960 GeomLib_CheckBSplineCurve Check(BS,myTolCheck,myTolAngCheck);
961 Check.FixTangent(Standard_True,Standard_True);
964 Standard_Real aDist = Max(BS->StartPoint().XYZ().SquareModulus(),
965 BS->EndPoint().XYZ().SquareModulus());
966 Standard_Real eps = Epsilon(aDist);
967 if(BS->StartPoint().SquareDistance(BS->EndPoint()) < 2.*eps)
969 // Avoid creating B-splines containing two coincident poles only
970 if (mbspc.Degree() == 1 && nbpoles == 2)
973 if (!BS->IsClosed() && !BS->IsPeriodic())
976 gp_Pnt aPm((BS->Pole(1).XYZ() + BS->Pole(BS->NbPoles()).XYZ()) / 2.);
978 BS->SetPole(BS->NbPoles(), aPm);
984 TColgp_Array1OfPnt2d tpoles2d(1,nbpoles);
985 mbspc.Curve(2,tpoles2d);
986 Handle(Geom2d_BSplineCurve) BS1=new Geom2d_BSplineCurve(tpoles2d,
988 mbspc.Multiplicities(),
990 GeomLib_Check2dBSplineCurve newCheck(BS1,myTolCheck,myTolAngCheck);
991 newCheck.FixTangent(Standard_True,Standard_True);
993 AdjustUPeriodic (aS1, BS1);
1001 TColgp_Array1OfPnt2d tpoles2d(1,nbpoles);
1002 mbspc.Curve((myApprox1==Standard_True)? 3 : 2,tpoles2d);
1003 Handle(Geom2d_BSplineCurve) BS2=new Geom2d_BSplineCurve(tpoles2d,
1005 mbspc.Multiplicities(),
1007 GeomLib_Check2dBSplineCurve newCheck(BS2,myTolCheck,myTolAngCheck);
1008 newCheck.FixTangent(Standard_True,Standard_True);
1010 AdjustUPeriodic (aS2, BS2);
1012 slineS2.Append(BS2);
1017 }// else { // typs1!=GeomAbs_Plane && typs2!=GeomAbs_Plane
1018 }// for (j=1; j<=aNbMultiCurves; j++
1025 case IntPatch_Restriction:
1027 Handle(IntPatch_RLine) RL =
1028 Handle(IntPatch_RLine)::DownCast(L);
1029 Handle(Geom_Curve) aC3d;
1030 Handle(Geom2d_Curve) aC2d1, aC2d2;
1031 Standard_Real aTolReached;
1032 TreatRLine(RL, myHS1, myHS2, aC3d,
1033 aC2d1, aC2d2, aTolReached);
1038 Bnd_Box2d aBox1, aBox2;
1040 const Standard_Real aU1f = myHS1->FirstUParameter(),
1041 aV1f = myHS1->FirstVParameter(),
1042 aU1l = myHS1->LastUParameter(),
1043 aV1l = myHS1->LastVParameter();
1044 const Standard_Real aU2f = myHS2->FirstUParameter(),
1045 aV2f = myHS2->FirstVParameter(),
1046 aU2l = myHS2->LastUParameter(),
1047 aV2l = myHS2->LastVParameter();
1049 aBox1.Add(gp_Pnt2d(aU1f, aV1f));
1050 aBox1.Add(gp_Pnt2d(aU1l, aV1l));
1051 aBox2.Add(gp_Pnt2d(aU2f, aV2f));
1052 aBox2.Add(gp_Pnt2d(aU2l, aV2l));
1054 GeomInt_VectorOfReal anArrayOfParameters;
1056 //We consider here that the intersection line is same-parameter-line
1057 anArrayOfParameters.Append(aC3d->FirstParameter());
1058 anArrayOfParameters.Append(aC3d->LastParameter());
1060 TrimILineOnSurfBoundaries(aC2d1, aC2d2, aBox1, aBox2, anArrayOfParameters);
1062 const Standard_Integer aNbIntersSolutionsm1 = anArrayOfParameters.Length() - 1;
1065 for(Standard_Integer anInd = 0; anInd < aNbIntersSolutionsm1; anInd++)
1067 const Standard_Real aParF = anArrayOfParameters(anInd),
1068 aParL = anArrayOfParameters(anInd+1);
1070 if((aParL - aParF) <= Precision::PConfusion())
1073 const Standard_Real aPar = 0.5*(aParF + aParL);
1076 Handle(Geom2d_Curve) aCurv2d1, aCurv2d2;
1079 aC2d1->D0(aPar, aPt);
1081 if(aBox1.IsOut(aPt))
1085 aCurv2d1 = new Geom2d_TrimmedCurve(aC2d1, aParF, aParL);
1090 aC2d2->D0(aPar, aPt);
1092 if(aBox2.IsOut(aPt))
1096 aCurv2d2 = new Geom2d_TrimmedCurve(aC2d2, aParF, aParL);
1099 Handle(Geom_Curve) aCurv3d = new Geom_TrimmedCurve(aC3d, aParF, aParL);
1101 sline.Append(aCurv3d);
1102 slineS1.Append(aCurv2d1);
1103 slineS2.Append(aCurv2d2);
1110 //=======================================================================
1111 //function : TreatRLine
1112 //purpose : Approx of Restriction line
1113 //=======================================================================
1114 void GeomInt_IntSS::TreatRLine(const Handle(IntPatch_RLine)& theRL,
1115 const Handle(GeomAdaptor_HSurface)& theHS1,
1116 const Handle(GeomAdaptor_HSurface)& theHS2,
1117 Handle(Geom_Curve)& theC3d,
1118 Handle(Geom2d_Curve)& theC2d1,
1119 Handle(Geom2d_Curve)& theC2d2,
1120 Standard_Real& theTolReached)
1122 Handle(GeomAdaptor_HSurface) aGAHS;
1123 Handle(Adaptor2d_HCurve2d) anAHC2d;
1124 Standard_Real tf, tl;
1126 // It is assumed that 2d curve is 2d line (rectangular surface domain)
1127 if(theRL->IsArcOnS1())
1130 anAHC2d = theRL->ArcOnS1();
1131 theRL->ParamOnS1(tf, tl);
1132 theC2d1 = Geom2dAdaptor::MakeCurve(anAHC2d->Curve2d());
1133 tf = Max(tf, theC2d1->FirstParameter());
1134 tl = Min(tl, theC2d1->LastParameter());
1135 theC2d1 = new Geom2d_TrimmedCurve(theC2d1, tf, tl);
1137 else if (theRL->IsArcOnS2())
1140 anAHC2d = theRL->ArcOnS2();
1141 theRL->ParamOnS2(tf, tl);
1142 theC2d2 = Geom2dAdaptor::MakeCurve(anAHC2d->Curve2d());
1143 tf = Max(tf, theC2d2->FirstParameter());
1144 tl = Min(tl, theC2d2->LastParameter());
1145 theC2d2 = new Geom2d_TrimmedCurve(theC2d2, tf, tl);
1152 //Restriction line can correspond to a degenerated edge.
1153 //In this case we return null-curve.
1154 if(isDegenerated(aGAHS, anAHC2d, tf, tl))
1158 //To provide sameparameter it is necessary to get 3d curve as
1159 //approximation of curve on surface.
1160 Standard_Integer aMaxDeg = 8;
1161 Standard_Integer aMaxSeg = 1000;
1162 Approx_CurveOnSurface anApp(anAHC2d, aGAHS, tf, tl, Precision::Confusion(),
1163 GeomAbs_C1, aMaxDeg, aMaxSeg,
1164 Standard_True, Standard_False);
1165 if(!anApp.HasResult())
1168 theC3d = anApp.Curve3d();
1169 theTolReached = anApp.MaxError3d();
1170 Standard_Real aTol = Precision::Confusion();
1171 if(theRL->IsArcOnS1())
1173 Handle(Geom_Surface) aS = GeomAdaptor::MakeSurface(theHS2->Surface());
1174 BuildPCurves (tf, tl, aTol,
1175 aS, theC3d, theC2d2);
1177 if(theRL->IsArcOnS2())
1179 Handle(Geom_Surface) aS = GeomAdaptor::MakeSurface(theHS1->Surface());
1180 BuildPCurves (tf, tl, aTol,
1181 aS, theC3d, theC2d1);
1183 theTolReached = Max(theTolReached, aTol);
1186 //=======================================================================
1187 //function : BuildPCurves
1189 //=======================================================================
1190 void GeomInt_IntSS::BuildPCurves (Standard_Real f,
1193 const Handle (Geom_Surface)& S,
1194 const Handle (Geom_Curve)& C,
1195 Handle (Geom2d_Curve)& C2d)
1197 if (!C2d.IsNull()) {
1201 Standard_Real umin,umax,vmin,vmax;
1203 S->Bounds(umin, umax, vmin, vmax);
1204 // in class ProjLib_Function the range of parameters is shrank by 1.e-09
1205 if((l - f) > 2.e-09) {
1206 C2d = GeomProjLib::Curve2d(C,f,l,S,umin,umax,vmin,vmax,Tol);
1208 // proj. a circle that goes through the pole on a sphere to the sphere
1209 Tol += Precision::Confusion();
1210 C2d = GeomProjLib::Curve2d(C,f,l,S,Tol);
1212 const Handle(Standard_Type)& aType = C2d->DynamicType();
1213 if ( aType == STANDARD_TYPE(Geom2d_BSplineCurve))
1215 //Check first, last knots to avoid problems with trimming
1216 //First, last knots can differ from f, l because of numerical error
1217 //of projection and approximation
1218 //The same checking as in Geom2d_TrimmedCurve
1219 if((C2d->FirstParameter() - f > Precision::PConfusion()) ||
1220 (l - C2d->LastParameter() > Precision::PConfusion()))
1222 Handle(Geom2d_BSplineCurve) aBspl = Handle(Geom2d_BSplineCurve)::DownCast(C2d);
1223 TColStd_Array1OfReal aKnots(1, aBspl->NbKnots());
1224 aBspl->Knots(aKnots);
1225 BSplCLib::Reparametrize(f, l, aKnots);
1226 aBspl->SetKnots(aKnots);
1231 if((l - f) > Epsilon(Abs(f)))
1233 //The domain of C2d is [Epsilon(Abs(f)), 2.e-09]
1234 //On this small range C2d can be considered as segment
1237 Standard_Real aU=0., aV=0.;
1238 GeomAdaptor_Surface anAS;
1240 Extrema_ExtPS anExtr;
1241 const gp_Pnt aP3d1 = C->Value(f);
1242 const gp_Pnt aP3d2 = C->Value(l);
1244 anExtr.SetAlgo(Extrema_ExtAlgo_Grad);
1245 anExtr.Initialize(anAS, umin, umax, vmin, vmax,
1246 Precision::Confusion(), Precision::Confusion());
1247 anExtr.Perform(aP3d1);
1249 if(ParametersOfNearestPointOnSurface(anExtr, aU, aV))
1251 const gp_Pnt2d aP2d1(aU, aV);
1253 anExtr.Perform(aP3d2);
1255 if(ParametersOfNearestPointOnSurface(anExtr, aU, aV))
1257 const gp_Pnt2d aP2d2(aU, aV);
1259 if(aP2d1.Distance(aP2d2) > gp::Resolution())
1261 TColgp_Array1OfPnt2d poles(1,2);
1262 TColStd_Array1OfReal knots(1,2);
1263 TColStd_Array1OfInteger mults(1,2);
1268 mults(1) = mults(2) = 2;
1270 C2d = new Geom2d_BSplineCurve(poles,knots,mults,1);
1272 //Check same parameter in middle point .begin
1273 const gp_Pnt PMid(C->Value(0.5*(f+l)));
1274 const gp_Pnt2d pmidcurve2d(0.5*(aP2d1.XY() + aP2d2.XY()));
1275 const gp_Pnt aPC(anAS.Value(pmidcurve2d.X(), pmidcurve2d.Y()));
1276 const Standard_Real aDist = PMid.Distance(aPC);
1277 Tol = Max(aDist, Tol);
1278 //Check same parameter in middle point .end
1285 if (S->IsUPeriodic() && !C2d.IsNull()) {
1286 // Recadre dans le domaine UV de la face
1287 Standard_Real aTm, U0, aEps, period, du, U0x;
1288 Standard_Boolean bAdjust;
1290 aEps = Precision::PConfusion();
1291 period = S->UPeriod();
1294 gp_Pnt2d pm = C2d->Value(aTm);
1298 GeomInt::AdjustPeriodic(U0, umin, umax, period, U0x, du, aEps);
1300 gp_Vec2d T1(du, 0.);
1306 //=======================================================================
1307 //function : TrimILineOnSurfBoundaries
1308 //purpose : This function finds intersection points of given curves with
1309 // surface boundaries and fills theArrayOfParameters by parameters
1310 // along the given curves corresponding of these points.
1311 //=======================================================================
1312 void GeomInt_IntSS::TrimILineOnSurfBoundaries(const Handle(Geom2d_Curve)& theC2d1,
1313 const Handle(Geom2d_Curve)& theC2d2,
1314 const Bnd_Box2d& theBound1,
1315 const Bnd_Box2d& theBound2,
1316 GeomInt_VectorOfReal& theArrayOfParameters)
1318 //Rectangular boundaries of two surfaces: [0]:U=Ufirst, [1]:U=Ulast,
1319 // [2]:V=Vfirst, [3]:V=Vlast
1320 const Standard_Integer aNumberOfCurves = 4;
1321 Handle(Geom2d_Curve) aCurS1Bounds[aNumberOfCurves];
1322 Handle(Geom2d_Curve) aCurS2Bounds[aNumberOfCurves];
1324 Standard_Real aU1f=0.0, aV1f=0.0, aU1l=0.0, aV1l=0.0;
1325 Standard_Real aU2f=0.0, aV2f=0.0, aU2l=0.0, aV2l=0.0;
1327 theBound1.Get(aU1f, aV1f, aU1l, aV1l);
1328 theBound2.Get(aU2f, aV2f, aU2l, aV2l);
1330 Standard_Real aDelta = aV1l-aV1f;
1331 if(Abs(aDelta) > RealSmall())
1333 if(!Precision::IsInfinite(aU1f))
1335 aCurS1Bounds[0] = new Geom2d_Line(gp_Pnt2d(aU1f, aV1f), gp_Dir2d(0.0, 1.0));
1337 if(!Precision::IsInfinite(aDelta))
1338 aCurS1Bounds[0] = new Geom2d_TrimmedCurve(aCurS1Bounds[0], 0, aDelta);
1341 if(!Precision::IsInfinite(aU1l))
1343 aCurS1Bounds[1] = new Geom2d_Line(gp_Pnt2d(aU1l, aV1f), gp_Dir2d(0.0, 1.0));
1344 if(!Precision::IsInfinite(aDelta))
1345 aCurS1Bounds[1] = new Geom2d_TrimmedCurve(aCurS1Bounds[1], 0, aDelta);
1350 if(Abs(aDelta) > RealSmall())
1352 if(!Precision::IsInfinite(aV1f))
1354 aCurS1Bounds[2] = new Geom2d_Line(gp_Pnt2d(aU1f, aV1f), gp_Dir2d(1.0, 0.0));
1355 if(!Precision::IsInfinite(aDelta))
1356 aCurS1Bounds[2] = new Geom2d_TrimmedCurve(aCurS1Bounds[2], 0, aDelta);
1359 if(!Precision::IsInfinite(aV1l))
1361 aCurS1Bounds[3] = new Geom2d_Line(gp_Pnt2d(aU1l, aV1l), gp_Dir2d(1.0, 0.0));
1362 if(!Precision::IsInfinite(aDelta))
1363 aCurS1Bounds[3] = new Geom2d_TrimmedCurve(aCurS1Bounds[3], 0, aDelta);
1368 if(Abs(aDelta) > RealSmall())
1370 if(!Precision::IsInfinite(aU2f))
1372 aCurS2Bounds[0] = new Geom2d_Line(gp_Pnt2d(aU2f, aV2f), gp_Dir2d(0.0, 1.0));
1373 if(!Precision::IsInfinite(aDelta))
1374 aCurS2Bounds[0] = new Geom2d_TrimmedCurve(aCurS2Bounds[0], 0, aDelta);
1377 if(!Precision::IsInfinite(aU2l))
1379 aCurS2Bounds[1] = new Geom2d_Line(gp_Pnt2d(aU2l, aV2f), gp_Dir2d(0.0, 1.0));
1380 if(!Precision::IsInfinite(aDelta))
1381 aCurS2Bounds[1] = new Geom2d_TrimmedCurve(aCurS2Bounds[1], 0, aDelta);
1386 if(Abs(aDelta) > RealSmall())
1388 if(!Precision::IsInfinite(aV2f))
1390 aCurS2Bounds[2] = new Geom2d_Line(gp_Pnt2d(aU2f, aV2f), gp_Dir2d(1.0, 0.0));
1391 if(!Precision::IsInfinite(aDelta))
1392 aCurS2Bounds[2] = new Geom2d_TrimmedCurve(aCurS2Bounds[2], 0, aDelta);
1395 if(!Precision::IsInfinite(aV2l))
1397 aCurS2Bounds[3] = new Geom2d_Line(gp_Pnt2d(aU2l, aV2l), gp_Dir2d(1.0, 0.0));
1398 if(!Precision::IsInfinite(aDelta))
1399 aCurS2Bounds[3] = new Geom2d_TrimmedCurve(aCurS2Bounds[3], 0, aDelta);
1403 const Standard_Real anIntTol = 10.0*Precision::Confusion();
1405 IntersectCurveAndBoundary(theC2d1, aCurS1Bounds,
1406 aNumberOfCurves, anIntTol, theArrayOfParameters);
1408 IntersectCurveAndBoundary(theC2d2, aCurS2Bounds,
1409 aNumberOfCurves, anIntTol, theArrayOfParameters);
1411 std::sort(theArrayOfParameters.begin(), theArrayOfParameters.end());
1414 //=======================================================================
1415 //function : MakeBSpline
1417 //=======================================================================
1418 Handle(Geom_Curve) GeomInt_IntSS::MakeBSpline (const Handle(IntPatch_WLine)& WL,
1419 const Standard_Integer ideb,
1420 const Standard_Integer ifin)
1422 const Standard_Integer nbpnt = ifin-ideb+1;
1423 TColgp_Array1OfPnt poles(1,nbpnt);
1424 TColStd_Array1OfReal knots(1,nbpnt);
1425 TColStd_Array1OfInteger mults(1,nbpnt);
1426 Standard_Integer i = 1, ipidebm1 = ideb;
1427 for(; i<=nbpnt; ipidebm1++, i++)
1429 poles(i) = WL->Point(ipidebm1).Value();
1433 mults(1) = mults(nbpnt) = 2;
1434 return new Geom_BSplineCurve(poles,knots,mults,1);
1437 //=======================================================================
1438 //function : MakeBSpline2d
1440 //=======================================================================
1441 Handle(Geom2d_BSplineCurve) GeomInt_IntSS::
1442 MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine,
1443 const Standard_Integer ideb,
1444 const Standard_Integer ifin,
1445 const Standard_Boolean onFirst)
1447 const Standard_Integer nbpnt = ifin-ideb+1;
1448 TColgp_Array1OfPnt2d poles(1,nbpnt);
1449 TColStd_Array1OfReal knots(1,nbpnt);
1450 TColStd_Array1OfInteger mults(1,nbpnt);
1451 Standard_Integer i = 1, ipidebm1 = ideb;
1452 for(; i <= nbpnt; ipidebm1++, i++)
1456 theWLine->Point(ipidebm1).ParametersOnS1(U, V);
1458 theWLine->Point(ipidebm1).ParametersOnS2(U, V);
1459 poles(i).SetCoord(U, V);
1464 mults(1) = mults(nbpnt) = 2;
1465 return new Geom2d_BSplineCurve(poles,knots,mults,1);