0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / BiTgte / BiTgte_CurveOnEdge.cxx
... / ...
CommitLineData
1// Created on: 1997-01-10
2// Created by: Bruno DUMORTIER
3// Copyright (c) 1997-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
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
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17
18#include <Adaptor3d_HCurve.hxx>
19#include <BiTgte_CurveOnEdge.hxx>
20#include <BiTgte_HCurveOnEdge.hxx>
21#include <BRep_Tool.hxx>
22#include <Geom_BezierCurve.hxx>
23#include <Geom_BSplineCurve.hxx>
24#include <Geom_Curve.hxx>
25#include <Geom_TrimmedCurve.hxx>
26#include <GeomAdaptor_Curve.hxx>
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>
35#include <Precision.hxx>
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>
41
42//=======================================================================
43//function : BiTgte_CurveOnEdge
44//purpose :
45//======================================================================
46BiTgte_CurveOnEdge::BiTgte_CurveOnEdge()
47: myType(GeomAbs_OtherCurve)
48{
49}
50
51
52//=======================================================================
53//function : BiTgte_CurveOnEdge
54//purpose :
55//=======================================================================
56
57BiTgte_CurveOnEdge::BiTgte_CurveOnEdge(const TopoDS_Edge& theEonF,
58 const TopoDS_Edge& theEdge)
59: myEdge(theEdge),
60 myEonF(theEonF),
61 myType(GeomAbs_OtherCurve)
62{
63 Init(theEonF, theEdge);
64}
65
66
67//=======================================================================
68//function : Init
69//purpose :
70//=======================================================================
71
72void BiTgte_CurveOnEdge::Init(const TopoDS_Edge& EonF,
73 const TopoDS_Edge& Edge)
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
107Standard_Real BiTgte_CurveOnEdge::FirstParameter() const
108{
109 return myConF->FirstParameter();
110}
111
112
113//=======================================================================
114//function : LastParameter
115//purpose :
116//=======================================================================
117
118Standard_Real BiTgte_CurveOnEdge::LastParameter() const
119{
120 return myConF->LastParameter();
121}
122
123
124//=======================================================================
125//function :
126//purpose :
127//=======================================================================
128
129GeomAbs_Shape BiTgte_CurveOnEdge::Continuity() const
130{
131 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
132}
133
134
135//=======================================================================
136//function :
137//purpose :
138//=======================================================================
139
140Standard_Integer BiTgte_CurveOnEdge::NbIntervals(const GeomAbs_Shape) const
141{
142 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
143}
144
145
146//=======================================================================
147//function :
148//purpose :
149//=======================================================================
150
151void BiTgte_CurveOnEdge::Intervals(TColStd_Array1OfReal&,
152 const GeomAbs_Shape) const
153{
154 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
155}
156
157
158//=======================================================================
159//function :
160//purpose :
161//=======================================================================
162
163Handle(Adaptor3d_HCurve) BiTgte_CurveOnEdge::Trim(const Standard_Real,
164 const Standard_Real,
165 const Standard_Real) const
166{
167 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
168}
169
170
171//=======================================================================
172//function :
173//purpose :
174//=======================================================================
175
176Standard_Boolean BiTgte_CurveOnEdge::IsClosed() const
177{
178 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
179}
180
181
182//=======================================================================
183//function :
184//purpose :
185//=======================================================================
186
187Standard_Boolean BiTgte_CurveOnEdge::IsPeriodic() const
188{
189 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
190}
191
192
193//=======================================================================
194//function :
195//purpose :
196//=======================================================================
197
198Standard_Real BiTgte_CurveOnEdge::Period() const
199{
200 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
201}
202
203
204//=======================================================================
205//function :
206//purpose :
207//=======================================================================
208
209gp_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
222void 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
236void BiTgte_CurveOnEdge::D1(const Standard_Real,gp_Pnt& ,gp_Vec& ) const
237{
238 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
239}
240
241
242//=======================================================================
243//function :
244//purpose :
245//=======================================================================
246
247void BiTgte_CurveOnEdge::D2(const Standard_Real ,gp_Pnt&,
248 gp_Vec& ,gp_Vec&) const
249{
250 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
251}
252
253
254//=======================================================================
255//function :
256//purpose :
257//=======================================================================
258
259void BiTgte_CurveOnEdge::D3(const Standard_Real ,gp_Pnt&,
260 gp_Vec& ,gp_Vec& ,gp_Vec& ) const
261{
262 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
263}
264
265
266//=======================================================================
267//function :
268//purpose :
269//=======================================================================
270
271gp_Vec BiTgte_CurveOnEdge::DN(const Standard_Real,
272 const Standard_Integer) const
273{
274 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
275}
276
277
278//=======================================================================
279//function :
280//purpose :
281//=======================================================================
282
283Standard_Real BiTgte_CurveOnEdge::Resolution(const Standard_Real) const
284{
285 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
286}
287
288
289//=======================================================================
290//function :
291//purpose :
292//=======================================================================
293
294GeomAbs_CurveType BiTgte_CurveOnEdge::GetType() const
295{
296 return myType;
297}
298
299
300//=======================================================================
301//function :
302//purpose :
303//=======================================================================
304
305gp_Lin BiTgte_CurveOnEdge::Line() const
306{
307 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
308}
309
310
311//=======================================================================
312//function :
313//purpose :
314//=======================================================================
315
316gp_Circ BiTgte_CurveOnEdge::Circle() const
317{
318 if ( myType != GeomAbs_Circle) {
319 throw Standard_NoSuchObject("BiTgte_CurveOnEdge::Circle");
320 }
321
322 return myCirc;
323}
324
325
326//=======================================================================
327//function :
328//purpose :
329//=======================================================================
330
331gp_Elips BiTgte_CurveOnEdge::Ellipse() const
332{
333 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
334}
335
336
337//=======================================================================
338//function :
339//purpose :
340//=======================================================================
341
342gp_Hypr BiTgte_CurveOnEdge::Hyperbola() const
343{
344 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
345}
346
347
348//=======================================================================
349//function :
350//purpose :
351//=======================================================================
352
353gp_Parab BiTgte_CurveOnEdge::Parabola() const
354{
355 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
356}
357
358
359//=======================================================================
360//function :
361//purpose :
362//=======================================================================
363
364Standard_Integer BiTgte_CurveOnEdge::Degree() const
365{
366 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
367}
368
369
370//=======================================================================
371//function :
372//purpose :
373//=======================================================================
374
375Standard_Boolean BiTgte_CurveOnEdge::IsRational() const
376{
377 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
378}
379
380
381//=======================================================================
382//function :
383//purpose :
384//=======================================================================
385
386Standard_Integer BiTgte_CurveOnEdge::NbPoles() const
387{
388 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
389}
390
391
392//=======================================================================
393//function :
394//purpose :
395//=======================================================================
396
397Standard_Integer BiTgte_CurveOnEdge::NbKnots() const
398{
399 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
400}
401
402
403//=======================================================================
404//function :
405//purpose :
406//=======================================================================
407
408Handle(Geom_BezierCurve) BiTgte_CurveOnEdge::Bezier() const
409{
410 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
411}
412
413
414//=======================================================================
415//function :
416//purpose :
417//=======================================================================
418
419Handle(Geom_BSplineCurve) BiTgte_CurveOnEdge::BSpline() const
420{
421 throw Standard_NotImplemented("BiTgte_CurveOnEdge");
422}
423
424