0024275: Cppcheck warnings on uninitialized class members
[occt.git] / src / Adaptor3d / Adaptor3d_IsoCurve.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
3// The content of this file is subject to the Open CASCADE Technology Public
4// License Version 6.5 (the "License"). You may not use the content of this file
5// except in compliance with the License. Please obtain a copy of the License
6// at http://www.opencascade.org and read it completely before using this file.
7//
8// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10//
11// The Original Code and all software distributed under the License is
12// distributed on an "AS IS" basis, without warranty of any kind, and the
13// Initial Developer hereby disclaims all such warranties, including without
14// limitation, any warranties of merchantability, fitness for a particular
15// purpose or non-infringement. Please see the License for the specific terms
16// and conditions governing the rights and limitations under the License.
17
7fd59977 18#include <Adaptor3d_IsoCurve.ixx>
19
20#include <Adaptor3d_HIsoCurve.hxx>
21#include <Adaptor3d_HSurfaceOfRevolution.hxx>
22#include <Geom_BezierSurface.hxx>
23#include <Geom_BSplineSurface.hxx>
24#include <GeomAbs_SurfaceType.hxx>
25#include <Standard_NoSuchObject.hxx>
26#include <Standard_NotImplemented.hxx>
27#include <gp_Ax2.hxx>
28#include <ElCLib.hxx>
29#include <ElSLib.hxx>
30#include <BSplCLib.hxx>
31#include <BSplSLib.hxx>
32#include <Precision.hxx>
33#include <TColgp_Array1OfPnt.hxx>
34#include <TColgp_Array2OfPnt.hxx>
35
36
37//=======================================================================
38//function : Adaptor3d_IsoCurve
39//purpose :
40//=======================================================================
41
42Adaptor3d_IsoCurve::Adaptor3d_IsoCurve() :
c24d4017 43 myIso(GeomAbs_NoneIso),
44 myFirst ( 0. ),
45 myLast ( 0. ),
46 myParameter ( 0. )
7fd59977 47{}
48
49//=======================================================================
50//function : Adaptor3d_IsoCurve
51//purpose :
52//=======================================================================
53
c24d4017 54Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S) :
55 myFirst ( 0. ),
56 myLast ( 0. ),
57 myParameter ( 0. )
7fd59977 58{
59 Load(S);
60}
61
62//=======================================================================
63//function : Adaptor3d_IsoCurve
64//purpose :
65//=======================================================================
66
67Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
68 const GeomAbs_IsoType Iso,
69 const Standard_Real Param)
70{
71 Load(S);
72 Load(Iso,Param);
73}
74
75//=======================================================================
76//function : Adaptor3d_IsoCurve
77//purpose :
78//=======================================================================
79
80Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
81 const GeomAbs_IsoType Iso,
82 const Standard_Real Param,
83 const Standard_Real WFirst,
84 const Standard_Real WLast)
85{
86 Load(S);
87 Load(Iso,Param,WFirst,WLast);
88}
89
90//=======================================================================
91//function : Load
92//purpose :
93//=======================================================================
94
95void Adaptor3d_IsoCurve::Load(const Handle(Adaptor3d_HSurface)& S )
96{
97 mySurface = S;
98 myIso = GeomAbs_NoneIso;
99}
100
101//=======================================================================
102//function : Load
103//purpose :
104//=======================================================================
105
106void Adaptor3d_IsoCurve::Load(const GeomAbs_IsoType Iso,
107 const Standard_Real Param)
108{
109 switch (Iso) {
110
111 case GeomAbs_IsoU:
112 Load(Iso,Param,
113 mySurface->FirstVParameter(),
114 mySurface->LastVParameter());
115 break;
116
117 case GeomAbs_IsoV:
118 Load(Iso,Param,
119 mySurface->FirstUParameter(),
120 mySurface->LastUParameter());
121 break;
122
123 case GeomAbs_NoneIso:
124 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
125 break;
126 }
127}
128
129//=======================================================================
130//function : Load
131//purpose :
132//=======================================================================
133
134void Adaptor3d_IsoCurve::Load(const GeomAbs_IsoType Iso,
135 const Standard_Real Param,
136 const Standard_Real WFirst,
137 const Standard_Real WLast)
138{
139 myIso =Iso;
140 myParameter = Param;
141 myFirst = WFirst;
142 myLast = WLast;
143
144
145 if (myIso == GeomAbs_IsoU) {
146 myFirst = Max(myFirst, mySurface->FirstVParameter());
147 myLast = Min(myLast, mySurface->LastVParameter());
148 }
149 else {
150 myFirst = Max(myFirst, mySurface->FirstUParameter());
151 myLast = Min(myLast, mySurface->LastUParameter());
152 }
153
154// Adjust the parameters on periodic surfaces
155
156 Standard_Real dummy = myParameter;
157
158 if (mySurface->IsUPeriodic()) {
159
160 if (myIso == GeomAbs_IsoU) {
161 ElCLib::AdjustPeriodic
162 (mySurface->FirstUParameter(),
163 mySurface->FirstUParameter()+
164 mySurface->UPeriod(),
165 mySurface->UResolution(Precision::Confusion()),
166 myParameter,dummy);
167 }
168 else {
169 ElCLib::AdjustPeriodic
170 (mySurface->FirstUParameter(),
171 mySurface->FirstUParameter()+
172 mySurface->UPeriod(),
173 mySurface->UResolution(Precision::Confusion()),
174 myFirst,myLast);
175 }
176 }
177
178 if (mySurface->IsVPeriodic()) {
179
180 if (myIso == GeomAbs_IsoV) {
181 ElCLib::AdjustPeriodic
182 (mySurface->FirstVParameter(),
183 mySurface->FirstVParameter() +
184 mySurface->VPeriod(),
185 mySurface->VResolution(Precision::Confusion()),
186 myParameter,dummy);
187 }
188 else {
189 ElCLib::AdjustPeriodic
190 (mySurface->FirstVParameter(),
191 mySurface->FirstVParameter() +
192 mySurface->VPeriod(),
193 mySurface->VResolution(Precision::Confusion()),
194 myFirst,myLast);
195 }
196 }
197
198}
199
200//=======================================================================
201//function : Continuity
202//purpose :
203//=======================================================================
204
205GeomAbs_Shape Adaptor3d_IsoCurve::Continuity() const
206{
207 switch (myIso) {
208 case GeomAbs_IsoU:
209 return mySurface->VContinuity();
210 case GeomAbs_IsoV:
211 return mySurface->UContinuity();
212 case GeomAbs_NoneIso:
213 default:
214 break;
215 }
216
217 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
218 return GeomAbs_C0;
219}
220
221//=======================================================================
222//function : NbIntervals
223//purpose :
224//=======================================================================
225
226Standard_Integer Adaptor3d_IsoCurve::NbIntervals(const GeomAbs_Shape S)
227{
228 if (myIso == GeomAbs_NoneIso) Standard_NoSuchObject::Raise();
229 Standard_Boolean UIso = (myIso == GeomAbs_IsoU);
230
231 Standard_Integer nbInter = UIso ?
232 mySurface->NbVIntervals(S) :
233 mySurface->NbUIntervals(S);
234
235 TColStd_Array1OfReal T(1,nbInter+1);
236
237 if (UIso)
238 mySurface->VIntervals(T,S);
239 else
240 mySurface->UIntervals(T,S);
241
242 if(nbInter == 1) return nbInter;
243
244 Standard_Integer first = 1;
245 while (T(first) <= myFirst) first++;
246 Standard_Integer last = nbInter+1;
247 while (T(last) >= myLast) last--;
248 return (last - first + 2);
249}
250
251//=======================================================================
252//function : Intervals
253//purpose :
254//=======================================================================
255
256void Adaptor3d_IsoCurve::Intervals(TColStd_Array1OfReal& TI,
257 const GeomAbs_Shape S)
258{
259 if (myIso == GeomAbs_NoneIso) Standard_NoSuchObject::Raise();
260 Standard_Boolean UIso = (myIso == GeomAbs_IsoU);
261
262 Standard_Integer nbInter = UIso ?
263 mySurface->NbVIntervals(S) :
264 mySurface->NbUIntervals(S);
265
266 TColStd_Array1OfReal T(1,nbInter+1);
267
268 if (UIso)
269 mySurface->VIntervals(T,S);
270 else
271 mySurface->UIntervals(T,S);
272
273 if(nbInter == 1) {
274 TI(TI.Lower()) = myFirst ;
275 TI(TI.Lower() + 1) = myLast ;
276 return;
277 }
278
279 Standard_Integer first = 1;
280 while (T(first) <= myFirst) first++;
281 Standard_Integer last = nbInter+1;
282 while (T(last) >= myLast) last--;
283
284 Standard_Integer i = TI.Lower(), j;
285 for (j = first-1; j <= last+1; j++) {
286 TI(i) = T(j);
287 i++;
288 }
289 TI(TI.Lower()) = myFirst ;
290 TI(TI.Lower() + last-first + 2) = myLast ;
291}
292
293//=======================================================================
294//function : Trim
295//purpose :
296//=======================================================================
297
298Handle(Adaptor3d_HCurve) Adaptor3d_IsoCurve::Trim
299 (const Standard_Real First,
300 const Standard_Real Last,
301 const Standard_Real) const
302{
303 Handle(Adaptor3d_HIsoCurve) HI = new Adaptor3d_HIsoCurve(*this);
304 ((Adaptor3d_IsoCurve *)&(HI->Curve()))->Load(myIso,myParameter,First,Last);
305 return HI;
306}
307
308//=======================================================================
309//function : IsClosed
310//purpose :
311//=======================================================================
312
313Standard_Boolean Adaptor3d_IsoCurve::IsClosed() const
314{
315 switch (myIso) {
316 case GeomAbs_IsoU:
317 return mySurface->IsVClosed();
318 case GeomAbs_IsoV:
319 return mySurface->IsUClosed();
320 case GeomAbs_NoneIso:
321 default:
322 break;
323 }
324
325 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
326 return Standard_False;
327}
328
329//=======================================================================
330//function : IsPeriodic
331//purpose :
332//=======================================================================
333
334Standard_Boolean Adaptor3d_IsoCurve::IsPeriodic() const
335{
336 switch (myIso) {
337 case GeomAbs_IsoU:
338 return mySurface->IsVPeriodic();
339 case GeomAbs_IsoV:
340 return mySurface->IsUPeriodic();
341 case GeomAbs_NoneIso:
342 default:
343 break;
344 }
345
346 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
347 return Standard_False;
348}
349
350//=======================================================================
351//function : Period
352//purpose :
353//=======================================================================
354
355Standard_Real Adaptor3d_IsoCurve::Period() const
356{
357 switch (myIso) {
358 case GeomAbs_IsoU:
359 return mySurface->VPeriod();
360 case GeomAbs_IsoV:
361 return mySurface->UPeriod();
362 case GeomAbs_NoneIso:
363 default:
364 break;
365 }
366
367 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
368 return 0.;
369}
370
371//=======================================================================
372//function : Value
373//purpose :
374//=======================================================================
375
376gp_Pnt Adaptor3d_IsoCurve::Value(const Standard_Real T) const
377{
378 switch (myIso) {
379
380 case GeomAbs_IsoU:
381 return mySurface->Value(myParameter,T);
382
383 case GeomAbs_IsoV:
384 return mySurface->Value(T,myParameter);
385
386 case GeomAbs_NoneIso:
387 {
388 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
389 break;
390 }
391 }
392 // portage WNT
393 return gp_Pnt();
394}
395
396
397//=======================================================================
398//function : D0
399//purpose :
400//=======================================================================
401
402void Adaptor3d_IsoCurve::D0(const Standard_Real T, gp_Pnt& P) const
403{
404 switch (myIso) {
405
406 case GeomAbs_IsoU:
407 mySurface->D0(myParameter,T,P);
408 break;
409
410 case GeomAbs_IsoV:
411 mySurface->D0(T,myParameter,P);
412 break;
413
414 case GeomAbs_NoneIso:
415 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
416 break;
417 }
418}
419
420//=======================================================================
421//function : D1
422//purpose :
423//=======================================================================
424
425void Adaptor3d_IsoCurve::D1(const Standard_Real T, gp_Pnt& P, gp_Vec& V) const
426{
427 gp_Vec dummy;
428 switch (myIso) {
429
430 case GeomAbs_IsoU:
431 mySurface->D1(myParameter,T,P,dummy,V);
432 break;
433
434 case GeomAbs_IsoV:
435 mySurface->D1(T,myParameter,P,V,dummy);
436 break;
437
438 case GeomAbs_NoneIso:
439 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
440 break;
441 }
442}
443
444//=======================================================================
445//function : D2
446//purpose :
447//=======================================================================
448
449void Adaptor3d_IsoCurve::D2(const Standard_Real T, gp_Pnt& P,
450 gp_Vec& V1, gp_Vec& V2) const
451{
452 gp_Vec dummy1,dummy2,dummy3;
453 switch (myIso) {
454
455 case GeomAbs_IsoU:
456 mySurface->D2(myParameter,T,P,
457 dummy1,V1,dummy2,V2,dummy3);
458 break;
459 case GeomAbs_IsoV:
460 mySurface->D2(T,myParameter,
461 P,V1,dummy1,V2,dummy2,dummy3);
462 break;
463 case GeomAbs_NoneIso:
464 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
465 break;
466 }
467}
468
469//=======================================================================
470//function : D3
471//purpose :
472//=======================================================================
473
474void Adaptor3d_IsoCurve::D3(const Standard_Real T, gp_Pnt& P,
475 gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
476{
477 gp_Vec dummy[6];
478 switch (myIso) {
479
480 case GeomAbs_IsoU:
481 mySurface->D3(myParameter,T,P,dummy[0],V1,dummy[1],
482 V2,dummy[2],dummy[3],V3,dummy[4],dummy[5]);
483 break;
484
485 case GeomAbs_IsoV:
486 mySurface->D3(T,myParameter,P,V1,dummy[0],V2,dummy[1],
487 dummy[2],V3,dummy[3],dummy[4],dummy[5]);
488 break;
489
490 case GeomAbs_NoneIso:
491 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
492 break;
493 }
494}
495
496//=======================================================================
497//function : DN
498//purpose :
499//=======================================================================
500
501gp_Vec Adaptor3d_IsoCurve::DN(const Standard_Real T,
502 const Standard_Integer N) const
503{
504 switch (myIso) {
505
506 case GeomAbs_IsoU:
507 return mySurface->DN(myParameter,T,0,N);
508 case GeomAbs_IsoV:
509 return mySurface->DN(T,myParameter,N,0);
510 case GeomAbs_NoneIso:
511 {
512 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
513 break;
514 }
515 }
516
517 // portage WNT
518 return gp_Vec();
519}
520
521
522//=======================================================================
523//function : Resolution
524//purpose :
525//=======================================================================
526
527Standard_Real Adaptor3d_IsoCurve::Resolution(const Standard_Real R3D) const
528{
529 // Peut-on faire mieux ??
530 return Precision::Parametric(R3D);
531}
532
533
534
535//=======================================================================
536//function : GetType
537//purpose :
538//=======================================================================
539
540GeomAbs_CurveType Adaptor3d_IsoCurve::GetType() const {
541
542 switch (mySurface->GetType()) {
543
544 case GeomAbs_Plane:
545 return GeomAbs_Line;
546
547 case GeomAbs_Cylinder:
548 case GeomAbs_Cone:
549 {
550 switch (myIso) {
551 case GeomAbs_IsoU:
552 return GeomAbs_Line;
553
554 case GeomAbs_IsoV:
555 return GeomAbs_Circle;
556
557 case GeomAbs_NoneIso:
558 {
559 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
560 // portage WNT
561 return GeomAbs_OtherCurve;
7fd59977 562 }
563 }
564 break;
565 }
566
567 case GeomAbs_Sphere:
568 case GeomAbs_Torus:
569 return GeomAbs_Circle;
570
571 case GeomAbs_BezierSurface:
572 return GeomAbs_BezierCurve;
573
574 case GeomAbs_BSplineSurface:
575 return GeomAbs_BSplineCurve;
576
577 case GeomAbs_SurfaceOfRevolution:
578 {
579 switch (myIso) {
580 case GeomAbs_IsoU:
581 return mySurface->BasisCurve()->GetType();
582
583 case GeomAbs_IsoV:
584 return GeomAbs_Circle;
585
586 case GeomAbs_NoneIso:
587 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
588 // portage WNT
589 return GeomAbs_OtherCurve;
590 break;
591 }
592 break;
593 }
594
595 case GeomAbs_SurfaceOfExtrusion:
596 {
597 switch (myIso) {
598 case GeomAbs_IsoU:
599 return GeomAbs_Line;
600
601 case GeomAbs_IsoV:
602 return mySurface->BasisCurve()->GetType();
603
604 case GeomAbs_NoneIso:
605 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
606 // portage WNT
607 return GeomAbs_OtherCurve;
608 break;
609 }
610 break;
611 }
612 default:
613 return GeomAbs_OtherCurve;
614 }
615
616 // portage WNT
617 return GeomAbs_OtherCurve;
618}
619
620//=======================================================================
621//function : Line
622//purpose :
623//=======================================================================
624
625gp_Lin Adaptor3d_IsoCurve::Line() const
626{
627 gp_Pnt P;
628 gp_Vec V;
629 D1(0,P,V);
630 return gp_Lin(P,V);
631}
632
633//=======================================================================
634//function : computeHR
635//purpose :
636//=======================================================================
637
638static void computeHR(const gp_Ax3& axes,
639 const gp_Pnt& P,
640 Standard_Real& h,
641 Standard_Real& radius)
642{
643 gp_Vec V(axes.Location(),P);
644 h = V * axes.Direction();
645 radius = V * axes.XDirection();
646}
647
648//=======================================================================
649//function : Circle
650//purpose :
651//=======================================================================
652
653gp_Circ Adaptor3d_IsoCurve::Circle() const
654{
655 gp_Ax3 axes;
656 Standard_Real radius,h = 0.;
657
658 switch (mySurface->GetType()) {
659
660 case GeomAbs_Cylinder:
661 {
662 gp_Cylinder cyl = mySurface->Cylinder();
663
664 switch (myIso) {
665
666 case GeomAbs_IsoU:
667 {
668 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:UIso");
669 return gp_Circ();
670 }
671 case GeomAbs_IsoV:
672 {
673 return ElSLib::CylinderVIso(cyl.Position(),cyl.Radius(),myParameter);
674 }
675 case GeomAbs_NoneIso:
676 {
677 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
678 return gp_Circ();
679 }
680 }
681 break;
682 }
683
684 case GeomAbs_Cone:
685 {
686 gp_Cone cone = mySurface->Cone();
687
688 switch (myIso) {
689
690 case GeomAbs_IsoU:
691 {
692 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:UIso");
693 return gp_Circ();
694 }
695 case GeomAbs_IsoV:
696 {
697 return ElSLib::ConeVIso(cone.Position(),cone.RefRadius(),
698 cone.SemiAngle(),myParameter);
699 }
700 case GeomAbs_NoneIso:
701 {
702 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
703 return gp_Circ();
704 }
705 }
706 break;
707 }
708
709 case GeomAbs_Sphere:
710 {
711 gp_Sphere sph = mySurface->Sphere();
712
713 switch (myIso) {
714
715 case GeomAbs_IsoU:
716 {
717 return ElSLib::SphereUIso(sph.Position(),sph.Radius(),myParameter);
718 }
719
720 case GeomAbs_IsoV:
721 {
722 return ElSLib::SphereVIso(sph.Position(),sph.Radius(),myParameter);
723 }
724
725 case GeomAbs_NoneIso:
726 {
727 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
728 return gp_Circ();
729 }
730 }
731 break;
732 }
733
734 case GeomAbs_Torus: {
735 gp_Torus tor = mySurface->Torus();
736
737 switch (myIso) {
738
739 case GeomAbs_IsoU:
740 {
741 return ElSLib::TorusUIso(tor.Position(),tor.MajorRadius(),
742 tor.MinorRadius(),myParameter);
743 }
744
745 case GeomAbs_IsoV:
746 {
747 return ElSLib::TorusVIso(tor.Position(),tor.MajorRadius(),
748 tor.MinorRadius(),myParameter);
749 }
750
751 case GeomAbs_NoneIso:
752 {
753 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
754 return gp_Circ();
755 }
756 }
757 break;
758 }
759
760 case GeomAbs_SurfaceOfRevolution:
761 {
762 if (myIso == GeomAbs_IsoV) {
763 gp_Ax1 Ax1 = mySurface->AxeOfRevolution();
764 gp_Vec DX(Ax1.Location(), Value(0));
765 if(DX.IsParallel(Ax1.Direction(),Precision::Angular())) {
766 return gp_Circ(gp_Ax2(Value(0), Ax1.Direction()),0);
767 }
768 else {
769 axes = gp_Ax3(Ax1.Location(), Ax1.Direction(), DX);
770 computeHR(axes,Value(0),h,radius);
771 gp_Vec VT = axes.Direction();
772 axes.Translate(VT * h);
773 return gp_Circ(axes.Ax2(),radius);
774 }
775 }
776 else {
777 return mySurface->BasisCurve()->Circle().Rotated
778 (mySurface->AxeOfRevolution(),myParameter);
779 }
780 }
781
782 case GeomAbs_SurfaceOfExtrusion: {
783 return mySurface->BasisCurve()->Circle().Translated
784 (myParameter * gp_Vec(mySurface->Direction()));
785 }
786 default:
787 {
788 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:Circle");
789 return gp_Circ();
790 }
791
792 }
793 // portage WNT
794 return gp_Circ();
795}
796
797//=======================================================================
798//function : Ellipse
799//purpose :
800//=======================================================================
801
802gp_Elips Adaptor3d_IsoCurve::Ellipse() const
803{
804 switch (mySurface->GetType()) {
805
806 case GeomAbs_SurfaceOfExtrusion: {
807 return mySurface->BasisCurve()->Ellipse().Translated
808 (myParameter * gp_Vec(mySurface->Direction()));
809 }
810 default:
811 {
812 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:Ellipse");
d3f26155 813 }
7fd59977 814 }
cf6625bd 815 return gp_Elips();
7fd59977 816}
817
818//=======================================================================
819//function : Hyperbola
820//purpose :
821//=======================================================================
822
823gp_Hypr Adaptor3d_IsoCurve::Hyperbola() const
824{
825 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:Hyperbola");
826 return gp_Hypr();
827}
828
829//=======================================================================
830//function : Parabola
831//purpose :
832//=======================================================================
833
834gp_Parab Adaptor3d_IsoCurve::Parabola() const
835{
836 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:Parabola");
837 return gp_Parab();
838}
839
840//=======================================================================
841//function : Degree
842//purpose :
843//=======================================================================
844
845Standard_Integer Adaptor3d_IsoCurve::Degree() const
846{
847 Standard_Integer degree = 0 ;
848 GeomAbs_SurfaceType type = mySurface->GetType() ;
849 switch(type) {
850 case GeomAbs_BezierSurface:
851 case GeomAbs_BSplineSurface:
852 {
853 switch (myIso) {
854 case GeomAbs_IsoU:
855 degree = mySurface->VDegree() ;
856 break ;
857 case GeomAbs_IsoV:
858 degree = mySurface->UDegree() ;
859 break ;
860
861 case GeomAbs_NoneIso:
862 default:
863 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
864 }
865 }
866 break ;
867 case GeomAbs_SurfaceOfRevolution:
868 {
869 switch (myIso) {
870 case GeomAbs_IsoU:
871 degree = mySurface->BasisCurve()->Degree();
872 break;
873 default:
874 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
875 }
876 }
877 break;
878 case GeomAbs_SurfaceOfExtrusion:
879 {
880 switch (myIso) {
881 case GeomAbs_IsoV:
882 degree = mySurface->BasisCurve()->Degree();
883 break;
884 default:
885 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
886 }
887 }
888 break;
889 default:
890 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
891 break ;
892 }
893 return degree ;
894}
895
896//=======================================================================
897//function : IsRational
898//purpose :
899//=======================================================================
900
901Standard_Boolean Adaptor3d_IsoCurve::IsRational() const
902{
903 Standard_Integer is_rational = Standard_False ;
904 GeomAbs_SurfaceType type = mySurface->GetType() ;
905 switch(type) {
906 case GeomAbs_BezierSurface:
907 case GeomAbs_BSplineSurface:
908 {
909 switch (myIso) {
910 case GeomAbs_IsoU:
911 is_rational = mySurface->IsVRational() ;
912 break ;
913 case GeomAbs_IsoV:
914 is_rational = mySurface->IsURational() ;
915 break ;
916
917 case GeomAbs_NoneIso:
918 default:
919 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
920 }
921 }
922 break ;
923 case GeomAbs_SurfaceOfRevolution:
924 {
925 switch (myIso) {
926 case GeomAbs_IsoU:
927 is_rational = mySurface->BasisCurve()->IsRational();
928 break;
929 default:
930 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
931 }
932 }
933 break;
934 case GeomAbs_SurfaceOfExtrusion:
935 {
936 switch (myIso) {
937 case GeomAbs_IsoV:
938 is_rational = mySurface->BasisCurve()->IsRational();
939 break;
940 default:
941 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
942 }
943 }
944 break;
945 default:
946 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
947 }
948 return is_rational;
949}
950
951
952//=======================================================================
953//function : NbPoles
954//purpose :
955//=======================================================================
956
957Standard_Integer Adaptor3d_IsoCurve::NbPoles() const
958{
959 Standard_Integer nb_poles = 0 ;
960 GeomAbs_SurfaceType type = mySurface->GetType() ;
961 switch(type) {
962 case GeomAbs_BezierSurface:
963 case GeomAbs_BSplineSurface:
964 switch (myIso) {
965 case GeomAbs_IsoU:
966 nb_poles = mySurface->NbVPoles() ;
967 break ;
968 case GeomAbs_IsoV:
969 nb_poles = mySurface->NbUPoles() ;
970 break ;
971
972 case GeomAbs_NoneIso:
973 default:
974 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
975 }
976 break ;
977 case GeomAbs_SurfaceOfRevolution:
978 {
979 switch( myIso) {
980 case GeomAbs_IsoU:
981 {
982 nb_poles = mySurface->BasisCurve()->NbPoles();
983 }
984 break;
985 default:
986 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
987 }
988 }
989 break;
990 case GeomAbs_SurfaceOfExtrusion:
991 {
992 switch( myIso) {
993 case GeomAbs_IsoV:
994 {
995 nb_poles = mySurface->BasisCurve()->NbPoles();
996 }
997 break;
998 default:
999 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
1000 }
1001 }
1002 break;
1003
1004 default:
1005 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
1006 break ;
1007 }
1008 return nb_poles ;
1009 }
1010
1011//=======================================================================
1012//function : NbKnots
1013//purpose :
1014//=======================================================================
1015
1016Standard_Integer Adaptor3d_IsoCurve::NbKnots() const
1017{
1018 Standard_Integer nb_knots = 0 ;
1019 GeomAbs_SurfaceType type = mySurface->GetType() ;
1020 switch(type) {
1021 case GeomAbs_BSplineSurface:
1022 {
1023 switch (myIso) {
1024 case GeomAbs_IsoU:
1025 nb_knots = mySurface->NbVKnots() ;
1026 break ;
1027 case GeomAbs_IsoV:
1028 nb_knots = mySurface->NbUKnots() ;
1029 break ;
1030
1031 case GeomAbs_NoneIso:
1032 default:
1033 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
1034 }
1035 }
1036 break ;
1037 case GeomAbs_SurfaceOfRevolution:
1038 {
1039 switch (myIso) {
1040 case GeomAbs_IsoU:
1041 {
1042 nb_knots = mySurface->BasisCurve()->NbKnots() ;
1043 break ;
1044 }
1045 default:
1046 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
1047 }
1048 }
1049 break ;
1050 case GeomAbs_SurfaceOfExtrusion:
1051 {
1052 switch (myIso) {
1053 case GeomAbs_IsoV:
1054 {
1055 nb_knots = mySurface->BasisCurve()->NbKnots() ;
1056 break ;
1057 }
1058 default:
1059 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
1060 }
1061 }
1062 break ;
1063 default:
1064 Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:NoneIso");
1065 break ;
1066 }
1067 return nb_knots ;
1068 }
1069
1070//=======================================================================
1071//function : Bezier
1072//purpose :
1073//=======================================================================
1074
1075Handle(Geom_BezierCurve) Adaptor3d_IsoCurve::Bezier() const
1076{
1077 Handle(Geom_BezierCurve) C;
1078 if (mySurface->GetType() == GeomAbs_SurfaceOfRevolution) {
1079 C = mySurface->BasisCurve()->Bezier();
1080 C = Handle(Geom_BezierCurve)::DownCast(C->Copy());
1081 C->Rotate(mySurface->AxeOfRevolution(),myParameter);
1082 }
1083 else if (mySurface->GetType() == GeomAbs_SurfaceOfExtrusion) {
1084 C = mySurface->BasisCurve()->Bezier();
1085 C = Handle(Geom_BezierCurve)::DownCast(C->Copy());
1086 C->Translate(myParameter * gp_Vec(mySurface->Direction()));
1087 }
1088 else if (myIso == GeomAbs_IsoU) {
1089 C = Handle(Geom_BezierCurve)::DownCast
1090 (mySurface->Bezier()->UIso(myParameter)) ;
1091 }
1092 else {
1093 C = Handle(Geom_BezierCurve)::DownCast
1094 (mySurface->Bezier()->VIso(myParameter));
1095 }
1096// C->Segment(myFirst,myLast);
1097 return C;
1098}
1099
1100//=======================================================================
1101//function : BSpline
1102//purpose :
1103//=======================================================================
1104
1105Handle(Geom_BSplineCurve) Adaptor3d_IsoCurve::BSpline() const
1106{
1107 Handle(Geom_BSplineCurve) C;
1108 if (mySurface->GetType() == GeomAbs_SurfaceOfRevolution) {
1109 C = mySurface->BasisCurve()->BSpline();
1110 C = Handle(Geom_BSplineCurve)::DownCast(C->Copy());
1111 C->Rotate(mySurface->AxeOfRevolution(),myParameter);
1112 }
1113 else if (mySurface->GetType() == GeomAbs_SurfaceOfExtrusion) {
1114 C = mySurface->BasisCurve()->BSpline();
1115 C = Handle(Geom_BSplineCurve)::DownCast(C->Copy());
1116 C->Translate(myParameter * gp_Vec(mySurface->Direction()));
1117 }
1118 else if (myIso == GeomAbs_IsoU) {
1119 C = Handle(Geom_BSplineCurve)::DownCast
1120 (mySurface->BSpline()->UIso(myParameter)) ;
1121 }
1122 else {
1123 C = Handle(Geom_BSplineCurve)::DownCast
1124 (mySurface->BSpline()->VIso(myParameter));
1125 }
1126// C->Segment(myFirst,myLast);
1127 return C;
1128}
1129