MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
math::Accum< T > Class Template Reference

Accumulator class that operates on arbitrary types. More...

#include <accum.h>

Public Member Functions

 Accum (T const &init)
 Initializes the internal value (usually to zero).
 
 Accum (void)
 Leaves internal value uninitialized.
 
void add (T const &value, float weight)
 Adds the weighted given value to the internal value.
 
normalized (float weight) const
 Returns a normalized version of the internal value, i.e.
 
normalized (void) const
 Returns a normalized version of the internal value, i.e.
 
void sub (T const &value, float weight)
 Subtracts the weighted given value from the internal value.
 

Public Attributes

v
 
float w
 

Detailed Description

template<typename T>
class math::Accum< T >

Accumulator class that operates on arbitrary types.

The idea behind this is that values can be accumulated even for basic integral types, such as unsigned chars, where accumulation would normally quickly cause overflows or rounding errors.

Accumulation of arbitrary types is handled by specializations of the 'Accum' class. For example, unsigned char values are all internally converted to float to achieve accurate results.

Note: This class currently supports:

Definition at line 34 of file accum.h.

Constructor & Destructor Documentation

◆ Accum() [1/2]

template<typename T >
math::Accum< T >::Accum ( void  )
inline

Leaves internal value uninitialized.

Definition at line 72 of file accum.h.

◆ Accum() [2/2]

template<typename T >
math::Accum< T >::Accum ( T const &  init)
inline

Initializes the internal value (usually to zero).

Definition at line 79 of file accum.h.

Member Function Documentation

◆ add()

template<typename T >
void math::Accum< T >::add ( T const &  value,
float  weight 
)
inline

Adds the weighted given value to the internal value.

Definition at line 86 of file accum.h.

◆ normalized() [1/2]

template<typename T >
unsigned char math::Accum< T >::normalized ( float  weight) const
inline

Returns a normalized version of the internal value, i.e.

dividing the internal value by the given weight. The internal value is not changed by this operation.

Definition at line 102 of file accum.h.

◆ normalized() [2/2]

template<typename T >
unsigned char math::Accum< T >::normalized ( void  ) const
inline

Returns a normalized version of the internal value, i.e.

dividing the internal value by the internal weight, which is the cumulative weight from the 'add' calls.

Definition at line 109 of file accum.h.

◆ sub()

template<typename T >
void math::Accum< T >::sub ( T const &  value,
float  weight 
)
inline

Subtracts the weighted given value from the internal value.

Definition at line 94 of file accum.h.

Member Data Documentation

◆ v

template<typename T >
T math::Accum< T >::v

Definition at line 37 of file accum.h.

◆ w

template<typename T >
float math::Accum< T >::w

Definition at line 38 of file accum.h.


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