Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:37

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