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

T | m_min
| The minimum value of the interval. More...
T | m_max
| The maximum value of the interval. More...
T | 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

  T | the 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

  min | minimum value for the clamp interval
  max | maximum value for the clamp interval
  epsilon | values 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

  x | the 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:

- SurgSim/Math/Scalar.h
- SurgSim/Math/Scalar-inl.h