1 // Created on: 1993-08-25
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1993-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.
17 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272
19 #include <GeomAbs_SurfaceType.hxx>
20 #include <Standard_NoSuchObject.hxx>
21 #include <Standard_NotImplemented.hxx>
22 #include <ProjLib_ProjectedCurve.hxx>
23 #include <ProjLib_CompProjectedCurve.hxx>
24 #include <ProjLib_HCompProjectedCurve.hxx>
25 #include <ProjLib_ComputeApproxOnPolarSurface.hxx>
26 #include <ProjLib_ComputeApprox.hxx>
27 #include <ProjLib_Projector.hxx>
28 #include <Adaptor3d_HCurve.hxx>
29 #include <Adaptor3d_HSurface.hxx>
30 #include <Approx_CurveOnSurface.hxx>
31 #include <ProjLib_Plane.hxx>
32 #include <ProjLib_Cylinder.hxx>
33 #include <ProjLib_Cone.hxx>
34 #include <ProjLib_Sphere.hxx>
35 #include <ProjLib_Torus.hxx>
36 #include <Precision.hxx>
37 #include <Geom2d_BSplineCurve.hxx>
38 #include <Geom2d_BezierCurve.hxx>
39 #include <gp_Vec2d.hxx>
40 #include <StdFail_NotDone.hxx>
42 #include <TColgp_HArray1OfPnt2d.hxx>
43 #include <TColStd_HArray1OfReal.hxx>
44 #include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
45 #include <TColStd_Array1OfReal.hxx>
46 #include <TColStd_Array1OfInteger.hxx>
47 #include <TColgp_Array1OfPnt2d.hxx>
48 #include <TColgp_HArray1OfVec2d.hxx>
49 #include <TColStd_HArray1OfBoolean.hxx>
50 #include <BSplCLib.hxx>
51 #include <GeomAbs_IsoType.hxx>
52 #include <Geom2d_Line.hxx>
53 #include <Geom2d_TrimmedCurve.hxx>
55 #include <GeomLib.hxx>
56 #include <Extrema_ExtPC.hxx>
58 //=======================================================================
61 //=======================================================================
63 static Standard_Boolean IsoIsDeg (const Adaptor3d_Surface& S,
64 const Standard_Real Param,
65 const GeomAbs_IsoType IT,
66 const Standard_Real TolMin,
67 const Standard_Real TolMax)
69 Standard_Real U1=0.,U2=0.,V1=0.,V2=0.,T;
70 Standard_Boolean Along = Standard_True;
71 U1 = S.FirstUParameter();
72 U2 = S.LastUParameter();
73 V1 = S.FirstVParameter();
74 V2 = S.LastVParameter();
77 Standard_Real Step,D1NormMax;
78 if (IT == GeomAbs_IsoV)
82 for (T=U1;T<=U2;T=T+Step)
84 S.D1(T,Param,P,D1U,D1V);
85 D1NormMax=Max(D1NormMax,D1U.Magnitude());
88 if (D1NormMax >TolMax || D1NormMax < TolMin )
89 Along = Standard_False;
95 for (T=V1;T<=V2;T=T+Step)
97 S.D1(Param,T,P,D1U,D1V);
98 D1NormMax=Max(D1NormMax,D1V.Magnitude());
101 if (D1NormMax >TolMax || D1NormMax < TolMin )
102 Along = Standard_False;
109 //=======================================================================
112 //=======================================================================
114 static void TrimC3d(Handle(Adaptor3d_HCurve)& myCurve,
115 Standard_Boolean* IsTrimmed,
116 const Standard_Real dt,
118 Standard_Integer* SingularCase,
119 const Standard_Integer NumberOfSingularCase)
121 Standard_Real f = myCurve->FirstParameter();
122 Standard_Real l = myCurve->LastParameter();
124 gp_Pnt P = myCurve->Value(f);
126 if(P.Distance(Pole) < Precision::Confusion()) {
127 IsTrimmed[0] = Standard_True;
129 myCurve = myCurve->Trim(f, l, Precision::Confusion());
130 SingularCase[0] = NumberOfSingularCase;
133 P = myCurve->Value(l);
134 if(P.Distance(Pole) < Precision::Confusion()) {
135 IsTrimmed[1] = Standard_True;
137 myCurve = myCurve->Trim(f, l, Precision::Confusion());
138 SingularCase[1] = NumberOfSingularCase;
142 //=======================================================================
143 //function : ExtendC2d
145 //=======================================================================
147 static void ExtendC2d (Handle(Geom2d_BSplineCurve)& aRes,
148 const Standard_Real /*t*/,
149 const Standard_Real /*dt*/,
150 const Standard_Real u1,
151 const Standard_Real u2,
152 const Standard_Real v1,
153 const Standard_Real v2,
154 const Standard_Integer FirstOrLast,
155 const Standard_Integer NumberOfSingularCase)
157 Standard_Real theParam = (FirstOrLast == 0)? aRes->FirstParameter()
158 : aRes->LastParameter();
163 Handle(Geom2d_TrimmedCurve) aSegment;
164 Geom2dConvert_CompCurveToBSplineCurve aCompCurve(aRes, Convert_RationalC1);
165 Standard_Real aTol = Precision::Confusion();
167 aRes->D1(theParam, aPBnd, aVBnd);
168 aDBnd.SetXY(aVBnd.XY());
169 gp_Lin2d aLin(aPBnd, aDBnd); //line in direction of derivative
172 gp_Dir2d theBoundDir;
173 switch (NumberOfSingularCase)
177 thePole.SetCoord(u1, v1);
178 theBoundDir.SetCoord(0., 1.);
183 thePole.SetCoord(u2, v1);
184 theBoundDir.SetCoord(0., 1.);
189 thePole.SetCoord(u1, v1);
190 theBoundDir.SetCoord(1., 0.);
195 thePole.SetCoord(u1, v2);
196 theBoundDir.SetCoord(1., 0.);
200 gp_Lin2d BoundLin(thePole, theBoundDir); //one of the bounds of rectangle
202 Standard_Real U1x = BoundLin.Direction().X();
203 Standard_Real U1y = BoundLin.Direction().Y();
204 Standard_Real U2x = aLin.Direction().X();
205 Standard_Real U2y = aLin.Direction().Y();
206 Standard_Real Uo21x = aLin.Location().X() - BoundLin.Location().X();
207 Standard_Real Uo21y = aLin.Location().Y() - BoundLin.Location().Y();
209 Standard_Real D = U1y*U2x-U1x*U2y;
211 Standard_Real ParOnLin = (Uo21y * U1x - Uo21x * U1y)/D; //parameter of intersection point
213 Handle(Geom2d_Line) aSegLine = new Geom2d_Line(aLin);
214 aSegment = (FirstOrLast == 0)?
215 new Geom2d_TrimmedCurve(aSegLine, ParOnLin, 0.) :
216 new Geom2d_TrimmedCurve(aSegLine, 0., ParOnLin);
218 aCompCurve.Add(aSegment, aTol);
219 aRes = aCompCurve.BSplineCurve();
222 //=======================================================================
225 //=======================================================================
227 static void Project(ProjLib_Projector& P, Handle(Adaptor3d_HCurve)& C)
229 GeomAbs_CurveType CType = C->GetType();
232 P.Project(C->Line());
235 P.Project(C->Circle());
237 case GeomAbs_Ellipse:
238 P.Project(C->Ellipse());
240 case GeomAbs_Hyperbola:
241 P.Project(C->Hyperbola());
243 case GeomAbs_Parabola:
244 P.Project(C->Parabola());
246 case GeomAbs_BSplineCurve:
247 case GeomAbs_BezierCurve:
248 case GeomAbs_OtherCurve: // try the approximation
251 Standard_NoSuchObject::Raise(" ");
255 //=======================================================================
256 //function : ProjLib_ProjectedCurve
258 //=======================================================================
260 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve()
263 myTolerance = Precision::Confusion();
267 //=======================================================================
268 //function : ProjLib_ProjectedCurve
270 //=======================================================================
272 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
273 (const Handle(Adaptor3d_HSurface)& S)
275 myTolerance = Precision::Confusion();
280 //=======================================================================
281 //function : ProjLib_ProjectedCurve
283 //=======================================================================
285 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
286 (const Handle(Adaptor3d_HSurface)& S,
287 const Handle(Adaptor3d_HCurve)& C)
289 myTolerance = Precision::Confusion();
295 //=======================================================================
296 //function : ProjLib_ProjectedCurve
298 //=======================================================================
300 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
301 (const Handle(Adaptor3d_HSurface)& S,
302 const Handle(Adaptor3d_HCurve)& C,
303 const Standard_Real Tol)
305 myTolerance = Max(Tol, Precision::Confusion());
311 //=======================================================================
314 //=======================================================================
316 void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HSurface)& S)
322 //=======================================================================
325 //=======================================================================
327 void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
329 myTolerance = Max(myTolerance, Precision::Confusion());
331 Standard_Real FirstPar = C->FirstParameter();
332 Standard_Real LastPar = C->LastParameter();
333 GeomAbs_SurfaceType SType = mySurface->GetType();
334 GeomAbs_CurveType CType = myCurve->GetType();
340 ProjLib_Plane P(mySurface->Plane());
346 case GeomAbs_Cylinder:
348 ProjLib_Cylinder P(mySurface->Cylinder());
356 ProjLib_Cone P(mySurface->Cone());
364 ProjLib_Sphere P(mySurface->Sphere());
368 // on met dans la pseudo-periode ( car Sphere n'est pas
369 // periodique en V !)
370 P.SetInBounds(myCurve->FirstParameter());
378 ProjLib_Torus P(mySurface->Torus());
384 case GeomAbs_BezierSurface:
385 case GeomAbs_BSplineSurface:
387 Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
388 Standard_Integer SingularCase[2];
389 Standard_Real f, l, dt;
390 const Standard_Real eps = 0.01;
391 f = myCurve->FirstParameter();
392 l = myCurve->LastParameter();
395 Standard_Real U1 = 0.0, U2=0.0, V1=0.0, V2=0.0;
396 const Adaptor3d_Surface& S = mySurface->Surface();
397 U1 = S.FirstUParameter();
398 U2 = S.LastUParameter();
399 V1 = S.FirstVParameter();
400 V2 = S.LastVParameter();
402 if(IsoIsDeg(S, U1, GeomAbs_IsoU, 0., myTolerance))
404 //Surface has pole at U = Umin
405 gp_Pnt Pole = mySurface->Value(U1, V1);
406 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 1);
409 if(IsoIsDeg(S, U2, GeomAbs_IsoU, 0., myTolerance))
411 //Surface has pole at U = Umax
412 gp_Pnt Pole = mySurface->Value(U2, V1);
413 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 2);
416 if(IsoIsDeg(S, V1, GeomAbs_IsoV, 0., myTolerance))
418 //Surface has pole at V = Vmin
419 gp_Pnt Pole = mySurface->Value(U1, V1);
420 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 3);
423 if(IsoIsDeg(S, V2, GeomAbs_IsoV, 0., myTolerance))
425 //Surface has pole at V = Vmax
426 gp_Pnt Pole = mySurface->Value(U1, V2);
427 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 4);
430 ProjLib_ComputeApproxOnPolarSurface polar(myCurve, mySurface, myTolerance);
432 Handle(Geom2d_BSplineCurve) aRes = polar.BSpline();
434 if(IsTrimmed[0] || IsTrimmed[1])
438 //Add segment before start of curve
439 f = myCurve->FirstParameter();
440 ExtendC2d(aRes, f, -dt, U1, U2, V1, V2, 0, SingularCase[0]);
444 //Add segment after end of curve
445 l = myCurve->LastParameter();
446 ExtendC2d(aRes, l, dt, U1, U2, V1, V2, 1, SingularCase[1]);
448 Handle(Geom2d_Curve) NewCurve2d;
449 GeomLib::SameRange(Precision::PConfusion(), aRes,
450 aRes->FirstParameter(), aRes->LastParameter(),
451 FirstPar, LastPar, NewCurve2d);
452 aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
454 myResult.SetBSpline(aRes);
456 myResult.SetType(GeomAbs_BSplineCurve);
462 Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
463 Standard_Real Vsingular[2] = {0.0 , 0.0}; //for surfaces of revolution
464 Standard_Real f = 0.0, l = 0.0, dt = 0.0;
465 const Standard_Real eps = 0.01;
467 if(mySurface->GetType() == GeomAbs_SurfaceOfRevolution)
469 //Check possible singularity
471 gp_Pnt P = mySurface->AxeOfRevolution().Location();
472 gp_Dir N = mySurface->AxeOfRevolution().Direction();
476 f = myCurve->FirstParameter();
477 l = myCurve->LastParameter();
480 P = myCurve->Value(f);
481 if(L.Distance(P) < Precision::Confusion())
483 IsTrimmed[0] = Standard_True;
485 myCurve = myCurve->Trim(f, l, Precision::Confusion());
486 // Searching the parameter on the basis curve for surface of revolution
487 Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
490 Standard_Integer anIndex = 1;
491 while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
492 Vsingular[0] = anExtr.Point(anIndex).Parameter();
495 Vsingular[0] = ElCLib::Parameter(L, P);
496 //SingularCase[0] = 3;
499 P = myCurve->Value(l);
500 if(L.Distance(P) < Precision::Confusion())
502 IsTrimmed[1] = Standard_True;
504 myCurve = myCurve->Trim(f, l, Precision::Confusion());
505 // Searching the parameter on the basis curve for surface of revolution
506 Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
509 Standard_Integer anIndex = 1;
510 while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
511 Vsingular[1] = anExtr.Point(anIndex).Parameter();
514 Vsingular[1] = ElCLib::Parameter(L, P);
515 //SingularCase[1] = 4;
519 ProjLib_CompProjectedCurve Projector(mySurface,myCurve, myTolerance, myTolerance);
520 Handle(ProjLib_HCompProjectedCurve) HProjector = new ProjLib_HCompProjectedCurve();
521 HProjector->Set(Projector);
523 // Normalement, dans le cadre de ProjLib, le resultat
524 // doit etre une et une seule courbe !!!
525 // De plus, cette courbe ne doit pas etre Single point
526 Standard_Integer NbCurves = Projector.NbCurves();
527 Standard_Real Udeb = 0.0,Ufin = 0.0;
530 Projector.Bounds(1, Udeb, Ufin);
534 StdFail_NotDone::Raise("ProjLib CompProjectedCurve Not Done");
536 // Approximons cette courbe algorithmique.
537 Standard_Boolean Only3d = Standard_False;
538 Standard_Boolean Only2d = Standard_True;
539 GeomAbs_Shape Continuity = GeomAbs_C1;
540 Standard_Integer MaxDegree = 14;
541 Standard_Integer MaxSeg = 16;
543 Approx_CurveOnSurface appr(HProjector, mySurface, Udeb, Ufin,
544 myTolerance, Continuity, MaxDegree, MaxSeg,
547 Handle(Geom2d_BSplineCurve) aRes = appr.Curve2d();
549 if(IsTrimmed[0] || IsTrimmed[1])
551 // Treatment only for surface of revolution
552 Standard_Real u1, u2, v1, v2;
553 u1 = mySurface->FirstUParameter();
554 u2 = mySurface->LastUParameter();
555 v1 = mySurface->FirstVParameter();
556 v2 = mySurface->LastVParameter();
560 //Add segment before start of curve
561 ExtendC2d(aRes, f, -dt, u1, u2, Vsingular[0], v2, 0, 3);
565 //Add segment after end of curve
566 ExtendC2d(aRes, l, dt, u1, u2, v1, Vsingular[1], 1, 4);
568 Handle(Geom2d_Curve) NewCurve2d;
569 GeomLib::SameRange(Precision::PConfusion(), aRes,
570 aRes->FirstParameter(), aRes->LastParameter(),
571 FirstPar, LastPar, NewCurve2d);
572 aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
575 myResult.SetBSpline(aRes);
577 myResult.SetType(GeomAbs_BSplineCurve);
580 if ( !myResult.IsDone())
582 ProjLib_ComputeApprox Comp( myCurve, mySurface, myTolerance);
586 if ( SType == GeomAbs_Plane && CType == GeomAbs_BezierCurve)
588 myResult.SetType(GeomAbs_BezierCurve);
589 myResult.SetBezier(Comp.Bezier()) ;
593 myResult.SetType(GeomAbs_BSplineCurve);
594 myResult.SetBSpline(Comp.BSpline()) ;
596 // set the periodicity flag
597 if (SType == GeomAbs_Plane &&
598 CType == GeomAbs_BSplineCurve &&
599 myCurve->IsPeriodic() )
601 myResult.SetPeriodic();
603 myTolerance = Comp.Tolerance();
608 // On remet arbitrairement la tol atteinte a une valeur
609 // petite en attendant mieux. dub lbo 11/03/97
610 myTolerance = Min(myTolerance,Precision::Confusion());
612 // Translate the projected curve to keep the first point
613 // In the canonical boundaries of periodic surfaces.
614 if (mySurface->IsUPeriodic())
617 Standard_Real aT1, aT2, aU1, aU2, aUPeriod, aUr, aUm, aUmid, dUm, dUr;
618 GeomAbs_CurveType aTypeR;
619 ProjLib_Projector aResult;
621 aT1 = myCurve->FirstParameter();
622 aT2 = myCurve->LastParameter();
623 aU1 = mySurface->FirstUParameter();
624 aU2 = mySurface->LastUParameter();
625 aUPeriod = mySurface->UPeriod();
627 aTypeR = myResult.GetType();
628 if ((aU2 - aU1) < (aUPeriod - myTolerance) && aTypeR == GeomAbs_Line)
631 aResult.UFrame(aT1, aT2, aU1, aUPeriod);
633 gp_Lin2d &aLr = (gp_Lin2d &) aResult.Line();
634 aUr=aLr.Location().X();
635 gp_Lin2d &aLm = (gp_Lin2d &) myResult.Line();
636 aUm=aLm.Location().X();
638 aUmid = 0.5 * (aU2 + aU1);
639 dUm = fabs(aUm - aUmid);
640 dUr = fabs(aUr - aUmid);
648 myResult.UFrame(aT1, aT2, aU1, aUPeriod);
652 myResult.UFrame(myCurve->FirstParameter(),
653 myCurve->LastParameter(),
654 mySurface->FirstUParameter(),
655 mySurface->UPeriod());
658 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
659 // Correct the U isoline in periodical surface
660 // to be inside restriction boundaries.
661 if (myResult.GetType() == GeomAbs_Line)
663 gp_Lin2d &aLine = (gp_Lin2d &) myResult.Line();
665 Standard_Real aPeriod = mySurface->UPeriod();
666 Standard_Real aFUPar = mySurface->FirstUParameter();
667 Standard_Real aLUPar = mySurface->LastUParameter();
669 // Check if the parametric range is lower then the period.
670 if (aLUPar - aFUPar < aPeriod - myTolerance)
672 Standard_Real aU = aLine.Location().X();
674 if (Abs(aU + aPeriod - aFUPar) < myTolerance ||
675 Abs(aU - aPeriod - aFUPar) < myTolerance)
677 gp_Pnt2d aNewLoc(aFUPar, aLine.Location().Y());
679 aLine.SetLocation(aNewLoc);
681 else if (Abs(aU + aPeriod - aLUPar) < myTolerance ||
682 Abs(aU - aPeriod - aLUPar) < myTolerance)
684 gp_Pnt2d aNewLoc(aLUPar, aLine.Location().Y());
685 aLine.SetLocation(aNewLoc);
690 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
692 if (mySurface->IsVPeriodic())
694 myResult.VFrame(myCurve->FirstParameter(), myCurve->LastParameter(),
695 mySurface->FirstVParameter(), mySurface->VPeriod());
696 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
697 // Correct the V isoline in a periodical surface
698 // to be inside restriction boundaries.
699 if (myResult.GetType() == GeomAbs_Line)
701 gp_Lin2d &aLine = (gp_Lin2d &) myResult.Line();
703 Standard_Real aPeriod = mySurface->VPeriod();
704 Standard_Real aFVPar = mySurface->FirstVParameter();
705 Standard_Real aLVPar = mySurface->LastVParameter();
707 // Check if the parametric range is lower then the period.
708 if (aLVPar - aFVPar < aPeriod - myTolerance)
710 Standard_Real aV = aLine.Location().Y();
712 if (Abs(aV + aPeriod - aFVPar) < myTolerance ||
713 Abs(aV - aPeriod - aFVPar) < myTolerance)
715 gp_Pnt2d aNewLoc(aLine.Location().X(), aFVPar);
716 aLine.SetLocation(aNewLoc);
718 else if (Abs(aV + aPeriod - aLVPar) < myTolerance ||
719 Abs(aV - aPeriod - aLVPar) < myTolerance)
721 gp_Pnt2d aNewLoc(aLine.Location().X(), aLVPar);
722 aLine.SetLocation(aNewLoc);
727 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
732 //=======================================================================
733 //function : GetSurface
735 //=======================================================================
737 const Handle(Adaptor3d_HSurface)& ProjLib_ProjectedCurve::GetSurface() const
743 //=======================================================================
744 //function : GetCurve
746 //=======================================================================
748 const Handle(Adaptor3d_HCurve)& ProjLib_ProjectedCurve::GetCurve() const
754 //=======================================================================
755 //function : GetTolerance
757 //=======================================================================
759 Standard_Real ProjLib_ProjectedCurve::GetTolerance() const
765 //=======================================================================
766 //function : FirstParameter
768 //=======================================================================
770 Standard_Real ProjLib_ProjectedCurve::FirstParameter() const
772 return myCurve->FirstParameter();
776 //=======================================================================
777 //function : LastParameter
779 //=======================================================================
781 Standard_Real ProjLib_ProjectedCurve::LastParameter() const
783 return myCurve->LastParameter();
787 //=======================================================================
788 //function : Continuity
790 //=======================================================================
792 GeomAbs_Shape ProjLib_ProjectedCurve::Continuity() const
794 Standard_NotImplemented::Raise("");
799 //=======================================================================
800 //function : NbIntervals
802 //=======================================================================
804 Standard_Integer ProjLib_ProjectedCurve::NbIntervals(const GeomAbs_Shape ) const
806 Standard_NotImplemented::Raise("");
811 //=======================================================================
812 //function : Intervals
814 //=======================================================================
816 //void ProjLib_ProjectedCurve::Intervals(TColStd_Array1OfReal& T,
817 void ProjLib_ProjectedCurve::Intervals(TColStd_Array1OfReal& ,
818 const GeomAbs_Shape ) const
820 Standard_NotImplemented::Raise("");
824 //=======================================================================
825 //function : IsClosed
827 //=======================================================================
829 Standard_Boolean ProjLib_ProjectedCurve::IsClosed() const
831 Standard_NotImplemented::Raise("");
832 return Standard_True;
836 //=======================================================================
837 //function : IsPeriodic
839 //=======================================================================
841 Standard_Boolean ProjLib_ProjectedCurve::IsPeriodic() const
843 return myResult.IsPeriodic();
847 //=======================================================================
850 //=======================================================================
852 Standard_Real ProjLib_ProjectedCurve::Period() const
854 Standard_NotImplemented::Raise("");
859 //=======================================================================
862 //=======================================================================
864 gp_Pnt2d ProjLib_ProjectedCurve::Value(const Standard_Real ) const
866 Standard_NotImplemented::Raise("");
867 return gp_Pnt2d(0.,0.);
871 //=======================================================================
874 //=======================================================================
876 void ProjLib_ProjectedCurve::D0(const Standard_Real , gp_Pnt2d& ) const
878 Standard_NotImplemented::Raise("");
882 //=======================================================================
885 //=======================================================================
887 void ProjLib_ProjectedCurve::D1(const Standard_Real ,
891 Standard_NotImplemented::Raise("");
895 //=======================================================================
898 //=======================================================================
900 void ProjLib_ProjectedCurve::D2(const Standard_Real ,
905 Standard_NotImplemented::Raise("");
909 //=======================================================================
912 //=======================================================================
914 void ProjLib_ProjectedCurve::D3(const Standard_Real,
920 Standard_NotImplemented::Raise("");
924 //=======================================================================
927 //=======================================================================
929 gp_Vec2d ProjLib_ProjectedCurve::DN(const Standard_Real,
930 const Standard_Integer) const
932 Standard_NotImplemented::Raise("");
933 return gp_Vec2d(0.,0.);
937 //=======================================================================
938 //function : Resolution
940 //=======================================================================
942 Standard_Real ProjLib_ProjectedCurve::Resolution(const Standard_Real) const
944 Standard_NotImplemented::Raise("");
949 //=======================================================================
952 //=======================================================================
954 GeomAbs_CurveType ProjLib_ProjectedCurve::GetType() const
956 return myResult.GetType();
960 //=======================================================================
963 //=======================================================================
965 gp_Lin2d ProjLib_ProjectedCurve::Line() const
967 return myResult.Line();
971 //=======================================================================
974 //=======================================================================
976 gp_Circ2d ProjLib_ProjectedCurve::Circle() const
978 return myResult.Circle();
982 //=======================================================================
985 //=======================================================================
987 gp_Elips2d ProjLib_ProjectedCurve::Ellipse() const
989 return myResult.Ellipse();
993 //=======================================================================
994 //function : Hyperbola
996 //=======================================================================
998 gp_Hypr2d ProjLib_ProjectedCurve::Hyperbola() const
1000 return myResult.Hyperbola();
1004 //=======================================================================
1005 //function : Parabola
1007 //=======================================================================
1009 gp_Parab2d ProjLib_ProjectedCurve::Parabola() const
1011 return myResult.Parabola();
1016 //=======================================================================
1019 //=======================================================================
1021 Standard_Integer ProjLib_ProjectedCurve::Degree() const
1023 Standard_NoSuchObject_Raise_if
1024 ( (GetType() != GeomAbs_BSplineCurve) &&
1025 (GetType() != GeomAbs_BezierCurve),
1026 "ProjLib_ProjectedCurve:Degree");
1027 if (GetType() == GeomAbs_BSplineCurve) {
1028 return myResult.BSpline()->Degree();
1030 else if (GetType() == GeomAbs_BezierCurve) {
1031 return myResult.Bezier()->Degree();
1038 //=======================================================================
1039 //function : IsRational
1041 //=======================================================================
1043 Standard_Boolean ProjLib_ProjectedCurve::IsRational() const
1045 Standard_NoSuchObject_Raise_if
1046 ( (GetType() != GeomAbs_BSplineCurve) &&
1047 (GetType() != GeomAbs_BezierCurve),
1048 "ProjLib_ProjectedCurve:IsRational");
1049 if (GetType() == GeomAbs_BSplineCurve) {
1050 return myResult.BSpline()->IsRational();
1052 else if (GetType() == GeomAbs_BezierCurve) {
1053 return myResult.Bezier()->IsRational();
1056 return Standard_False;
1059 //=======================================================================
1060 //function : NbPoles
1062 //=======================================================================
1064 Standard_Integer ProjLib_ProjectedCurve::NbPoles() const
1066 Standard_NoSuchObject_Raise_if
1067 ( (GetType() != GeomAbs_BSplineCurve) &&
1068 (GetType() != GeomAbs_BezierCurve)
1069 ,"ProjLib_ProjectedCurve:NbPoles" );
1070 if (GetType() == GeomAbs_BSplineCurve) {
1071 return myResult.BSpline()->NbPoles();
1073 else if (GetType() == GeomAbs_BezierCurve) {
1074 return myResult.Bezier()->NbPoles();
1081 //=======================================================================
1082 //function : NbKnots
1084 //=======================================================================
1086 Standard_Integer ProjLib_ProjectedCurve::NbKnots() const
1088 Standard_NoSuchObject_Raise_if ( GetType() != GeomAbs_BSplineCurve,
1089 "ProjLib_ProjectedCurve:NbKnots");
1090 return myResult.BSpline()->NbKnots();
1093 //=======================================================================
1096 //=======================================================================
1098 Handle(Geom2d_BezierCurve) ProjLib_ProjectedCurve::Bezier() const
1100 return myResult.Bezier() ;
1103 //=======================================================================
1104 //function : BSpline
1106 //=======================================================================
1108 Handle(Geom2d_BSplineCurve) ProjLib_ProjectedCurve::BSpline() const
1110 return myResult.BSpline() ;
1112 //=======================================================================
1115 //=======================================================================
1117 Handle(Adaptor2d_HCurve2d) ProjLib_ProjectedCurve::Trim
1118 //(const Standard_Real First,
1119 // const Standard_Real Last,
1120 // const Standard_Real Tolerance) const
1121 (const Standard_Real ,
1122 const Standard_Real ,
1123 const Standard_Real ) const
1125 Standard_NotImplemented::Raise("");