42cf5bc1 |
1 | // Created on: 1993-03-10 |
2 | // Created by: JCV |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Geom_Surface_HeaderFile |
18 | #define _Geom_Surface_HeaderFile |
19 | |
5b111128 |
20 | #include <Geom_Curve.hxx> |
2724a0b3 |
21 | |
42cf5bc1 |
22 | class gp_Trsf; |
23 | class gp_GTrsf2d; |
42cf5bc1 |
24 | class gp_Pnt; |
25 | class gp_Vec; |
26 | |
42cf5bc1 |
27 | class Geom_Surface; |
28 | DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry) |
29 | |
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. |
53 | //! Warning |
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 |
57 | { |
58 | |
59 | public: |
60 | |
61 | |
62 | |
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; |
66 | |
67 | |
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. |
6ed44b1c |
71 | Standard_NODISCARD Standard_EXPORT Handle(Geom_Surface) UReversed() const; |
42cf5bc1 |
72 | |
73 | //! Returns the parameter on the Ureversed surface for |
74 | //! the point of parameter U on <me>. |
75 | //! |
76 | //! me->UReversed()->Value(me->UReversedParameter(U),V) |
77 | //! |
78 | //! is the same point as |
79 | //! |
80 | //! me->Value(U,V) |
81 | Standard_EXPORT virtual Standard_Real UReversedParameter (const Standard_Real U) const = 0; |
82 | |
83 | |
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; |
87 | |
88 | |
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. |
6ed44b1c |
92 | Standard_NODISCARD Standard_EXPORT Handle(Geom_Surface) VReversed() const; |
42cf5bc1 |
93 | |
94 | //! Returns the parameter on the Vreversed surface for |
95 | //! the point of parameter V on <me>. |
96 | //! |
97 | //! me->VReversed()->Value(U,me->VReversedParameter(V)) |
98 | //! |
99 | //! is the same point as |
100 | //! |
101 | //! me->Value(U,V) |
102 | Standard_EXPORT virtual Standard_Real VReversedParameter (const Standard_Real V) const = 0; |
103 | |
104 | //! Computes the parameters on the transformed surface for |
105 | //! the transform of the point of parameters U,V on <me>. |
106 | //! |
107 | //! me->Transformed(T)->Value(U',V') |
108 | //! |
109 | //! is the same point as |
110 | //! |
111 | //! me->Value(U,V).Transformed(T) |
112 | //! |
113 | //! Where U',V' are the new values of U,V after calling |
114 | //! |
115 | //! me->TranformParameters(U,V,T) |
116 | //! |
117 | //! This methods does not change <U> and <V> |
118 | //! |
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; |
122 | |
123 | //! Returns a 2d transformation used to find the new |
124 | //! parameters of a point on the transformed surface. |
125 | //! |
126 | //! me->Transformed(T)->Value(U',V') |
127 | //! |
128 | //! is the same point as |
129 | //! |
130 | //! me->Value(U,V).Transformed(T) |
131 | //! |
132 | //! Where U',V' are obtained by transforming U,V with |
133 | //! th 2d transformation returned by |
134 | //! |
135 | //! me->ParametricTransformation(T) |
136 | //! |
137 | //! This methods returns an identity transformation |
138 | //! |
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; |
142 | |
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; |
147 | |
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; |
156 | |
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; |
166 | |
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; |
176 | |
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; |
181 | |
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; |
191 | |
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; |
195 | |
196 | //! Computes the U isoparametric curve. |
197 | Standard_EXPORT virtual Handle(Geom_Curve) UIso (const Standard_Real U) const = 0; |
198 | |
199 | //! Computes the V isoparametric curve. |
200 | Standard_EXPORT virtual Handle(Geom_Curve) VIso (const Standard_Real V) const = 0; |
201 | |
202 | |
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. |
211 | //! Example : |
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; |
215 | |
216 | //! Returns the order of continuity of the surface in the |
217 | //! U parametric direction. |
218 | //! Raised if N < 0. |
219 | Standard_EXPORT virtual Standard_Boolean IsCNu (const Standard_Integer N) const = 0; |
220 | |
221 | //! Returns the order of continuity of the surface in the |
222 | //! V parametric direction. |
223 | //! Raised if N < 0. |
224 | Standard_EXPORT virtual Standard_Boolean IsCNv (const Standard_Integer N) const = 0; |
225 | |
226 | //! Computes the point of parameter U,V on the surface. |
227 | //! |
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; |
231 | |
232 | |
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; |
237 | |
238 | |
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; |
243 | |
244 | |
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; |
249 | |
250 | //! ---Purpose ; |
251 | //! Computes the derivative of order Nu in the direction U and Nv |
252 | //! in the direction V at the point P(U, V). |
253 | //! |
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; |
258 | |
259 | |
260 | //! Computes the point of parameter U on the surface. |
261 | //! |
262 | //! It is implemented with D0 |
263 | //! |
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; |
267 | |
bc73b006 |
268 | //! Dumps the content of me into the stream |
269 | Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; |
270 | |
42cf5bc1 |
271 | |
272 | |
273 | |
92efcf78 |
274 | DEFINE_STANDARD_RTTIEXT(Geom_Surface,Geom_Geometry) |
42cf5bc1 |
275 | |
276 | protected: |
277 | |
278 | |
279 | |
280 | |
281 | private: |
282 | |
283 | |
284 | |
285 | |
286 | }; |
287 | |
288 | |
289 | |
290 | |
291 | |
292 | |
293 | |
294 | #endif // _Geom_Surface_HeaderFile |