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 <Geom_Curve.hxx>
28 DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry)
30 //! Describes the common behavior of surfaces in 3D
31 //! space. The Geom package provides many
32 //! implementations of concrete derived surfaces, such as
33 //! planes, cylinders, cones, spheres and tori, surfaces of
34 //! linear extrusion, surfaces of revolution, Bezier and
35 //! BSpline surfaces, and so on.
36 //! The key characteristic of these surfaces is that they
37 //! are parameterized. Geom_Surface demonstrates:
38 //! - how to work with the parametric equation of a
39 //! surface to compute the point of parameters (u,
40 //! v), and, at this point, the 1st, 2nd ... Nth derivative,
41 //! - how to find global information about a surface in
42 //! each parametric direction (for example, level of
43 //! continuity, whether the surface is closed, its
44 //! periodicity, the bounds of the parameters and so on), and
45 //! - how the parameters change when geometric
46 //! transformations are applied to the surface, or the
47 //! orientation is modified.
48 //! Note that all surfaces must have a geometric
49 //! continuity, and any surface is at least "C0". Generally,
50 //! continuity is checked at construction time or when the
51 //! curve is edited. Where this is not the case, the
52 //! documentation makes this explicit.
54 //! The Geom package does not prevent the construction of
55 //! surfaces with null areas, or surfaces which self-intersect.
56 class Geom_Surface : public Geom_Geometry
63 //! Reverses the U direction of parametrization of <me>.
64 //! The bounds of the surface are not modified.
65 Standard_EXPORT virtual void UReverse() = 0;
68 //! Reverses the U direction of parametrization of <me>.
69 //! The bounds of the surface are not modified.
70 //! A copy of <me> is returned.
71 Standard_EXPORT Standard_NODISCARD Handle(Geom_Surface) UReversed() const;
73 //! Returns the parameter on the Ureversed surface for
74 //! the point of parameter U on <me>.
76 //! me->UReversed()->Value(me->UReversedParameter(U),V)
78 //! is the same point as
81 Standard_EXPORT virtual Standard_Real UReversedParameter (const Standard_Real U) const = 0;
84 //! Reverses the V direction of parametrization of <me>.
85 //! The bounds of the surface are not modified.
86 Standard_EXPORT virtual void VReverse() = 0;
89 //! Reverses the V direction of parametrization of <me>.
90 //! The bounds of the surface are not modified.
91 //! A copy of <me> is returned.
92 Standard_EXPORT Standard_NODISCARD Handle(Geom_Surface) VReversed() const;
94 //! Returns the parameter on the Vreversed surface for
95 //! the point of parameter V on <me>.
97 //! me->VReversed()->Value(U,me->VReversedParameter(V))
99 //! is the same point as
102 Standard_EXPORT virtual Standard_Real VReversedParameter (const Standard_Real V) const = 0;
104 //! Computes the parameters on the transformed surface for
105 //! the transform of the point of parameters U,V on <me>.
107 //! me->Transformed(T)->Value(U',V')
109 //! is the same point as
111 //! me->Value(U,V).Transformed(T)
113 //! Where U',V' are the new values of U,V after calling
115 //! me->TranformParameters(U,V,T)
117 //! This methods does not change <U> and <V>
119 //! It can be redefined. For example on the Plane,
120 //! Cylinder, Cone, Revolved and Extruded surfaces.
121 Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const;
123 //! Returns a 2d transformation used to find the new
124 //! parameters of a point on the transformed surface.
126 //! me->Transformed(T)->Value(U',V')
128 //! is the same point as
130 //! me->Value(U,V).Transformed(T)
132 //! Where U',V' are obtained by transforming U,V with
133 //! th 2d transformation returned by
135 //! me->ParametricTransformation(T)
137 //! This methods returns an identity transformation
139 //! It can be redefined. For example on the Plane,
140 //! Cylinder, Cone, Revolved and Extruded surfaces.
141 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const;
143 //! Returns the parametric bounds U1, U2, V1 and V2 of this surface.
144 //! If the surface is infinite, this function can return a value
145 //! equal to Precision::Infinite: instead of Standard_Real::LastReal.
146 Standard_EXPORT virtual void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const = 0;
148 //! Checks whether this surface is closed in the u
149 //! parametric direction.
150 //! Returns true if, in the u parametric direction: taking
151 //! uFirst and uLast as the parametric bounds in
152 //! the u parametric direction, for each parameter v, the
153 //! distance between the points P(uFirst, v) and
154 //! P(uLast, v) is less than or equal to gp::Resolution().
155 Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
157 //! Checks whether this surface is closed in the u
158 //! parametric direction.
159 //! Returns true if, in the v parametric
160 //! direction: taking vFirst and vLast as the
161 //! parametric bounds in the v parametric direction, for
162 //! each parameter u, the distance between the points
163 //! P(u, vFirst) and P(u, vLast) is less than
164 //! or equal to gp::Resolution().
165 Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
167 //! Checks if this surface is periodic in the u
168 //! parametric direction. Returns true if:
169 //! - this surface is closed in the u parametric direction, and
170 //! - there is a constant T such that the distance
171 //! between the points P (u, v) and P (u + T,
172 //! v) (or the points P (u, v) and P (u, v +
173 //! T)) is less than or equal to gp::Resolution().
174 //! Note: T is the parametric period in the u parametric direction.
175 Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
177 //! Returns the period of this surface in the u
178 //! parametric direction.
179 //! raises if the surface is not uperiodic.
180 Standard_EXPORT virtual Standard_Real UPeriod() const;
182 //! Checks if this surface is periodic in the v
183 //! parametric direction. Returns true if:
184 //! - this surface is closed in the v parametric direction, and
185 //! - there is a constant T such that the distance
186 //! between the points P (u, v) and P (u + T,
187 //! v) (or the points P (u, v) and P (u, v +
188 //! T)) is less than or equal to gp::Resolution().
189 //! Note: T is the parametric period in the v parametric direction.
190 Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
192 //! Returns the period of this surface in the v parametric direction.
193 //! raises if the surface is not vperiodic.
194 Standard_EXPORT virtual Standard_Real VPeriod() const;
196 //! Computes the U isoparametric curve.
197 Standard_EXPORT virtual Handle(Geom_Curve) UIso (const Standard_Real U) const = 0;
199 //! Computes the V isoparametric curve.
200 Standard_EXPORT virtual Handle(Geom_Curve) VIso (const Standard_Real V) const = 0;
203 //! Returns the Global Continuity of the surface in direction U and V :
204 //! C0 : only geometric continuity,
205 //! C1 : continuity of the first derivative all along the surface,
206 //! C2 : continuity of the second derivative all along the surface,
207 //! C3 : continuity of the third derivative all along the surface,
208 //! G1 : tangency continuity all along the surface,
209 //! G2 : curvature continuity all along the surface,
210 //! CN : the order of continuity is infinite.
212 //! If the surface is C1 in the V parametric direction and C2
213 //! in the U parametric direction Shape = C1.
214 Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0;
216 //! Returns the order of continuity of the surface in the
217 //! U parametric direction.
219 Standard_EXPORT virtual Standard_Boolean IsCNu (const Standard_Integer N) const = 0;
221 //! Returns the order of continuity of the surface in the
222 //! V parametric direction.
224 Standard_EXPORT virtual Standard_Boolean IsCNv (const Standard_Integer N) const = 0;
226 //! Computes the point of parameter U,V on the surface.
228 //! Raised only for an "OffsetSurface" if it is not possible to
229 //! compute the current point.
230 Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const = 0;
233 //! Computes the point P and the first derivatives in the
234 //! directions U and V at this point.
235 //! Raised if the continuity of the surface is not C1.
236 Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const = 0;
239 //! Computes the point P, the first and the second derivatives in
240 //! the directions U and V at this point.
241 //! Raised if the continuity of the surface is not C2.
242 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;
245 //! Computes the point P, the first,the second and the third
246 //! derivatives in the directions U and V at this point.
247 //! Raised if the continuity of the surface is not C2.
248 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;
251 //! Computes the derivative of order Nu in the direction U and Nv
252 //! in the direction V at the point P(U, V).
254 //! Raised if the continuity of the surface is not CNu in the U
255 //! direction or not CNv in the V direction.
256 //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
257 Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const = 0;
260 //! Computes the point of parameter U on the surface.
262 //! It is implemented with D0
264 //! Raised only for an "OffsetSurface" if it is not possible to
265 //! compute the current point.
266 Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
271 DEFINE_STANDARD_RTTIEXT(Geom_Surface,Geom_Geometry)
291 #endif // _Geom_Surface_HeaderFile