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_Surface_HeaderFile
18 #define _Geom_Surface_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Geom_Curve.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <GeomAbs_Shape.hxx>
27 #include <Standard_Integer.hxx>
28 class Standard_RangeError;
29 class Standard_NoSuchObject;
30 class Geom_UndefinedDerivative;
31 class Geom_UndefinedValue;
39 DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry)
41 //! Describes the common behavior of surfaces in 3D
42 //! space. The Geom package provides many
43 //! implementations of concrete derived surfaces, such as
44 //! planes, cylinders, cones, spheres and tori, surfaces of
45 //! linear extrusion, surfaces of revolution, Bezier and
46 //! BSpline surfaces, and so on.
47 //! The key characteristic of these surfaces is that they
48 //! are parameterized. Geom_Surface demonstrates:
49 //! - how to work with the parametric equation of a
50 //! surface to compute the point of parameters (u,
51 //! v), and, at this point, the 1st, 2nd ... Nth derivative,
52 //! - how to find global information about a surface in
53 //! each parametric direction (for example, level of
54 //! continuity, whether the surface is closed, its
55 //! periodicity, the bounds of the parameters and so on), and
56 //! - how the parameters change when geometric
57 //! transformations are applied to the surface, or the
58 //! orientation is modified.
59 //! Note that all surfaces must have a geometric
60 //! continuity, and any surface is at least "C0". Generally,
61 //! continuity is checked at construction time or when the
62 //! curve is edited. Where this is not the case, the
63 //! documentation makes this explicit.
65 //! The Geom package does not prevent the construction of
66 //! surfaces with null areas, or surfaces which self-intersect.
67 class Geom_Surface : public Geom_Geometry
74 //! Reverses the U direction of parametrization of <me>.
75 //! The bounds of the surface are not modified.
76 Standard_EXPORT virtual void UReverse() = 0;
79 //! Reverses the U direction of parametrization of <me>.
80 //! The bounds of the surface are not modified.
81 //! A copy of <me> is returned.
82 Standard_EXPORT Handle(Geom_Surface) UReversed() const;
84 //! Returns the parameter on the Ureversed surface for
85 //! the point of parameter U on <me>.
87 //! me->UReversed()->Value(me->UReversedParameter(U),V)
89 //! is the same point as
92 Standard_EXPORT virtual Standard_Real UReversedParameter (const Standard_Real U) const = 0;
95 //! Reverses the V direction of parametrization of <me>.
96 //! The bounds of the surface are not modified.
97 Standard_EXPORT virtual void VReverse() = 0;
100 //! Reverses the V direction of parametrization of <me>.
101 //! The bounds of the surface are not modified.
102 //! A copy of <me> is returned.
103 Standard_EXPORT Handle(Geom_Surface) VReversed() const;
105 //! Returns the parameter on the Vreversed surface for
106 //! the point of parameter V on <me>.
108 //! me->VReversed()->Value(U,me->VReversedParameter(V))
110 //! is the same point as
113 Standard_EXPORT virtual Standard_Real VReversedParameter (const Standard_Real V) const = 0;
115 //! Computes the parameters on the transformed surface for
116 //! the transform of the point of parameters U,V on <me>.
118 //! me->Transformed(T)->Value(U',V')
120 //! is the same point as
122 //! me->Value(U,V).Transformed(T)
124 //! Where U',V' are the new values of U,V after calling
126 //! me->TranformParameters(U,V,T)
128 //! This methods does not change <U> and <V>
130 //! It can be redefined. For example on the Plane,
131 //! Cylinder, Cone, Revolved and Extruded surfaces.
132 Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const;
134 //! Returns a 2d transformation used to find the new
135 //! parameters of a point on the transformed surface.
137 //! me->Transformed(T)->Value(U',V')
139 //! is the same point as
141 //! me->Value(U,V).Transformed(T)
143 //! Where U',V' are obtained by transforming U,V with
144 //! th 2d transformation returned by
146 //! me->ParametricTransformation(T)
148 //! This methods returns an identity transformation
150 //! It can be redefined. For example on the Plane,
151 //! Cylinder, Cone, Revolved and Extruded surfaces.
152 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const;
154 //! Returns the parametric bounds U1, U2, V1 and V2 of this surface.
155 //! If the surface is infinite, this function can return a value
156 //! equal to Precision::Infinite: instead of Standard_Real::LastReal.
157 Standard_EXPORT virtual void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const = 0;
159 //! Checks whether this surface is closed in the u
160 //! parametric direction.
161 //! Returns true if, in the u parametric direction: taking
162 //! uFirst and uLast as the parametric bounds in
163 //! the u parametric direction, for each parameter v, the
164 //! distance between the points P(uFirst, v) and
165 //! P(uLast, v) is less than or equal to gp::Resolution().
166 Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
168 //! Checks whether this surface is closed in the u
169 //! parametric direction.
170 //! Returns true if, in the v parametric
171 //! direction: taking vFirst and vLast as the
172 //! parametric bounds in the v parametric direction, for
173 //! each parameter u, the distance between the points
174 //! P(u, vFirst) and P(u, vLast) is less than
175 //! or equal to gp::Resolution().
176 Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
178 //! Checks if this surface is periodic in the u
179 //! parametric direction. Returns true if:
180 //! - this surface is closed in the u parametric direction, and
181 //! - there is a constant T such that the distance
182 //! between the points P (u, v) and P (u + T,
183 //! v) (or the points P (u, v) and P (u, v +
184 //! T)) is less than or equal to gp::Resolution().
185 //! Note: T is the parametric period in the u parametric direction.
186 Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
188 //! Returns the period of this surface in the u
189 //! parametric direction.
190 //! raises if the surface is not uperiodic.
191 Standard_EXPORT virtual Standard_Real UPeriod() const;
193 //! Checks if this surface is periodic in the v
194 //! parametric direction. Returns true if:
195 //! - this surface is closed in the v parametric direction, and
196 //! - there is a constant T such that the distance
197 //! between the points P (u, v) and P (u + T,
198 //! v) (or the points P (u, v) and P (u, v +
199 //! T)) is less than or equal to gp::Resolution().
200 //! Note: T is the parametric period in the v parametric direction.
201 Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
203 //! Returns the period of this surface in the v parametric direction.
204 //! raises if the surface is not vperiodic.
205 Standard_EXPORT virtual Standard_Real VPeriod() const;
207 //! Computes the U isoparametric curve.
208 Standard_EXPORT virtual Handle(Geom_Curve) UIso (const Standard_Real U) const = 0;
210 //! Computes the V isoparametric curve.
211 Standard_EXPORT virtual Handle(Geom_Curve) VIso (const Standard_Real V) const = 0;
214 //! Returns the Global Continuity of the surface in direction U and V :
215 //! C0 : only geometric continuity,
216 //! C1 : continuity of the first derivative all along the surface,
217 //! C2 : continuity of the second derivative all along the surface,
218 //! C3 : continuity of the third derivative all along the surface,
219 //! G1 : tangency continuity all along the surface,
220 //! G2 : curvature continuity all along the surface,
221 //! CN : the order of continuity is infinite.
223 //! If the surface is C1 in the V parametric direction and C2
224 //! in the U parametric direction Shape = C1.
225 Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0;
227 //! Returns the order of continuity of the surface in the
228 //! U parametric direction.
230 Standard_EXPORT virtual Standard_Boolean IsCNu (const Standard_Integer N) const = 0;
232 //! Returns the order of continuity of the surface in the
233 //! V parametric direction.
235 Standard_EXPORT virtual Standard_Boolean IsCNv (const Standard_Integer N) const = 0;
237 //! Computes the point of parameter U,V on the surface.
239 //! Raised only for an "OffsetSurface" if it is not possible to
240 //! compute the current point.
241 Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const = 0;
244 //! Computes the point P and the first derivatives in the
245 //! directions U and V at this point.
246 //! Raised if the continuity of the surface is not C1.
247 Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const = 0;
250 //! Computes the point P, the first and the second derivatives in
251 //! the directions U and V at this point.
252 //! Raised if the continuity of the surface is not C2.
253 Standard_EXPORT virtual 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 = 0;
256 //! Computes the point P, the first,the second and the third
257 //! derivatives in the directions U and V at this point.
258 //! Raised if the continuity of the surface is not C2.
259 Standard_EXPORT virtual 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 = 0;
262 //! Computes the derivative of order Nu in the direction U and Nv
263 //! in the direction V at the point P(U, V).
265 //! Raised if the continuity of the surface is not CNu in the U
266 //! direction or not CNv in the V direction.
267 //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
268 Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const = 0;
271 //! Computes the point of parameter U on the surface.
273 //! It is implemented with D0
275 //! Raised only for an "OffsetSurface" if it is not possible to
276 //! compute the current point.
277 Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
282 DEFINE_STANDARD_RTTIEXT(Geom_Surface,Geom_Geometry)
302 #endif // _Geom_Surface_HeaderFile