Back to home page

EIC code displayed by LXR

 
 

    


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

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 _GeomEval_CircularHelixCurve_HeaderFile
0015 #define _GeomEval_CircularHelixCurve_HeaderFile
0016 
0017 #include <Geom_Curve.hxx>
0018 #include <gp_Ax2.hxx>
0019 
0020 class gp_Trsf;
0021 class Geom_Geometry;
0022 
0023 //! Describes a circular helix in 3D space.
0024 //! A circular helix is an unbounded curve defined by a radius R,
0025 //! a pitch P (axial advance per full 2*Pi turn), and a coordinate system.
0026 //!
0027 //! The parametric equation is:
0028 //! @code
0029 //!   C(t) = O + R*cos(t)*XDir + R*sin(t)*YDir + (P*t/(2*Pi))*ZDir
0030 //! @endcode
0031 //! where:
0032 //! - O, XDir, YDir, ZDir are the origin and directions of the local coordinate system,
0033 //! - R is the radius (> 0),
0034 //! - P is the pitch (can be negative for left-handed helix).
0035 //!
0036 //! The parameter range is (-inf, +inf). The curve is neither periodic nor closed.
0037 //! Continuity is GeomAbs_CN.
0038 class GeomEval_CircularHelixCurve : public Geom_Curve
0039 {
0040 public:
0041   //! Creates a circular helix with the given coordinate system, radius, and pitch.
0042   //! @param[in] thePosition the local coordinate system
0043   //! @param[in] theRadius the helix radius (must be > 0)
0044   //! @param[in] thePitch the axial advance per 2*Pi turn (can be negative)
0045   //! @throw Standard_ConstructionError if theRadius <= 0
0046   Standard_EXPORT GeomEval_CircularHelixCurve(const gp_Ax2& thePosition,
0047                                               double        theRadius,
0048                                               double        thePitch);
0049 
0050   //! Returns the local coordinate system.
0051   Standard_EXPORT const gp_Ax2& Position() const;
0052 
0053   //! Returns the helix radius.
0054   Standard_EXPORT double Radius() const;
0055 
0056   //! Returns the pitch (axial advance per 2*Pi turn).
0057   Standard_EXPORT double Pitch() const;
0058 
0059   //! Reversal of parametrization is not supported for this eval geometry.
0060   //! @throw Standard_NotImplemented
0061   Standard_EXPORT void Reverse() final;
0062 
0063   //! Reversal of parametrization is not supported for this eval geometry.
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_Pnt EvalD0(const double U) const final;
0087 
0088   //! Computes the point and first derivative at parameter U.
0089   Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double U) const final;
0090 
0091   //! Computes the point and first two derivatives at parameter U.
0092   Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double U) const final;
0093 
0094   //! Computes the point and first three derivatives at parameter U.
0095   Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double U) const final;
0096 
0097   //! Computes the N-th derivative at parameter U.
0098   //! @param[in] U the parameter value
0099   //! @param[in] N the derivative order (must be >= 1)
0100   //! @return the N-th derivative vector
0101   //! @throw Standard_RangeError if N < 1
0102   Standard_EXPORT gp_Vec EvalDN(const double U, const int N) const final;
0103 
0104   //! Transformation is not supported for this eval geometry.
0105   //! @throw Standard_NotImplemented
0106   Standard_EXPORT void Transform(const gp_Trsf& T) final;
0107 
0108   //! Creates a new object which is a copy of this curve.
0109   Standard_EXPORT occ::handle<Geom_Geometry> Copy() const final;
0110 
0111   //! Dumps the content of me into the stream.
0112   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0113 
0114   DEFINE_STANDARD_RTTIEXT(GeomEval_CircularHelixCurve, Geom_Curve)
0115 
0116 private:
0117   gp_Ax2 myPosition; //!< Local coordinate system
0118   double myRadius;   //!< Helix radius (> 0)
0119   double myPitch;    //!< Axial advance per 2*Pi turn
0120 };
0121 
0122 #endif // _GeomEval_CircularHelixCurve_HeaderFile