1 // Created on: 1993-03-10
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom_SurfaceOfLinearExtrusion_HeaderFile
18 #define _Geom_SurfaceOfLinearExtrusion_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Geom_SweptSurface.hxx>
24 #include <GeomEvaluator_SurfaceOfExtrusion.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 class Standard_RangeError;
29 class Geom_UndefinedDerivative;
39 class Geom_SurfaceOfLinearExtrusion;
40 DEFINE_STANDARD_HANDLE(Geom_SurfaceOfLinearExtrusion, Geom_SweptSurface)
42 //! Describes a surface of linear extrusion ("extruded
43 //! surface"), e.g. a generalized cylinder. Such a surface
44 //! is obtained by sweeping a curve (called the "extruded
45 //! curve" or "basis") in a given direction (referred to as
46 //! the "direction of extrusion" and defined by a unit vector).
47 //! The u parameter is along the extruded curve. The v
48 //! parameter is along the direction of extrusion.
49 //! The parameter range for the u parameter is defined
50 //! by the reference curve.
51 //! The parameter range for the v parameter is ] -
52 //! infinity, + infinity [.
53 //! The position of the curve gives the origin of the v parameter.
54 //! The surface is "CN" in the v parametric direction.
55 //! The form of a surface of linear extrusion is generally a
56 //! ruled surface (GeomAbs_RuledForm). It can be:
57 //! - a cylindrical surface, if the extruded curve is a circle,
58 //! or a trimmed circle, with an axis parallel to the
59 //! direction of extrusion (GeomAbs_CylindricalForm), or
60 //! - a planar surface, if the extruded curve is a line
61 //! (GeomAbs_PlanarForm).
62 //! Note: The surface of extrusion is built from a copy of
63 //! the original basis curve, so the original curve is not
64 //! modified when the surface is modified.
66 //! Degenerate surfaces are not detected. A degenerate
67 //! surface is obtained, for example, when the extruded
68 //! curve is a line and the direction of extrusion is parallel
70 class Geom_SurfaceOfLinearExtrusion : public Geom_SweptSurface
77 //! V is the direction of extrusion.
78 //! C is the extruded curve.
79 //! The form of a SurfaceOfLinearExtrusion can be :
80 //! . ruled surface (RuledForm),
81 //! . a cylindrical surface if the extruded curve is a circle or
82 //! a trimmed circle (CylindricalForm),
83 //! . a plane surface if the extruded curve is a Line (PlanarForm).
85 //! Degenerated surface cases are not detected. For example if the
86 //! curve C is a line and V is parallel to the direction of this
88 Standard_EXPORT Geom_SurfaceOfLinearExtrusion(const Handle(Geom_Curve)& C, const gp_Dir& V);
90 //! Assigns V as the "direction of extrusion" for this
91 //! surface of linear extrusion.
92 Standard_EXPORT void SetDirection (const gp_Dir& V);
94 //! Modifies this surface of linear extrusion by redefining
95 //! its "basis curve" (the "extruded curve").
96 Standard_EXPORT void SetBasisCurve (const Handle(Geom_Curve)& C);
98 //! Changes the orientation of this surface of linear
99 //! extrusion in the u parametric direction. The
100 //! bounds of the surface are not changed, but the given
101 //! parametric direction is reversed. Hence the
102 //! orientation of the surface is reversed.
103 //! In the case of a surface of linear extrusion:
104 //! - UReverse reverses the basis curve, and
105 //! - VReverse reverses the direction of linear extrusion.
106 Standard_EXPORT void UReverse() Standard_OVERRIDE;
108 //! Computes the u parameter on the modified
109 //! surface, produced by reversing its u parametric
110 //! direction, for any point of u parameter U on this surface of linear extrusion.
111 //! In the case of an extruded surface:
112 //! - UReverseParameter returns the reversed
113 //! parameter given by the function
114 //! ReversedParameter called with U on the basis curve,
115 Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
117 //! Changes the orientation of this surface of linear
118 //! extrusion in the v parametric direction. The
119 //! bounds of the surface are not changed, but the given
120 //! parametric direction is reversed. Hence the
121 //! orientation of the surface is reversed.
122 //! In the case of a surface of linear extrusion:
123 //! - UReverse reverses the basis curve, and
124 //! - VReverse reverses the direction of linear extrusion.
125 Standard_EXPORT void VReverse() Standard_OVERRIDE;
127 //! Computes the v parameter on the modified
128 //! surface, produced by reversing its u v parametric
129 //! direction, for any point of v parameter V on this surface of linear extrusion.
130 //! In the case of an extruded surface VReverse returns -V.
131 Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
133 //! Returns the parametric bounds U1, U2, V1 and V2 of
134 //! this surface of linear extrusion.
135 //! A surface of linear extrusion is infinite in the v
136 //! parametric direction, so:
137 //! - V1 = Standard_Real::RealFirst()
138 //! - V2 = Standard_Real::RealLast().
139 Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
141 //! IsUClosed returns true if the "basis curve" of this
142 //! surface of linear extrusion is closed.
143 Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
145 //! IsVClosed always returns false.
146 Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
148 //! IsCNu returns true if the degree of continuity for the
149 //! "basis curve" of this surface of linear extrusion is at least N.
150 //! Raises RangeError if N < 0.
151 Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE;
153 //! IsCNv always returns true.
154 Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
156 //! IsUPeriodic returns true if the "basis curve" of this
157 //! surface of linear extrusion is periodic.
158 Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
160 //! IsVPeriodic always returns false.
161 Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
163 //! Computes the U isoparametric curve of this surface
164 //! of linear extrusion. This is the line parallel to the
165 //! direction of extrusion, passing through the point of
166 //! parameter U of the basis curve.
167 Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
169 //! Computes the V isoparametric curve of this surface
170 //! of linear extrusion. This curve is obtained by
171 //! translating the extruded curve in the direction of
172 //! extrusion, with the magnitude V.
173 Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
176 //! Computes the point P (U, V) on the surface.
177 //! The parameter U is the parameter on the extruded curve.
178 //! The parametrization V is a linear parametrization, and
179 //! the direction of parametrization is the direction of
180 //! extrusion. If the point is on the extruded curve, V = 0.0
181 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
184 //! Computes the current point and the first derivatives in the
185 //! directions U and V.
186 //! Raises UndefinedDerivative if the continuity of the surface is not C1.
187 Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
190 //! Computes the current point, the first and the second derivatives
191 //! in the directions U and V.
192 //! Raises UndefinedDerivative if the continuity of the surface is not C2.
193 Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE;
196 //! Computes the current point, the first,the second and the third
197 //! derivatives in the directions U and V.
198 //! Raises UndefinedDerivative if the continuity of the surface is not C3.
199 Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE;
202 //! Computes the derivative of order Nu in the direction u
203 //! and Nv in the direction v.
204 //! Raises UndefinedDerivative if the continuity of the surface is not CNu in the u
205 //! direction and CNv in the v direction.
206 //! Raises RangeError if Nu + Nv < 1 or Nu < 0 or Nv < 0.
207 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
209 //! Applies the transformation T to this surface of linear extrusion.
210 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
212 //! Computes the parameters on the transformed surface for
213 //! the transform of the point of parameters U,V on <me>.
215 //! me->Transformed(T)->Value(U',V')
217 //! is the same point as
219 //! me->Value(U,V).Transformed(T)
221 //! Where U',V' are the new values of U,V after calling
223 //! me->TranformParameters(U,V,T)
225 //! This methods multiplies :
226 //! U by BasisCurve()->ParametricTransformation(T)
227 //! V by T.ScaleFactor()
228 Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE;
230 //! Returns a 2d transformation used to find the new
231 //! parameters of a point on the transformed surface.
233 //! me->Transformed(T)->Value(U',V')
235 //! is the same point as
237 //! me->Value(U,V).Transformed(T)
239 //! Where U',V' are obtained by transforming U,V with
240 //! th 2d transformation returned by
242 //! me->ParametricTransformation(T)
244 //! This methods returns a scale
245 //! U by BasisCurve()->ParametricTransformation(T)
246 //! V by T.ScaleFactor()
247 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
249 //! Creates a new object which is a copy of this surface of linear extrusion.
250 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
252 //! Dumps the content of me into the stream
253 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
258 DEFINE_STANDARD_RTTIEXT(Geom_SurfaceOfLinearExtrusion,Geom_SweptSurface)
266 Handle(GeomEvaluator_SurfaceOfExtrusion) myEvaluator;
278 #endif // _Geom_SurfaceOfLinearExtrusion_HeaderFile