Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-04 08:45:20

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_SurfaceOfLinearExtrusion_HeaderFile
0018 #define _Geom_SurfaceOfLinearExtrusion_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom_SweptSurface.hxx>
0024 #include <GeomEvaluator_SurfaceOfExtrusion.hxx>
0025 #include <Standard_Integer.hxx>
0026 class Geom_Curve;
0027 class gp_Dir;
0028 class gp_Pnt;
0029 class gp_Vec;
0030 class gp_Trsf;
0031 class gp_GTrsf2d;
0032 class Geom_Geometry;
0033 
0034 class Geom_SurfaceOfLinearExtrusion;
0035 DEFINE_STANDARD_HANDLE(Geom_SurfaceOfLinearExtrusion, Geom_SweptSurface)
0036 
0037 //! Describes a surface of linear extrusion ("extruded
0038 //! surface"), e.g. a generalized cylinder. Such a surface
0039 //! is obtained by sweeping a curve (called the "extruded
0040 //! curve" or "basis") in a given direction (referred to as
0041 //! the "direction of extrusion" and defined by a unit vector).
0042 //! The u parameter is along the extruded curve. The v
0043 //! parameter is along the direction of extrusion.
0044 //! The parameter range for the u parameter is defined
0045 //! by the reference curve.
0046 //! The parameter range for the v parameter is ] -
0047 //! infinity, + infinity [.
0048 //! The position of the curve gives the origin of the v parameter.
0049 //! The surface is "CN" in the v parametric direction.
0050 //! The form of a surface of linear extrusion is generally a
0051 //! ruled surface (GeomAbs_RuledForm). It can be:
0052 //! - a cylindrical surface, if the extruded curve is a circle,
0053 //! or a trimmed circle, with an axis parallel to the
0054 //! direction of extrusion (GeomAbs_CylindricalForm), or
0055 //! - a planar surface, if the extruded curve is a line
0056 //! (GeomAbs_PlanarForm).
0057 //! Note: The surface of extrusion is built from a copy of
0058 //! the original basis curve, so the original curve is not
0059 //! modified when the surface is modified.
0060 //! Warning
0061 //! Degenerate surfaces are not detected. A degenerate
0062 //! surface is obtained, for example, when the extruded
0063 //! curve is a line and the direction of extrusion is parallel
0064 //! to that line.
0065 class Geom_SurfaceOfLinearExtrusion : public Geom_SweptSurface
0066 {
0067 
0068 public:
0069   //! V is the direction of extrusion.
0070   //! C is the extruded curve.
0071   //! The form of a SurfaceOfLinearExtrusion can be :
0072   //! . ruled surface (RuledForm),
0073   //! . a cylindrical surface if the extruded curve is a circle or
0074   //! a trimmed circle (CylindricalForm),
0075   //! . a plane surface if the extruded curve is a Line (PlanarForm).
0076   //! Warnings :
0077   //! Degenerated surface cases are not detected. For example if the
0078   //! curve C is a line and V is parallel to the direction of this
0079   //! line.
0080   Standard_EXPORT Geom_SurfaceOfLinearExtrusion(const Handle(Geom_Curve)& C, const gp_Dir& V);
0081 
0082   //! Assigns V as the "direction of extrusion" for this
0083   //! surface of linear extrusion.
0084   Standard_EXPORT void SetDirection(const gp_Dir& V);
0085 
0086   //! Modifies this surface of linear extrusion by redefining
0087   //! its "basis curve" (the "extruded curve").
0088   Standard_EXPORT void SetBasisCurve(const Handle(Geom_Curve)& C);
0089 
0090   //! Changes the orientation of this surface of linear
0091   //! extrusion in the u  parametric direction. The
0092   //! bounds of the surface are not changed, but the given
0093   //! parametric direction is reversed. Hence the
0094   //! orientation of the surface is reversed.
0095   //! In the case of a surface of linear extrusion:
0096   //! - UReverse reverses the basis curve, and
0097   //! - VReverse reverses the direction of linear extrusion.
0098   Standard_EXPORT void UReverse() Standard_OVERRIDE;
0099 
0100   //! Computes the u parameter on the modified
0101   //! surface, produced by reversing its u  parametric
0102   //! direction, for any point of u parameter U  on this surface of linear extrusion.
0103   //! In the case of an extruded surface:
0104   //! - UReverseParameter returns the reversed
0105   //! parameter given by the function
0106   //! ReversedParameter called with U on the basis   curve,
0107   Standard_EXPORT Standard_Real UReversedParameter(const Standard_Real U) const Standard_OVERRIDE;
0108 
0109   //! Changes the orientation of this surface of linear
0110   //! extrusion in the v parametric direction. The
0111   //! bounds of the surface are not changed, but the given
0112   //! parametric direction is reversed. Hence the
0113   //! orientation of the surface is reversed.
0114   //! In the case of a surface of linear extrusion:
0115   //! - UReverse reverses the basis curve, and
0116   //! - VReverse reverses the direction of linear extrusion.
0117   Standard_EXPORT void VReverse() Standard_OVERRIDE;
0118 
0119   //! Computes the v parameter on the modified
0120   //! surface, produced by reversing its u v parametric
0121   //! direction, for any point of v parameter V on this surface of linear extrusion.
0122   //! In the case of an extruded surface VReverse returns -V.
0123   Standard_EXPORT Standard_Real VReversedParameter(const Standard_Real V) const Standard_OVERRIDE;
0124 
0125   //! Returns the parametric bounds U1, U2, V1 and V2 of
0126   //! this surface of linear extrusion.
0127   //! A surface of linear extrusion is infinite in the v
0128   //! parametric direction, so:
0129   //! - V1 = Standard_Real::RealFirst()
0130   //! - V2 = Standard_Real::RealLast().
0131   Standard_EXPORT void Bounds(Standard_Real& U1,
0132                               Standard_Real& U2,
0133                               Standard_Real& V1,
0134                               Standard_Real& V2) const Standard_OVERRIDE;
0135 
0136   //! IsUClosed returns true if the "basis curve" of this
0137   //! surface of linear extrusion is closed.
0138   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
0139 
0140   //! IsVClosed always returns false.
0141   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
0142 
0143   //! IsCNu returns true if the degree of continuity for the
0144   //! "basis curve" of this surface of linear extrusion is at least N.
0145   //! Raises RangeError if N < 0.
0146   Standard_EXPORT Standard_Boolean IsCNu(const Standard_Integer N) const Standard_OVERRIDE;
0147 
0148   //! IsCNv always returns true.
0149   Standard_EXPORT Standard_Boolean IsCNv(const Standard_Integer N) const Standard_OVERRIDE;
0150 
0151   //! IsUPeriodic returns true if the "basis curve" of this
0152   //! surface of linear extrusion is periodic.
0153   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
0154 
0155   //! IsVPeriodic always returns false.
0156   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
0157 
0158   //! Computes the U isoparametric curve of this surface
0159   //! of linear extrusion. This is the line parallel to the
0160   //! direction of extrusion, passing through the point of
0161   //! parameter U of the basis curve.
0162   Standard_EXPORT Handle(Geom_Curve) UIso(const Standard_Real U) const Standard_OVERRIDE;
0163 
0164   //! Computes the V isoparametric curve of this surface
0165   //! of linear extrusion. This curve is obtained by
0166   //! translating the extruded curve in the direction of
0167   //! extrusion, with the magnitude V.
0168   Standard_EXPORT Handle(Geom_Curve) VIso(const Standard_Real V) const Standard_OVERRIDE;
0169 
0170   //! Computes the  point P (U, V) on the surface.
0171   //! The parameter U is the parameter on the extruded curve.
0172   //! The parametrization V is a linear parametrization, and
0173   //! the direction of parametrization is the direction of
0174   //! extrusion. If the point is on the extruded curve, V = 0.0
0175   Standard_EXPORT void D0(const Standard_Real U,
0176                           const Standard_Real V,
0177                           gp_Pnt&             P) const Standard_OVERRIDE;
0178 
0179   //! Computes the current point and the first derivatives in the
0180   //! directions U and V.
0181   //! Raises UndefinedDerivative if the continuity of the surface is not C1.
0182   Standard_EXPORT void D1(const Standard_Real U,
0183                           const Standard_Real V,
0184                           gp_Pnt&             P,
0185                           gp_Vec&             D1U,
0186                           gp_Vec&             D1V) const Standard_OVERRIDE;
0187 
0188   //! --- Purpose ;
0189   //! Computes the current point, the first and the second derivatives
0190   //! in the directions U and V.
0191   //! Raises UndefinedDerivative if the continuity of the surface is not C2.
0192   Standard_EXPORT void D2(const Standard_Real U,
0193                           const Standard_Real V,
0194                           gp_Pnt&             P,
0195                           gp_Vec&             D1U,
0196                           gp_Vec&             D1V,
0197                           gp_Vec&             D2U,
0198                           gp_Vec&             D2V,
0199                           gp_Vec&             D2UV) const Standard_OVERRIDE;
0200 
0201   //! Computes the current point, the first,the second and the third
0202   //! derivatives in the directions U and V.
0203   //! Raises UndefinedDerivative if the continuity of the surface is not C3.
0204   Standard_EXPORT void D3(const Standard_Real U,
0205                           const Standard_Real V,
0206                           gp_Pnt&             P,
0207                           gp_Vec&             D1U,
0208                           gp_Vec&             D1V,
0209                           gp_Vec&             D2U,
0210                           gp_Vec&             D2V,
0211                           gp_Vec&             D2UV,
0212                           gp_Vec&             D3U,
0213                           gp_Vec&             D3V,
0214                           gp_Vec&             D3UUV,
0215                           gp_Vec&             D3UVV) const Standard_OVERRIDE;
0216 
0217   //! Computes the derivative of order Nu in the direction u
0218   //! and Nv in the direction v.
0219   //! Raises UndefinedDerivative if the continuity of the surface is not CNu in the u
0220   //! direction and CNv in the v direction.
0221   //! Raises RangeError if Nu + Nv < 1 or Nu < 0 or Nv < 0.
0222   Standard_EXPORT gp_Vec DN(const Standard_Real    U,
0223                             const Standard_Real    V,
0224                             const Standard_Integer Nu,
0225                             const Standard_Integer Nv) const Standard_OVERRIDE;
0226 
0227   //! Applies the transformation T to this surface of linear extrusion.
0228   Standard_EXPORT void Transform(const gp_Trsf& T) Standard_OVERRIDE;
0229 
0230   //! Computes the  parameters on the  transformed  surface for
0231   //! the transform of the point of parameters U,V on <me>.
0232   //! @code
0233   //!   me->Transformed(T)->Value(U',V')
0234   //! @endcode
0235   //! is the same point as
0236   //! @code
0237   //!   me->Value(U,V).Transformed(T)
0238   //! @endcode
0239   //! Where U',V' are the new values of U,V after calling
0240   //! @code
0241   //!   me->TransformParameters(U,V,T)
0242   //! @endcode
0243   //! This method multiplies:
0244   //! U by BasisCurve()->ParametricTransformation(T)
0245   //! V by T.ScaleFactor()
0246   Standard_EXPORT virtual void TransformParameters(Standard_Real& U,
0247                                                    Standard_Real& V,
0248                                                    const gp_Trsf& T) const Standard_OVERRIDE;
0249 
0250   //! Returns a 2d transformation  used to find the  new
0251   //! parameters of a point on the transformed surface.
0252   //! @code
0253   //!   me->Transformed(T)->Value(U',V')
0254   //! @endcode
0255   //! is the same point as
0256   //! @code
0257   //!   me->Value(U,V).Transformed(T)
0258   //! @endcode
0259   //! Where U',V' are  obtained by transforming U,V with
0260   //! the 2d transformation returned by
0261   //! @code
0262   //!   me->ParametricTransformation(T)
0263   //! @endcode
0264   //! This method returns a scale
0265   //! U by BasisCurve()->ParametricTransformation(T)
0266   //! V by T.ScaleFactor()
0267   Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation(const gp_Trsf& T) const
0268     Standard_OVERRIDE;
0269 
0270   //! Creates a new object which is a copy of this surface of linear extrusion.
0271   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0272 
0273   //! Dumps the content of me into the stream
0274   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0275                                         Standard_Integer  theDepth = -1) const Standard_OVERRIDE;
0276 
0277   DEFINE_STANDARD_RTTIEXT(Geom_SurfaceOfLinearExtrusion, Geom_SweptSurface)
0278 
0279 protected:
0280 private:
0281   Handle(GeomEvaluator_SurfaceOfExtrusion) myEvaluator;
0282 };
0283 
0284 #endif // _Geom_SurfaceOfLinearExtrusion_HeaderFile