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_ArchimedeanSpiralCurve_HeaderFile
0015 #define _Geom2dEval_ArchimedeanSpiralCurve_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 Archimedean spiral curve.
0024 //! The polar equation is r = a + b*t, where a is the initial radius
0025 //! and b is the growth rate per radian.
0026 //!
0027 //! The parametric equation is:
0028 //! @code
0029 //!   C(t) = O + (a + b*t)*cos(t)*XDir + (a + b*t)*sin(t)*YDir
0030 //! @endcode
0031 //! where:
0032 //! - O, XDir are from the local coordinate system,
0033 //! - YDir is the perpendicular to XDir,
0034 //! - a is the initial radius (>= 0),
0035 //! - b is the growth rate per radian (> 0).
0036 //!
0037 //! The parameter range is [0, +inf). The curve is neither periodic nor closed.
0038 class Geom2dEval_ArchimedeanSpiralCurve : public Geom2d_Curve
0039 {
0040 public:
0041   //! Creates an Archimedean spiral.
0042   //! @param[in] thePosition the local coordinate system
0043   //! @param[in] theInitialRadius the initial radius (must be >= 0)
0044   //! @param[in] theGrowthRate the growth rate per radian (must be > 0)
0045   //! @throw Standard_ConstructionError if theInitialRadius < 0 or theGrowthRate <= 0
0046   Standard_EXPORT Geom2dEval_ArchimedeanSpiralCurve(const gp_Ax2d& thePosition,
0047                                                     double         theInitialRadius,
0048                                                     double         theGrowthRate);
0049 
0050   //! Returns the local coordinate system.
0051   Standard_EXPORT const gp_Ax2d& Position() const;
0052 
0053   //! Returns the initial radius.
0054   Standard_EXPORT double InitialRadius() const;
0055 
0056   //! Returns the growth rate per radian.
0057   Standard_EXPORT double GrowthRate() 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 0.
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_ArchimedeanSpiralCurve, Geom2d_Curve)
0112 
0113 private:
0114   gp_Ax2d myPosition;      //!< Local coordinate system
0115   double  myInitialRadius; //!< Initial radius (>= 0)
0116   double  myGrowthRate;    //!< Growth rate per radian (> 0)
0117 };
0118 
0119 #endif // _Geom2dEval_ArchimedeanSpiralCurve_HeaderFile