# opentl::math::Math Class Reference

class supporting basic mathematical routines More...

List of all members.

## Public Member Functions
| Math ()
virtual | ~Math ()
## Static Public Member Functions
static double | AARectangleIntersectionArea (double Ax, double Ay, double Aw, double Ah, double Bx, double By, double Bw, double Bh)
static void | computeAABBOfEllipse (double centerX, double centerY, double majorAx, double minorAx, double &minX, double &minY, double &maxX, double &maxY, double angle=0.0f)
| Computes the coordinates of an axis aligned bounding box for a given ellipse.
static void | ComputePade4 (double X[][4], double num[][4], double den[][4])
static void | createStdDeviationVectorFromCovarianceMatrix (math::Vector *dstVec, const math::SquareMatrix *covarianceMat, math::Vector *meanVec=NULL, bool covMatrixIsDiagonal=true)
| Create standard deviation vector from (diagonal) covariance matrix.
static void | DeltaTransformLog (const math::Transform &T, math::Transform &logmT)
template<typename _Ty >
static const _Ty | getAbs (const _Ty &_X)
| Get abs value of two values. Return by reference even for floats/doubles which are NOT supported by the stdlib.
template<typename _Ty >
static const _Ty & | getCrop (const _Ty &_V, const _Ty &_Min, const _Ty &_Max)
| Crop the value to defined "boundary" values, if it lies outside a given range.
template<typename _Ty >
static const _Ty & | getMax (const _Ty &_X, const _Ty &_Y)
| Get maximum value of two values.
template<typename _Ty >
static const _Ty & | getMin (const _Ty &_X, const _Ty &_Y)
| Get minimum value of two values. Return by reference.
static bool | intersectAARectangle (double Ax, double Ay, double Aw, double Ah, double Bx, double By, double Bw, double Bh)
| tests if zwo axis aligned rectangles intersect
static void | normalizeWeights (std::vector< double > &weightVector)
static bool | pointInTriangle (double P[2], double A[2], double B[2], double C[2])
static int | round (double x)
| Rounds a value the fast financial way (via integer cast).
template<typename _Ty >
static const _Ty | sqr (const _Ty &_X)
static double | trunc (double value, int decimals)

## Detailed Description

class supporting basic mathematical routines

Author:
  Thomas Friedlhuber <friedlhu@in.tum.de>

  Thorsten Roeder <roeder@in.tum.de>

  Erwin Roth <eroth@mytum.de>

  Giorgio Panin <panin@in.tum.de>

## Constructor & Destructor Documentation

opentl::math::Math::Math | ( |  | ) |

virtual opentl::math::Math::~Math | ( |  | ) | `[virtual]`

## Member Function Documentation

static double opentl::math::Math::AARectangleIntersectionArea | ( | double | Ax,
|  | double | Ay,
|  | double | Aw,
|  | double | Ah,
|  | double | Bx,
|  | double | By,
|  | double | Bw,
|  | double | Bh |
| ) |  |  | `[static]`

static void opentl::math::Math::computeAABBOfEllipse | ( | double | centerX,
|  | double | centerY,
|  | double | majorAx,
|  | double | minorAx,
|  | double & | minX,
|  | double & | minY,
|  | double & | maxX,
|  | double & | maxY,
|  | double | angle = `0.0f` |
| ) |  |  | `[static]`

Computes the coordinates of an axis aligned bounding box for a given ellipse.

Parameters:

  | centerX | x coordinate of center
  | centerY | y coordinate of center
  | majorAx | the length of the major axis as returned by blob.detect or as used by cvEllipse
  | minorAx | the length of the minor axis as returned by blob.detect or as used by cvEllipse
  | minX | x coordinate of the "left" point
  | minY | y coordinate of the "left" point
  | maxX | x coordinate of the "right" point
  | maxY | y coordinate of the "right" point
  | angle | (in rad) specifies the rotation angle of the ellipse around the center coord. rotation is CCW

static void opentl::math::Math::ComputePade4 | ( | double | X[][4],
|  | double | num[][4],
|  | double | den[][4] |
| ) |  |  | `[static]`

Pade approximant of 4th order (Maple-generated code)

Parameters:

  | X | input matrix
  | num | Numerator of Pade approximant
  | deb | Denominator of Pade approximant

static void opentl::math::Math::createStdDeviationVectorFromCovarianceMatrix | ( | math::Vector * | dstVec,
|  | const math::SquareMatrix * | covarianceMat,
|  | math::Vector * | meanVec = `NULL`,
|  | bool | covMatrixIsDiagonal = `true` |
| ) |  |  | `[static]`

Create standard deviation vector from (diagonal) covariance matrix.

Parameters:

  | dstVec | Resulting noise vector
  | covarianceMat | Positive and symmetrix noise covariance matrix.
  | meanVec | Optional: Vector holding mean values
  | covMatrixIsDiagonal | Optional: specifies if the covariance matrix is diagonal. default = true(faster execution speed)

static void opentl::math::Math::DeltaTransformLog | ( | const math::Transform & | T,
|  | math::Transform & | logmT |
| ) |  |  | `[static]`

Logarithm of a transform close to the identity (Pade' approximants of 4th order)

Parameters:

  | T | input matrix
  | logmT | the matrix logarithm : expm(logmT) = I

template<typename _Ty >

static const _Ty opentl::math::Math::getAbs | ( | const _Ty & | _X | ) | `[inline, static]`

Get abs value of two values. Return by reference even for floats/doubles which are NOT supported by the stdlib.

Parameters:

  | v1 | value 1
  | v2 | value 2

template<typename _Ty >

static const _Ty& opentl::math::Math::getCrop | ( | const _Ty & | _V,
|  | const _Ty & | _Min,
|  | const _Ty & | _Max |
| ) |  |  | `[inline, static]`

Crop the value to defined "boundary" values, if it lies outside a given range.

Parameters:

  | v | value
  | min | minimum value
  | max | maximum value

template<typename _Ty >

static const _Ty& opentl::math::Math::getMax | ( | const _Ty & | _X,
|  | const _Ty & | _Y |
| ) |  |  | `[inline, static]`

Get maximum value of two values.

Parameters:

  | v1 | value 1
  | v2 | value 2

template<typename _Ty >

static const _Ty& opentl::math::Math::getMin | ( | const _Ty & | _X,
|  | const _Ty & | _Y |
| ) |  |  | `[inline, static]`

Get minimum value of two values. Return by reference.

Parameters:

  | v1 | value 1
  | v2 | value 2

static bool opentl::math::Math::intersectAARectangle | ( | double | Ax,
|  | double | Ay,
|  | double | Aw,
|  | double | Ah,
|  | double | Bx,
|  | double | By,
|  | double | Bw,
|  | double | Bh |
| ) |  |  | `[static]`

tests if zwo axis aligned rectangles intersect

Parameters:

  | Ax | center x coord of rect A
  | Ay | center y coord of rect A
  | Aw | width of rect A
  | Ah | height of rect A
  | Bx | center x coord of rect B
  | By | center y coord of rect B
  | Bw | width of rect B
  | Bh | height of rect B

static void opentl::math::Math::normalizeWeights | ( | std::vector< double > & | weightVector | ) | `[inline, static]`

static bool opentl::math::Math::pointInTriangle | ( | double | P[2],
|  | double | A[2],
|  | double | B[2],
|  | double | C[2] |
| ) |  |  | `[static]`

static int opentl::math::Math::round | ( | double | x | ) | `[inline, static]`

Rounds a value the fast financial way (via integer cast).

Parameters:

  | x | value to be rounded

template<typename _Ty >

static const _Ty opentl::math::Math::sqr | ( | const _Ty & | _X | ) | `[inline, static]`

square function

Parameters:

  | v | input value

Returns:
  squared value

static double opentl::math::Math::trunc | ( | double | value,
|  | int | decimals |
| ) |  |  | `[static]`

truncate value

Parameters:

  | value | input value
  | decimals | number of decimals that should not be truncated

Returns:
  truncated value