0023024: Update headers of OCCT files
[occt.git] / src / BiTgte / BiTgte_CurveOnEdge.cxx
1 // Created on: 1997-01-10
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
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.
10 //
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.
13 //
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.
20
21
22
23 #include <BiTgte_CurveOnEdge.ixx>
24
25 #include <BiTgte_HCurveOnEdge.hxx>
26 #include <BRep_Tool.hxx>
27 #include <Geom_TrimmedCurve.hxx>
28 #include <GeomAPI_ProjectPointOnCurve.hxx>
29 #include <GeomAdaptor_Curve.hxx>
30 #include <Standard_NotImplemented.hxx>
31 #include <Precision.hxx>
32
33
34 //=======================================================================
35 //function : BiTgte_CurveOnEdge
36 //purpose  : 
37 //======================================================================
38
39 BiTgte_CurveOnEdge::BiTgte_CurveOnEdge()
40 {
41 }
42
43
44 //=======================================================================
45 //function : BiTgte_CurveOnEdge
46 //purpose  : 
47 //=======================================================================
48
49 BiTgte_CurveOnEdge::BiTgte_CurveOnEdge(const TopoDS_Edge& EonF,
50                                        const TopoDS_Edge& Edge)
51 {
52   Init(EonF,Edge);
53 }
54
55
56 //=======================================================================
57 //function : Init
58 //purpose  : 
59 //=======================================================================
60
61 void BiTgte_CurveOnEdge::Init(const TopoDS_Edge& EonF,
62                               const TopoDS_Edge& Edge)
63 {
64   Standard_Real f,l;
65
66   myEdge = Edge;
67   myCurv = BRep_Tool::Curve(myEdge,f,l);
68   myCurv = new Geom_TrimmedCurve(myCurv,f,l);
69
70   myEonF = EonF;
71   myConF = BRep_Tool::Curve(myEonF,f,l);
72   myConF = new Geom_TrimmedCurve(myConF,f,l);
73
74   // peut on generer un cercle de rayon nul
75   GeomAdaptor_Curve Curv(myCurv);
76   GeomAdaptor_Curve ConF(myConF);
77   
78   myType = GeomAbs_OtherCurve;
79   if (Curv.GetType() == GeomAbs_Line && 
80       ConF.GetType() == GeomAbs_Circle ) {
81     gp_Ax1 a1 = Curv.Line().Position();
82     gp_Ax1 a2 = ConF.Circle().Axis();
83     if ( a1.IsCoaxial(a2,Precision::Angular(),Precision::Confusion())) {
84       myType = GeomAbs_Circle;
85       myCirc = gp_Circ(ConF.Circle().Position(),0.);
86     }
87   }
88 }
89
90
91 //=======================================================================
92 //function : FirstParameter
93 //purpose  : 
94 //=======================================================================
95
96 Standard_Real BiTgte_CurveOnEdge::FirstParameter() const
97 {
98   return myConF->FirstParameter();
99 }
100
101
102 //=======================================================================
103 //function : LastParameter
104 //purpose  : 
105 //=======================================================================
106
107 Standard_Real BiTgte_CurveOnEdge::LastParameter() const
108 {
109   return myConF->LastParameter();
110 }
111
112
113 //=======================================================================
114 //function : 
115 //purpose  : 
116 //=======================================================================
117
118 GeomAbs_Shape BiTgte_CurveOnEdge::Continuity() const
119 {
120   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
121   return GeomAbs_C0;
122 }
123
124
125 //=======================================================================
126 //function : 
127 //purpose  : 
128 //=======================================================================
129
130 Standard_Integer BiTgte_CurveOnEdge::NbIntervals(const GeomAbs_Shape S) const
131 {
132   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
133   return 0;
134 }
135
136
137 //=======================================================================
138 //function : 
139 //purpose  : 
140 //=======================================================================
141
142 void BiTgte_CurveOnEdge::Intervals(TColStd_Array1OfReal& T,
143                                    const GeomAbs_Shape S) const
144 {
145   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
146 }
147
148
149 //=======================================================================
150 //function : 
151 //purpose  : 
152 //=======================================================================
153
154 Handle(Adaptor3d_HCurve) BiTgte_CurveOnEdge::Trim(const Standard_Real First,
155                                                 const Standard_Real Last,
156                                                 const Standard_Real Tol) const
157 {
158   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
159   Handle(BiTgte_HCurveOnEdge) HC;
160   return HC;
161 }
162
163
164 //=======================================================================
165 //function : 
166 //purpose  : 
167 //=======================================================================
168
169 Standard_Boolean BiTgte_CurveOnEdge::IsClosed() const
170 {
171   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
172   return Standard_False;
173 }
174
175
176 //=======================================================================
177 //function : 
178 //purpose  : 
179 //=======================================================================
180
181 Standard_Boolean BiTgte_CurveOnEdge::IsPeriodic() const
182 {
183   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
184   return Standard_False;
185 }
186
187
188 //=======================================================================
189 //function : 
190 //purpose  : 
191 //=======================================================================
192
193 Standard_Real BiTgte_CurveOnEdge::Period() const
194 {
195   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
196   return 0.;
197 }
198
199
200 //=======================================================================
201 //function : 
202 //purpose  : 
203 //=======================================================================
204
205 gp_Pnt BiTgte_CurveOnEdge::Value(const Standard_Real U) const
206 {
207   gp_Pnt P;
208   D0(U,P);
209   return P;
210 }
211
212
213 //=======================================================================
214 //function : 
215 //purpose  : 
216 //=======================================================================
217
218 void BiTgte_CurveOnEdge::D0(const Standard_Real U,gp_Pnt& P) const
219 {
220   GeomAPI_ProjectPointOnCurve Projector;
221   P = myConF->Value(U);
222   Projector.Init(P, myCurv);
223   P = Projector.NearestPoint();
224 }
225
226
227 //=======================================================================
228 //function : 
229 //purpose  : 
230 //=======================================================================
231
232 void BiTgte_CurveOnEdge::D1(const Standard_Real U,gp_Pnt& P,gp_Vec& V) const
233 {
234   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
235 }
236
237
238 //=======================================================================
239 //function : 
240 //purpose  : 
241 //=======================================================================
242
243 void BiTgte_CurveOnEdge::D2(const Standard_Real U,gp_Pnt& P,
244                             gp_Vec& V1,gp_Vec& V2) const
245 {
246   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
247 }
248
249
250 //=======================================================================
251 //function : 
252 //purpose  : 
253 //=======================================================================
254
255 void BiTgte_CurveOnEdge::D3(const Standard_Real U,gp_Pnt& P,
256                             gp_Vec& V1,gp_Vec& V2,gp_Vec& V3) const
257 {
258   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
259 }
260
261
262 //=======================================================================
263 //function : 
264 //purpose  : 
265 //=======================================================================
266
267 gp_Vec BiTgte_CurveOnEdge::DN(const Standard_Real U,
268                               const Standard_Integer N) const
269 {
270   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
271   return gp_Vec();
272 }
273
274
275 //=======================================================================
276 //function : 
277 //purpose  : 
278 //=======================================================================
279
280 Standard_Real BiTgte_CurveOnEdge::Resolution(const Standard_Real R3d) const
281 {
282   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
283   return 0.;
284 }
285
286
287 //=======================================================================
288 //function : 
289 //purpose  : 
290 //=======================================================================
291
292 GeomAbs_CurveType BiTgte_CurveOnEdge::GetType() const
293 {
294   return myType;
295 }
296
297
298 //=======================================================================
299 //function : 
300 //purpose  : 
301 //=======================================================================
302
303 gp_Lin BiTgte_CurveOnEdge::Line() const
304 {
305   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
306   return gp_Lin();
307 }
308
309
310 //=======================================================================
311 //function : 
312 //purpose  : 
313 //=======================================================================
314
315 gp_Circ BiTgte_CurveOnEdge::Circle() const
316 {
317   if ( myType != GeomAbs_Circle) {
318     Standard_NoSuchObject::Raise("BiTgte_CurveOnEdge::Circle");
319     return gp_Circ();
320   }
321
322   return myCirc;
323 }
324
325
326 //=======================================================================
327 //function : 
328 //purpose  : 
329 //=======================================================================
330
331 gp_Elips BiTgte_CurveOnEdge::Ellipse() const
332 {
333   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
334   return gp_Elips();
335 }
336
337
338 //=======================================================================
339 //function : 
340 //purpose  : 
341 //=======================================================================
342
343 gp_Hypr BiTgte_CurveOnEdge::Hyperbola() const
344 {
345   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
346   return gp_Hypr();
347 }
348
349
350 //=======================================================================
351 //function : 
352 //purpose  : 
353 //=======================================================================
354
355 gp_Parab BiTgte_CurveOnEdge::Parabola() const
356 {
357   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
358   return gp_Parab();
359 }
360
361
362 //=======================================================================
363 //function : 
364 //purpose  : 
365 //=======================================================================
366
367 Standard_Integer BiTgte_CurveOnEdge::Degree() const
368 {
369   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
370   return 0;
371 }
372
373
374 //=======================================================================
375 //function : 
376 //purpose  : 
377 //=======================================================================
378
379 Standard_Boolean BiTgte_CurveOnEdge::IsRational() const
380 {
381   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
382   return Standard_False;
383 }
384
385
386 //=======================================================================
387 //function : 
388 //purpose  : 
389 //=======================================================================
390
391 Standard_Integer BiTgte_CurveOnEdge::NbPoles() const
392 {
393   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
394   return 0;
395 }
396
397
398 //=======================================================================
399 //function : 
400 //purpose  : 
401 //=======================================================================
402
403 Standard_Integer BiTgte_CurveOnEdge::NbKnots() const
404 {
405   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
406   return 0;
407 }
408
409
410 //=======================================================================
411 //function : 
412 //purpose  : 
413 //=======================================================================
414
415 Handle(Geom_BezierCurve) BiTgte_CurveOnEdge::Bezier() const
416 {
417   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
418   Handle(Geom_BezierCurve) B;
419   return B;
420 }
421
422
423 //=======================================================================
424 //function : 
425 //purpose  : 
426 //=======================================================================
427
428 Handle(Geom_BSplineCurve) BiTgte_CurveOnEdge::BSpline() const
429 {
430   Standard_NotImplemented::Raise("BiTgte_CurveOnEdge");
431   Handle(Geom_BSplineCurve) B;
432   return B;
433 }
434
435