|
|
|||
File indexing completed on 2026-09-20 09:17:34
0001 // Created on: 1993-03-10 0002 // Created by: JCV 0003 // Copyright (c) 1993-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _Geom_Surface_HeaderFile 0018 #define _Geom_Surface_HeaderFile 0019 0020 #include <Geom_Curve.hxx> 0021 #include <Geom_UndefinedDerivative.hxx> 0022 #include <Geom_UndefinedValue.hxx> 0023 0024 class gp_Trsf; 0025 class gp_GTrsf2d; 0026 0027 //! Describes the common behavior of surfaces in 3D space. 0028 //! The Geom package provides many implementations of concrete derived surfaces, 0029 //! such as planes, cylinders, cones, spheres and tori, surfaces of linear extrusion, 0030 //! surfaces of revolution, Bezier and BSpline surfaces, and so on. 0031 //! The key characteristic of these surfaces is that they are parameterized. 0032 //! Geom_Surface demonstrates: 0033 //! - how to work with the parametric equation of a surface 0034 //! to compute the point of parameters (u, v), and, at this point, the 1st, 2nd ... Nth 0035 //! derivative; 0036 //! - how to find global information about a surface in 0037 //! each parametric direction (for example, level of continuity, whether the surface is closed, 0038 //! its periodicity, the bounds of the parameters and so on); 0039 //! - how the parameters change when geometric transformations are applied to the surface, 0040 //! or the orientation is modified. 0041 //! 0042 //! Note that all surfaces must have a geometric continuity, and any surface is at least "C0". 0043 //! Generally, continuity is checked at construction time or when the curve is edited. 0044 //! Where this is not the case, the documentation makes this explicit. 0045 //! 0046 //! Warning 0047 //! The Geom package does not prevent the construction of 0048 //! surfaces with null areas, or surfaces which self-intersect. 0049 class Geom_Surface : public Geom_Geometry 0050 { 0051 0052 public: 0053 //! Result of D1 evaluation: point and partial first derivatives. 0054 struct ResD1 0055 { 0056 gp_Pnt Point; 0057 gp_Vec D1U; 0058 gp_Vec D1V; 0059 }; 0060 0061 //! Result of D2 evaluation: point and partial derivatives up to 2nd order. 0062 struct ResD2 0063 { 0064 gp_Pnt Point; 0065 gp_Vec D1U; 0066 gp_Vec D1V; 0067 gp_Vec D2U; 0068 gp_Vec D2V; 0069 gp_Vec D2UV; 0070 }; 0071 0072 //! Result of D3 evaluation: point and partial derivatives up to 3rd order. 0073 struct ResD3 0074 { 0075 gp_Pnt Point; 0076 gp_Vec D1U; 0077 gp_Vec D1V; 0078 gp_Vec D2U; 0079 gp_Vec D2V; 0080 gp_Vec D2UV; 0081 gp_Vec D3U; 0082 gp_Vec D3V; 0083 gp_Vec D3UUV; 0084 gp_Vec D3UVV; 0085 }; 0086 0087 //! Reverses the U direction of parametrization of <me>. 0088 //! The bounds of the surface are not modified. 0089 Standard_EXPORT virtual void UReverse() = 0; 0090 0091 //! Reverses the U direction of parametrization of <me>. 0092 //! The bounds of the surface are not modified. 0093 //! A copy of <me> is returned. 0094 [[nodiscard]] Standard_EXPORT occ::handle<Geom_Surface> UReversed() const; 0095 0096 //! Returns the parameter on the Ureversed surface for 0097 //! the point of parameter U on <me>. 0098 //! @code 0099 //! me->UReversed()->Value(me->UReversedParameter(U),V) 0100 //! @endcode 0101 //! is the same point as 0102 //! @code 0103 //! me->Value(U,V) 0104 //! @endcode 0105 Standard_EXPORT virtual double UReversedParameter(const double U) const = 0; 0106 0107 //! Reverses the V direction of parametrization of <me>. 0108 //! The bounds of the surface are not modified. 0109 Standard_EXPORT virtual void VReverse() = 0; 0110 0111 //! Reverses the V direction of parametrization of <me>. 0112 //! The bounds of the surface are not modified. 0113 //! A copy of <me> is returned. 0114 [[nodiscard]] Standard_EXPORT occ::handle<Geom_Surface> VReversed() const; 0115 0116 //! Returns the parameter on the Vreversed surface for 0117 //! the point of parameter V on <me>. 0118 //! @code 0119 //! me->VReversed()->Value(U,me->VReversedParameter(V)) 0120 //! @endcode 0121 //! is the same point as 0122 //! @code 0123 //! me->Value(U,V) 0124 //! @endcode 0125 Standard_EXPORT virtual double VReversedParameter(const double V) const = 0; 0126 0127 //! Computes the parameters on the transformed surface for 0128 //! the transform of the point of parameters U,V on <me>. 0129 //! @code 0130 //! me->Transformed(T)->Value(U',V') 0131 //! @endcode 0132 //! is the same point as 0133 //! @code 0134 //! me->Value(U,V).Transformed(T) 0135 //! @endcode 0136 //! Where U',V' are the new values of U,V after calling 0137 //! @code 0138 //! me->TransformParameters(U,V,T) 0139 //! @endcode 0140 //! This method does not change <U> and <V> 0141 //! 0142 //! It can be redefined. For example on the Plane, 0143 //! Cylinder, Cone, Revolved and Extruded surfaces. 0144 Standard_EXPORT virtual void TransformParameters(double& U, double& V, const gp_Trsf& T) const; 0145 0146 //! Returns a 2d transformation used to find the new 0147 //! parameters of a point on the transformed surface. 0148 //! @code 0149 //! me->Transformed(T)->Value(U',V') 0150 //! @endcode 0151 //! is the same point as 0152 //! @code 0153 //! me->Value(U,V).Transformed(T) 0154 //! @endcode 0155 //! Where U',V' are obtained by transforming U,V with 0156 //! the 2d transformation returned by 0157 //! @code 0158 //! me->ParametricTransformation(T) 0159 //! @endcode 0160 //! This method returns an identity transformation 0161 //! 0162 //! It can be redefined. For example on the Plane, 0163 //! Cylinder, Cone, Revolved and Extruded surfaces. 0164 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation(const gp_Trsf& T) const; 0165 0166 //! Returns the parametric bounds U1, U2, V1 and V2 of this surface. 0167 //! If the surface is infinite, this function can return a value 0168 //! equal to Precision::Infinite: instead of double::LastReal. 0169 Standard_EXPORT virtual void Bounds(double& U1, double& U2, double& V1, double& V2) const = 0; 0170 0171 //! Checks whether this surface is closed in the u parametric direction. 0172 //! Returns true if, in the u parametric direction: 0173 //! taking uFirst and uLast as the parametric bounds in 0174 //! the u parametric direction, for each parameter v, 0175 //! the distance between the points P(uFirst, v) and 0176 //! P(uLast, v) is less than or equal to gp::Resolution(). 0177 Standard_EXPORT virtual bool IsUClosed() const = 0; 0178 0179 //! Checks whether this surface is closed in the u parametric direction. 0180 //! Returns true if, in the v parametric direction: 0181 //! taking vFirst and vLast as the parametric bounds in the v parametric direction, 0182 //! for each parameter u, the distance between the points 0183 //! P(u, vFirst) and P(u, vLast) is less than or equal to gp::Resolution(). 0184 Standard_EXPORT virtual bool IsVClosed() const = 0; 0185 0186 //! Checks if this surface is periodic in the u parametric direction. 0187 //! Returns true if: 0188 //! - this surface is closed in the u parametric direction, and 0189 //! - there is a constant T such that the distance 0190 //! between the points P (u, v) and P (u + T, v) 0191 //! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution(). 0192 //! 0193 //! Note: T is the parametric period in the u parametric direction. 0194 Standard_EXPORT virtual bool IsUPeriodic() const = 0; 0195 0196 //! Returns the period of this surface in the u parametric direction. 0197 //! Raises if the surface is not uperiodic. 0198 Standard_EXPORT virtual double UPeriod() const; 0199 0200 //! Checks if this surface is periodic in the v parametric direction. 0201 //! Returns true if: 0202 //! - this surface is closed in the v parametric direction, and 0203 //! - there is a constant T such that the distance 0204 //! between the points P (u, v) and P (u + T, v) 0205 //! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution(). 0206 //! 0207 //! Note: T is the parametric period in the v parametric direction. 0208 Standard_EXPORT virtual bool IsVPeriodic() const = 0; 0209 0210 //! Returns the period of this surface in the v parametric direction. 0211 //! raises if the surface is not vperiodic. 0212 Standard_EXPORT virtual double VPeriod() const; 0213 0214 //! Computes the U isoparametric curve. 0215 Standard_EXPORT virtual occ::handle<Geom_Curve> UIso(const double U) const = 0; 0216 0217 //! Computes the V isoparametric curve. 0218 Standard_EXPORT virtual occ::handle<Geom_Curve> VIso(const double V) const = 0; 0219 0220 //! Returns the Global Continuity of the surface in direction U and V : 0221 //! - C0: only geometric continuity, 0222 //! - C1: continuity of the first derivative all along the surface, 0223 //! - C2: continuity of the second derivative all along the surface, 0224 //! - C3: continuity of the third derivative all along the surface, 0225 //! - G1: tangency continuity all along the surface, 0226 //! - G2: curvature continuity all along the surface, 0227 //! - CN: the order of continuity is infinite. 0228 //! 0229 //! Example: 0230 //! If the surface is C1 in the V parametric direction and C2 0231 //! in the U parametric direction Shape = C1. 0232 Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0; 0233 0234 //! Returns the order of continuity of the surface in the U parametric direction. 0235 //! Raised if N < 0. 0236 Standard_EXPORT virtual bool IsCNu(const int N) const = 0; 0237 0238 //! Returns the order of continuity of the surface in the V parametric direction. 0239 //! Raised if N < 0. 0240 Standard_EXPORT virtual bool IsCNv(const int N) const = 0; 0241 0242 //! Computes the point of parameter (U, V) on the surface. 0243 //! Raises an exception on failure. 0244 [[nodiscard]] Standard_EXPORT virtual gp_Pnt EvalD0(const double U, const double V) const = 0; 0245 0246 //! Computes the point and first partial derivatives at (U, V). 0247 //! Raises an exception if the surface continuity is not C1. 0248 [[nodiscard]] Standard_EXPORT virtual ResD1 EvalD1(const double U, const double V) const = 0; 0249 0250 //! Computes the point and partial derivatives up to 2nd order at (U, V). 0251 //! Raises an exception if the surface continuity is not C2. 0252 [[nodiscard]] Standard_EXPORT virtual ResD2 EvalD2(const double U, const double V) const = 0; 0253 0254 //! Computes the point and partial derivatives up to 3rd order at (U, V). 0255 //! Raises an exception if the surface continuity is not C3. 0256 [[nodiscard]] Standard_EXPORT virtual ResD3 EvalD3(const double U, const double V) const = 0; 0257 0258 //! Computes the derivative of order Nu in U and Nv in V at the point (U, V). 0259 //! Raises an exception on failure. 0260 [[nodiscard]] Standard_EXPORT virtual gp_Vec EvalDN(const double U, 0261 const double V, 0262 const int Nu, 0263 const int Nv) const = 0; 0264 0265 //! Computes the point of parameter (U, V). 0266 inline void D0(const double U, const double V, gp_Pnt& P) const { P = EvalD0(U, V); } 0267 0268 //! Computes the point and first partial derivatives. 0269 inline void D1(const double U, const double V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const 0270 { 0271 const ResD1 aR = EvalD1(U, V); 0272 P = aR.Point; 0273 D1U = aR.D1U; 0274 D1V = aR.D1V; 0275 } 0276 0277 //! Computes the point and partial derivatives up to 2nd order. 0278 inline void D2(const double U, 0279 const double V, 0280 gp_Pnt& P, 0281 gp_Vec& D1U, 0282 gp_Vec& D1V, 0283 gp_Vec& D2U, 0284 gp_Vec& D2V, 0285 gp_Vec& D2UV) const 0286 { 0287 const ResD2 aR = EvalD2(U, V); 0288 P = aR.Point; 0289 D1U = aR.D1U; 0290 D1V = aR.D1V; 0291 D2U = aR.D2U; 0292 D2V = aR.D2V; 0293 D2UV = aR.D2UV; 0294 } 0295 0296 //! Computes the point and partial derivatives up to 3rd order. 0297 inline void D3(const double U, 0298 const double V, 0299 gp_Pnt& P, 0300 gp_Vec& D1U, 0301 gp_Vec& D1V, 0302 gp_Vec& D2U, 0303 gp_Vec& D2V, 0304 gp_Vec& D2UV, 0305 gp_Vec& D3U, 0306 gp_Vec& D3V, 0307 gp_Vec& D3UUV, 0308 gp_Vec& D3UVV) const 0309 { 0310 const ResD3 aR = EvalD3(U, V); 0311 P = aR.Point; 0312 D1U = aR.D1U; 0313 D1V = aR.D1V; 0314 D2U = aR.D2U; 0315 D2V = aR.D2V; 0316 D2UV = aR.D2UV; 0317 D3U = aR.D3U; 0318 D3V = aR.D3V; 0319 D3UUV = aR.D3UUV; 0320 D3UVV = aR.D3UVV; 0321 } 0322 0323 //! Computes the derivative of order Nu in U and Nv in V. 0324 inline gp_Vec DN(const double U, const double V, const int Nu, const int Nv) const 0325 { 0326 return EvalDN(U, V, Nu, Nv); 0327 } 0328 0329 //! Computes the point of parameter (U, V) on the surface. 0330 gp_Pnt Value(const double U, const double V) const { return EvalD0(U, V); } 0331 0332 //! Dumps the content of me into the stream 0333 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override; 0334 0335 DEFINE_STANDARD_RTTIEXT(Geom_Surface, Geom_Geometry) 0336 }; 0337 0338 #endif // _Geom_Surface_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|