1 // File: ChFiDS_ElSpine.cxx
2 // Created: Thu May 4 13:58:23 1995
3 // Author: Laurent BOURESCHE
7 #include <ChFiDS_ElSpine.ixx>
8 #include <Geom_BSplineCurve.hxx>
10 #include <Precision.hxx>
13 //=======================================================================
14 //function : ChFiDS_ElSpine
16 //=======================================================================
18 ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
23 //=======================================================================
24 //function : FirstParameter
26 //=======================================================================
28 Standard_Real ChFiDS_ElSpine::FirstParameter() const
34 //=======================================================================
35 //function : LastParameter
37 //=======================================================================
39 Standard_Real ChFiDS_ElSpine::LastParameter() const
44 //=======================================================================
45 //function : Continuity
47 //=======================================================================
49 GeomAbs_Shape ChFiDS_ElSpine::Continuity() const
51 return curve.Continuity();
54 //=======================================================================
55 //function : NbIntervals
57 //=======================================================================
59 Standard_Integer ChFiDS_ElSpine::NbIntervals(const GeomAbs_Shape S)
61 return curve.NbIntervals(S);
64 //=======================================================================
65 //function : Intervals
67 //=======================================================================
69 void ChFiDS_ElSpine::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S)
74 //=======================================================================
77 //=======================================================================
79 Handle(Adaptor3d_HCurve) ChFiDS_ElSpine::Trim(const Standard_Real First,
80 const Standard_Real Last,
81 const Standard_Real Tol) const
83 return curve.Trim(First,Last,Tol);
86 //=======================================================================
87 //function : Resolution
89 //=======================================================================
91 Standard_Real ChFiDS_ElSpine::Resolution(const Standard_Real R3d) const
93 return curve.Resolution(R3d);
97 //=======================================================================
98 //function : Resolution
100 //=======================================================================
102 GeomAbs_CurveType ChFiDS_ElSpine::GetType() const
104 return curve.GetType();
108 //=======================================================================
109 //function : IsPeriodic
111 //=======================================================================
113 Standard_Boolean ChFiDS_ElSpine::IsPeriodic() const
119 //=======================================================================
120 //function : SetPeriodic
122 //=======================================================================
124 void ChFiDS_ElSpine::SetPeriodic(const Standard_Boolean I)
127 period = plast - pfirst;
132 //=======================================================================
135 //=======================================================================
137 Standard_Real ChFiDS_ElSpine::Period() const
139 if(!periodic) Standard_Failure::Raise("ElSpine non periodique");
144 //=======================================================================
147 //=======================================================================
149 gp_Pnt ChFiDS_ElSpine::Value(const Standard_Real AbsC) const
151 return curve.Value(AbsC);
155 //=======================================================================
158 //=======================================================================
160 void ChFiDS_ElSpine::D0(const Standard_Real AbsC, gp_Pnt& P) const
166 //=======================================================================
169 //=======================================================================
171 void ChFiDS_ElSpine::D1(const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1)
178 //=======================================================================
181 //=======================================================================
183 void ChFiDS_ElSpine::D2(const Standard_Real AbsC,
184 gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
186 curve.D2(AbsC,P,V1,V2);
189 //=======================================================================
192 //=======================================================================
194 void ChFiDS_ElSpine::D3(const Standard_Real AbsC,
195 gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
197 curve.D3(AbsC,P,V1,V2,V3);
201 //=======================================================================
202 //function : FirstParameter
204 //=======================================================================
206 void ChFiDS_ElSpine::FirstParameter(const Standard_Real P)
212 //=======================================================================
213 //function : LastParameter
215 //=======================================================================
217 void ChFiDS_ElSpine::LastParameter(const Standard_Real P)
223 //=======================================================================
224 //function : SetOrigin
226 //=======================================================================
228 void ChFiDS_ElSpine::SetOrigin(const Standard_Real O)
230 if(!periodic) Standard_Failure::Raise("Elspine non periodique");
231 Handle(Geom_BSplineCurve) bs = Handle(Geom_BSplineCurve)::DownCast(curve.Curve());
233 bs->SetOrigin(O,Precision::PConfusion());
238 //=======================================================================
239 //function : SetFirstPointAndTgt
241 //=======================================================================
243 void ChFiDS_ElSpine::SetFirstPointAndTgt(const gp_Pnt& P,
250 //=======================================================================
251 //function : SetLastPointAndTgt
253 //=======================================================================
255 void ChFiDS_ElSpine::SetLastPointAndTgt(const gp_Pnt& P,
262 //=======================================================================
263 //function : FirstPointAndTgt
265 //=======================================================================
267 void ChFiDS_ElSpine::FirstPointAndTgt(gp_Pnt& P,
274 //=======================================================================
275 //function : LastPointAndTgt
277 //=======================================================================
279 void ChFiDS_ElSpine::LastPointAndTgt(gp_Pnt& P,
286 //=======================================================================
287 //function : SetCurve
289 //=======================================================================
291 void ChFiDS_ElSpine::SetCurve(const Handle(Geom_Curve)& C)
296 //=======================================================================
297 //function : Previous
299 //=======================================================================
301 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Previous() const
307 //=======================================================================
308 //function : ChangePrevious
310 //=======================================================================
312 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangePrevious()
317 //=======================================================================
320 //=======================================================================
322 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Next() const
328 //=======================================================================
329 //function : ChangeNext
331 //=======================================================================
333 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangeNext()
339 // -- The following methods must be called when GetType returned
340 // -- the corresponding type.
343 //=======================================================================
346 //=======================================================================
348 gp_Lin ChFiDS_ElSpine::Line() const
353 //=======================================================================
356 //=======================================================================
358 gp_Circ ChFiDS_ElSpine::Circle() const
360 return curve.Circle();
363 //=======================================================================
366 //=======================================================================
368 gp_Elips ChFiDS_ElSpine::Ellipse() const
370 return curve.Ellipse();
373 //=======================================================================
374 //function : Hyperbola
376 //=======================================================================
378 gp_Hypr ChFiDS_ElSpine::Hyperbola() const
380 return curve.Hyperbola();
383 //=======================================================================
384 //function : Parabola
386 //=======================================================================
388 gp_Parab ChFiDS_ElSpine::Parabola() const
390 return curve.Parabola();
393 //=======================================================================
396 //=======================================================================
398 Handle(Geom_BezierCurve) ChFiDS_ElSpine::Bezier() const
400 return curve.Bezier();
403 //=======================================================================
406 //=======================================================================
408 Handle(Geom_BSplineCurve) ChFiDS_ElSpine::BSpline() const
410 return curve.BSpline();