0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / Geom / Geom_SurfaceOfLinearExtrusion.cxx
CommitLineData
b311480e 1// Created on: 1993-03-10
2// Created by: JCV
3// Copyright (c) 1993-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
42cf5bc1 17
18#include <BSplCLib.hxx>
19#include <BSplSLib.hxx>
20#include <Geom_BezierCurve.hxx>
21#include <Geom_BSplineCurve.hxx>
7fd59977 22#include <Geom_Circle.hxx>
42cf5bc1 23#include <Geom_Curve.hxx>
7fd59977 24#include <Geom_Ellipse.hxx>
42cf5bc1 25#include <Geom_Geometry.hxx>
7fd59977 26#include <Geom_Hyperbola.hxx>
42cf5bc1 27#include <Geom_Line.hxx>
28#include <Geom_OffsetCurve.hxx>
7fd59977 29#include <Geom_Parabola.hxx>
42cf5bc1 30#include <Geom_SurfaceOfLinearExtrusion.hxx>
7fd59977 31#include <Geom_TrimmedCurve.hxx>
42cf5bc1 32#include <Geom_UndefinedDerivative.hxx>
33#include <GeomAbs_CurveType.hxx>
6b84c3f7 34#include <GeomEvaluator_SurfaceOfExtrusion.hxx>
42cf5bc1 35#include <gp.hxx>
36#include <gp_Ax2d.hxx>
37#include <gp_Dir.hxx>
38#include <gp_GTrsf2d.hxx>
39#include <gp_Lin.hxx>
40#include <gp_Pnt.hxx>
41#include <gp_Trsf.hxx>
42#include <gp_Vec.hxx>
43#include <gp_XYZ.hxx>
44#include <Precision.hxx>
7fd59977 45#include <Standard_RangeError.hxx>
42cf5bc1 46#include <Standard_Type.hxx>
7fd59977 47
92efcf78 48IMPLEMENT_STANDARD_RTTIEXT(Geom_SurfaceOfLinearExtrusion,Geom_SweptSurface)
49
7fd59977 50#define POLES (poles->Array2())
51#define WEIGHTS (weights->Array2())
52#define UKNOTS (uknots->Array1())
53#define VKNOTS (vknots->Array1())
54#define UFKNOTS (ufknots->Array1())
55#define VFKNOTS (vfknots->Array1())
56#define FMULTS (BSplCLib::NoMults())
57
58typedef Geom_SurfaceOfLinearExtrusion SurfaceOfLinearExtrusion;
7fd59977 59typedef Geom_Curve Curve;
7fd59977 60typedef gp_Dir Dir;
61typedef gp_Pnt Pnt;
62typedef gp_Trsf Trsf;
63typedef gp_Vec Vec;
64typedef gp_XYZ XYZ;
65
7fd59977 66
67
68//=======================================================================
69//function : Copy
70//purpose :
71//=======================================================================
72
73Handle(Geom_Geometry) Geom_SurfaceOfLinearExtrusion::Copy () const
74{
75
76 Handle(Geom_SurfaceOfLinearExtrusion) Sr;
77 Sr = new SurfaceOfLinearExtrusion (basisCurve, direction);
78 return Sr;
79}
80
81
82//=======================================================================
83//function : Geom_SurfaceOfLinearExtrusion
84//purpose :
85//=======================================================================
86
87Geom_SurfaceOfLinearExtrusion::Geom_SurfaceOfLinearExtrusion
c04c30b3 88 ( const Handle(Geom_Curve)& C,
7fd59977 89 const Dir& V) {
90
c04c30b3 91 basisCurve = Handle(Geom_Curve)::DownCast(C->Copy()); // Copy 10-03-93
7fd59977 92 direction = V;
93 smooth = C->Continuity();
6b84c3f7 94 myEvaluator = new GeomEvaluator_SurfaceOfExtrusion(basisCurve, direction);
7fd59977 95 }
96
97
98//=======================================================================
99//function : UReverse
100//purpose :
101//=======================================================================
102
103void Geom_SurfaceOfLinearExtrusion::UReverse () {
104
105 basisCurve->Reverse();
106}
107
108
109//=======================================================================
110//function : UReversedParameter
111//purpose :
112//=======================================================================
113
114Standard_Real Geom_SurfaceOfLinearExtrusion::UReversedParameter(const Standard_Real U) const {
115
116 return basisCurve->ReversedParameter(U);
117}
118
119
120//=======================================================================
121//function : VReverse
122//purpose :
123//=======================================================================
124
125void Geom_SurfaceOfLinearExtrusion::VReverse () {
126
6b84c3f7 127 direction.Reverse();
128 myEvaluator->SetDirection(direction);
7fd59977 129}
130
131
132//=======================================================================
133//function : VReversedParameter
134//purpose :
135//=======================================================================
136
137Standard_Real Geom_SurfaceOfLinearExtrusion::VReversedParameter( const Standard_Real V) const {
138
139 return (-V);
140}
141
142
143//=======================================================================
144//function : SetDirection
145//purpose :
146//=======================================================================
147
6b84c3f7 148void Geom_SurfaceOfLinearExtrusion::SetDirection (const Dir& V)
149{
150 direction = V;
151 myEvaluator->SetDirection(direction);
152}
7fd59977 153
154
155//=======================================================================
156//function : SetBasisCurve
157//purpose :
158//=======================================================================
159
c04c30b3 160void Geom_SurfaceOfLinearExtrusion::SetBasisCurve (const Handle(Geom_Curve)& C) {
7fd59977 161
162 smooth = C->Continuity();
c04c30b3 163 basisCurve = Handle(Geom_Curve)::DownCast(C->Copy()); // Copy 10-03-93
6b84c3f7 164 myEvaluator = new GeomEvaluator_SurfaceOfExtrusion(basisCurve, direction);
7fd59977 165}
166
167
168//=======================================================================
169//function : Bounds
170//purpose :
171//=======================================================================
172
173void Geom_SurfaceOfLinearExtrusion::Bounds ( Standard_Real& U1,
174 Standard_Real& U2,
175 Standard_Real& V1,
176 Standard_Real& V2 ) const {
177
178 V1 = -Precision::Infinite(); V2 = Precision::Infinite();
179 U1 = basisCurve->FirstParameter(); U2 = basisCurve->LastParameter();
180}
181
182
183//=======================================================================
184//function : D0
185//purpose :
186//=======================================================================
187
6b84c3f7 188void Geom_SurfaceOfLinearExtrusion::D0 (const Standard_Real U,
189 const Standard_Real V,
190 Pnt& P) const
191{
192 myEvaluator->D0(U, V, P);
7fd59977 193}
194
195
196//=======================================================================
197//function : D1
198//purpose :
199//=======================================================================
200
6b84c3f7 201void Geom_SurfaceOfLinearExtrusion::D1 (const Standard_Real U,
202 const Standard_Real V,
203 Pnt& P,
204 Vec& D1U, Vec& D1V) const
205{
206 myEvaluator->D1(U, V, P, D1U, D1V);
7fd59977 207}
208
209
210//=======================================================================
211//function : D2
212//purpose :
213//=======================================================================
214
6b84c3f7 215void Geom_SurfaceOfLinearExtrusion::D2 (const Standard_Real U,
216 const Standard_Real V,
217 Pnt& P,
218 Vec& D1U, Vec& D1V,
219 Vec& D2U, Vec& D2V, Vec& D2UV) const
220{
221 myEvaluator->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
7fd59977 222}
223
224
225//=======================================================================
226//function : D3
227//purpose :
228//=======================================================================
229
6b84c3f7 230void Geom_SurfaceOfLinearExtrusion::D3 (const Standard_Real U,
231 const Standard_Real V,
232 Pnt& P,
233 Vec& D1U, Vec& D1V,
234 Vec& D2U, Vec& D2V, Vec& D2UV,
235 Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV) const
7fd59977 236{
6b84c3f7 237 myEvaluator->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
7fd59977 238}
239
7fd59977 240
241//=======================================================================
6b84c3f7 242//function : DN
7fd59977 243//purpose :
244//=======================================================================
245
6b84c3f7 246Vec Geom_SurfaceOfLinearExtrusion::DN (const Standard_Real U,
247 const Standard_Real V,
248 const Standard_Integer Nu,
249 const Standard_Integer Nv) const
7fd59977 250{
6b84c3f7 251 return myEvaluator->DN(U, V, Nu, Nv);
7fd59977 252}
253
6b84c3f7 254
7fd59977 255//=======================================================================
256//function : UIso
257//purpose :
258//=======================================================================
259
260Handle(Geom_Curve) Geom_SurfaceOfLinearExtrusion::UIso (const Standard_Real U) const {
261
262 Handle(Geom_Line) L;
263 L = new Geom_Line (basisCurve->Value (U), direction);
264 return L;
265}
266
267
268//=======================================================================
269//function : VIso
270//purpose :
271//=======================================================================
272
c04c30b3 273Handle(Geom_Curve) Geom_SurfaceOfLinearExtrusion::VIso (const Standard_Real V) const {
7fd59977 274
275 Vec Vdir (direction);
276 Vdir.Multiply (V);
c04c30b3 277 Handle(Geom_Curve) C;
7fd59977 278 C = Handle(Geom_Curve)::DownCast(basisCurve->Translated(Vdir));
279 return C;
280}
281
282
283//=======================================================================
284//function : IsCNu
285//purpose :
286//=======================================================================
287
288Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsCNu (const Standard_Integer N) const {
289
290 Standard_RangeError_Raise_if (N < 0, " ");
291 return basisCurve->IsCN (N);
292}
293
294
295//=======================================================================
296//function : IsCNv
297//purpose :
298//=======================================================================
299
300Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsCNv (const Standard_Integer ) const {
301
302 return Standard_True;
303}
304
305
306//=======================================================================
307//function : Transform
308//purpose :
309//=======================================================================
310
311void Geom_SurfaceOfLinearExtrusion::Transform (const Trsf& T) {
312
313 direction.Transform (T);
314 basisCurve->Transform (T);
6b84c3f7 315 myEvaluator->SetDirection(direction);
7fd59977 316}
317
318
319
320//=======================================================================
321//function : IsUClosed
322//purpose :
323//=======================================================================
324
325Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsUClosed () const {
326
327 return basisCurve->IsClosed ();
328}
329
330
331//=======================================================================
332//function : IsUPeriodic
333//purpose :
334//=======================================================================
335
336Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsUPeriodic () const {
337
338 return basisCurve->IsPeriodic ();
339}
340
341//=======================================================================
342//function : IsVClosed
343//purpose :
344//=======================================================================
345
346Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsVClosed () const {
347
348 return Standard_False;
349}
350
351//=======================================================================
352//function : IsVPeriodic
353//purpose :
354//=======================================================================
355
356Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsVPeriodic () const {
357
358 return Standard_False;
359}
360
361//=======================================================================
362//function : TransformParameters
363//purpose :
364//=======================================================================
365
366void Geom_SurfaceOfLinearExtrusion::TransformParameters(Standard_Real& U,
367 Standard_Real& V,
368 const gp_Trsf& T)
369const
370{
371 U = basisCurve->TransformedParameter(U,T);
372 if (!Precision::IsInfinite(V)) V *= Abs(T.ScaleFactor());
373}
374
375//=======================================================================
376//function : ParametricTransformation
377//purpose :
378//=======================================================================
379
380gp_GTrsf2d Geom_SurfaceOfLinearExtrusion::ParametricTransformation
381(const gp_Trsf& T) const
382{
383 // transformation in the V Direction
384 gp_GTrsf2d TV;
385 gp_Ax2d Axis(gp::Origin2d(),gp::DX2d());
386 TV.SetAffinity(Axis, Abs(T.ScaleFactor()));
387 // transformation in the U Direction
388 gp_GTrsf2d TU;
389 Axis = gp_Ax2d(gp::Origin2d(),gp::DY2d());
390 TU.SetAffinity(Axis, basisCurve->ParametricTransformation(T));
391
392 return TU * TV;
393}