1 // Created on: 1995-05-04
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1995-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 #include <ChFiDS_ElSpine.ixx>
24 #include <Geom_BSplineCurve.hxx>
26 #include <Precision.hxx>
29 //=======================================================================
30 //function : ChFiDS_ElSpine
32 //=======================================================================
34 ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
39 //=======================================================================
40 //function : FirstParameter
42 //=======================================================================
44 Standard_Real ChFiDS_ElSpine::FirstParameter() const
50 //=======================================================================
51 //function : LastParameter
53 //=======================================================================
55 Standard_Real ChFiDS_ElSpine::LastParameter() const
60 //=======================================================================
61 //function : Continuity
63 //=======================================================================
65 GeomAbs_Shape ChFiDS_ElSpine::Continuity() const
67 return curve.Continuity();
70 //=======================================================================
71 //function : NbIntervals
73 //=======================================================================
75 Standard_Integer ChFiDS_ElSpine::NbIntervals(const GeomAbs_Shape S)
77 return curve.NbIntervals(S);
80 //=======================================================================
81 //function : Intervals
83 //=======================================================================
85 void ChFiDS_ElSpine::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S)
90 //=======================================================================
93 //=======================================================================
95 Handle(Adaptor3d_HCurve) ChFiDS_ElSpine::Trim(const Standard_Real First,
96 const Standard_Real Last,
97 const Standard_Real Tol) const
99 return curve.Trim(First,Last,Tol);
102 //=======================================================================
103 //function : Resolution
105 //=======================================================================
107 Standard_Real ChFiDS_ElSpine::Resolution(const Standard_Real R3d) const
109 return curve.Resolution(R3d);
113 //=======================================================================
114 //function : Resolution
116 //=======================================================================
118 GeomAbs_CurveType ChFiDS_ElSpine::GetType() const
120 return curve.GetType();
124 //=======================================================================
125 //function : IsPeriodic
127 //=======================================================================
129 Standard_Boolean ChFiDS_ElSpine::IsPeriodic() const
135 //=======================================================================
136 //function : SetPeriodic
138 //=======================================================================
140 void ChFiDS_ElSpine::SetPeriodic(const Standard_Boolean I)
143 period = plast - pfirst;
148 //=======================================================================
151 //=======================================================================
153 Standard_Real ChFiDS_ElSpine::Period() const
155 if(!periodic) Standard_Failure::Raise("ElSpine non periodique");
160 //=======================================================================
163 //=======================================================================
165 gp_Pnt ChFiDS_ElSpine::Value(const Standard_Real AbsC) const
167 return curve.Value(AbsC);
171 //=======================================================================
174 //=======================================================================
176 void ChFiDS_ElSpine::D0(const Standard_Real AbsC, gp_Pnt& P) const
182 //=======================================================================
185 //=======================================================================
187 void ChFiDS_ElSpine::D1(const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1)
194 //=======================================================================
197 //=======================================================================
199 void ChFiDS_ElSpine::D2(const Standard_Real AbsC,
200 gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
202 curve.D2(AbsC,P,V1,V2);
205 //=======================================================================
208 //=======================================================================
210 void ChFiDS_ElSpine::D3(const Standard_Real AbsC,
211 gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
213 curve.D3(AbsC,P,V1,V2,V3);
217 //=======================================================================
218 //function : FirstParameter
220 //=======================================================================
222 void ChFiDS_ElSpine::FirstParameter(const Standard_Real P)
228 //=======================================================================
229 //function : LastParameter
231 //=======================================================================
233 void ChFiDS_ElSpine::LastParameter(const Standard_Real P)
239 //=======================================================================
240 //function : SetOrigin
242 //=======================================================================
244 void ChFiDS_ElSpine::SetOrigin(const Standard_Real O)
246 if(!periodic) Standard_Failure::Raise("Elspine non periodique");
247 Handle(Geom_BSplineCurve) bs = Handle(Geom_BSplineCurve)::DownCast(curve.Curve());
249 bs->SetOrigin(O,Precision::PConfusion());
254 //=======================================================================
255 //function : SetFirstPointAndTgt
257 //=======================================================================
259 void ChFiDS_ElSpine::SetFirstPointAndTgt(const gp_Pnt& P,
266 //=======================================================================
267 //function : SetLastPointAndTgt
269 //=======================================================================
271 void ChFiDS_ElSpine::SetLastPointAndTgt(const gp_Pnt& P,
278 //=======================================================================
279 //function : FirstPointAndTgt
281 //=======================================================================
283 void ChFiDS_ElSpine::FirstPointAndTgt(gp_Pnt& P,
290 //=======================================================================
291 //function : LastPointAndTgt
293 //=======================================================================
295 void ChFiDS_ElSpine::LastPointAndTgt(gp_Pnt& P,
302 //=======================================================================
303 //function : SetCurve
305 //=======================================================================
307 void ChFiDS_ElSpine::SetCurve(const Handle(Geom_Curve)& C)
312 //=======================================================================
313 //function : Previous
315 //=======================================================================
317 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Previous() const
323 //=======================================================================
324 //function : ChangePrevious
326 //=======================================================================
328 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangePrevious()
333 //=======================================================================
336 //=======================================================================
338 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Next() const
344 //=======================================================================
345 //function : ChangeNext
347 //=======================================================================
349 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangeNext()
355 // -- The following methods must be called when GetType returned
356 // -- the corresponding type.
359 //=======================================================================
362 //=======================================================================
364 gp_Lin ChFiDS_ElSpine::Line() const
369 //=======================================================================
372 //=======================================================================
374 gp_Circ ChFiDS_ElSpine::Circle() const
376 return curve.Circle();
379 //=======================================================================
382 //=======================================================================
384 gp_Elips ChFiDS_ElSpine::Ellipse() const
386 return curve.Ellipse();
389 //=======================================================================
390 //function : Hyperbola
392 //=======================================================================
394 gp_Hypr ChFiDS_ElSpine::Hyperbola() const
396 return curve.Hyperbola();
399 //=======================================================================
400 //function : Parabola
402 //=======================================================================
404 gp_Parab ChFiDS_ElSpine::Parabola() const
406 return curve.Parabola();
409 //=======================================================================
412 //=======================================================================
414 Handle(Geom_BezierCurve) ChFiDS_ElSpine::Bezier() const
416 return curve.Bezier();
419 //=======================================================================
422 //=======================================================================
424 Handle(Geom_BSplineCurve) ChFiDS_ElSpine::BSpline() const
426 return curve.BSpline();