Rigid Body Dynamics Library
Function_< T >::Sinusoid Class Reference

#include <Function.h>

+ Inheritance diagram for Function_< T >::Sinusoid:

Public Member Functions

 Sinusoid (double amplitude, double frequency, double phase=0)
 
void setAmplitude (double amplitude)
 
void setFrequency (double frequency)
 
void setPhase (double phase)
 
double getAmplitude () const
 
double getFrequency () const
 
double getPhase () const
 
virtual double calcValue (const RigidBodyDynamics::Math::VectorNd &x) const
 
virtual double calcDerivative (const std::vector< int > &derivComponents, const RigidBodyDynamics::Math::VectorNd &x) const
 
virtual int getArgumentSize () const
 
virtual int getMaxDerivativeOrder () const
 
- Public Member Functions inherited from Function_< double >
virtual ~Function_ ()
 
virtual double calcValue (const RigidBodyDynamics::Math::VectorNd &x) const=0
 
virtual double calcDerivative (const std::vector< int > &derivComponents, const RigidBodyDynamics::Math::VectorNd &x) const=0
 
virtual int getArgumentSize () const=0
 
virtual int getMaxDerivativeOrder () const=0
 

Private Attributes

double a
 
double w
 
double p
 

Detailed Description

template<class T>
class RigidBodyDynamics::Addons::Geometry::Function_< T >::Sinusoid

This is a Function_ subclass whose output value is a sinusoid of its argument: f(x) = a*sin(w*x + p) where a is amplitude, w is frequency in radians per unit of x, p is phase in radians.

This is only defined for a scalar (double) return value.

Definition at line 301 of file Function.h.

Constructor & Destructor Documentation

◆ Sinusoid()

Sinusoid ( double  amplitude,
double  frequency,
double  phase = 0 
)
inline

Create a Function::Sinusoid object, returning a*sin(w*x+p).

Parameters
[in]amplitude'a' in the above formula
[in]frequency'w' in the above formula
[in]phase'p' in the above formula

Definition at line 310 of file Function.h.

Member Function Documentation

◆ calcDerivative()

virtual double calcDerivative ( const std::vector< int > &  derivComponents,
const RigidBodyDynamics::Math::VectorNd x 
) const
inlinevirtual

Calculate a partial derivative of this function at a particular point.
Which derivative to take is specified by listing the input components with which to take it. For example, if derivComponents=={0}, that indicates a first derivative with respective to component 0. If derivComponents=={0, 0, 0}, that indicates a third derivative with respective to component 0. If derivComponents=={4, 7}, that indicates a partial second derivative with respect to components 4 and 7.

Parameters
derivComponents
The input components with respect to which the derivative should be taken. Its size must be less than or equal to the value returned by getMaxDerivativeOrder().
x
The RigidBodyDynamics::Math::VectorNd of input arguments. Its size must equal the value returned by getArgumentSize().
Returns
The value of the selected derivative, which is of type T.

Implements Function_< double >.

Definition at line 330 of file Function.h.

References std::cos(), std::pow(), std::sin(), and MX_Xd_dynamic::size().

◆ calcValue()

virtual double calcValue ( const RigidBodyDynamics::Math::VectorNd x) const
inlinevirtual

Calculate the value of this function at a particular point.

Parameters
xthe RigidBodyDynamics::Math::VectorNd of input arguments. Its size must equal the value returned by getArgumentSize().

Implements Function_< double >.

Definition at line 323 of file Function.h.

References std::sin().

◆ getAmplitude()

double getAmplitude ( ) const
inline

Definition at line 317 of file Function.h.

◆ getArgumentSize()

virtual int getArgumentSize ( ) const
inlinevirtual

This provides compatibility with std::vector without requiring any copying. Get the number of components expected in the input vector.

Implements Function_< double >.

Definition at line 353 of file Function.h.

◆ getFrequency()

double getFrequency ( ) const
inline

Definition at line 318 of file Function.h.

◆ getMaxDerivativeOrder()

virtual int getMaxDerivativeOrder ( ) const
inlinevirtual

Get the maximum derivative order this Function_ object can calculate.

Implements Function_< double >.

Definition at line 354 of file Function.h.

◆ getPhase()

double getPhase ( ) const
inline

Definition at line 319 of file Function.h.

◆ setAmplitude()

void setAmplitude ( double  amplitude)
inline

Definition at line 313 of file Function.h.

◆ setFrequency()

void setFrequency ( double  frequency)
inline

Definition at line 314 of file Function.h.

◆ setPhase()

void setPhase ( double  phase)
inline

Definition at line 315 of file Function.h.

Field Documentation

◆ a

double a
private

This provides compatibility with std::vector without requiring any copying.

Definition at line 366 of file Function.h.

◆ p

double p
private

Definition at line 366 of file Function.h.

◆ w

double w
private

Definition at line 366 of file Function.h.


The documentation for this class was generated from the following file: