Replacing french comments by english one
[occt.git] / src / ChFiDS / ChFiDS_ElSpine.cxx
1 // File:        ChFiDS_ElSpine.cxx
2 // Created:     Thu May  4 13:58:23 1995
3 // Author:      Laurent BOURESCHE
4 //              <lbo@phylox>
5
6
7 #include <ChFiDS_ElSpine.ixx>
8 #include <Geom_BSplineCurve.hxx>
9 #include <ElCLib.hxx>
10 #include <Precision.hxx>
11
12
13 //=======================================================================
14 //function : ChFiDS_ElSpine
15 //purpose  : 
16 //=======================================================================
17
18 ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
19 {
20 }
21
22
23 //=======================================================================
24 //function : FirstParameter
25 //purpose  : 
26 //=======================================================================
27
28 Standard_Real ChFiDS_ElSpine::FirstParameter() const
29 {
30   return pfirst;
31 }
32
33
34 //=======================================================================
35 //function : LastParameter
36 //purpose  : 
37 //=======================================================================
38
39 Standard_Real ChFiDS_ElSpine::LastParameter() const
40 {
41   return plast;
42 }
43
44 //=======================================================================
45 //function : Continuity
46 //purpose  : 
47 //=======================================================================
48
49 GeomAbs_Shape ChFiDS_ElSpine::Continuity() const
50 {
51   return curve.Continuity();
52 }
53
54 //=======================================================================
55 //function : NbIntervals
56 //purpose  : 
57 //=======================================================================
58
59 Standard_Integer ChFiDS_ElSpine::NbIntervals(const GeomAbs_Shape S) 
60 {
61   return curve.NbIntervals(S);
62 }
63
64 //=======================================================================
65 //function : Intervals
66 //purpose  : 
67 //=======================================================================
68
69 void ChFiDS_ElSpine::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) 
70 {
71   curve.Intervals(T,S);
72 }
73
74 //=======================================================================
75 //function : Trim
76 //purpose  : 
77 //=======================================================================
78
79 Handle(Adaptor3d_HCurve) ChFiDS_ElSpine::Trim(const Standard_Real First,
80                                             const Standard_Real Last,
81                                             const Standard_Real Tol) const
82 {
83   return curve.Trim(First,Last,Tol);
84 }
85
86 //=======================================================================
87 //function : Resolution
88 //purpose  : 
89 //=======================================================================
90
91 Standard_Real ChFiDS_ElSpine::Resolution(const Standard_Real R3d) const
92 {
93   return curve.Resolution(R3d);
94 }
95
96
97 //=======================================================================
98 //function : Resolution
99 //purpose  : 
100 //=======================================================================
101
102 GeomAbs_CurveType ChFiDS_ElSpine::GetType() const
103 {
104   return curve.GetType();
105 }
106
107
108 //=======================================================================
109 //function : IsPeriodic
110 //purpose  : 
111 //=======================================================================
112
113 Standard_Boolean ChFiDS_ElSpine::IsPeriodic() const
114 {
115   return periodic;
116 }
117
118
119 //=======================================================================
120 //function : SetPeriodic
121 //purpose  : 
122 //=======================================================================
123
124 void ChFiDS_ElSpine::SetPeriodic(const Standard_Boolean I) 
125 {
126   periodic = I;
127   period = plast - pfirst;
128 }
129
130
131
132 //=======================================================================
133 //function : Period
134 //purpose  : 
135 //=======================================================================
136
137 Standard_Real ChFiDS_ElSpine::Period() const
138 {
139   if(!periodic) Standard_Failure::Raise("ElSpine non periodique");
140   return period;
141 }
142
143
144 //=======================================================================
145 //function : Value
146 //purpose  : 
147 //=======================================================================
148
149 gp_Pnt ChFiDS_ElSpine::Value(const Standard_Real AbsC) const
150 {
151   return curve.Value(AbsC);
152 }
153
154
155 //=======================================================================
156 //function : D0
157 //purpose  : 
158 //=======================================================================
159
160 void ChFiDS_ElSpine::D0(const Standard_Real AbsC, gp_Pnt& P) const
161 {
162   curve.D0(AbsC,P);
163 }
164
165
166 //=======================================================================
167 //function : D1
168 //purpose  : 
169 //=======================================================================
170
171 void ChFiDS_ElSpine::D1(const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1)
172 const
173 {
174   curve.D1(AbsC,P,V1);
175 }
176
177
178 //=======================================================================
179 //function : D2
180 //purpose  : 
181 //=======================================================================
182
183 void ChFiDS_ElSpine::D2(const Standard_Real AbsC, 
184                         gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
185 {  
186   curve.D2(AbsC,P,V1,V2);
187 }
188
189 //=======================================================================
190 //function : D3
191 //purpose  : 
192 //=======================================================================
193
194 void ChFiDS_ElSpine::D3(const Standard_Real AbsC, 
195                         gp_Pnt& P, gp_Vec& V1, gp_Vec& V2,  gp_Vec& V3) const
196 {  
197   curve.D3(AbsC,P,V1,V2,V3);
198 }
199
200
201 //=======================================================================
202 //function : FirstParameter
203 //purpose  : 
204 //=======================================================================
205
206 void ChFiDS_ElSpine::FirstParameter(const Standard_Real P)
207 {
208   pfirst = P;
209 }
210
211
212 //=======================================================================
213 //function : LastParameter
214 //purpose  : 
215 //=======================================================================
216
217 void ChFiDS_ElSpine::LastParameter(const Standard_Real P)
218 {
219   plast = P;
220 }
221
222
223 //=======================================================================
224 //function : SetOrigin
225 //purpose  : 
226 //=======================================================================
227
228 void ChFiDS_ElSpine::SetOrigin(const Standard_Real O)
229 {
230   if(!periodic) Standard_Failure::Raise("Elspine non periodique");
231   Handle(Geom_BSplineCurve) bs = Handle(Geom_BSplineCurve)::DownCast(curve.Curve());
232   if(!bs.IsNull()) {
233     bs->SetOrigin(O,Precision::PConfusion());
234     curve.Load(bs);
235   }
236 }
237
238 //=======================================================================
239 //function : SetFirstPointAndTgt
240 //purpose  : 
241 //=======================================================================
242
243 void ChFiDS_ElSpine::SetFirstPointAndTgt(const gp_Pnt& P,
244                                          const gp_Vec& T)
245 {
246   ptfirst = P;
247   tgfirst = T;
248 }
249
250 //=======================================================================
251 //function : SetLastPointAndTgt
252 //purpose  : 
253 //=======================================================================
254
255 void ChFiDS_ElSpine::SetLastPointAndTgt(const gp_Pnt& P,
256                                         const gp_Vec& T)
257 {
258   ptlast = P;
259   tglast = T;
260 }
261
262 //=======================================================================
263 //function : FirstPointAndTgt
264 //purpose  : 
265 //=======================================================================
266
267 void ChFiDS_ElSpine::FirstPointAndTgt(gp_Pnt& P,
268                                       gp_Vec& T) const
269 {
270   P = ptfirst;
271   T = tgfirst;
272 }
273
274 //=======================================================================
275 //function : LastPointAndTgt
276 //purpose  : 
277 //=======================================================================
278
279 void ChFiDS_ElSpine::LastPointAndTgt(gp_Pnt& P,
280                                      gp_Vec& T) const
281 {
282   P = ptlast;
283   T = tglast;
284 }
285
286 //=======================================================================
287 //function : SetCurve
288 //purpose  : 
289 //=======================================================================
290
291 void ChFiDS_ElSpine::SetCurve(const Handle(Geom_Curve)& C)
292 {
293   curve.Load(C);
294 }
295
296 //=======================================================================
297 //function : Previous
298 //purpose  : 
299 //=======================================================================
300
301 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Previous() const 
302 {
303   return previous;
304 }
305
306
307 //=======================================================================
308 //function : ChangePrevious
309 //purpose  : 
310 //=======================================================================
311
312 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangePrevious()
313 {
314   return previous;
315 }
316
317 //=======================================================================
318 //function : Next
319 //purpose  : 
320 //=======================================================================
321
322 const Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::Next() const 
323 {
324   return next;
325 }
326
327
328 //=======================================================================
329 //function : ChangeNext
330 //purpose  : 
331 //=======================================================================
332
333 Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangeNext()
334 {
335   return next;
336 }
337
338 //    --
339 //    --     The following methods must  be called when GetType returned
340 //    --     the corresponding type.
341 //    --     
342
343 //=======================================================================
344 //function : Line
345 //purpose  : 
346 //=======================================================================
347
348 gp_Lin ChFiDS_ElSpine::Line() const 
349 {
350  return curve.Line();  
351 }
352
353 //=======================================================================
354 //function : Circle
355 //purpose  : 
356 //=======================================================================
357
358 gp_Circ  ChFiDS_ElSpine::Circle() const 
359 {
360  return curve.Circle();
361 }
362
363 //=======================================================================
364 //function : Ellipse
365 //purpose  : 
366 //=======================================================================
367
368 gp_Elips ChFiDS_ElSpine::Ellipse() const 
369 {
370   return curve.Ellipse();
371 }
372
373 //=======================================================================
374 //function : Hyperbola
375 //purpose  : 
376 //=======================================================================
377
378 gp_Hypr ChFiDS_ElSpine::Hyperbola() const 
379 {
380   return curve.Hyperbola();  
381 }
382
383 //=======================================================================
384 //function : Parabola
385 //purpose  : 
386 //=======================================================================
387
388 gp_Parab ChFiDS_ElSpine::Parabola() const 
389 {
390  return curve.Parabola();
391 }
392
393 //=======================================================================
394 //function : Bezier
395 //purpose  : 
396 //=======================================================================
397
398 Handle(Geom_BezierCurve) ChFiDS_ElSpine::Bezier() const 
399 {
400   return curve.Bezier();
401 }
402
403 //=======================================================================
404 //function : BSpline
405 //purpose  : 
406 //=======================================================================
407
408 Handle(Geom_BSplineCurve) ChFiDS_ElSpine::BSpline() const 
409 {
410   return curve.BSpline();
411 }