|
||||
File indexing completed on 2025-01-18 10:03:36
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_OffsetSurface_HeaderFile 0018 #define _Geom_OffsetSurface_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <GeomAbs_Shape.hxx> 0024 #include <Geom_Surface.hxx> 0025 #include <Standard_Integer.hxx> 0026 #include <GeomEvaluator_OffsetSurface.hxx> 0027 class Geom_Curve; 0028 class gp_Pnt; 0029 class gp_Vec; 0030 class Geom_BSplineSurface; 0031 class gp_Trsf; 0032 class gp_GTrsf2d; 0033 class Geom_Geometry; 0034 0035 0036 class Geom_OffsetSurface; 0037 DEFINE_STANDARD_HANDLE(Geom_OffsetSurface, Geom_Surface) 0038 0039 //! Describes an offset surface in 3D space. 0040 //! An offset surface is defined by: 0041 //! - the basis surface to which it is parallel, and 0042 //! - the distance between the offset surface and its basis surface. 0043 //! A point on the offset surface is built by measuring the 0044 //! offset value along the normal vector at a point on the 0045 //! basis surface. This normal vector is given by the cross 0046 //! product D1u^D1v, where D1u and D1v are the 0047 //! vectors tangential to the basis surface in the u and v 0048 //! parametric directions at this point. The side of the 0049 //! basis surface on which the offset is measured 0050 //! depends on the sign of the offset value. 0051 //! A Geom_OffsetSurface surface can be 0052 //! self-intersecting, even if the basis surface does not 0053 //! self-intersect. The self-intersecting portions are not 0054 //! deleted at the time of construction. 0055 //! Warning 0056 //! There must be only one normal vector defined at any 0057 //! point on the basis surface. This must be verified by the 0058 //! user as no check is made at the time of construction 0059 //! to detect points with multiple possible normal 0060 //! directions (for example, the top of a conical surface). 0061 class Geom_OffsetSurface : public Geom_Surface 0062 { 0063 0064 public: 0065 0066 //! Constructs a surface offset from the basis surface 0067 //! S, where Offset is the distance between the offset 0068 //! surface and the basis surface at any point. 0069 //! A point on the offset surface is built by measuring 0070 //! the offset value along a normal vector at a point on 0071 //! S. This normal vector is given by the cross product 0072 //! D1u^D1v, where D1u and D1v are the vectors 0073 //! tangential to the basis surface in the u and v 0074 //! parametric directions at this point. The side of S on 0075 //! which the offset value is measured is indicated by 0076 //! this normal vector if Offset is positive, or is the 0077 //! inverse sense if Offset is negative. 0078 //! If isNotCheckC0 = TRUE checking if basis surface has C0-continuity 0079 //! is not made. 0080 //! Warnings : 0081 //! - The offset surface is built with a copy of the 0082 //! surface S. Therefore, when S is modified the 0083 //! offset surface is not modified. 0084 //! - No check is made at the time of construction to 0085 //! detect points on S with multiple possible normal directions. 0086 //! Raised if S is not at least C1. 0087 //! Warnings : 0088 //! No check is done to verify that a unique normal direction is 0089 //! defined at any point of the basis surface S. 0090 Standard_EXPORT Geom_OffsetSurface(const Handle(Geom_Surface)& S, const Standard_Real Offset, const Standard_Boolean isNotCheckC0 = Standard_False); 0091 0092 //! Raised if S is not at least C1. 0093 //! Warnings : 0094 //! No check is done to verify that a unique normal direction is 0095 //! defined at any point of the basis surface S. 0096 //! If isNotCheckC0 = TRUE checking if basis surface has C0-continuity 0097 //! is not made. 0098 //! Exceptions 0099 //! Standard_ConstructionError if the surface S is not 0100 //! at least "C1" continuous. 0101 Standard_EXPORT void SetBasisSurface (const Handle(Geom_Surface)& S, const Standard_Boolean isNotCheckC0 = Standard_False); 0102 0103 //! Changes this offset surface by assigning D as the offset value. 0104 Standard_EXPORT void SetOffsetValue (const Standard_Real D); 0105 0106 //! Returns the offset value of this offset surface. 0107 inline Standard_Real Offset() const 0108 { return offsetValue; } 0109 0110 //! Returns the basis surface of this offset surface. 0111 //! Note: The basis surface can be an offset surface. 0112 inline const Handle(Geom_Surface) & BasisSurface() const 0113 { return basisSurf; } 0114 0115 //! Returns osculating surface if base surface is B-spline or Bezier 0116 inline const Handle(Geom_OsculatingSurface)& OsculatingSurface() const 0117 { return myOscSurf; } 0118 0119 //! Changes the orientation of this offset surface in the u 0120 //! parametric direction. The bounds of the surface 0121 //! are not changed but the given parametric direction is reversed. 0122 Standard_EXPORT void UReverse() Standard_OVERRIDE; 0123 0124 //! Computes the u parameter on the modified 0125 //! surface, produced by reversing the u 0126 //! parametric direction of this offset surface, for any 0127 //! point of u parameter U on this offset surface. 0128 Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE; 0129 0130 //! Changes the orientation of this offset surface in the v parametric direction. The bounds of the surface 0131 //! are not changed but the given parametric direction is reversed. 0132 Standard_EXPORT void VReverse() Standard_OVERRIDE; 0133 0134 //! Computes the v parameter on the modified 0135 //! surface, produced by reversing the or v 0136 //! parametric direction of this offset surface, for any 0137 //! point of v parameter V on this offset surface. 0138 Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE; 0139 0140 //! Returns the parametric bounds U1, U2, V1 and V2 of 0141 //! this offset surface. 0142 //! If the surface is infinite, this function can return: 0143 //! - Standard_Real::RealFirst(), or 0144 //! - Standard_Real::RealLast(). 0145 Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE; 0146 0147 //! This method returns the continuity of the basis surface - 1. 0148 //! Continuity of the Offset surface : 0149 //! C0 : only geometric continuity, 0150 //! C1 : continuity of the first derivative all along the Surface, 0151 //! C2 : continuity of the second derivative all along the Surface, 0152 //! C3 : continuity of the third derivative all along the Surface, 0153 //! CN : the order of continuity is infinite. 0154 //! Example : 0155 //! If the basis surface is C2 in the V direction and C3 in the U 0156 //! direction Shape = C1. 0157 //! Warnings : 0158 //! If the basis surface has a unique normal direction defined at 0159 //! any point this method gives the continuity of the offset 0160 //! surface otherwise the effective continuity can be lower than 0161 //! the continuity of the basis surface - 1. 0162 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; 0163 0164 //! This method answer True if the continuity of the basis surface 0165 //! is N + 1 in the U parametric direction. We suppose in this 0166 //! class that a unique normal is defined at any point on the basis 0167 //! surface. 0168 //! Raised if N <0. 0169 Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE; 0170 0171 //! This method answer True if the continuity of the basis surface 0172 //! is N + 1 in the V parametric direction. We suppose in this 0173 //! class that a unique normal is defined at any point on the basis 0174 //! surface. 0175 //! Raised if N <0. 0176 Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE; 0177 0178 //! Checks whether this offset surface is closed in the u 0179 //! parametric direction. 0180 //! Returns true if, taking uFirst and uLast as 0181 //! the parametric bounds in the u parametric direction, 0182 //! the distance between the points P(uFirst,v) 0183 //! and P(uLast,v) is less than or equal to 0184 //! gp::Resolution() for each value of the parameter v. 0185 Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE; 0186 0187 //! Checks whether this offset surface is closed in the u 0188 //! or v parametric direction. Returns true if taking vFirst and vLast as the 0189 //! parametric bounds in the v parametric direction, the 0190 //! distance between the points P(u,vFirst) and 0191 //! P(u,vLast) is less than or equal to 0192 //! gp::Resolution() for each value of the parameter u. 0193 Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; 0194 0195 //! Returns true if this offset surface is periodic in the u 0196 //! parametric direction, i.e. if the basis 0197 //! surface of this offset surface is periodic in this direction. 0198 Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; 0199 0200 //! Returns the period of this offset surface in the u 0201 //! parametric direction respectively, i.e. the period of the 0202 //! basis surface of this offset surface in this parametric direction. 0203 //! raises if the surface is not uperiodic. 0204 Standard_EXPORT virtual Standard_Real UPeriod() const Standard_OVERRIDE; 0205 0206 //! Returns true if this offset surface is periodic in the v 0207 //! parametric direction, i.e. if the basis 0208 //! surface of this offset surface is periodic in this direction. 0209 Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; 0210 0211 //! Returns the period of this offset surface in the v 0212 //! parametric direction respectively, i.e. the period of the 0213 //! basis surface of this offset surface in this parametric direction. 0214 //! raises if the surface is not vperiodic. 0215 Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE; 0216 0217 //! Computes the U isoparametric curve. 0218 Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE; 0219 0220 //! Computes the V isoparametric curve. 0221 //! 0222 //! The following methods compute value and derivatives. 0223 //! 0224 //! Warnings 0225 //! An exception is raised if a unique normal vector is 0226 //! not defined on the basis surface for the parametric value (U,V). 0227 //! No check is done at the creation time and we suppose 0228 //! in this package that the offset surface can be defined at any point. 0229 Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE; 0230 0231 //! @code 0232 //! P (U, V) = Pbasis + Offset * Ndir 0233 //! @endcode 0234 //! where 0235 //! @code 0236 //! Ndir = D1Ubasis ^ D1Vbasis / ||D1Ubasis ^ D1Vbasis|| 0237 //! @endcode 0238 //! is the normal direction of the basis surface. 0239 //! Pbasis, D1Ubasis, D1Vbasis are the point and the first derivatives on the basis surface. 0240 //! If Ndir is undefined this method computes an approached normal 0241 //! direction using the following limited development: 0242 //! @code 0243 //! Ndir = N0 + DNdir/DU + DNdir/DV + Eps 0244 //! @endcode 0245 //! with Eps->0 which requires to compute the second derivatives on the basis surface. 0246 //! If the normal direction cannot be approximate for this order 0247 //! of derivation the exception UndefinedValue is raised. 0248 //! 0249 //! Raised if the continuity of the basis surface is not C1. 0250 //! Raised if the order of derivation required to compute the 0251 //! normal direction is greater than the second order. 0252 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE; 0253 0254 //! Raised if the continuity of the basis surface is not C2. 0255 Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE; 0256 0257 //! Raised if the continuity of the basis surface is not C3. 0258 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; 0259 0260 //! Raised if the continuity of the basis surface is not C4. 0261 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; 0262 0263 //! Computes the derivative of order Nu in the direction u and Nv in the direction v. 0264 //! 0265 //! Raised if the continuity of the basis surface is not CNu + 1 0266 //! in the U direction and CNv + 1 in the V direction. 0267 //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. 0268 //! 0269 //! The following methods compute the value and derivatives 0270 //! on the offset surface and returns the derivatives on the 0271 //! basis surface too. 0272 //! The computation of the value and derivatives on the basis 0273 //! surface are used to evaluate the offset surface. 0274 //! 0275 //! Warnings: 0276 //! The exception UndefinedValue or UndefinedDerivative is 0277 //! raised if it is not possible to compute a unique offset direction. 0278 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE; 0279 0280 //! Applies the transformation T to this offset surface. 0281 //! Note: the basis surface is also modified. 0282 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; 0283 0284 //! Computes the parameters on the transformed surface for 0285 //! the transform of the point of parameters U,V on <me>. 0286 //! @code 0287 //! me->Transformed(T)->Value(U',V') 0288 //! @endcode 0289 //! is the same point as 0290 //! @code 0291 //! me->Value(U,V).Transformed(T) 0292 //! @endcode 0293 //! Where U',V' are the new values of U,V after calling 0294 //! @code 0295 //! me->TransformParameters(U,V,T) 0296 //! @endcode 0297 //! This method calls the basis surface method. 0298 Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE; 0299 0300 //! Returns a 2d transformation used to find the new 0301 //! parameters of a point on the transformed surface. 0302 //! @code 0303 //! me->Transformed(T)->Value(U',V') 0304 //! @endcode 0305 //! is the same point as 0306 //! @code 0307 //! me->Value(U,V).Transformed(T) 0308 //! @endcode 0309 //! Where U',V' are obtained by transforming U,V with the 2d transformation returned by 0310 //! @code 0311 //! me->ParametricTransformation(T) 0312 //! @endcode 0313 //! This method calls the basis surface method. 0314 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE; 0315 0316 //! Creates a new object which is a copy of this offset surface. 0317 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; 0318 0319 //! returns an equivalent surface of the offset surface 0320 //! when the basis surface is a canonic surface or a 0321 //! rectangular limited surface on canonic surface or if 0322 //! the offset is null. 0323 Standard_EXPORT Handle(Geom_Surface) Surface() const; 0324 0325 //! if Standard_True, L is the local osculating surface 0326 //! along U at the point U,V. It means that DL/DU is 0327 //! collinear to DS/DU . If IsOpposite == Standard_True 0328 //! these vectors have opposite direction. 0329 Standard_EXPORT Standard_Boolean UOsculatingSurface (const Standard_Real U, const Standard_Real V, Standard_Boolean& IsOpposite, Handle(Geom_BSplineSurface)& UOsculSurf) const; 0330 0331 //! if Standard_True, L is the local osculating surface 0332 //! along V at the point U,V. 0333 //! It means that DL/DV is 0334 //! collinear to DS/DV . If IsOpposite == Standard_True 0335 //! these vectors have opposite direction. 0336 Standard_EXPORT Standard_Boolean VOsculatingSurface (const Standard_Real U, const Standard_Real V, Standard_Boolean& IsOpposite, Handle(Geom_BSplineSurface)& VOsculSurf) const; 0337 0338 //! Returns continuity of the basis surface. 0339 inline GeomAbs_Shape GetBasisSurfContinuity() const 0340 { return myBasisSurfContinuity; } 0341 0342 //! Dumps the content of me into the stream 0343 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; 0344 0345 DEFINE_STANDARD_RTTIEXT(Geom_OffsetSurface,Geom_Surface) 0346 0347 private: 0348 0349 Handle(Geom_Surface) basisSurf; 0350 Handle(Geom_Surface) equivSurf; 0351 Standard_Real offsetValue; 0352 Handle(Geom_OsculatingSurface) myOscSurf; 0353 GeomAbs_Shape myBasisSurfContinuity; 0354 Handle(GeomEvaluator_OffsetSurface) myEvaluator; 0355 }; 0356 0357 #endif // _Geom_OffsetSurface_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |