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