Functions
karto::math Namespace Reference

Functions

template<class T >
AlignValue (size_t value, size_t alignValue=8)
template<typename T >
const T & Clip (const T &n, const T &minValue, const T &maxValue)
kt_double DegreesToRadians (kt_double degrees)
kt_bool DoubleEqual (kt_double a, kt_double b)
template<typename T >
kt_bool InRange (const T &value, const T &a, const T &b)
template<typename T >
kt_bool IsUpTo (const T &value, const T &maximum)
template<>
kt_bool IsUpTo< kt_int32u > (const kt_int32u &value, const kt_int32u &maximum)
template<typename T >
const T & Maximum (const T &value1, const T &value2)
template<typename T >
const T & Minimum (const T &value1, const T &value2)
kt_double NormalizeAngle (kt_double angle)
kt_double NormalizeAngleDifference (kt_double minuend, kt_double subtrahend)
kt_double RadiansToDegrees (kt_double radians)
kt_double Round (kt_double value)
template<typename T >
Square (T value)

Function Documentation

template<class T >
T karto::math::AlignValue ( size_t  value,
size_t  alignValue = 8 
) [inline]

Align a value to the alignValue. The alignValue should be the power of two (2, 4, 8, 16, 32 and so on)

Parameters:
value
alignValue
Returns:
aligned value

Definition at line 244 of file Math.h.

template<typename T >
const T& karto::math::Clip ( const T &  n,
const T &  minValue,
const T &  maxValue 
) [inline]

Clips a number to the specified minimum and maximum values.

Parameters:
nnumber to be clipped
minValueminimum value
maxValuemaximum value
Returns:
the clipped value

Definition at line 124 of file Math.h.

Converts degrees into radians

Parameters:
degrees
Returns:
radian equivalent of degrees

Definition at line 56 of file Math.h.

Checks whether two numbers are equal within a certain tolerance.

Parameters:
a
b
Returns:
true if a and b differ by at most a certain tolerance.

Definition at line 135 of file Math.h.

template<typename T >
kt_bool karto::math::InRange ( const T &  value,
const T &  a,
const T &  b 
) [inline]

Checks whether value is in the range [a;b]

Parameters:
value
a
b

Definition at line 172 of file Math.h.

template<typename T >
kt_bool karto::math::IsUpTo ( const T &  value,
const T &  maximum 
) [inline]

Checks whether value is in the range [0;maximum)

Parameters:
value
maximum

Definition at line 147 of file Math.h.

template<>
kt_bool karto::math::IsUpTo< kt_int32u > ( const kt_int32u value,
const kt_int32u maximum 
) [inline]

Checks whether value is in the range [0;maximum) Specialized version for unsigned int (kt_int32u)

Parameters:
value
maximum

Definition at line 159 of file Math.h.

template<typename T >
const T& karto::math::Maximum ( const T &  value1,
const T &  value2 
) [inline]

Binary maximum function

Parameters:
value1
value2
Returns:
the greater of value1 and value2

Definition at line 111 of file Math.h.

template<typename T >
const T& karto::math::Minimum ( const T &  value1,
const T &  value2 
) [inline]

Binary minimum function

Parameters:
value1
value2
Returns:
the lesser of value1 and value2

Definition at line 99 of file Math.h.

Normalizes angle to be in the range of [-pi, pi]

Parameters:
angleto be normalized
Returns:
normalized angle

Definition at line 182 of file Math.h.

kt_double karto::math::NormalizeAngleDifference ( kt_double  minuend,
kt_double  subtrahend 
) [inline]

Returns an equivalent angle to the first parameter such that the difference when the second parameter is subtracted from this new value is an angle in the normalized range of [-pi, pi], i.e. abs(minuend - subtrahend) <= pi.

Parameters:
minuend
subtrahend
Returns:
normalized angle

Definition at line 221 of file Math.h.

Converts radians into degrees

Parameters:
radians
Returns:
degree equivalent of radians

Definition at line 66 of file Math.h.

kt_double karto::math::Round ( kt_double  value) [inline]

Round function

Parameters:
value
Returns:
rounds value to the nearest whole number (as double)

Definition at line 87 of file Math.h.

template<typename T >
T karto::math::Square ( value) [inline]

Square function

Parameters:
value
Returns:
square of value

Definition at line 77 of file Math.h.



open_karto
Author(s):
autogenerated on Thu Jun 6 2019 21:02:57