Back to home page

EIC code displayed by LXR

 
 

    


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

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_SineWaveCurve_HeaderFile
0015 #define _Geom2dEval_SineWaveCurve_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 sine wave curve.
0024 //!
0025 //! The parametric equation is:
0026 //! @code
0027 //!   C(t) = O + t*XDir + A*sin(omega*t + phi)*YDir
0028 //! @endcode
0029 //! where:
0030 //! - O, XDir, YDir are from the local coordinate system (gp_Ax2d gives XDir,
0031 //!   YDir is the perpendicular),
0032 //! - A is the amplitude (> 0),
0033 //! - omega is the angular frequency (> 0),
0034 //! - phi is the phase shift.
0035 //!
0036 //! The parameter range is (-inf, +inf). The curve is not periodic.
0037 class Geom2dEval_SineWaveCurve : public Geom2d_Curve
0038 {
0039 public:
0040   //! Creates a 2D sine wave curve.
0041   //! @param[in] thePosition the local coordinate system
0042   //! @param[in] theAmplitude the wave amplitude (must be > 0)
0043   //! @param[in] theOmega the angular frequency (must be > 0)
0044   //! @param[in] thePhase the phase shift (default 0)
0045   //! @throw Standard_ConstructionError if theAmplitude <= 0 or theOmega <= 0
0046   Standard_EXPORT Geom2dEval_SineWaveCurve(const gp_Ax2d& thePosition,
0047                                            double         theAmplitude,
0048                                            double         theOmega,
0049                                            double         thePhase = 0.0);
0050 
0051   //! Returns the local coordinate system.
0052   Standard_EXPORT const gp_Ax2d& Position() const;
0053 
0054   //! Returns the amplitude.
0055   Standard_EXPORT double Amplitude() const;
0056 
0057   //! Returns the angular frequency.
0058   Standard_EXPORT double Omega() const;
0059 
0060   //! Returns the phase shift.
0061   Standard_EXPORT double Phase() const;
0062 
0063   //! Reversal is not supported for this eval curve.
0064   //! @throw Standard_NotImplemented
0065   Standard_EXPORT void Reverse() final;
0066 
0067   //! Reversal is not supported for this eval curve.
0068   //! @throw Standard_NotImplemented
0069   Standard_EXPORT double ReversedParameter(const double U) const final;
0070 
0071   //! Returns -Precision::Infinite().
0072   Standard_EXPORT double FirstParameter() const final;
0073 
0074   //! Returns Precision::Infinite().
0075   Standard_EXPORT double LastParameter() const final;
0076 
0077   //! Returns false.
0078   Standard_EXPORT bool IsClosed() const final;
0079 
0080   //! Returns false.
0081   Standard_EXPORT bool IsPeriodic() const final;
0082 
0083   //! Returns GeomAbs_CN.
0084   Standard_EXPORT GeomAbs_Shape Continuity() const final;
0085 
0086   //! Returns true for any N >= 0.
0087   Standard_EXPORT bool IsCN(const int N) const final;
0088 
0089   //! Computes the point at parameter U.
0090   Standard_EXPORT gp_Pnt2d EvalD0(const double U) const final;
0091 
0092   //! Computes the point and first derivative at parameter U.
0093   Standard_EXPORT Geom2d_Curve::ResD1 EvalD1(const double U) const final;
0094 
0095   //! Computes the point and first two derivatives at parameter U.
0096   Standard_EXPORT Geom2d_Curve::ResD2 EvalD2(const double U) const final;
0097 
0098   //! Computes the point and first three derivatives at parameter U.
0099   Standard_EXPORT Geom2d_Curve::ResD3 EvalD3(const double U) const final;
0100 
0101   //! Computes the N-th derivative at parameter U.
0102   //! @throw Standard_RangeError if N < 1
0103   Standard_EXPORT gp_Vec2d EvalDN(const double U, const int N) const final;
0104 
0105   //! Transformation is not supported for this eval geometry.
0106   //! @throw Standard_NotImplemented
0107   Standard_EXPORT void Transform(const gp_Trsf2d& T) final;
0108 
0109   //! Creates a new object which is a copy of this curve.
0110   Standard_EXPORT occ::handle<Geom2d_Geometry> Copy() const final;
0111 
0112   //! Dumps the content of me into the stream.
0113   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0114 
0115   DEFINE_STANDARD_RTTIEXT(Geom2dEval_SineWaveCurve, Geom2d_Curve)
0116 
0117 private:
0118   gp_Ax2d myPosition;  //!< Local coordinate system
0119   double  myAmplitude; //!< Wave amplitude (> 0)
0120   double  myOmega;     //!< Angular frequency (> 0)
0121   double  myPhase;     //!< Phase shift
0122 };
0123 
0124 #endif // _Geom2dEval_SineWaveCurve_HeaderFile