1 // Created on: 1993-08-25
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272
25 #include <GeomAbs_SurfaceType.hxx>
26 #include <Standard_NoSuchObject.hxx>
27 #include <Standard_NotImplemented.hxx>
28 #include <ProjLib_ProjectedCurve.hxx>
29 #include <ProjLib_CompProjectedCurve.hxx>
30 #include <ProjLib_HCompProjectedCurve.hxx>
31 #include <ProjLib_ComputeApproxOnPolarSurface.hxx>
32 #include <ProjLib_ComputeApprox.hxx>
33 #include <ProjLib_Projector.hxx>
34 #include <Handle_Adaptor3d_HCurve.hxx>
35 #include <Handle_Adaptor3d_HSurface.hxx>
36 #include <Adaptor3d_HCurve.hxx>
37 #include <Adaptor3d_HSurface.hxx>
38 #include <Approx_CurveOnSurface.hxx>
39 #include <ProjLib_Plane.hxx>
40 #include <ProjLib_Cylinder.hxx>
41 #include <ProjLib_Cone.hxx>
42 #include <ProjLib_Sphere.hxx>
43 #include <ProjLib_Torus.hxx>
44 #include <Precision.hxx>
45 #include <Handle_Geom_BSplineCurve.hxx>
46 #include <Geom2d_BSplineCurve.hxx>
47 #include <Handle_Geom2d_BSplineCurve.hxx>
48 #include <Geom2d_BezierCurve.hxx>
49 #include <Handle_Geom2d_BezierCurve.hxx>
50 #include <Handle_Adaptor2d_HCurve2d.hxx>
51 #include <gp_Vec2d.hxx>
52 #include <StdFail_NotDone.hxx>
54 #include <TColgp_HArray1OfPnt2d.hxx>
55 #include <TColStd_HArray1OfReal.hxx>
56 #include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
57 #include <TColStd_Array1OfReal.hxx>
58 #include <TColStd_Array1OfInteger.hxx>
59 #include <TColgp_Array1OfPnt2d.hxx>
60 #include <TColgp_HArray1OfVec2d.hxx>
61 #include <TColStd_HArray1OfBoolean.hxx>
62 #include <BSplCLib.hxx>
63 #include <GeomAbs_IsoType.hxx>
64 #include <Geom2d_Line.hxx>
65 #include <Geom2d_TrimmedCurve.hxx>
67 #include <GeomLib.hxx>
69 //=======================================================================
72 //=======================================================================
74 static Standard_Boolean IsoIsDeg (const Adaptor3d_Surface& S,
75 const Standard_Real Param,
76 const GeomAbs_IsoType IT,
77 const Standard_Real TolMin,
78 const Standard_Real TolMax)
80 Standard_Real U1=0.,U2=0.,V1=0.,V2=0.,T;
81 Standard_Boolean Along = Standard_True;
82 U1 = S.FirstUParameter();
83 U2 = S.LastUParameter();
84 V1 = S.FirstVParameter();
85 V2 = S.LastVParameter();
88 Standard_Real Step,D1NormMax;
89 if (IT == GeomAbs_IsoV)
93 for (T=U1;T<=U2;T=T+Step)
95 S.D1(T,Param,P,D1U,D1V);
96 D1NormMax=Max(D1NormMax,D1U.Magnitude());
99 if (D1NormMax >TolMax || D1NormMax < TolMin )
100 Along = Standard_False;
106 for (T=V1;T<=V2;T=T+Step)
108 S.D1(Param,T,P,D1U,D1V);
109 D1NormMax=Max(D1NormMax,D1V.Magnitude());
112 if (D1NormMax >TolMax || D1NormMax < TolMin )
113 Along = Standard_False;
120 //=======================================================================
123 //=======================================================================
125 static void TrimC3d(Handle(Adaptor3d_HCurve)& myCurve,
126 Standard_Boolean* IsTrimmed,
127 const Standard_Real dt,
129 Standard_Integer* SingularCase,
130 const Standard_Integer NumberOfSingularCase)
132 Standard_Real f = myCurve->FirstParameter();
133 Standard_Real l = myCurve->LastParameter();
135 gp_Pnt P = myCurve->Value(f);
137 if(P.Distance(Pole) < Precision::Confusion()) {
138 IsTrimmed[0] = Standard_True;
140 myCurve = myCurve->Trim(f, l, Precision::Confusion());
141 SingularCase[0] = NumberOfSingularCase;
144 P = myCurve->Value(l);
145 if(P.Distance(Pole) < Precision::Confusion()) {
146 IsTrimmed[1] = Standard_True;
148 myCurve = myCurve->Trim(f, l, Precision::Confusion());
149 SingularCase[1] = NumberOfSingularCase;
153 //=======================================================================
154 //function : ExtendC2d
156 //=======================================================================
158 static void ExtendC2d (Handle(Geom2d_BSplineCurve)& aRes,
159 const Standard_Real /*t*/,
160 const Standard_Real /*dt*/,
161 const Standard_Real u1,
162 const Standard_Real u2,
163 const Standard_Real v1,
164 const Standard_Real v2,
165 const Standard_Integer FirstOrLast,
166 const Standard_Integer NumberOfSingularCase)
168 Standard_Real theParam = (FirstOrLast == 0)? aRes->FirstParameter()
169 : aRes->LastParameter();
174 Handle(Geom2d_TrimmedCurve) aSegment;
175 Geom2dConvert_CompCurveToBSplineCurve aCompCurve(aRes, Convert_RationalC1);
176 Standard_Real aTol = Precision::Confusion();
178 aRes->D1(theParam, aPBnd, aVBnd);
179 aDBnd.SetXY(aVBnd.XY());
180 gp_Lin2d aLin(aPBnd, aDBnd); //line in direction of derivative
183 gp_Dir2d theBoundDir;
184 switch (NumberOfSingularCase)
188 thePole.SetCoord(u1, v1);
189 theBoundDir.SetCoord(0., 1.);
194 thePole.SetCoord(u2, v1);
195 theBoundDir.SetCoord(0., 1.);
200 thePole.SetCoord(u1, v1);
201 theBoundDir.SetCoord(1., 0.);
206 thePole.SetCoord(u1, v2);
207 theBoundDir.SetCoord(1., 0.);
211 gp_Lin2d BoundLin(thePole, theBoundDir); //one of the bounds of rectangle
213 Standard_Real U1x = BoundLin.Direction().X();
214 Standard_Real U1y = BoundLin.Direction().Y();
215 Standard_Real U2x = aLin.Direction().X();
216 Standard_Real U2y = aLin.Direction().Y();
217 Standard_Real Uo21x = aLin.Location().X() - BoundLin.Location().X();
218 Standard_Real Uo21y = aLin.Location().Y() - BoundLin.Location().Y();
220 Standard_Real D = U1y*U2x-U1x*U2y;
222 Standard_Real ParOnLin = (Uo21y * U1x - Uo21x * U1y)/D; //parameter of intersection point
224 Handle(Geom2d_Line) aSegLine = new Geom2d_Line(aLin);
225 aSegment = (FirstOrLast == 0)?
226 new Geom2d_TrimmedCurve(aSegLine, ParOnLin, 0.) :
227 new Geom2d_TrimmedCurve(aSegLine, 0., ParOnLin);
229 aCompCurve.Add(aSegment, aTol);
230 aRes = aCompCurve.BSplineCurve();
233 //=======================================================================
236 //=======================================================================
238 static void Project(ProjLib_Projector& P, Handle(Adaptor3d_HCurve)& C)
240 GeomAbs_CurveType CType = C->GetType();
243 P.Project(C->Line());
246 P.Project(C->Circle());
248 case GeomAbs_Ellipse:
249 P.Project(C->Ellipse());
251 case GeomAbs_Hyperbola:
252 P.Project(C->Hyperbola());
254 case GeomAbs_Parabola:
255 P.Project(C->Parabola());
257 case GeomAbs_BSplineCurve:
258 case GeomAbs_BezierCurve:
259 case GeomAbs_OtherCurve: // try the approximation
262 Standard_NoSuchObject::Raise(" ");
266 //=======================================================================
267 //function : ProjLib_ProjectedCurve
269 //=======================================================================
271 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve()
274 myTolerance = Precision::Confusion();
278 //=======================================================================
279 //function : ProjLib_ProjectedCurve
281 //=======================================================================
283 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
284 (const Handle(Adaptor3d_HSurface)& S)
286 myTolerance = Precision::Confusion();
291 //=======================================================================
292 //function : ProjLib_ProjectedCurve
294 //=======================================================================
296 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
297 (const Handle(Adaptor3d_HSurface)& S,
298 const Handle(Adaptor3d_HCurve)& C)
300 myTolerance = Precision::Confusion();
306 //=======================================================================
307 //function : ProjLib_ProjectedCurve
309 //=======================================================================
311 ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
312 (const Handle(Adaptor3d_HSurface)& S,
313 const Handle(Adaptor3d_HCurve)& C,
314 const Standard_Real Tol)
316 myTolerance = Max(Tol, Precision::Confusion());
322 //=======================================================================
325 //=======================================================================
327 void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HSurface)& S)
333 //=======================================================================
336 //=======================================================================
338 void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
340 myTolerance = Max(myTolerance, Precision::Confusion());
342 Standard_Real FirstPar = C->FirstParameter();
343 Standard_Real LastPar = C->LastParameter();
344 GeomAbs_SurfaceType SType = mySurface->GetType();
345 GeomAbs_CurveType CType = myCurve->GetType();
351 ProjLib_Plane P(mySurface->Plane());
357 case GeomAbs_Cylinder:
359 ProjLib_Cylinder P(mySurface->Cylinder());
367 ProjLib_Cone P(mySurface->Cone());
375 ProjLib_Sphere P(mySurface->Sphere());
378 // on met dans la pseudo-periode ( car Sphere n'est pas
379 // periodique en V !)
380 P.SetInBounds(myCurve->FirstParameter());
388 ProjLib_Torus P(mySurface->Torus());
394 case GeomAbs_BezierSurface:
395 case GeomAbs_BSplineSurface:
398 Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
399 Standard_Integer SingularCase[2];
400 Standard_Real f, l, dt;
401 const Standard_Real eps = 0.01;
402 f = myCurve->FirstParameter();
403 l = myCurve->LastParameter();
406 Standard_Real U1=0.,U2=0.,V1=0.,V2=0;
407 const Adaptor3d_Surface& S = mySurface->Surface();
408 U1 = S.FirstUParameter();
409 U2 = S.LastUParameter();
410 V1 = S.FirstVParameter();
411 V2 = S.LastVParameter();
413 if(IsoIsDeg(S, U1, GeomAbs_IsoU, 0., myTolerance) ) {
414 //Surface has pole at U = Umin
415 gp_Pnt Pole = mySurface->Value(U1, V1);
416 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 1);
419 if(IsoIsDeg(S, U2, GeomAbs_IsoU, 0., myTolerance) ) {
420 //Surface has pole at U = Umax
421 gp_Pnt Pole = mySurface->Value(U2, V1);
422 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 2);
425 if(IsoIsDeg(S, V1, GeomAbs_IsoV, 0., myTolerance) ) {
426 //Surface has pole at V = Vmin
427 gp_Pnt Pole = mySurface->Value(U1, V1);
428 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 3);
431 if(IsoIsDeg(S, V2, GeomAbs_IsoV, 0., myTolerance) ) {
432 //Surface has pole at V = Vmax
433 gp_Pnt Pole = mySurface->Value(U1, V2);
434 TrimC3d(myCurve, IsTrimmed, dt, Pole, SingularCase, 4);
437 ProjLib_ComputeApproxOnPolarSurface polar(myCurve,
441 Handle(Geom2d_BSplineCurve) aRes = polar.BSpline();
443 if(IsTrimmed[0] || IsTrimmed[1]) {
445 //Add segment before start of curve
446 f = myCurve->FirstParameter();
447 ExtendC2d(aRes, f, -dt, U1, U2, V1, V2, 0, SingularCase[0]);
450 //Add segment after end of curve
451 l = myCurve->LastParameter();
452 ExtendC2d(aRes, l, dt, U1, U2, V1, V2, 1, SingularCase[1]);
454 Handle(Geom2d_Curve) NewCurve2d;
455 GeomLib::SameRange(Precision::PConfusion(), aRes,
456 aRes->FirstParameter(), aRes->LastParameter(),
459 aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
461 myResult.SetBSpline(aRes);
463 myResult.SetType(GeomAbs_BSplineCurve);
469 Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
470 Standard_Real Vsingular[2]; //for surfaces of revolution
471 Standard_Real f, l, dt;
472 const Standard_Real eps = 0.01;
474 if(mySurface->GetType() == GeomAbs_SurfaceOfRevolution) {
475 //Check possible singularity
477 gp_Pnt P = mySurface->AxeOfRevolution().Location();
478 gp_Dir N = mySurface->AxeOfRevolution().Direction();
482 f = myCurve->FirstParameter();
483 l = myCurve->LastParameter();
486 P = myCurve->Value(f);
487 if(L.Distance(P) < Precision::Confusion()) {
488 IsTrimmed[0] = Standard_True;
490 myCurve = myCurve->Trim(f, l, Precision::Confusion());
491 Vsingular[0] = ElCLib::Parameter(L, P);
492 //SingularCase[0] = 3;
495 P = myCurve->Value(l);
496 if(L.Distance(P) < Precision::Confusion()) {
497 IsTrimmed[1] = Standard_True;
499 myCurve = myCurve->Trim(f, l, Precision::Confusion());
500 Vsingular[1] = ElCLib::Parameter(L, P);
501 //SingularCase[1] = 3;
505 ProjLib_CompProjectedCurve Projector(mySurface,myCurve,
506 myTolerance,myTolerance);
507 Handle(ProjLib_HCompProjectedCurve) HProjector =
508 new ProjLib_HCompProjectedCurve();
509 HProjector->Set(Projector);
511 // Normalement, dans le cadre de ProjLib, le resultat
512 // doit etre une et une seule courbe !!!
513 // De plus, cette courbe ne doit pas etre Single point
514 Standard_Integer NbCurves = Projector.NbCurves();
515 Standard_Real Udeb,Ufin;
517 Projector.Bounds(1,Udeb,Ufin);
520 StdFail_NotDone::Raise("ProjLib CompProjectedCurve Not Done");
522 // Approximons cette courbe algorithmique.
523 Standard_Boolean Only3d = Standard_False;
524 Standard_Boolean Only2d = Standard_True;
525 GeomAbs_Shape Continuity = GeomAbs_C1;
526 Standard_Integer MaxDegree = 14;
527 Standard_Integer MaxSeg = 16;
529 Approx_CurveOnSurface appr(HProjector, mySurface, Udeb, Ufin,
531 Continuity, MaxDegree, MaxSeg,
534 Handle(Geom2d_BSplineCurve) aRes = appr.Curve2d();
536 if(IsTrimmed[0] || IsTrimmed[1]) {
537 // Treatment only for surface of revolution
538 Standard_Real u1, u2, v1, v2;
539 u1 = mySurface->FirstUParameter();
540 u2 = mySurface->LastUParameter();
541 v1 = mySurface->FirstVParameter();
542 v2 = mySurface->LastVParameter();
545 //Add segment before start of curve
546 ExtendC2d(aRes, f, -dt, u1, u2, Vsingular[0], v2, 0, 3);
549 //Add segment after end of curve
550 ExtendC2d(aRes, l, dt, u1, u2, Vsingular[1], v2, 1, 3);
552 Handle(Geom2d_Curve) NewCurve2d;
553 GeomLib::SameRange(Precision::PConfusion(), aRes,
554 aRes->FirstParameter(), aRes->LastParameter(),
557 aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
560 myResult.SetBSpline(aRes);
562 myResult.SetType(GeomAbs_BSplineCurve);
565 if ( !myResult.IsDone()) {
566 ProjLib_ComputeApprox Comp( myCurve, mySurface, myTolerance);
570 if ( SType == GeomAbs_Plane && CType == GeomAbs_BezierCurve) {
571 myResult.SetType(GeomAbs_BezierCurve);
572 myResult.SetBezier(Comp.Bezier()) ;
575 myResult.SetType(GeomAbs_BSplineCurve);
576 myResult.SetBSpline(Comp.BSpline()) ;
578 // set the periodicity flag
579 if ( SType == GeomAbs_Plane &&
580 CType == GeomAbs_BSplineCurve &&
581 myCurve->IsPeriodic() ) {
582 myResult.SetPeriodic();
584 myTolerance = Comp.Tolerance();
588 // On remet arbitrairement la tol atteinte a une valeur
589 // petite en attendant mieux. dub lbo 11/03/97
590 myTolerance = Min(myTolerance,Precision::Confusion());
592 // Translate the projected curve to keep the first point
593 // In the canonical boundaries of periodic surfaces.
594 if (mySurface->IsUPeriodic()) {
596 Standard_Real aT1, aT2, aU1, aU2, aUPeriod, aUr, aUm, aUmid, dUm, dUr;
597 GeomAbs_CurveType aTypeR;
598 ProjLib_Projector aResult;
600 aT1=myCurve->FirstParameter();
601 aT2=myCurve->LastParameter();
602 aU1=mySurface->FirstUParameter();
603 aU2=mySurface->LastUParameter();
604 aUPeriod=mySurface->UPeriod();
606 aTypeR=myResult.GetType();
607 if ((aU2-aU1)<(aUPeriod-myTolerance) && aTypeR == GeomAbs_Line) {
609 aResult.UFrame(aT1, aT2, aU1, aUPeriod);
611 gp_Lin2d &aLr = (gp_Lin2d &) aResult.Line();
612 aUr=aLr.Location().X();
613 gp_Lin2d &aLm = (gp_Lin2d &) myResult.Line();
614 aUm=aLm.Location().X();
624 myResult.UFrame(aT1, aT2, aU1, aUPeriod);
628 myResult.UFrame(myCurve->FirstParameter(),
629 myCurve->LastParameter(),
630 mySurface->FirstUParameter(),
631 mySurface->UPeriod());
634 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
635 // Correct the U isoline in periodical surface
636 // to be inside restriction boundaries.
637 if (myResult.GetType() == GeomAbs_Line) {
638 gp_Lin2d &aLine = (gp_Lin2d &) myResult.Line();
640 Standard_Real aPeriod = mySurface->UPeriod();
641 Standard_Real aFUPar = mySurface->FirstUParameter();
642 Standard_Real aLUPar = mySurface->LastUParameter();
644 // Check if the parametric range is lower then the period.
645 if (aLUPar - aFUPar < aPeriod - myTolerance) {
646 Standard_Real aU = aLine.Location().X();
648 if (Abs(aU + aPeriod - aFUPar) < myTolerance ||
649 Abs(aU - aPeriod - aFUPar) < myTolerance) {
650 gp_Pnt2d aNewLoc(aFUPar, aLine.Location().Y());
652 aLine.SetLocation(aNewLoc);
653 } else if (Abs(aU + aPeriod - aLUPar) < myTolerance ||
654 Abs(aU - aPeriod - aLUPar) < myTolerance) {
655 gp_Pnt2d aNewLoc(aLUPar, aLine.Location().Y());
657 aLine.SetLocation(aNewLoc);
662 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
664 if (mySurface->IsVPeriodic()) {
665 myResult.VFrame(myCurve->FirstParameter(),
666 myCurve->LastParameter(),
667 mySurface->FirstVParameter(),
668 mySurface->VPeriod());
669 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 Begin
670 // Correct the V isoline in a periodical surface
671 // to be inside restriction boundaries.
672 if (myResult.GetType() == GeomAbs_Line) {
673 gp_Lin2d &aLine = (gp_Lin2d &) myResult.Line();
675 Standard_Real aPeriod = mySurface->VPeriod();
676 Standard_Real aFVPar = mySurface->FirstVParameter();
677 Standard_Real aLVPar = mySurface->LastVParameter();
679 // Check if the parametric range is lower then the period.
680 if (aLVPar - aFVPar < aPeriod - myTolerance) {
681 Standard_Real aV = aLine.Location().Y();
683 if (Abs(aV + aPeriod - aFVPar) < myTolerance ||
684 Abs(aV - aPeriod - aFVPar) < myTolerance) {
685 gp_Pnt2d aNewLoc(aLine.Location().X(), aFVPar);
687 aLine.SetLocation(aNewLoc);
688 } else if (Abs(aV + aPeriod - aLVPar) < myTolerance ||
689 Abs(aV - aPeriod - aLVPar) < myTolerance) {
690 gp_Pnt2d aNewLoc(aLine.Location().X(), aLVPar);
692 aLine.SetLocation(aNewLoc);
697 // Modified by skv - Wed Aug 11 15:45:58 2004 OCC6272 End
702 //=======================================================================
703 //function : GetSurface
705 //=======================================================================
707 const Handle(Adaptor3d_HSurface)& ProjLib_ProjectedCurve::GetSurface() const
713 //=======================================================================
714 //function : GetCurve
716 //=======================================================================
718 const Handle(Adaptor3d_HCurve)& ProjLib_ProjectedCurve::GetCurve() const
724 //=======================================================================
725 //function : GetTolerance
727 //=======================================================================
729 Standard_Real ProjLib_ProjectedCurve::GetTolerance() const
735 //=======================================================================
736 //function : FirstParameter
738 //=======================================================================
740 Standard_Real ProjLib_ProjectedCurve::FirstParameter() const
742 return myCurve->FirstParameter();
746 //=======================================================================
747 //function : LastParameter
749 //=======================================================================
751 Standard_Real ProjLib_ProjectedCurve::LastParameter() const
753 return myCurve->LastParameter();
757 //=======================================================================
758 //function : Continuity
760 //=======================================================================
762 GeomAbs_Shape ProjLib_ProjectedCurve::Continuity() const
764 Standard_NotImplemented::Raise("");
769 //=======================================================================
770 //function : NbIntervals
772 //=======================================================================
774 Standard_Integer ProjLib_ProjectedCurve::NbIntervals(const GeomAbs_Shape ) const
776 Standard_NotImplemented::Raise("");
781 //=======================================================================
782 //function : Intervals
784 //=======================================================================
786 //void ProjLib_ProjectedCurve::Intervals(TColStd_Array1OfReal& T,
787 void ProjLib_ProjectedCurve::Intervals(TColStd_Array1OfReal& ,
788 const GeomAbs_Shape ) const
790 Standard_NotImplemented::Raise("");
794 //=======================================================================
795 //function : IsClosed
797 //=======================================================================
799 Standard_Boolean ProjLib_ProjectedCurve::IsClosed() const
801 Standard_NotImplemented::Raise("");
802 return Standard_True;
806 //=======================================================================
807 //function : IsPeriodic
809 //=======================================================================
811 Standard_Boolean ProjLib_ProjectedCurve::IsPeriodic() const
813 return myResult.IsPeriodic();
817 //=======================================================================
820 //=======================================================================
822 Standard_Real ProjLib_ProjectedCurve::Period() const
824 Standard_NotImplemented::Raise("");
829 //=======================================================================
832 //=======================================================================
834 gp_Pnt2d ProjLib_ProjectedCurve::Value(const Standard_Real ) const
836 Standard_NotImplemented::Raise("");
837 return gp_Pnt2d(0.,0.);
841 //=======================================================================
844 //=======================================================================
846 void ProjLib_ProjectedCurve::D0(const Standard_Real , gp_Pnt2d& ) const
848 Standard_NotImplemented::Raise("");
852 //=======================================================================
855 //=======================================================================
857 void ProjLib_ProjectedCurve::D1(const Standard_Real ,
861 Standard_NotImplemented::Raise("");
865 //=======================================================================
868 //=======================================================================
870 void ProjLib_ProjectedCurve::D2(const Standard_Real ,
875 Standard_NotImplemented::Raise("");
879 //=======================================================================
882 //=======================================================================
884 void ProjLib_ProjectedCurve::D3(const Standard_Real,
890 Standard_NotImplemented::Raise("");
894 //=======================================================================
897 //=======================================================================
899 gp_Vec2d ProjLib_ProjectedCurve::DN(const Standard_Real,
900 const Standard_Integer) const
902 Standard_NotImplemented::Raise("");
903 return gp_Vec2d(0.,0.);
907 //=======================================================================
908 //function : Resolution
910 //=======================================================================
912 Standard_Real ProjLib_ProjectedCurve::Resolution(const Standard_Real) const
914 Standard_NotImplemented::Raise("");
919 //=======================================================================
922 //=======================================================================
924 GeomAbs_CurveType ProjLib_ProjectedCurve::GetType() const
926 return myResult.GetType();
930 //=======================================================================
933 //=======================================================================
935 gp_Lin2d ProjLib_ProjectedCurve::Line() const
937 return myResult.Line();
941 //=======================================================================
944 //=======================================================================
946 gp_Circ2d ProjLib_ProjectedCurve::Circle() const
948 return myResult.Circle();
952 //=======================================================================
955 //=======================================================================
957 gp_Elips2d ProjLib_ProjectedCurve::Ellipse() const
959 return myResult.Ellipse();
963 //=======================================================================
964 //function : Hyperbola
966 //=======================================================================
968 gp_Hypr2d ProjLib_ProjectedCurve::Hyperbola() const
970 return myResult.Hyperbola();
974 //=======================================================================
975 //function : Parabola
977 //=======================================================================
979 gp_Parab2d ProjLib_ProjectedCurve::Parabola() const
981 return myResult.Parabola();
986 //=======================================================================
989 //=======================================================================
991 Standard_Integer ProjLib_ProjectedCurve::Degree() const
993 Standard_NoSuchObject_Raise_if
994 ( (GetType() != GeomAbs_BSplineCurve) &&
995 (GetType() != GeomAbs_BezierCurve),
996 "ProjLib_ProjectedCurve:Degree");
997 if (GetType() == GeomAbs_BSplineCurve) {
998 return myResult.BSpline()->Degree();
1000 else if (GetType() == GeomAbs_BezierCurve) {
1001 return myResult.Bezier()->Degree();
1008 //=======================================================================
1009 //function : IsRational
1011 //=======================================================================
1013 Standard_Boolean ProjLib_ProjectedCurve::IsRational() const
1015 Standard_NoSuchObject_Raise_if
1016 ( (GetType() != GeomAbs_BSplineCurve) &&
1017 (GetType() != GeomAbs_BezierCurve),
1018 "ProjLib_ProjectedCurve:IsRational");
1019 if (GetType() == GeomAbs_BSplineCurve) {
1020 return myResult.BSpline()->IsRational();
1022 else if (GetType() == GeomAbs_BezierCurve) {
1023 return myResult.Bezier()->IsRational();
1026 return Standard_False;
1029 //=======================================================================
1030 //function : NbPoles
1032 //=======================================================================
1034 Standard_Integer ProjLib_ProjectedCurve::NbPoles() const
1036 Standard_NoSuchObject_Raise_if
1037 ( (GetType() != GeomAbs_BSplineCurve) &&
1038 (GetType() != GeomAbs_BezierCurve)
1039 ,"ProjLib_ProjectedCurve:NbPoles" );
1040 if (GetType() == GeomAbs_BSplineCurve) {
1041 return myResult.BSpline()->NbPoles();
1043 else if (GetType() == GeomAbs_BezierCurve) {
1044 return myResult.Bezier()->NbPoles();
1051 //=======================================================================
1052 //function : NbKnots
1054 //=======================================================================
1056 Standard_Integer ProjLib_ProjectedCurve::NbKnots() const
1058 Standard_NoSuchObject_Raise_if ( GetType() != GeomAbs_BSplineCurve,
1059 "ProjLib_ProjectedCurve:NbKnots");
1060 return myResult.BSpline()->NbKnots();
1063 //=======================================================================
1066 //=======================================================================
1068 Handle(Geom2d_BezierCurve) ProjLib_ProjectedCurve::Bezier() const
1070 return myResult.Bezier() ;
1073 //=======================================================================
1074 //function : BSpline
1076 //=======================================================================
1078 Handle(Geom2d_BSplineCurve) ProjLib_ProjectedCurve::BSpline() const
1080 return myResult.BSpline() ;
1082 //=======================================================================
1085 //=======================================================================
1087 Handle(Adaptor2d_HCurve2d) ProjLib_ProjectedCurve::Trim
1088 //(const Standard_Real First,
1089 // const Standard_Real Last,
1090 // const Standard_Real Tolerance) const
1091 (const Standard_Real ,
1092 const Standard_Real ,
1093 const Standard_Real ) const
1095 Standard_NotImplemented::Raise("");