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_ConicalSurface_HeaderFile
0018 #define _Geom_ConicalSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom_ElementarySurface.hxx>
0024 #include <Standard_Integer.hxx>
0025 class gp_Ax3;
0026 class gp_Cone;
0027 class gp_Trsf;
0028 class gp_GTrsf2d;
0029 class gp_Pnt;
0030 class Geom_Curve;
0031 class gp_Vec;
0032 class Geom_Geometry;
0033 
0034 
0035 class Geom_ConicalSurface;
0036 DEFINE_STANDARD_HANDLE(Geom_ConicalSurface, Geom_ElementarySurface)
0037 
0038 //! Describes a cone.
0039 //! A cone is defined by the half-angle (can be negative) at its apex, and
0040 //! is positioned in space by a coordinate system (a
0041 //! gp_Ax3 object) and a reference radius as follows:
0042 //! - The "main Axis" of the coordinate system is the
0043 //! axis of revolution of the cone.
0044 //! - The plane defined by the origin, the "X Direction"
0045 //! and the "Y Direction" of the coordinate system is
0046 //! the reference plane of the cone. The intersection
0047 //! of the cone with this reference plane is a circle of
0048 //! radius equal to the reference radius.
0049 //! - The apex of the cone is on the negative side of
0050 //! the "main Axis" of the coordinate system if the
0051 //! half-angle is positive, and on the positive side if
0052 //! the half-angle is negative.
0053 //! This coordinate system is the "local coordinate
0054 //! system" of the cone. The following apply:
0055 //! - Rotation around its "main Axis", in the
0056 //! trigonometric sense given by the "X Direction"
0057 //! and the "Y Direction", defines the u parametric direction.
0058 //! - Its "X Axis" gives the origin for the u parameter.
0059 //! - Its "main Direction" is the v parametric direction of the cone.
0060 //! - Its origin is the origin of the v parameter.
0061 //! The parametric range of the two parameters is:
0062 //! @code
0063 //!  - [ 0, 2.*Pi ] for u, and
0064 //!  - ] -infinity, +infinity [ for v
0065 //! @endcode
0066 //! The parametric equation of the cone is:
0067 //! @code
0068 //! P(u, v) = O + (R + v*sin(Ang)) * (cos(u)*XDir + sin(u)*YDir) + v*cos(Ang)*ZDir
0069 //! @endcode
0070 //! where:
0071 //! - O, XDir, YDir and ZDir are respectively
0072 //! the origin, the "X Direction", the "Y Direction" and
0073 //! the "Z Direction" of the cone's local coordinate system,
0074 //! - Ang is the half-angle at the apex of the cone,   and
0075 //! - R is the reference radius.
0076 class Geom_ConicalSurface : public Geom_ElementarySurface
0077 {
0078 
0079 public:
0080 
0081   
0082 
0083   //! A3 defines the local coordinate system of the conical surface.
0084   //! Ang is the conical surface semi-angle. Its absolute value is in range
0085   //! ]0, PI/2[.
0086   //! Radius is the radius of the circle Viso in the placement plane
0087   //! of the conical surface defined with "XAxis" and "YAxis".
0088   //! The "ZDirection" of A3 defines the direction of the surface's
0089   //! axis of symmetry.
0090   //! If the location point of A3 is the apex of the surface
0091   //! Radius = 0 .
0092   //! At the creation the parametrization of the surface is defined
0093   //! such that the normal Vector (N = D1U ^ D1V) is oriented towards
0094   //! the "outside region" of the surface.
0095   //!
0096   //! Raised if Radius < 0.0 or Abs(Ang) < Resolution from gp or
0097   //! Abs(Ang) >= PI/2 - Resolution
0098   Standard_EXPORT Geom_ConicalSurface(const gp_Ax3& A3, const Standard_Real Ang, const Standard_Real Radius);
0099   
0100 
0101   //! Creates a ConicalSurface from a non transient gp_Cone.
0102   Standard_EXPORT Geom_ConicalSurface(const gp_Cone& C);
0103 
0104   //! Set <me> so that <me> has the same geometric properties as C.
0105   Standard_EXPORT void SetCone (const gp_Cone& C);
0106 
0107   //! Changes the radius of the conical surface in the placement plane (Z = 0, V = 0).
0108   //! The local coordinate system is not modified.
0109   //! Raised if R < 0.0
0110   Standard_EXPORT void SetRadius (const Standard_Real R);
0111 
0112   //! Changes the semi angle of the conical surface.
0113   //! Semi-angle can be negative. Its absolute value
0114   //! Abs(Ang) is in range ]0,PI/2[.
0115   //! Raises ConstructionError if Abs(Ang) < Resolution from gp or
0116   //! Abs(Ang) >= PI/2 - Resolution
0117   Standard_EXPORT void SetSemiAngle(const Standard_Real Ang);
0118 
0119   //! Returns a non transient cone with the same geometric properties as <me>.
0120   Standard_EXPORT gp_Cone Cone() const;
0121 
0122   //! Eeturn 2.PI - U.
0123   Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
0124 
0125   //! Computes the u (or v) parameter on the modified surface,
0126   //! when reversing its u (or v) parametric direction,
0127   //! for any point of u parameter U (or of v parameter V) on this cone.
0128   //! In the case of a cone, these functions return respectively:
0129   //! - 2.*Pi - U, -V.
0130   Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
0131   
0132   //! Changes the orientation of this cone in the v parametric direction.
0133   //! The bounds of the surface are not changed but the v parametric direction is reversed.
0134   //! As a consequence, for a cone:
0135   //! - the "main Direction" of the local coordinate system
0136   //! is reversed, and
0137   //! - the half-angle at the apex is inverted.
0138   Standard_EXPORT virtual void VReverse() Standard_OVERRIDE;
0139 
0140   //! Computes the parameters on the transformed surface for
0141   //! the transform of the point of parameters U,V on <me>.
0142   //! @code
0143   //!   me->Transformed(T)->Value(U',V')
0144   //! @endcode
0145   //! is the same point as
0146   //! @code
0147   //!   me->Value(U,V).Transformed(T)
0148   //! @endcode
0149   //! Where U',V' are the new values of U,V after calling
0150   //! @code
0151   //!   me->TransformParameters(U,V,T)
0152   //! @endcode
0153   //! This method multiplies V by T.ScaleFactor()
0154   Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE;
0155 
0156   //! Returns a 2d transformation used to find the new
0157   //! parameters of a point on the transformed surface.
0158   //! @code
0159   //!   me->Transformed(T)->Value(U',V')
0160   //! @endcode
0161   //! is the same point as
0162   //! @code
0163   //!   me->Value(U,V).Transformed(T)
0164   //! @endcode
0165   //! Where U',V' are obtained by transforming U,V with the 2d transformation returned by
0166   //! @code
0167   //!   me->ParametricTransformation(T)
0168   //! @endcode
0169   //! This method returns a scale centered on the U axis with T.ScaleFactor
0170   Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
0171 
0172   //! Computes the apex of this cone. It is on the negative
0173   //! side of the axis of revolution of this cone if the
0174   //! half-angle at the apex is positive, and on the positive
0175   //! side of the "main Axis" if the half-angle is negative.
0176   Standard_EXPORT gp_Pnt Apex() const;
0177 
0178   //! The conical surface is infinite in the V direction so
0179   //! V1 = Realfirst from Standard and V2 = RealLast.
0180   //! U1 = 0 and U2 = 2*PI.
0181   Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
0182 
0183   //! Returns the coefficients of the implicit equation of the
0184   //! quadric in the absolute cartesian coordinate system :
0185   //! These coefficients are normalized.
0186   //! @code
0187   //!   A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) + 2.(C1.X + C2.Y + C3.Z) + D = 0.0
0188   //! @endcode
0189   Standard_EXPORT void Coefficients (Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const;
0190 
0191   //! Returns the reference radius of this cone.
0192   //! The reference radius is the radius of the circle formed
0193   //! by the intersection of this cone and its reference
0194   //! plane (i.e. the plane defined by the origin, "X
0195   //! Direction" and "Y Direction" of the local coordinate
0196   //! system of this cone).
0197   //! If the apex of this cone is on the origin of the local
0198   //! coordinate system of this cone, the returned value is 0.
0199   Standard_EXPORT Standard_Real RefRadius() const;
0200 
0201   //! Returns the semi-angle at the apex of this cone.
0202   //! Attention! Semi-angle can be negative.
0203   Standard_EXPORT Standard_Real SemiAngle() const;
0204 
0205   //! returns True.
0206   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
0207 
0208   //! returns False.
0209   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
0210 
0211   //! Returns True.
0212   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
0213 
0214   //! Returns False.
0215   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
0216 
0217   //! Builds the U isoparametric line of this cone.
0218   //! The origin of this line is on the reference plane of this cone
0219   //! (i.e. the plane defined by the origin, "X Direction"
0220   //! and "Y Direction" of the local coordinate system of this cone).
0221   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
0222 
0223   //! Builds the V isoparametric circle of this cone.
0224   //! It is the circle on this cone, located in the plane of Z
0225   //! coordinate V*cos(Semi-Angle) in the local coordinate system of this cone.
0226   //! The "Axis" of this circle is the axis of revolution of this cone.
0227   //! Its starting point is defined by the "X Direction" of this cone.
0228   //! Warning
0229   //! If the V isoparametric circle is close to the apex of
0230   //! this cone, the radius of the circle becomes very small.
0231   //! It is possible to have a circle with radius equal to 0.0.
0232   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
0233 
0234   //! Computes the point P (U, V) on the surface.
0235   //! @code
0236   //!   P (U, V) = Loc +
0237   //!              (RefRadius + V * sin (Semi-Angle)) * (cos (U) * XDir + sin (U) * YDir) +
0238   //!              V * cos (Semi-Angle) * ZDir
0239   //! @endcode
0240   //! where Loc is the origin of the placement plane (XAxis, YAxis)
0241   //! XDir is the direction of the XAxis and YDir the direction of the YAxis.
0242   Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
0243 
0244   //! Computes the current point and the first derivatives in the directions U and V.
0245   Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
0246 
0247   //! Computes the current point, the first and the second derivatives in the directions U and V.
0248   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;
0249 
0250   //! Computes the current point, the first,the second and the third
0251   //! derivatives in the directions U and V.
0252   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;
0253 
0254   //! Computes the derivative of order Nu in the u
0255   //! parametric direction, and Nv in the v parametric
0256   //! direction at the point of parameters (U, V) of this cone.
0257   //! Exceptions
0258   //! Standard_RangeError if:
0259   //! - Nu + Nv is less than 1,
0260   //! - Nu or Nv is negative.
0261   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
0262 
0263   //! Applies the transformation T to this cone.
0264   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
0265 
0266   //! Creates a new object which is a copy of this cone.
0267   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0268   //! Dumps the content of me into the stream
0269   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0270 
0271   DEFINE_STANDARD_RTTIEXT(Geom_ConicalSurface,Geom_ElementarySurface)
0272 
0273 private:
0274 
0275   Standard_Real radius;
0276   Standard_Real semiAngle;
0277 
0278 };
0279 
0280 #endif // _Geom_ConicalSurface_HeaderFile