Public Member Functions | Private Attributes | List of all members
SurgSim::Math::clampOperator< T > Class Template Reference

define a custom template unary functor to execute the clamp operation over an Eigen matrix structure. More...

#include <SurgSim/Math/Scalar.h>

Public Member Functions

 clampOperator (const T &min, const T &max, const T &epsilon)
 Constructor. More...
 
const T operator() (const T &x) const
 Execute the clamp operator. More...
 

Private Attributes

m_min
 The minimum value of the interval. More...
 
m_max
 The maximum value of the interval. More...
 
m_epsilon
 The closeness parameter for the clamp. More...
 

Detailed Description

template<typename T>
class SurgSim::Math::clampOperator< T >

define a custom template unary functor to execute the clamp operation over an Eigen matrix structure.

The operation clamps based on an epsilon interval. For values outside the interval min to max, the clamp proceeds as expected. However, values within the interval that lie within epsilon of an endpoint are also clamped to th endpoint.

Template Parameters
Tthe type over which the operator is defined.

Constructor & Destructor Documentation

◆ clampOperator()

template<typename T >
SurgSim::Math::clampOperator< T >::clampOperator ( const T &  min,
const T &  max,
const T &  epsilon 
)
inline

Constructor.

Parameters
minminimum value for the clamp interval
maxmaximum value for the clamp interval
epsilonvalues within epsilon of an interval endpoint are clamped to the interval regardless of if they are within the interval or not

Member Function Documentation

◆ operator()()

template<typename T >
const T SurgSim::Math::clampOperator< T >::operator() ( const T &  x) const

Execute the clamp operator.

Parameters
xthe value to clamp based
Returns
the x clamped using the minimum, maximum and epsilon specified in he class constructor

Member Data Documentation

◆ m_epsilon

template<typename T >
T SurgSim::Math::clampOperator< T >::m_epsilon
private

The closeness parameter for the clamp.

Values within epsilon of an interval endpoint are clamped to the interval regardless of if they are within the interval or not

◆ m_max

template<typename T >
T SurgSim::Math::clampOperator< T >::m_max
private

The maximum value of the interval.

◆ m_min

template<typename T >
T SurgSim::Math::clampOperator< T >::m_min
private

The minimum value of the interval.


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