Public Member Functions | List of all members
SurgSim::Math::Polynomial< T, 2 > Class Template Reference

Polynomial<T, 2> specializes the Polynomial class for degree 2 (quadratic polynomials) More...

#include <SurgSim/Math/Polynomial.h>

Public Member Functions

 Polynomial ()
 Constructor. More...
 
 Polynomial (const T &a0, const T &a1, const T &a2)
 Constructor. More...
 
discriminant () const
 Evaluate the discriminant of a quadratic polynomial. More...
 
evaluate (const T &x) const
 Evaluate the polynomial at a point. More...
 
operator() (const T &x) const
 Evaluate the polynomial at a point. More...
 
Polynomial< T, 1 > derivative () const
 
bool isNearZero (const T &epsilon=static_cast< T >(polynomial_epsilon)) const
 
bool isApprox (const Polynomial< T, 2 > &p, const T &epsilon) const
 
getCoefficient (size_t i) const
 
void setCoefficient (size_t i, const T &value)
 Set a specified coefficient to a desired value. More...
 
T & operator[] (const size_t i)
 
const T & operator[] (const size_t i) const
 
Polynomial< T, 2 > operator- () const
 
Polynomial< T, 2 > operator+ (const Polynomial< T, 2 > &rhs) const
 
Polynomial< T, 2 > & operator+= (const Polynomial< T, 2 > &rhs)
 
Polynomial< T, 2 > operator- (const Polynomial< T, 2 > &rhs) const
 
Polynomial< T, 2 > & operator-= (const Polynomial< T, 2 > &rhs)
 

Private Attributes

m_a0
 
m_a1
 
m_a2
 

Detailed Description

template<typename T>
class SurgSim::Math::Polynomial< T, 2 >

Polynomial<T, 2> specializes the Polynomial class for degree 2 (quadratic polynomials)

See also
Polynomial<T, N>

Constructor & Destructor Documentation

◆ Polynomial() [1/2]

template<class T >
SurgSim::Math::Polynomial< T, 2 >::Polynomial

Constructor.

◆ Polynomial() [2/2]

template<class T >
SurgSim::Math::Polynomial< T, 2 >::Polynomial ( const T &  a0,
const T &  a1,
const T &  a2 
)

Constructor.

Parameters
a0coefficient of the 0 degree term
a1coefficient of the 1 degree term
a2coefficient of the 2 degree term

Member Function Documentation

◆ derivative()

template<class T >
Polynomial< T, 1 > SurgSim::Math::Polynomial< T, 2 >::derivative
Returns
the derivative of the polynomial

◆ discriminant()

template<class T >
T SurgSim::Math::Polynomial< T, 2 >::discriminant

Evaluate the discriminant of a quadratic polynomial.

Returns
the discriminant (b^2 - a4c)

◆ evaluate()

template<class T >
T SurgSim::Math::Polynomial< T, 2 >::evaluate ( const T &  x) const

Evaluate the polynomial at a point.

Parameters
xpoint at which to evaluate the polynomial
Returns
the value of the polynomial at x

◆ getCoefficient()

template<class T >
T SurgSim::Math::Polynomial< T, 2 >::getCoefficient ( size_t  i) const
Parameters
iindex of the desired coefficient
Returns
the value of coefficient i

◆ isApprox()

template<class T >
bool SurgSim::Math::Polynomial< T, 2 >::isApprox ( const Polynomial< T, 2 > &  p,
const T &  epsilon 
) const
Parameters
pthe test polynomial
epsilonthe closeness parameter
Returns
true if all the coefficients of the current polynomial are within an epsilon of the corresponding coefficient in p

◆ isNearZero()

template<class T >
bool SurgSim::Math::Polynomial< T, 2 >::isNearZero ( const T &  epsilon = static_cast<T>(polynomial_epsilon)) const
Parameters
epsilonthe closeness parameter
Returns
true if all coefficients of the polynomial are within an epsilon of 0

◆ operator()()

template<class T >
T SurgSim::Math::Polynomial< T, 2 >::operator() ( const T &  x) const

Evaluate the polynomial at a point.

Parameters
xpoint at which to evaluate the polynomial
Returns
the value of the polynomial at x

◆ operator+()

template<class T >
Polynomial< T, 2 > SurgSim::Math::Polynomial< T, 2 >::operator+ ( const Polynomial< T, 2 > &  rhs) const

Standard arithmetic operators extended to intervals

◆ operator+=()

template<class T >
Polynomial< T, 2 > & SurgSim::Math::Polynomial< T, 2 >::operator+= ( const Polynomial< T, 2 > &  rhs)

Standard arithmetic operators extended to intervals

◆ operator-() [1/2]

template<class T >
Polynomial< T, 2 > SurgSim::Math::Polynomial< T, 2 >::operator-

Standard arithmetic operators extended to intervals

◆ operator-() [2/2]

template<class T >
Polynomial< T, 2 > SurgSim::Math::Polynomial< T, 2 >::operator- ( const Polynomial< T, 2 > &  rhs) const

Standard arithmetic operators extended to intervals

◆ operator-=()

template<class T >
Polynomial< T, 2 > & SurgSim::Math::Polynomial< T, 2 >::operator-= ( const Polynomial< T, 2 > &  rhs)

Standard arithmetic operators extended to intervals

◆ operator[]() [1/2]

template<class T >
T & SurgSim::Math::Polynomial< T, 2 >::operator[] ( const size_t  i)

Standard arithmetic operators extended to intervals

◆ operator[]() [2/2]

template<class T >
const T & SurgSim::Math::Polynomial< T, 2 >::operator[] ( const size_t  i) const

Standard arithmetic operators extended to intervals

◆ setCoefficient()

template<class T >
void SurgSim::Math::Polynomial< T, 2 >::setCoefficient ( size_t  i,
const T &  value 
)

Set a specified coefficient to a desired value.

Parameters
iindex of the desired coefficient
valuethe value to be set in the coefficient
Exceptions
ifi is greater than the polynomial degree

Member Data Documentation

◆ m_a0

template<typename T >
T SurgSim::Math::Polynomial< T, 2 >::m_a0
private

Coefficient of the polynomial

◆ m_a1

template<typename T >
T SurgSim::Math::Polynomial< T, 2 >::m_a1
private

Coefficient of the polynomial

◆ m_a2

template<typename T >
T SurgSim::Math::Polynomial< T, 2 >::m_a2
private

Coefficient of the polynomial


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