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_SurfaceOfRevolution_HeaderFile
0018 #define _Geom_SurfaceOfRevolution_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <gp_Pnt.hxx>
0024 #include <Geom_SweptSurface.hxx>
0025 #include <GeomEvaluator_SurfaceOfRevolution.hxx>
0026 #include <Standard_Integer.hxx>
0027 class Geom_Curve;
0028 class gp_Ax1;
0029 class gp_Dir;
0030 class gp_Ax2;
0031 class gp_Trsf;
0032 class gp_GTrsf2d;
0033 class gp_Vec;
0034 class Geom_Geometry;
0035 
0036 
0037 class Geom_SurfaceOfRevolution;
0038 DEFINE_STANDARD_HANDLE(Geom_SurfaceOfRevolution, Geom_SweptSurface)
0039 
0040 //! Describes a surface of revolution (revolved surface).
0041 //! Such a surface is obtained by rotating a curve (called
0042 //! the "meridian") through a complete revolution about
0043 //! an axis (referred to as the "axis of revolution"). The
0044 //! curve and the axis must be in the same plane (the
0045 //! "reference plane" of the surface).
0046 //! Rotation around the axis of revolution in the
0047 //! trigonometric sense defines the u parametric
0048 //! direction. So the u parameter is an angle, and its
0049 //! origin is given by the position of the meridian on the surface.
0050 //! The parametric range for the u parameter is: [ 0, 2.*Pi ]
0051 //! The v parameter is that of the meridian.
0052 //! Note: A surface of revolution is built from a copy of the
0053 //! original meridian. As a result the original meridian is
0054 //! not modified when the surface is modified.
0055 //! The form of a surface of revolution is typically a
0056 //! general revolution surface
0057 //! (GeomAbs_RevolutionForm). It can be:
0058 //! - a conical surface, if the meridian is a line or a
0059 //! trimmed line (GeomAbs_ConicalForm),
0060 //! - a cylindrical surface, if the meridian is a line or a
0061 //! trimmed line parallel to the axis of revolution
0062 //! (GeomAbs_CylindricalForm),
0063 //! - a planar surface if the meridian is a line or a
0064 //! trimmed line perpendicular to the axis of revolution
0065 //! of the surface (GeomAbs_PlanarForm),
0066 //! - a toroidal surface, if the meridian is a circle or a
0067 //! trimmed circle (GeomAbs_ToroidalForm), or
0068 //! - a spherical surface, if the meridian is a circle, the
0069 //! center of which is located on the axis of the
0070 //! revolved surface (GeomAbs_SphericalForm).
0071 //! Warning
0072 //! Be careful not to construct a surface of revolution
0073 //! where the curve and the axis or revolution are not
0074 //! defined in the same plane. If you do not have a
0075 //! correct configuration, you can correct your initial
0076 //! curve, using a cylindrical projection in the reference plane.
0077 class Geom_SurfaceOfRevolution : public Geom_SweptSurface
0078 {
0079 
0080 public:
0081 
0082   
0083 
0084   //! C : is the meridian  or the referenced curve.
0085   //! A1 is the axis of revolution.
0086   //! The form of a SurfaceOfRevolution can be :
0087   //! . a general revolution surface (RevolutionForm),
0088   //! . a conical surface if the meridian is a line or a trimmed line
0089   //! (ConicalForm),
0090   //! . a cylindrical surface if the meridian is a line or a trimmed
0091   //! line parallel to the revolution axis (CylindricalForm),
0092   //! . a planar surface if the meridian is a line perpendicular to
0093   //! the revolution axis of the surface (PlanarForm).
0094   //! . a spherical surface,
0095   //! . a toroidal surface,
0096   //! . a quadric surface.
0097   //! Warnings :
0098   //! It is not checked that the curve C is planar and that the
0099   //! surface axis is in the plane of the curve.
0100   //! It is not checked that the revolved curve C doesn't
0101   //! self-intersects.
0102   Standard_EXPORT Geom_SurfaceOfRevolution(const Handle(Geom_Curve)& C, const gp_Ax1& A1);
0103   
0104   //! Changes the axis of revolution.
0105   //! Warnings :
0106   //! It is not checked that the axis is in the plane of the
0107   //! revolved curve.
0108   Standard_EXPORT void SetAxis (const gp_Ax1& A1);
0109   
0110   //! Changes the direction of the revolution axis.
0111   //! Warnings :
0112   //! It is not checked that the axis is in the plane of the
0113   //! revolved curve.
0114   Standard_EXPORT void SetDirection (const gp_Dir& V);
0115   
0116   //! Changes the revolved curve of the surface.
0117   //! Warnings :
0118   //! It is not checked that the curve C is planar and that the
0119   //! surface axis is in the plane of the curve.
0120   //! It is not checked that the revolved curve C doesn't
0121   //! self-intersects.
0122   Standard_EXPORT void SetBasisCurve (const Handle(Geom_Curve)& C);
0123   
0124   //! Changes the location point of the revolution axis.
0125   //! Warnings :
0126   //! It is not checked that the axis is in the plane of the
0127   //! revolved curve.
0128   Standard_EXPORT void SetLocation (const gp_Pnt& P);
0129   
0130   //! Returns the revolution axis of the surface.
0131   Standard_EXPORT gp_Ax1 Axis() const;
0132   
0133 
0134   //! Returns the location point of the axis of revolution.
0135   Standard_EXPORT const gp_Pnt& Location() const;
0136   
0137 
0138   //! Computes the position of the reference plane of the surface
0139   //! defined by the basis curve and the symmetry axis.
0140   //! The location point is the location point of the revolution's
0141   //! axis, the XDirection of the plane is given by the revolution's
0142   //! axis and the orientation of the normal to the plane is given
0143   //! by the sense of revolution.
0144   //!
0145   //! Raised if the revolved curve is not planar or if the revolved
0146   //! curve and the symmetry axis are not in the same plane or if
0147   //! the maximum of distance between the axis and the revolved
0148   //! curve is lower or equal to Resolution from gp.
0149   Standard_EXPORT gp_Ax2 ReferencePlane() const;
0150   
0151   //! Changes the orientation of this surface of revolution
0152   //! in the u  parametric direction. The bounds of the
0153   //! surface are not changed but the given parametric
0154   //! direction is reversed. Hence the orientation of the
0155   //! surface is reversed.
0156   //! As a consequence:
0157   //! - UReverse reverses the direction of the axis of
0158   //! revolution of this surface,
0159   Standard_EXPORT void UReverse() Standard_OVERRIDE;
0160   
0161   //! Computes the u  parameter on the modified
0162   //! surface, when reversing its u  parametric
0163   //! direction, for any point of u parameter U  on this surface of revolution.
0164   //! In the case of a revolved surface:
0165   //! - UReversedParameter returns 2.*Pi - U
0166   Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
0167   
0168   //! Changes the orientation of this surface of revolution
0169   //! in the v parametric direction. The bounds of the
0170   //! surface are not changed but the given parametric
0171   //! direction is reversed. Hence the orientation of the
0172   //! surface is reversed.
0173   //! As a consequence:
0174   //! - VReverse reverses the meridian of this surface of revolution.
0175   Standard_EXPORT void VReverse() Standard_OVERRIDE;
0176   
0177   //! Computes the  v parameter on the modified
0178   //! surface, when reversing its  v parametric
0179   //! direction, for any point of v parameter V on this surface of revolution.
0180   //! In the case of a revolved surface:
0181   //! - VReversedParameter returns the reversed
0182   //! parameter given by the function
0183   //! ReversedParameter called with V on the meridian.
0184   Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
0185   
0186   //! Computes the  parameters on the  transformed  surface for
0187   //! the transform of the point of parameters U,V on <me>.
0188   //! @code
0189   //!   me->Transformed(T)->Value(U',V')
0190   //! @endcode
0191   //! is the same point as
0192   //! @code
0193   //!   me->Value(U,V).Transformed(T)
0194   //! @endcode
0195   //! Where U',V' are the new values of U,V after calling
0196   //! @code
0197   //!   me->TransformParameters(U,V,T)
0198   //! @endcode
0199   //! This method multiplies V by BasisCurve()->ParametricTransformation(T)
0200   Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE;
0201   
0202   //! Returns a 2d transformation  used to find the  new
0203   //! parameters of a point on the transformed surface.
0204   //! @code
0205   //!   me->Transformed(T)->Value(U',V')
0206   //! @endcode
0207   //! is the same point as
0208   //! @code
0209   //!   me->Value(U,V).Transformed(T)
0210   //! @endcode
0211   //! Where U',V' are  obtained by transforming U,V with
0212   //! the 2d transformation returned by
0213   //! @code
0214   //!   me->ParametricTransformation(T)
0215   //! @endcode
0216   //! This  method  returns  a scale  centered  on  the
0217   //! U axis with BasisCurve()->ParametricTransformation(T)
0218   Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
0219   
0220   //! Returns the parametric bounds U1, U2 , V1 and V2 of this surface.
0221   //! A surface of revolution is always complete, so U1 = 0, U2 = 2*PI.
0222   Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
0223   
0224   //! IsUClosed always returns true.
0225   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
0226   
0227   //! IsVClosed returns true if the meridian of this
0228   //! surface of revolution is closed.
0229   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
0230   
0231   //! IsCNu always returns true.
0232   Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE;
0233   
0234   //! IsCNv returns true if the degree of continuity of the
0235   //! meridian of this surface of revolution is at least N.
0236   //! Raised if N < 0.
0237   Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
0238   
0239   //! Returns True.
0240   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
0241   
0242   //! IsVPeriodic returns true if the meridian of this
0243   //! surface of revolution is periodic.
0244   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
0245   
0246   //! Computes the U isoparametric curve of this surface
0247   //! of revolution. It is the curve obtained by rotating the
0248   //! meridian through an angle U about the axis of revolution.
0249   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
0250   
0251   //! Computes the U isoparametric curve of this surface
0252   //! of revolution. It is the curve obtained by rotating the
0253   //! meridian through an angle U about the axis of revolution.
0254   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
0255   
0256   //! Computes the  point P (U, V) on the surface.
0257   //! U is the angle of the rotation around the revolution axis.
0258   //! The direction of this axis gives the sense of rotation.
0259   //! V is the parameter of the revolved curve.
0260   Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
0261 
0262   //! Computes the current point and the first derivatives
0263   //! in the directions U and V.
0264   //! Raised if the continuity of the surface is not C1.
0265   Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
0266 
0267   //! Computes the current point, the first and the second derivatives
0268   //! in the directions U and V.
0269   //! Raised if the continuity of the surface is not C2.
0270   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;
0271 
0272   //! Computes the current point, the first,the second and the third
0273   //! derivatives in the directions U and V.
0274   //! Raised if the continuity of the surface is not C3.
0275   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;
0276 
0277   //! Computes the derivative of order Nu in the direction u and
0278   //! Nv in the direction v.
0279   //!
0280   //! Raised if the continuity of the surface is not CNu in the u
0281   //! direction and CNv in the v direction.
0282   //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
0283   //! The following  functions  evaluates the  local
0284   //! derivatives on surface. Useful to manage discontinuities
0285   //! on the surface.
0286   //! if    Side  =  1  ->  P  =  S( U+,V )
0287   //! if    Side  = -1  ->  P  =  S( U-,V )
0288   //! else  P  is betveen discontinuities
0289   //! can be evaluated using methods  of
0290   //! global evaluations    P  =  S( U ,V )
0291   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
0292 
0293   //! Applies the transformation T to this surface of revolution.
0294   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
0295   
0296   //! Creates a new object which is a copy of this surface of revolution.
0297   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0298 
0299   //! Dumps the content of me into the stream
0300   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0301 
0302 
0303   DEFINE_STANDARD_RTTIEXT(Geom_SurfaceOfRevolution,Geom_SweptSurface)
0304 
0305 private:
0306   Handle(GeomEvaluator_SurfaceOfRevolution) myEvaluator;
0307   gp_Pnt loc;
0308 };
0309 
0310 #endif // _Geom_SurfaceOfRevolution_HeaderFile