Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:20:02

0001 // Copyright (c) 2025 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _Geom2dEval_LogarithmicSpiralCurve_HeaderFile
0015 #define _Geom2dEval_LogarithmicSpiralCurve_HeaderFile
0016 
0017 #include <Geom2d_Curve.hxx>
0018 #include <gp_Ax2d.hxx>
0019 
0020 class gp_Trsf2d;
0021 class Geom2d_Geometry;
0022 
0023 //! Describes a 2D logarithmic (equiangular) spiral curve.
0024 //! The polar equation is r = a*exp(b*t).
0025 //!
0026 //! The parametric equation is:
0027 //! @code
0028 //!   C(t) = O + a*exp(b*t)*cos(t)*XDir + a*exp(b*t)*sin(t)*YDir
0029 //! @endcode
0030 //! where:
0031 //! - O, XDir are from the local coordinate system,
0032 //! - YDir is the perpendicular to XDir,
0033 //! - a is the scale factor (> 0),
0034 //! - b is the growth exponent (> 0).
0035 //!
0036 //! The parameter range is (-inf, +inf).
0037 //! The angle between tangent and radial direction is constant = atan(1/b).
0038 class Geom2dEval_LogarithmicSpiralCurve : public Geom2d_Curve
0039 {
0040 public:
0041   //! Creates a logarithmic spiral.
0042   //! @param[in] thePosition the local coordinate system
0043   //! @param[in] theScale the scale factor (must be > 0)
0044   //! @param[in] theGrowthExponent the growth exponent (must be > 0)
0045   //! @throw Standard_ConstructionError if theScale <= 0 or theGrowthExponent <= 0
0046   Standard_EXPORT Geom2dEval_LogarithmicSpiralCurve(const gp_Ax2d& thePosition,
0047                                                     double         theScale,
0048                                                     double         theGrowthExponent);
0049 
0050   //! Returns the local coordinate system.
0051   Standard_EXPORT const gp_Ax2d& Position() const;
0052 
0053   //! Returns the scale factor.
0054   Standard_EXPORT double Scale() const;
0055 
0056   //! Returns the growth exponent.
0057   Standard_EXPORT double GrowthExponent() const;
0058 
0059   //! Reversal is not supported for this eval curve.
0060   //! @throw Standard_NotImplemented
0061   Standard_EXPORT void Reverse() final;
0062 
0063   //! Reversal is not supported for this eval curve.
0064   //! @throw Standard_NotImplemented
0065   Standard_EXPORT double ReversedParameter(const double U) const final;
0066 
0067   //! Returns -Precision::Infinite().
0068   Standard_EXPORT double FirstParameter() const final;
0069 
0070   //! Returns Precision::Infinite().
0071   Standard_EXPORT double LastParameter() const final;
0072 
0073   //! Returns false.
0074   Standard_EXPORT bool IsClosed() const final;
0075 
0076   //! Returns false.
0077   Standard_EXPORT bool IsPeriodic() const final;
0078 
0079   //! Returns GeomAbs_CN.
0080   Standard_EXPORT GeomAbs_Shape Continuity() const final;
0081 
0082   //! Returns true for any N >= 0.
0083   Standard_EXPORT bool IsCN(const int N) const final;
0084 
0085   //! Computes the point at parameter U.
0086   Standard_EXPORT gp_Pnt2d EvalD0(const double U) const final;
0087 
0088   //! Computes the point and first derivative at parameter U.
0089   Standard_EXPORT Geom2d_Curve::ResD1 EvalD1(const double U) const final;
0090 
0091   //! Computes the point and first two derivatives at parameter U.
0092   Standard_EXPORT Geom2d_Curve::ResD2 EvalD2(const double U) const final;
0093 
0094   //! Computes the point and first three derivatives at parameter U.
0095   Standard_EXPORT Geom2d_Curve::ResD3 EvalD3(const double U) const final;
0096 
0097   //! Computes the N-th derivative at parameter U.
0098   //! @throw Standard_RangeError if N < 1
0099   Standard_EXPORT gp_Vec2d EvalDN(const double U, const int N) const final;
0100 
0101   //! Transformation is not supported for this eval geometry.
0102   //! @throw Standard_NotImplemented
0103   Standard_EXPORT void Transform(const gp_Trsf2d& T) final;
0104 
0105   //! Creates a new object which is a copy of this curve.
0106   Standard_EXPORT occ::handle<Geom2d_Geometry> Copy() const final;
0107 
0108   //! Dumps the content of me into the stream.
0109   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0110 
0111   DEFINE_STANDARD_RTTIEXT(Geom2dEval_LogarithmicSpiralCurve, Geom2d_Curve)
0112 
0113 private:
0114   gp_Ax2d myPosition;       //!< Local coordinate system
0115   double  myScale;          //!< Scale factor (> 0)
0116   double  myGrowthExponent; //!< Growth exponent (> 0)
0117 };
0118 
0119 #endif // _Geom2dEval_LogarithmicSpiralCurve_HeaderFile