Integration of OCCT 6.5.0 from SVN
[occt.git] / src / Adaptor2d / Adaptor2d_Line2d.cxx
CommitLineData
7fd59977 1#include <Adaptor2d_Line2d.ixx>
2
3#include <Precision.hxx>
4#include <ElCLib.hxx>
5#include <Standard_OutOfRange.hxx>
6#include <Standard_NoSuchObject.hxx>
7#include <Adaptor2d_HLine2d.hxx>
8
9//=======================================================================
10//function : Adaptor2d_Line2d
11//purpose :
12//=======================================================================
13
14 Adaptor2d_Line2d::Adaptor2d_Line2d()
15{
16}
17
18//=======================================================================
19//function : Adaptor_Line2d
20//purpose :
21//=======================================================================
22
23 Adaptor2d_Line2d::Adaptor2d_Line2d(const gp_Pnt2d& P, const gp_Dir2d& D,
24 const Standard_Real UFirst,
25 const Standard_Real ULast):
26 myUfirst(UFirst),myUlast(ULast),myAx2d(P,D)
27{
28}
29
30//=======================================================================
31//function : Load
32//purpose :
33//=======================================================================
34
35void Adaptor2d_Line2d::Load(const gp_Lin2d& L)
36{
37 myAx2d = L.Position();
38 myUfirst = -Precision::Infinite();
39 myUlast = Precision::Infinite();
40}
41
42//=======================================================================
43//function : Load
44//purpose :
45//=======================================================================
46
47void Adaptor2d_Line2d::Load(const gp_Lin2d& L, const Standard_Real Fi, const Standard_Real La)
48{
49 myAx2d = L.Position();
50 myUfirst = Fi;
51 myUlast = La;
52}
53
54//=======================================================================
55//function : FirstParameter
56//purpose :
57//=======================================================================
58
59Standard_Real Adaptor2d_Line2d::FirstParameter() const
60{
61 return myUfirst;
62}
63
64//=======================================================================
65//function : LastParameter
66//purpose :
67//=======================================================================
68
69Standard_Real Adaptor2d_Line2d::LastParameter() const
70{
71 return myUlast;
72}
73
74//=======================================================================
75//function : Continuity
76//purpose :
77//=======================================================================
78
79GeomAbs_Shape Adaptor2d_Line2d::Continuity() const
80{
81 return GeomAbs_CN;
82}
83
84//=======================================================================
85//function : NbIntervals
86//purpose :
87//=======================================================================
88
89//Standard_Integer Adaptor2d_Line2d::NbIntervals(const GeomAbs_Shape S) const
90Standard_Integer Adaptor2d_Line2d::NbIntervals(const GeomAbs_Shape ) const
91{
92 return 1;
93}
94
95//=======================================================================
96//function : Interval
97//purpose :
98//=======================================================================
99
100void Adaptor2d_Line2d::Intervals(TColStd_Array1OfReal& T,
101// const GeomAbs_Shape S) const
102 const GeomAbs_Shape ) const
103{
104 T(T.Lower()) = myUfirst;
105 T(T.Lower()+1) = myUlast;
106}
107
108//=======================================================================
109//function : Trim
110//purpose :
111//=======================================================================
112
113Handle(Adaptor2d_HCurve2d) Adaptor2d_Line2d::Trim
114(const Standard_Real First,
115 const Standard_Real Last,
116 const Standard_Real) const
117{
118 Handle(Adaptor2d_HLine2d) HL = new Adaptor2d_HLine2d();
119 HL->ChangeCurve2d().Load(gp_Lin2d(myAx2d),First,Last);
120 return HL;
121}
122
123//=======================================================================
124//function : IsClosed
125//purpose :
126//=======================================================================
127
128Standard_Boolean Adaptor2d_Line2d::IsClosed() const
129{
130 return Standard_False;
131}
132
133//=======================================================================
134//function : IsPeriodic
135//purpose :
136//=======================================================================
137
138Standard_Boolean Adaptor2d_Line2d::IsPeriodic() const
139{
140 return Standard_False;
141}
142
143//=======================================================================
144//function : Period
145//purpose :
146//=======================================================================
147
148Standard_Real Adaptor2d_Line2d::Period() const
149{
150 Standard_NoSuchObject::Raise();
151 return 0;
152}
153
154//=======================================================================
155//function : Value
156//purpose :
157//=======================================================================
158
159gp_Pnt2d Adaptor2d_Line2d::Value(const Standard_Real X) const
160{
161 return ElCLib::LineValue(X,myAx2d);
162}
163
164//=======================================================================
165//function : D0
166//purpose :
167//=======================================================================
168
169void Adaptor2d_Line2d::D0(const Standard_Real X, gp_Pnt2d& P) const
170{
171 P = ElCLib::LineValue(X,myAx2d);
172}
173
174//=======================================================================
175//function : D1
176//purpose :
177//=======================================================================
178
179void Adaptor2d_Line2d::D1(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V) const
180{
181 ElCLib::LineD1(X,myAx2d,P,V);
182}
183
184//=======================================================================
185//function : D2
186//purpose :
187//=======================================================================
188
189void Adaptor2d_Line2d::D2(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const
190{
191 ElCLib::LineD1(X,myAx2d,P,V1);
192 V2.SetCoord(0.,0.);
193}
194
195//=======================================================================
196//function : D3
197//purpose :
198//=======================================================================
199
200void Adaptor2d_Line2d::D3(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const
201{
202 ElCLib::LineD1(X,myAx2d,P,V1);
203 V2.SetCoord(0.,0.);
204 V3.SetCoord(0.,0.);
205}
206
207//=======================================================================
208//function : DN
209//purpose :
210//=======================================================================
211
212//gp_Vec2d Adaptor2d_Line2d::DN(const Standard_Real U, const Standard_Integer N) const
213gp_Vec2d Adaptor2d_Line2d::DN(const Standard_Real , const Standard_Integer N) const
214{
215 if (N<=0) {Standard_OutOfRange::Raise();}
216 if (N==1) {
217 return myAx2d.Direction();
218 }
219 return gp_Vec2d(0.,0.);
220}
221
222//=======================================================================
223//function : Resolution
224//purpose :
225//=======================================================================
226
227Standard_Real Adaptor2d_Line2d::Resolution(const Standard_Real R3d) const
228{
229 return R3d; // nul !!!!
230}
231
232//=======================================================================
233//function : GetType
234//purpose :
235//=======================================================================
236
237GeomAbs_CurveType Adaptor2d_Line2d::GetType() const
238{
239 return GeomAbs_Line;
240}
241
242//=======================================================================
243//function : Line
244//purpose :
245//=======================================================================
246
247gp_Lin2d Adaptor2d_Line2d::Line() const
248{
249 return gp_Lin2d(myAx2d);
250}
251
252//=======================================================================
253//function : Circle
254//purpose :
255//=======================================================================
256
257gp_Circ2d Adaptor2d_Line2d::Circle() const
258{
259 Standard_NoSuchObject::Raise();
260 return gp_Circ2d();
261}
262
263//=======================================================================
264//function : Ellipse
265//purpose :
266//=======================================================================
267
268gp_Elips2d Adaptor2d_Line2d::Ellipse() const
269{
270 Standard_NoSuchObject::Raise();
271 return gp_Elips2d();
272}
273
274//=======================================================================
275//function : Hyperbola
276//purpose :
277//=======================================================================
278
279gp_Hypr2d Adaptor2d_Line2d::Hyperbola() const
280{
281 Standard_NoSuchObject::Raise();
282 return gp_Hypr2d();
283}
284
285//=======================================================================
286//function : Parabola
287//purpose :
288//=======================================================================
289
290gp_Parab2d Adaptor2d_Line2d::Parabola() const
291{
292 Standard_NoSuchObject::Raise();
293 return gp_Parab2d();
294}
295
296//=======================================================================
297//function : Degree
298//purpose :
299//=======================================================================
300
301Standard_Integer Adaptor2d_Line2d::Degree() const
302 {
303 Standard_NoSuchObject::Raise();
304 return 0 ;
305}
306//=======================================================================
307//function : IsRational
308//purpose :
309//=======================================================================
310
311Standard_Boolean Adaptor2d_Line2d::IsRational() const
312 {
313 Standard_NoSuchObject::Raise();
314 return 0 ;
315}
316//=======================================================================
317//function : NbPoles
318//purpose :
319//=======================================================================
320
321Standard_Integer Adaptor2d_Line2d::NbPoles() const
322 {
323 Standard_NoSuchObject::Raise();
324 return 0 ;
325}
326//=======================================================================
327//function : NbKnots
328//purpose :
329//=======================================================================
330
331Standard_Integer Adaptor2d_Line2d::NbKnots() const
332 {
333 Standard_NoSuchObject::Raise();
334 return 0 ;
335}
336//=======================================================================
337//function : Bezier
338//purpose :
339//=======================================================================
340
341Handle(Geom2d_BezierCurve) Adaptor2d_Line2d::Bezier() const
342{
343 Standard_NoSuchObject::Raise();
344 Handle(Geom2d_BezierCurve) nul;
345 return nul;
346}
347
348//=======================================================================
349//function : BSpline
350//purpose :
351//=======================================================================
352
353Handle(Geom2d_BSplineCurve) Adaptor2d_Line2d::BSpline() const
354{
355 Standard_NoSuchObject::Raise();
356 Handle(Geom2d_BSplineCurve) nul;
357 return nul;
358}
359