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>
57 #include <NCollection_DataMap.hxx>
59 //=======================================================================
62 //=======================================================================
64 static Standard_Boolean IsoIsDeg (const Adaptor3d_Surface& S,
65 const Standard_Real Param,
66 const GeomAbs_IsoType IT,
67 const Standard_Real TolMin,
68 const Standard_Real TolMax)
70 Standard_Real U1=0.,U2=0.,V1=0.,V2=0.,T;
71 Standard_Boolean Along = Standard_True;
72 U1 = S.FirstUParameter();
73 U2 = S.LastUParameter();
74 V1 = S.FirstVParameter();
75 V2 = S.LastVParameter();
78 Standard_Real Step,D1NormMax;
79 if (IT == GeomAbs_IsoV)
83 for (T=U1;T<=U2;T=T+Step)
85 S.D1(T,Param,P,D1U,D1V);
86 D1NormMax=Max(D1NormMax,D1U.Magnitude());
89 if (D1NormMax >TolMax || D1NormMax < TolMin )
90 Along = Standard_False;
96 for (T=V1;T<=V2;T=T+Step)
98 S.D1(Param,T,P,D1U,D1V);
99 D1NormMax=Max(D1NormMax,D1V.Magnitude());
102 if (D1NormMax >TolMax || D1NormMax < TolMin )
103 Along = Standard_False;
110 //=======================================================================
113 //=======================================================================
115 static void TrimC3d(Handle(Adaptor3d_HCurve)& myCurve,
116 Standard_Boolean* IsTrimmed,
117 const Standard_Real dt,
119 Standard_Integer* SingularCase,
120 const Standard_Integer NumberOfSingularCase)
122 Standard_Real f = myCurve->FirstParameter();
123 Standard_Real l = myCurve->LastParameter();
125 gp_Pnt P = myCurve->Value(f);
127 if(P.Distance(Pole) < Precision::Confusion()) {
128 IsTrimmed[0] = Standard_True;
130 myCurve = myCurve->Trim(f, l, Precision::Confusion());
131 SingularCase[0] = NumberOfSingularCase;
134 P = myCurve->Value(l);
135 if(P.Distance(Pole) < Precision::Confusion()) {
136 IsTrimmed[1] = Standard_True;
138 myCurve = myCurve->Trim(f, l, Precision::Confusion());
139 SingularCase[1] = NumberOfSingularCase;
143 //=======================================================================
144 //function : ExtendC2d
146 //=======================================================================
148 static void ExtendC2d (Handle(Geom2d_BSplineCurve)& aRes,
149 const Standard_Real /*t*/,
150 const Standard_Real /*dt*/,
151 const Standard_Real u1,
152 const Standard_Real u2,
153 const Standard_Real v1,
154 const Standard_Real v2,
155 const Standard_Integer FirstOrLast,
156 const Standard_Integer NumberOfSingularCase)
158 Standard_Real theParam = (FirstOrLast == 0)? aRes->FirstParameter()
159 : aRes->LastParameter();
164 Handle(Geom2d_TrimmedCurve) aSegment;
165 Geom2dConvert_CompCurveToBSplineCurve aCompCurve(aRes, Convert_RationalC1);
166 Standard_Real aTol = Precision::Confusion();
168 aRes->D1(theParam, aPBnd, aVBnd);
169 aDBnd.SetXY(aVBnd.XY());
170 gp_Lin2d aLin(aPBnd, aDBnd); //line in direction of derivative
173 gp_Dir2d theBoundDir;
174 switch (NumberOfSingularCase)
178 thePole.SetCoord(u1, v1);
179 theBoundDir.SetCoord(0., 1.);
184 thePole.SetCoord(u2, v1);
185 theBoundDir.SetCoord(0., 1.);
190 thePole.SetCoord(u1, v1);
191 theBoundDir.SetCoord(1., 0.);
196 thePole.SetCoord(u1, v2);
197 theBoundDir.SetCoord(1., 0.);
201 gp_Lin2d BoundLin(thePole, theBoundDir); //one of the bounds of rectangle
203 Standard_Real U1x = BoundLin.Direction().X();
204 Standard_Real U1y = BoundLin.Direction().Y();
205 Standard_Real U2x = aLin.Direction().X();
206 Standard_Real U2y = aLin.Direction().Y();
207 Standard_Real Uo21x = aLin.Location().X() - BoundLin.Location().X();
208 Standard_Real Uo21y = aLin.Location().Y() - BoundLin.Location().Y();
210 Standard_Real D = U1y*U2x-U1x*U2y;
212 Standard_Real ParOnLin = (Uo21y * U1x - Uo21x * U1y)/D; //parameter of intersection point
214 Handle(Geom2d_Line) aSegLine = new Geom2d_Line(aLin);
215 aSegment = (FirstOrLast == 0)?
216 new Geom2d_TrimmedCurve(aSegLine, ParOnLin, 0.) :
217 new Geom2d_TrimmedCurve(aSegLine, 0., ParOnLin);
219 aCompCurve.Add(aSegment, aTol);
220 aRes = aCompCurve.BSplineCurve();
223 //=======================================================================
226 //=======================================================================
228 static void Project(ProjLib_Projector& P, Handle(Adaptor3d_HCurve)& C)
230 GeomAbs_CurveType CType = C->GetType();
233 P.Project(C->Line());
236 P.Project(C->Circle());
238 case GeomAbs_Ellipse:
239 P.Project(C->Ellipse());
241 case GeomAbs_Hyperbola:
242 P.Project(C->Hyperbola());
244 case GeomAbs_Parabola:
245 P.Project(C->Parabola());
247 case GeomAbs_BSplineCurve:
248 case GeomAbs_BezierCurve:
249 case GeomAbs_OtherCurve: // try the approximation
252 Standard_NoSuchObject::Raise(" ");
256 //=======================================================================
257 //function : ProjLib_ProjectedCurve
259 //=======================================================================
261 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve()
264 myTolerance = Precision::Confusion();
268 //=======================================================================
269 //function : ProjLib_ProjectedCurve
271 //=======================================================================
273 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
274 (const Handle(Adaptor3d_HSurface)& S)
276 myTolerance = Precision::Confusion();
281 //=======================================================================
282 //function : ProjLib_ProjectedCurve
284 //=======================================================================
286 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
287 (const Handle(Adaptor3d_HSurface)& S,
288 const Handle(Adaptor3d_HCurve)& C)
290 myTolerance = Precision::Confusion();
296 //=======================================================================
297 //function : ProjLib_ProjectedCurve
299 //=======================================================================
301 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
302 (const Handle(Adaptor3d_HSurface)& S,
303 const Handle(Adaptor3d_HCurve)& C,
304 const Standard_Real Tol)
306 myTolerance = Max(Tol, Precision::Confusion());
312 //=======================================================================
315 //=======================================================================
317 void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HSurface)& S)
323 //=======================================================================
326 //=======================================================================
328 void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
330 myTolerance = Max(myTolerance, Precision::Confusion());
332 Standard_Real FirstPar = C->FirstParameter();
333 Standard_Real LastPar = C->LastParameter();
334 GeomAbs_SurfaceType SType = mySurface->GetType();
335 GeomAbs_CurveType CType = myCurve->GetType();
336 Standard_Boolean isAnalyticalSurf = Standard_True;
342 ProjLib_Plane P(mySurface->Plane());
348 case GeomAbs_Cylinder:
350 ProjLib_Cylinder P(mySurface->Cylinder());
358 ProjLib_Cone P(mySurface->Cone());
366 ProjLib_Sphere P(mySurface->Sphere());
370 // on met dans la pseudo-periode ( car Sphere n'est pas
371 // periodique en V !)
372 P.SetInBounds(myCurve->FirstParameter());
380 ProjLib_Torus P(mySurface->Torus());
386 case GeomAbs_BezierSurface:
387 case GeomAbs_BSplineSurface:
389 isAnalyticalSurf = Standard_False;
390 Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
391 Standard_Integer SingularCase[2];
392 Standard_Real f, l, dt;
393 const Standard_Real eps = 0.01;
394 f = myCurve->FirstParameter();
395 l = myCurve->LastParameter();
398 Standard_Real U1 = 0.0, U2=0.0, V1=0.0, V2=0.0;
399 const Adaptor3d_Surface& S = mySurface->Surface();
400 U1 = S.FirstUParameter();
401 U2 = S.LastUParameter();
402 V1 = S.FirstVParameter();
403 V2 = S.LastVParameter();
405 if(IsoIsDeg(S, U1, GeomAbs_IsoU, 0., myTolerance))
407 //Surface has pole at U = Umin
408 gp_Pnt Pole = mySurface->Value(U1, V1);
409 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 1);
412 if(IsoIsDeg(S, U2, GeomAbs_IsoU, 0., myTolerance))
414 //Surface has pole at U = Umax
415 gp_Pnt Pole = mySurface->Value(U2, V1);
416 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 2);
419 if(IsoIsDeg(S, V1, GeomAbs_IsoV, 0., myTolerance))
421 //Surface has pole at V = Vmin
422 gp_Pnt Pole = mySurface->Value(U1, V1);
423 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 3);
426 if(IsoIsDeg(S, V2, GeomAbs_IsoV, 0., myTolerance))
428 //Surface has pole at V = Vmax
429 gp_Pnt Pole = mySurface->Value(U1, V2);
430 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 4);
433 ProjLib_ComputeApproxOnPolarSurface polar(myCurve, mySurface, myTolerance);
435 Handle(Geom2d_BSplineCurve) aRes = polar.BSpline();
439 if( (IsTrimmed[0] || IsTrimmed[1]))
443 //Add segment before start of curve
444 f = myCurve->FirstParameter();
445 ExtendC2d(aRes, f, -dt, U1, U2, V1, V2, 0, SingularCase[0]);
449 //Add segment after end of curve
450 l = myCurve->LastParameter();
451 ExtendC2d(aRes, l, dt, U1, U2, V1, V2, 1, SingularCase[1]);
453 Handle(Geom2d_Curve) NewCurve2d;
454 GeomLib::SameRange(Precision::PConfusion(), aRes,
455 aRes->FirstParameter(), aRes->LastParameter(),
456 FirstPar, LastPar, NewCurve2d);
457 aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
459 myResult.SetBSpline(aRes);
461 myResult.SetType(GeomAbs_BSplineCurve);
468 isAnalyticalSurf = Standard_False;
469 Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
470 Standard_Real Vsingular[2] = {0.0 , 0.0}; //for surfaces of revolution
471 Standard_Real f = 0.0, l = 0.0, dt = 0.0;
472 const Standard_Real eps = 0.01;
474 if(mySurface->GetType() == GeomAbs_SurfaceOfRevolution)
476 //Check possible singularity
478 gp_Pnt P = mySurface->AxeOfRevolution().Location();
479 gp_Dir N = mySurface->AxeOfRevolution().Direction();
483 f = myCurve->FirstParameter();
484 l = myCurve->LastParameter();
487 P = myCurve->Value(f);
488 if(L.Distance(P) < Precision::Confusion())
490 IsTrimmed[0] = Standard_True;
492 myCurve = myCurve->Trim(f, l, Precision::Confusion());
493 // Searching the parameter on the basis curve for surface of revolution
494 Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
497 Standard_Real aMinDist = RealLast();
498 for(Standard_Integer anIdx = 1; anIdx <= anExtr.NbExt(); anIdx++)
500 if (anExtr.IsMin(anIdx) &&
501 anExtr.SquareDistance(anIdx) < aMinDist)
503 aMinDist = anExtr.SquareDistance(anIdx);
504 Vsingular[0] = anExtr.Point(anIdx).Parameter();
509 Vsingular[0] = ElCLib::Parameter(L, P);
510 //SingularCase[0] = 3;
513 P = myCurve->Value(l);
514 if(L.Distance(P) < Precision::Confusion())
516 IsTrimmed[1] = Standard_True;
518 myCurve = myCurve->Trim(f, l, Precision::Confusion());
519 // Searching the parameter on the basis curve for surface of revolution
520 Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
523 Standard_Real aMinDist = RealLast();
524 for(Standard_Integer anIdx = 1; anIdx <= anExtr.NbExt(); anIdx++)
526 if (anExtr.IsMin(anIdx) &&
527 anExtr.SquareDistance(anIdx) < aMinDist)
529 aMinDist = anExtr.SquareDistance(anIdx);
530 Vsingular[1] = anExtr.Point(anIdx).Parameter();
535 Vsingular[1] = ElCLib::Parameter(L, P);
536 //SingularCase[1] = 4;
540 ProjLib_CompProjectedCurve Projector(mySurface,myCurve, myTolerance, myTolerance, 100 * myTolerance);
541 Handle(ProjLib_HCompProjectedCurve) HProjector = new ProjLib_HCompProjectedCurve();
542 HProjector->Set(Projector);
544 // Normalement, dans le cadre de ProjLib, le resultat
545 // doit etre une et une seule courbe !!!
546 // De plus, cette courbe ne doit pas etre Single point
547 Standard_Integer NbCurves = Projector.NbCurves();
548 Standard_Real Udeb = 0.0,Ufin = 0.0;
551 Projector.Bounds(1, Udeb, Ufin);
557 // Approximons cette courbe algorithmique.
558 Standard_Boolean Only3d = Standard_False;
559 Standard_Boolean Only2d = Standard_True;
560 GeomAbs_Shape Continuity = GeomAbs_C1;
561 Standard_Integer MaxDegree = 14;
562 Standard_Integer MaxSeg = 16;
564 Approx_CurveOnSurface appr(HProjector, mySurface, Udeb, Ufin,
565 myTolerance, Continuity, MaxDegree, MaxSeg,
568 Handle(Geom2d_BSplineCurve) aRes = appr.Curve2d();
572 if(IsTrimmed[0] || IsTrimmed[1])
574 // Treatment only for surface of revolution
575 Standard_Real u1, u2, v1, v2;
576 u1 = mySurface->FirstUParameter();
577 u2 = mySurface->LastUParameter();
578 v1 = mySurface->FirstVParameter();
579 v2 = mySurface->LastVParameter();
583 //Add segment before start of curve
584 ExtendC2d(aRes, f, -dt, u1, u2, Vsingular[0], v2, 0, 3);
588 //Add segment after end of curve
589 ExtendC2d(aRes, l, dt, u1, u2, v1, Vsingular[1], 1, 4);
591 Handle(Geom2d_Curve) NewCurve2d;
592 GeomLib::SameRange(Precision::PConfusion(), aRes,
593 aRes->FirstParameter(), aRes->LastParameter(),
594 FirstPar, LastPar, NewCurve2d);
595 aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
598 myResult.SetBSpline(aRes);
600 myResult.SetType(GeomAbs_BSplineCurve);
605 if ( !myResult.IsDone() && isAnalyticalSurf)
607 // Use advanced analytical projector if base analytical projection failed.
608 ProjLib_ComputeApprox Comp( myCurve, mySurface, myTolerance);
612 if ( SType == GeomAbs_Plane && CType == GeomAbs_BezierCurve)
614 myResult.SetType(GeomAbs_BezierCurve);
615 myResult.SetBezier(Comp.Bezier()) ;
619 myResult.SetType(GeomAbs_BSplineCurve);
620 myResult.SetBSpline(Comp.BSpline()) ;
622 // set the periodicity flag
623 if (SType == GeomAbs_Plane &&
624 CType == GeomAbs_BSplineCurve &&
625 myCurve->IsPeriodic() )
627 myResult.SetPeriodic();
629 myTolerance = Comp.Tolerance();
632 Standard_Boolean isPeriodic[] = {mySurface->IsUPeriodic(),
633 mySurface->IsVPeriodic()};
634 if (myResult.IsDone() &&
635 (isPeriodic[0] || isPeriodic[1]))
637 // Check result curve to be in params space.
639 // U and V parameters space correspondingly.
640 const Standard_Real aSurfFirstPar[2] = {mySurface->FirstUParameter(),
641 mySurface->FirstVParameter()};
642 Standard_Real aSurfPeriod[2] = {0.0, 0.0};
644 aSurfPeriod[0] = mySurface->UPeriod();
646 aSurfPeriod[1] = mySurface->VPeriod();
648 for(Standard_Integer anIdx = 1; anIdx <= 2; anIdx++)
650 if (!isPeriodic[anIdx - 1])
653 if (myResult.GetType() == GeomAbs_BSplineCurve)
655 NCollection_DataMap<Standard_Integer, Standard_Integer> aMap;
656 Handle(Geom2d_BSplineCurve) aRes = myResult.BSpline();
657 const Standard_Integer aDeg = aRes->Degree();
659 for(Standard_Integer aKnotIdx = aRes->FirstUKnotIndex();
660 aKnotIdx < aRes->LastUKnotIndex();
663 const Standard_Real aFirstParam = aRes->Knot(aKnotIdx);
664 const Standard_Real aLastParam = aRes->Knot(aKnotIdx + 1);
666 for(Standard_Integer anIntIdx = 0; anIntIdx <= aDeg; anIntIdx++)
668 const Standard_Real aCurrParam = aFirstParam + (aLastParam - aFirstParam) * anIntIdx / (aDeg + 1.0);
670 aRes->D0(aCurrParam, aPnt2d);
672 Standard_Integer aMapKey = Standard_Integer ((aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1]) / aSurfPeriod[anIdx - 1]);
674 if (aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1] < 0.0)
677 if (aMap.IsBound(aMapKey))
678 aMap.ChangeFind(aMapKey)++;
680 aMap.Bind(aMapKey, 1);
684 Standard_Integer aMaxPoints = 0, aMaxIdx = 0;
685 NCollection_DataMap<Standard_Integer, Standard_Integer>::Iterator aMapIter(aMap);
686 for( ; aMapIter.More(); aMapIter.Next())
688 if (aMapIter.Value() > aMaxPoints)
690 aMaxPoints = aMapIter.Value();
691 aMaxIdx = aMapIter.Key();
696 gp_Pnt2d aFirstPnt = aRes->Value(aRes->FirstParameter());
697 gp_Pnt2d aSecondPnt = aFirstPnt;
698 aSecondPnt.SetCoord(anIdx, aFirstPnt.Coord(anIdx) - aSurfPeriod[anIdx - 1] * aMaxIdx);
699 aRes->Translate(gp_Vec2d(aFirstPnt, aSecondPnt));
703 if (myResult.GetType() == GeomAbs_Line)
705 Standard_Real aT1 = myCurve->FirstParameter();
706 Standard_Real aT2 = myCurve->LastParameter();
711 myResult.UFrame(aT1, aT2, aSurfFirstPar[anIdx - 1], aSurfPeriod[anIdx - 1]);
716 myResult.VFrame(aT1, aT2, aSurfFirstPar[anIdx - 1], aSurfPeriod[anIdx - 1]);
724 //=======================================================================
725 //function : GetSurface
727 //=======================================================================
729 const Handle(Adaptor3d_HSurface)& ProjLib_ProjectedCurve::GetSurface() const
735 //=======================================================================
736 //function : GetCurve
738 //=======================================================================
740 const Handle(Adaptor3d_HCurve)& ProjLib_ProjectedCurve::GetCurve() const
746 //=======================================================================
747 //function : GetTolerance
749 //=======================================================================
751 Standard_Real ProjLib_ProjectedCurve::GetTolerance() const
757 //=======================================================================
758 //function : FirstParameter
760 //=======================================================================
762 Standard_Real ProjLib_ProjectedCurve::FirstParameter() const
764 return myCurve->FirstParameter();
768 //=======================================================================
769 //function : LastParameter
771 //=======================================================================
773 Standard_Real ProjLib_ProjectedCurve::LastParameter() const
775 return myCurve->LastParameter();
779 //=======================================================================
780 //function : Continuity
782 //=======================================================================
784 GeomAbs_Shape ProjLib_ProjectedCurve::Continuity() const
786 Standard_NotImplemented::Raise("");
791 //=======================================================================
792 //function : NbIntervals
794 //=======================================================================
796 Standard_Integer ProjLib_ProjectedCurve::NbIntervals(const GeomAbs_Shape ) const
798 Standard_NotImplemented::Raise("");
803 //=======================================================================
804 //function : Intervals
806 //=======================================================================
808 //void ProjLib_ProjectedCurve::Intervals(TColStd_Array1OfReal& T,
809 void ProjLib_ProjectedCurve::Intervals(TColStd_Array1OfReal& ,
810 const GeomAbs_Shape ) const
812 Standard_NotImplemented::Raise("");
816 //=======================================================================
817 //function : IsClosed
819 //=======================================================================
821 Standard_Boolean ProjLib_ProjectedCurve::IsClosed() const
823 Standard_NotImplemented::Raise("");
824 return Standard_True;
828 //=======================================================================
829 //function : IsPeriodic
831 //=======================================================================
833 Standard_Boolean ProjLib_ProjectedCurve::IsPeriodic() const
835 return myResult.IsPeriodic();
839 //=======================================================================
842 //=======================================================================
844 Standard_Real ProjLib_ProjectedCurve::Period() const
846 Standard_NotImplemented::Raise("");
851 //=======================================================================
854 //=======================================================================
856 gp_Pnt2d ProjLib_ProjectedCurve::Value(const Standard_Real ) const
858 Standard_NotImplemented::Raise("");
859 return gp_Pnt2d(0.,0.);
863 //=======================================================================
866 //=======================================================================
868 void ProjLib_ProjectedCurve::D0(const Standard_Real , gp_Pnt2d& ) const
870 Standard_NotImplemented::Raise("");
874 //=======================================================================
877 //=======================================================================
879 void ProjLib_ProjectedCurve::D1(const Standard_Real ,
883 Standard_NotImplemented::Raise("");
887 //=======================================================================
890 //=======================================================================
892 void ProjLib_ProjectedCurve::D2(const Standard_Real ,
897 Standard_NotImplemented::Raise("");
901 //=======================================================================
904 //=======================================================================
906 void ProjLib_ProjectedCurve::D3(const Standard_Real,
912 Standard_NotImplemented::Raise("");
916 //=======================================================================
919 //=======================================================================
921 gp_Vec2d ProjLib_ProjectedCurve::DN(const Standard_Real,
922 const Standard_Integer) const
924 Standard_NotImplemented::Raise("");
925 return gp_Vec2d(0.,0.);
929 //=======================================================================
930 //function : Resolution
932 //=======================================================================
934 Standard_Real ProjLib_ProjectedCurve::Resolution(const Standard_Real) const
936 Standard_NotImplemented::Raise("");
941 //=======================================================================
944 //=======================================================================
946 GeomAbs_CurveType ProjLib_ProjectedCurve::GetType() const
948 return myResult.GetType();
952 //=======================================================================
955 //=======================================================================
957 gp_Lin2d ProjLib_ProjectedCurve::Line() const
959 return myResult.Line();
963 //=======================================================================
966 //=======================================================================
968 gp_Circ2d ProjLib_ProjectedCurve::Circle() const
970 return myResult.Circle();
974 //=======================================================================
977 //=======================================================================
979 gp_Elips2d ProjLib_ProjectedCurve::Ellipse() const
981 return myResult.Ellipse();
985 //=======================================================================
986 //function : Hyperbola
988 //=======================================================================
990 gp_Hypr2d ProjLib_ProjectedCurve::Hyperbola() const
992 return myResult.Hyperbola();
996 //=======================================================================
997 //function : Parabola
999 //=======================================================================
1001 gp_Parab2d ProjLib_ProjectedCurve::Parabola() const
1003 return myResult.Parabola();
1008 //=======================================================================
1011 //=======================================================================
1013 Standard_Integer ProjLib_ProjectedCurve::Degree() const
1015 Standard_NoSuchObject_Raise_if
1016 ( (GetType() != GeomAbs_BSplineCurve) &&
1017 (GetType() != GeomAbs_BezierCurve),
1018 "ProjLib_ProjectedCurve:Degree");
1019 if (GetType() == GeomAbs_BSplineCurve) {
1020 return myResult.BSpline()->Degree();
1022 else if (GetType() == GeomAbs_BezierCurve) {
1023 return myResult.Bezier()->Degree();
1030 //=======================================================================
1031 //function : IsRational
1033 //=======================================================================
1035 Standard_Boolean ProjLib_ProjectedCurve::IsRational() const
1037 Standard_NoSuchObject_Raise_if
1038 ( (GetType() != GeomAbs_BSplineCurve) &&
1039 (GetType() != GeomAbs_BezierCurve),
1040 "ProjLib_ProjectedCurve:IsRational");
1041 if (GetType() == GeomAbs_BSplineCurve) {
1042 return myResult.BSpline()->IsRational();
1044 else if (GetType() == GeomAbs_BezierCurve) {
1045 return myResult.Bezier()->IsRational();
1048 return Standard_False;
1051 //=======================================================================
1052 //function : NbPoles
1054 //=======================================================================
1056 Standard_Integer ProjLib_ProjectedCurve::NbPoles() const
1058 Standard_NoSuchObject_Raise_if
1059 ( (GetType() != GeomAbs_BSplineCurve) &&
1060 (GetType() != GeomAbs_BezierCurve)
1061 ,"ProjLib_ProjectedCurve:NbPoles" );
1062 if (GetType() == GeomAbs_BSplineCurve) {
1063 return myResult.BSpline()->NbPoles();
1065 else if (GetType() == GeomAbs_BezierCurve) {
1066 return myResult.Bezier()->NbPoles();
1073 //=======================================================================
1074 //function : NbKnots
1076 //=======================================================================
1078 Standard_Integer ProjLib_ProjectedCurve::NbKnots() const
1080 Standard_NoSuchObject_Raise_if ( GetType() != GeomAbs_BSplineCurve,
1081 "ProjLib_ProjectedCurve:NbKnots");
1082 return myResult.BSpline()->NbKnots();
1085 //=======================================================================
1088 //=======================================================================
1090 Handle(Geom2d_BezierCurve) ProjLib_ProjectedCurve::Bezier() const
1092 return myResult.Bezier() ;
1095 //=======================================================================
1096 //function : BSpline
1098 //=======================================================================
1100 Handle(Geom2d_BSplineCurve) ProjLib_ProjectedCurve::BSpline() const
1102 return myResult.BSpline() ;
1104 //=======================================================================
1107 //=======================================================================
1109 Handle(Adaptor2d_HCurve2d) ProjLib_ProjectedCurve::Trim
1110 //(const Standard_Real First,
1111 // const Standard_Real Last,
1112 // const Standard_Real Tolerance) const
1113 (const Standard_Real ,
1114 const Standard_Real ,
1115 const Standard_Real ) const
1117 Standard_NotImplemented::Raise("");