Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-31 09:35:44

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