Back to home page

EIC code displayed by LXR

 
 

    


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_RectangularTrimmedSurface_HeaderFile
0018 #define _Geom_RectangularTrimmedSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom_BoundedSurface.hxx>
0024 #include <GeomAbs_Shape.hxx>
0025 #include <Standard_Integer.hxx>
0026 class Geom_Surface;
0027 class Geom_Curve;
0028 class gp_Pnt;
0029 class gp_Vec;
0030 class gp_Trsf;
0031 class gp_GTrsf2d;
0032 class Geom_Geometry;
0033 
0034 
0035 class Geom_RectangularTrimmedSurface;
0036 DEFINE_STANDARD_HANDLE(Geom_RectangularTrimmedSurface, Geom_BoundedSurface)
0037 
0038 //! Describes a portion of a surface (a patch) limited
0039 //! by two values of the u parameter in the u
0040 //! parametric direction, and two values of the v
0041 //! parameter in the v parametric direction. The
0042 //! domain of the trimmed surface must be within the
0043 //! domain of the surface being trimmed.
0044 //! The trimmed surface is defined by:
0045 //! - the basis surface, and
0046 //! - the values (umin, umax) and (vmin, vmax)
0047 //! which limit it in the u and v parametric directions.
0048 //! The trimmed surface is built from a copy of the basis
0049 //! surface. Therefore, when the basis surface is
0050 //! modified the trimmed surface is not changed.
0051 //! Consequently, the trimmed surface does not
0052 //! necessarily have the same orientation as the basis surface.
0053 //! Warning:  The  case of surface   being trimmed is  periodic and
0054 //! parametrics values are outside the domain is possible.
0055 //! But, domain of the  trimmed surface can be translated
0056 //! by (n X) the period.
0057 class Geom_RectangularTrimmedSurface : public Geom_BoundedSurface
0058 {
0059 
0060 public:
0061 
0062   //! The U parametric direction of the surface is oriented from U1
0063   //! to U2. The V parametric direction of the surface is oriented
0064   //! from V1 to V2.
0065   //! These two directions define the orientation of the surface
0066   //! (normal). If the surface is not periodic USense and VSense are
0067   //! not used for the construction. If the surface S is periodic in
0068   //! one direction USense and VSense give the available part of the
0069   //! surface. By default in this case the surface has the same
0070   //! orientation as the basis surface S.
0071   //! The returned surface is not closed and not periodic.
0072   //! ConstructionError   Raised if
0073   //! S is not periodic in the UDirection and U1 or U2 are out of the
0074   //! bounds of S.
0075   //! S is not periodic in the VDirection and V1 or V2 are out of the
0076   //! bounds of S.
0077   //! U1 = U2 or V1 = V2
0078   Standard_EXPORT Geom_RectangularTrimmedSurface(const Handle(Geom_Surface)& S, const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Boolean USense = Standard_True, const Standard_Boolean VSense = Standard_True);
0079 
0080   //! The basis surface S is only trim in one parametric direction.
0081   //! If UTrim = True the surface is trimmed in the U parametric
0082   //! direction else the surface is trimmed in the V parametric
0083   //! direction.
0084   //! In the considered parametric direction the resulting surface is
0085   //! oriented from Param1 to Param2. If S is periodic Sense gives the
0086   //! available part of the surface. By default the trimmed surface has
0087   //! the same orientation as the basis surface S in the considered
0088   //! parametric direction (Sense = True).
0089   //! If the basis surface S is closed or periodic in the parametric
0090   //! direction opposite to the trimming direction the trimmed surface
0091   //! has the same characteristics as the surface S in this direction.
0092   //! Warnings :
0093   //! In this package the entities are not shared.
0094   //! The RectangularTrimmedSurface is built with a copy of the
0095   //! surface S. So when S is modified the RectangularTrimmedSurface
0096   //! is not modified
0097   //! Raised if
0098   //! S is not periodic in the considered parametric direction and
0099   //! Param1 or Param2 are out of the bounds of S.
0100   //! Param1 = Param2
0101   Standard_EXPORT Geom_RectangularTrimmedSurface(const Handle(Geom_Surface)& S, const Standard_Real Param1, const Standard_Real Param2, const Standard_Boolean UTrim, const Standard_Boolean Sense = Standard_True);
0102 
0103   //! Modifies this patch by changing the trim values
0104   //! applied to the original surface
0105   //! The u parametric direction of
0106   //! this patch is oriented from U1 to U2. The v
0107   //! parametric direction of this patch is oriented
0108   //! from V1 to V2. USense and VSense are used
0109   //! for the construction only if the surface is periodic
0110   //! in the corresponding parametric direction, and
0111   //! define the available part of the surface; by default
0112   //! in this case, this patch has the same orientation
0113   //! as the basis surface.
0114   //! Raised if
0115   //! The BasisSurface is not periodic in the UDirection and U1 or U2
0116   //! are out of the bounds of the BasisSurface.
0117   //! The BasisSurface is not periodic in the VDirection and V1 or V2
0118   //! are out of the bounds of the BasisSurface.
0119   //! U1 = U2 or V1 = V2
0120   Standard_EXPORT void SetTrim (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Boolean USense = Standard_True, const Standard_Boolean VSense = Standard_True);
0121 
0122   //! Modifies this patch by changing the trim values
0123   //! applied to the original surface
0124   //! The basis surface is trimmed only in one parametric direction: if UTrim
0125   //! is true, the surface is trimmed in the u parametric
0126   //! direction; if it is false, it is trimmed in the v
0127   //! parametric direction. In the "trimmed" direction,
0128   //! this patch is oriented from Param1 to Param2. If
0129   //! the basis surface is periodic in the "trimmed"
0130   //! direction, Sense defines its available part. By
0131   //! default in this case, this patch has the same
0132   //! orientation as the basis surface in this parametric
0133   //! direction. If the basis surface is closed or periodic
0134   //! in the other parametric direction (i.e. not the
0135   //! "trimmed" direction), this patch has the same
0136   //! characteristics as the basis surface in that parametric direction.
0137   //! Raised if
0138   //! The BasisSurface is not periodic in the considered direction and
0139   //! Param1 or Param2 are out of the bounds of the BasisSurface.
0140   //! Param1 = Param2
0141   Standard_EXPORT void SetTrim (const Standard_Real Param1, const Standard_Real Param2, const Standard_Boolean UTrim, const Standard_Boolean Sense = Standard_True);
0142 
0143   //! Returns the Basis surface of <me>.
0144   Standard_EXPORT Handle(Geom_Surface) BasisSurface() const;
0145 
0146   //! Changes the orientation of this patch in the u
0147   //! parametric direction. The bounds of the surface are
0148   //! not changed, but the given parametric direction is
0149   //! reversed. Hence the orientation of the surface is reversed.
0150   Standard_EXPORT void UReverse() Standard_OVERRIDE;
0151 
0152   //! Computes the u  parameter on the modified
0153   //! surface, produced by when reversing its u
0154   //! parametric direction, for any point of u parameter U on this patch.
0155   Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
0156 
0157   //! Changes the orientation of this patch in the v
0158   //! parametric direction. The bounds of the surface are
0159   //! not changed, but the given parametric direction is
0160   //! reversed. Hence the orientation of the surface is reversed.
0161   Standard_EXPORT void VReverse() Standard_OVERRIDE;
0162 
0163   //! Computes the v  parameter on the modified
0164   //! surface, produced by when reversing its v
0165   //! parametric direction, for any point of v parameter V on this patch.
0166   Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
0167 
0168   //! Returns the parametric bounds U1, U2, V1 and V2 of this patch.
0169   Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
0170 
0171   //! Returns  the continuity of the surface :
0172   //! C0 : only geometric continuity,
0173   //! C1 : continuity of the first derivative all along the Surface,
0174   //! C2 : continuity of the second derivative all along the Surface,
0175   //! C3 : continuity of the third derivative all along the Surface,
0176   //! CN : the order of continuity is infinite.
0177   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
0178 
0179   //! Returns true if this patch is closed in the given parametric direction.
0180   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
0181 
0182   //! Returns true if this patch is closed in the given parametric direction.
0183   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
0184 
0185   //! Returns true if the order of derivation in the U parametric
0186   //! direction is N.
0187   //! Raised if N < 0.
0188   Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE;
0189 
0190   //! Returns true if the order of derivation in the V parametric
0191   //! direction is N.
0192   //! Raised if N < 0.
0193   Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
0194 
0195   //! Returns true if this patch is periodic and not trimmed in the given
0196   //! parametric direction.
0197   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
0198 
0199   //! Returns the period of this patch in the u
0200   //! parametric direction.
0201   //! raises if the surface is not uperiodic.
0202   Standard_EXPORT virtual Standard_Real UPeriod() const Standard_OVERRIDE;
0203 
0204   //! Returns true if this patch is periodic and not trimmed in the given
0205   //! parametric direction.
0206   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
0207 
0208   //! Returns the period of this patch in the v
0209   //! parametric direction.
0210   //! raises if the surface is not vperiodic.
0211   //! value and derivatives
0212   Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE;
0213 
0214   //! computes the U isoparametric curve.
0215   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
0216 
0217   //! Computes the V isoparametric curve.
0218   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
0219 
0220   //! Can be raised if the basis surface is an OffsetSurface.
0221   Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
0222 
0223   //! The returned derivatives have the same orientation as the
0224   //! derivatives of the basis surface even if the trimmed surface
0225   //! has not the same parametric orientation.
0226   //! Warning!  UndefinedDerivative  raised if the continuity of the surface is not C1.
0227   Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
0228 
0229   //! The returned derivatives have the same orientation as the
0230   //! derivatives of the basis surface even if the trimmed surface
0231   //! has not the same parametric orientation.
0232   //! Warning! UndefinedDerivative raised if the continuity of the surface is not C2.
0233   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;
0234 
0235   //! The returned derivatives have the same orientation as the
0236   //! derivatives of the basis surface even if the trimmed surface
0237   //! has not the same parametric orientation.
0238   //! Warning UndefinedDerivative raised if the continuity of the surface is not C3.
0239   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;
0240 
0241   //! The returned derivative has the same orientation as the
0242   //! derivative of the basis surface even if the trimmed surface
0243   //! has not the same parametric orientation.
0244   //! Warning!  UndefinedDerivative raised if the continuity of the surface is not CNu in the U
0245   //! parametric direction and CNv in the V parametric direction.
0246   //! RangeError Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
0247   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
0248 
0249   //! Applies the transformation T to this patch.
0250   //! Warning
0251   //! As a consequence, the basis surface included in the
0252   //! data structure of this patch is also modified.
0253   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
0254 
0255   //! Computes the  parameters on the  transformed  surface for
0256   //! the transform of the point of parameters U,V on <me>.
0257   //! @code
0258   //!   me->Transformed(T)->Value(U',V')
0259   //! @endcode
0260   //! is the same point as
0261   //! @code
0262   //!   me->Value(U,V).Transformed(T)
0263   //! @endcode
0264   //! Where U',V' are the new values of U,V after calling
0265   //! @code
0266   //!   me->TransformParameters(U,V,T)
0267   //! @endcode
0268   //! This method calls the basis surface method.
0269   Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE;
0270 
0271   //! Returns a 2d transformation  used to find the  new
0272   //! parameters of a point on the transformed surface.
0273   //! @code
0274   //!   me->Transformed(T)->Value(U',V')
0275   //! @endcode
0276   //! is the same point as
0277   //! @code
0278   //!   me->Value(U,V).Transformed(T)
0279   //! @endcode
0280   //! Where U',V' are  obtained by transforming U,V with
0281   //! the 2d transformation returned by
0282   //! @code
0283   //!   me->ParametricTransformation(T)
0284   //! @endcode
0285   //! This method calls the basis surface method.
0286   Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
0287 
0288   //! Creates a new object which is a copy of this patch.
0289   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0290 
0291   //! Dumps the content of me into the stream
0292   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0293 
0294   DEFINE_STANDARD_RTTIEXT(Geom_RectangularTrimmedSurface,Geom_BoundedSurface)
0295 
0296 private:
0297 
0298   //! General set trim,  to implement constructors and
0299   //! others set trim.
0300   Standard_EXPORT void SetTrim (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Boolean UTrim, const Standard_Boolean VTrim, const Standard_Boolean USense, const Standard_Boolean VSense);
0301 
0302   Handle(Geom_Surface) basisSurf;
0303   Standard_Real utrim1;
0304   Standard_Real vtrim1;
0305   Standard_Real utrim2;
0306   Standard_Real vtrim2;
0307   Standard_Boolean isutrimmed;
0308   Standard_Boolean isvtrimmed;
0309 
0310 };
0311 
0312 #endif // _Geom_RectangularTrimmedSurface_HeaderFile