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