0023706: Cannot project point on curve
[occt.git] / src / HLRBRep / HLRBRep_CurveTool.lxx
CommitLineData
b311480e 1// Created on: 1992-10-22
2// Created by: Laurent BUCHARD
3// Copyright (c) 1992-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
7fd59977 21
22#include <HLRBRep_Curve.hxx>
23#include <GeomAbs_CurveType.hxx>
24#include <GeomAbs_Shape.hxx>
25#include <gp_Vec2d.hxx>
26#include <gp_Lin2d.hxx>
27#include <gp_Circ2d.hxx>
28#include <gp_Elips2d.hxx>
29#include <gp_Parab2d.hxx>
30#include <gp_Hypr2d.hxx>
31#include <Handle_Geom2d_BezierCurve.hxx>
32#include <Handle_Geom2d_BSplineCurve.hxx>
33#include <TColStd_Array1OfReal.hxx>
34
35#define IS_C2_COMPOSITE 0
36
37//=======================================================================
38//function : FirstParameter
39//purpose :
40//=======================================================================
41
42inline Standard_Real
43HLRBRep_CurveTool::FirstParameter (const Standard_Address C)
44{ return(((HLRBRep_Curve *)C)->FirstParameter()); }
45
46//=======================================================================
47//function : LastParameter
48//purpose :
49//=======================================================================
50
51inline Standard_Real
52HLRBRep_CurveTool::LastParameter (const Standard_Address C)
53{ return(((HLRBRep_Curve *)C)->LastParameter()); }
54
55//=======================================================================
56//function : Continuity
57//purpose :
58//=======================================================================
59
60inline GeomAbs_Shape
61HLRBRep_CurveTool::Continuity (const Standard_Address C)
62{ return(((HLRBRep_Curve *)C)->Continuity()); }
63
64//=======================================================================
65//function : NbIntervals
66//purpose :
67//=======================================================================
68
69inline Standard_Integer
70HLRBRep_CurveTool::NbIntervals(const Standard_Address C)
71{
72#if IS_C2_COMPOSITE
73 return(((HLRBRep_Curve *)C)->NbIntervals(GeomAbs_C2));
74#else
75 return(((HLRBRep_Curve *)C)->NbIntervals(GeomAbs_C1));
76#endif
77}
78
79//=======================================================================
80//function : Intervals
81//purpose :
82//=======================================================================
83
84inline void
85HLRBRep_CurveTool::Intervals(const Standard_Address C,
86 TColStd_Array1OfReal& Tab)
87{
88#if IS_C2_COMPOSITE
89 ((HLRBRep_Curve *)C)->Intervals(Tab,GeomAbs_C2);
90#else
91 ((HLRBRep_Curve *)C)->Intervals(Tab,GeomAbs_C1);
92#endif
93}
94
95//=======================================================================
96//function : GetInterval
97//purpose :
98//=======================================================================
99
100inline void
101HLRBRep_CurveTool::GetInterval(const Standard_Address C,
102 const Standard_Integer i,
103 const TColStd_Array1OfReal& Tab,
104 Standard_Real& a,
105 Standard_Real& b)
106{
107 a = Tab.Value(i);
108 b = Tab.Value(i+1);
109}
110
111//=======================================================================
112//function : IsClosed
113//purpose :
114//=======================================================================
115
116inline Standard_Boolean
117HLRBRep_CurveTool::IsClosed(const Standard_Address C)
118{ return(((HLRBRep_Curve *)C)->IsClosed()); }
119
120//=======================================================================
121//function : IsPeriodic
122//purpose :
123//=======================================================================
124
125inline Standard_Boolean
126HLRBRep_CurveTool::IsPeriodic(const Standard_Address C)
127{ return(((HLRBRep_Curve *)C)->IsPeriodic()); }
128
129//=======================================================================
130//function : Period
131//purpose :
132//=======================================================================
133
134inline Standard_Real
135HLRBRep_CurveTool::Period(const Standard_Address C)
136{ return(((HLRBRep_Curve *)C)->Period()); }
137
138//=======================================================================
139//function : Value
140//purpose :
141//=======================================================================
142
143inline gp_Pnt2d
144HLRBRep_CurveTool::Value (const Standard_Address C,
145 const Standard_Real U)
146{ return(((HLRBRep_Curve *)C)->Value(U)); }
147
148//=======================================================================
149//function : D0
150//purpose :
151//=======================================================================
152
153inline void
154HLRBRep_CurveTool::D0(const Standard_Address C,
155 const Standard_Real U,
156 gp_Pnt2d& P)
157{ ((HLRBRep_Curve *)C)->D0(U,P); }
158
159//=======================================================================
160//function : D1
161//purpose :
162//=======================================================================
163
164inline void
165HLRBRep_CurveTool::D1 (const Standard_Address C,
166 const Standard_Real U,
167 gp_Pnt2d& P,
168 gp_Vec2d& T)
169{ ((HLRBRep_Curve *)C)->D1(U,P,T); }
170
171//=======================================================================
172//function : D2
173//purpose :
174//=======================================================================
175
176inline void
177HLRBRep_CurveTool::D2 (const Standard_Address C,
178 const Standard_Real U,
179 gp_Pnt2d& P,
180 gp_Vec2d& T,
181 gp_Vec2d& N)
182{ ((HLRBRep_Curve *)C)->D2(U,P,T,N); }
183
184//=======================================================================
185//function : D3
186//purpose :
187//=======================================================================
188
189inline void
190HLRBRep_CurveTool::D3 (const Standard_Address C,
191 const Standard_Real U,
192 gp_Pnt2d& P,
193 gp_Vec2d& V1,
194 gp_Vec2d& V2,
195 gp_Vec2d& V3)
196{ ((HLRBRep_Curve *)C)->D3(U,P,V1,V2,V3); }
197
198//=======================================================================
199//function : DN
200//purpose :
201//=======================================================================
202
203inline gp_Vec2d
204HLRBRep_CurveTool::DN (const Standard_Address C,
205 const Standard_Real U,
206 const Standard_Integer N)
207{ return(((HLRBRep_Curve *)C)->DN(U,N)); }
208
209//=======================================================================
210//function : Resolution
211//purpose :
212//=======================================================================
213
214inline Standard_Real
215HLRBRep_CurveTool::Resolution(const Standard_Address C,
216 const Standard_Real R3d)
217{ return(((HLRBRep_Curve *)C)->Resolution(R3d)); }
218
219//=======================================================================
220//function : GetType
221//purpose :
222//=======================================================================
223
224inline GeomAbs_CurveType
225HLRBRep_CurveTool::GetType(const Standard_Address C)
226{ return(((HLRBRep_Curve *)C)->GetType()); }
227
228//=======================================================================
229//function : TheType
230//purpose :
231//=======================================================================
232
233inline GeomAbs_CurveType
234HLRBRep_CurveTool::TheType(const Standard_Address C)
235{ return(((HLRBRep_Curve *)C)->GetType()); }
236
237//=======================================================================
238//function : Line
239//purpose :
240//=======================================================================
241
242inline gp_Lin2d
243HLRBRep_CurveTool::Line (const Standard_Address C)
244{ return(((HLRBRep_Curve *)C)->Line()); }
245
246//=======================================================================
247//function : Circle
248//purpose :
249//=======================================================================
250
251inline gp_Circ2d
252HLRBRep_CurveTool::Circle (const Standard_Address C)
253{ return(((HLRBRep_Curve *)C)->Circle()); }
254
255//=======================================================================
256//function : Ellipse
257//purpose :
258//=======================================================================
259
260inline gp_Elips2d
261HLRBRep_CurveTool::Ellipse (const Standard_Address C)
262{ return(((HLRBRep_Curve *)C)->Ellipse()); }
263
264//=======================================================================
265//function : Parabola
266//purpose :
267//=======================================================================
268
269inline gp_Parab2d
270HLRBRep_CurveTool::Parabola (const Standard_Address C)
271{ return(((HLRBRep_Curve *)C)->Parabola()); }
272
273//=======================================================================
274//function : Hyperbola
275//purpose :
276//=======================================================================
277
278inline gp_Hypr2d
279HLRBRep_CurveTool::Hyperbola (const Standard_Address C)
280{ return(((HLRBRep_Curve *)C)->Hyperbola()); }
281
282//=======================================================================
283//function : Bezier
284//purpose :
285//=======================================================================
286
287inline Handle(Geom2d_BezierCurve)
288 HLRBRep_CurveTool::Bezier (const Standard_Address C)
289{
290 cout<<" HLRBRep_CurveTool::Bezier : Not Implemented "<<endl;
291 //-- return(((HLRBRep_Curve *)C)->Bezier());
292 return(0);
293}
294
295//=======================================================================
296//function : BSpline
297//purpose :
298//=======================================================================
299
300inline Handle(Geom2d_BSplineCurve)
301 HLRBRep_CurveTool::BSpline (const Standard_Address C)
302{
303 cout<<" HLRBRep_CurveTool::BSpline : Not Implemented "<<endl;
304 //-- return(((HLRBRep_Curve *)C)->BSpline());
305 return(0);
306}
307
308//=======================================================================
309//function : EpsX
310//purpose :
311//=======================================================================
312
313inline Standard_Real
314HLRBRep_CurveTool::EpsX(const Standard_Address C)
315{ return(1e-10); }
32ca7a51 316
317
318//=======================================================================
319//function : Degree
320//purpose :
321//=======================================================================
322
323inline Standard_Integer
324 HLRBRep_CurveTool::Degree (const Standard_Address C)
325{
326 return(((HLRBRep_Curve *)C)->Degree());
327}