1 // Created on: 1995-05-04
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1995-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
9 // under the terms of the GNU Lesser General Public 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 #include <ChFiDS_ElSpine.ixx>
18 #include <Geom_BSplineCurve.hxx>
20 #include <Precision.hxx>
23 //=======================================================================
24 //function : ChFiDS_ElSpine
26 //=======================================================================
28 ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
33 //=======================================================================
34 //function : FirstParameter
36 //=======================================================================
38 Standard_Real ChFiDS_ElSpine::FirstParameter() const
44 //=======================================================================
45 //function : LastParameter
47 //=======================================================================
49 Standard_Real ChFiDS_ElSpine::LastParameter() const
54 //=======================================================================
55 //function : Continuity
57 //=======================================================================
59 GeomAbs_Shape ChFiDS_ElSpine::Continuity() const
61 return curve.Continuity();
64 //=======================================================================
65 //function : NbIntervals
67 //=======================================================================
69 Standard_Integer ChFiDS_ElSpine::NbIntervals(const GeomAbs_Shape S)
71 return curve.NbIntervals(S);
74 //=======================================================================
75 //function : Intervals
77 //=======================================================================
79 void ChFiDS_ElSpine::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S)
84 //=======================================================================
87 //=======================================================================
89 Handle(Adaptor3d_HCurve) ChFiDS_ElSpine::Trim(const Standard_Real First,
90 const Standard_Real Last,
91 const Standard_Real Tol) const
93 return curve.Trim(First,Last,Tol);
96 //=======================================================================
97 //function : Resolution
99 //=======================================================================
101 Standard_Real ChFiDS_ElSpine::Resolution(const Standard_Real R3d) const
103 return curve.Resolution(R3d);
107 //=======================================================================
108 //function : Resolution
110 //=======================================================================
112 GeomAbs_CurveType ChFiDS_ElSpine::GetType() const
114 return curve.GetType();
118 //=======================================================================
119 //function : IsPeriodic
121 //=======================================================================
123 Standard_Boolean ChFiDS_ElSpine::IsPeriodic() const
129 //=======================================================================
130 //function : SetPeriodic
132 //=======================================================================
134 void ChFiDS_ElSpine::SetPeriodic(const Standard_Boolean I)
137 period = plast - pfirst;
142 //=======================================================================
145 //=======================================================================
147 Standard_Real ChFiDS_ElSpine::Period() const
149 if(!periodic) Standard_Failure::Raise("ElSpine non periodique");
154 //=======================================================================
157 //=======================================================================
159 gp_Pnt ChFiDS_ElSpine::Value(const Standard_Real AbsC) const
161 return curve.Value(AbsC);
165 //=======================================================================
168 //=======================================================================
170 void ChFiDS_ElSpine::D0(const Standard_Real AbsC, gp_Pnt& P) const
176 //=======================================================================
179 //=======================================================================
181 void ChFiDS_ElSpine::D1(const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1)
188 //=======================================================================
191 //=======================================================================
193 void ChFiDS_ElSpine::D2(const Standard_Real AbsC,
194 gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
196 curve.D2(AbsC,P,V1,V2);
199 //=======================================================================
202 //=======================================================================
204 void ChFiDS_ElSpine::D3(const Standard_Real AbsC,
205 gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
207 curve.D3(AbsC,P,V1,V2,V3);
211 //=======================================================================
212 //function : FirstParameter
214 //=======================================================================
216 void ChFiDS_ElSpine::FirstParameter(const Standard_Real P)
222 //=======================================================================
223 //function : LastParameter
225 //=======================================================================
227 void ChFiDS_ElSpine::LastParameter(const Standard_Real P)
233 //=======================================================================
234 //function : SetOrigin
236 //=======================================================================
238 void ChFiDS_ElSpine::SetOrigin(const Standard_Real O)
240 if(!periodic) Standard_Failure::Raise("Elspine non periodique");
241 Handle(Geom_BSplineCurve) bs = Handle(Geom_BSplineCurve)::DownCast(curve.Curve());
243 bs->SetOrigin(O,Precision::PConfusion());
248 //=======================================================================
249 //function : SetFirstPointAndTgt
251 //=======================================================================
253 void ChFiDS_ElSpine::SetFirstPointAndTgt(const gp_Pnt& P,
260 //=======================================================================
261 //function : SetLastPointAndTgt
263 //=======================================================================
265 void ChFiDS_ElSpine::SetLastPointAndTgt(const gp_Pnt& P,
272 //=======================================================================
273 //function : FirstPointAndTgt
275 //=======================================================================
277 void ChFiDS_ElSpine::FirstPointAndTgt(gp_Pnt& P,
284 //=======================================================================
285 //function : LastPointAndTgt
287 //=======================================================================
289 void ChFiDS_ElSpine::LastPointAndTgt(gp_Pnt& P,
296 //=======================================================================
297 //function : SetCurve
299 //=======================================================================
301 void ChFiDS_ElSpine::SetCurve(const Handle(Geom_Curve)& C)
306 //=======================================================================
307 //function : Previous
309 //=======================================================================
311 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Previous() const
317 //=======================================================================
318 //function : ChangePrevious
320 //=======================================================================
322 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangePrevious()
327 //=======================================================================
330 //=======================================================================
332 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Next() const
338 //=======================================================================
339 //function : ChangeNext
341 //=======================================================================
343 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangeNext()
349 // -- The following methods must be called when GetType returned
350 // -- the corresponding type.
353 //=======================================================================
356 //=======================================================================
358 gp_Lin ChFiDS_ElSpine::Line() const
363 //=======================================================================
366 //=======================================================================
368 gp_Circ ChFiDS_ElSpine::Circle() const
370 return curve.Circle();
373 //=======================================================================
376 //=======================================================================
378 gp_Elips ChFiDS_ElSpine::Ellipse() const
380 return curve.Ellipse();
383 //=======================================================================
384 //function : Hyperbola
386 //=======================================================================
388 gp_Hypr ChFiDS_ElSpine::Hyperbola() const
390 return curve.Hyperbola();
393 //=======================================================================
394 //function : Parabola
396 //=======================================================================
398 gp_Parab ChFiDS_ElSpine::Parabola() const
400 return curve.Parabola();
403 //=======================================================================
406 //=======================================================================
408 Handle(Geom_BezierCurve) ChFiDS_ElSpine::Bezier() const
410 return curve.Bezier();
413 //=======================================================================
416 //=======================================================================
418 Handle(Geom_BSplineCurve) ChFiDS_ElSpine::BSpline() const
420 return curve.BSpline();