NSRoutines Namespace Reference

Namespace with fast routines. More...


Functions

float DegToRad (const float &deg)
 Converts angle in degrees to radians.
float RadToDeg (const float &rad)
 Converts angle in radians to degrees.
float FloatClampNormalize (const float &number)
 Clamp given number to range <0,1> Compute:.
float FloatClamp (const float &value, const float &min, const float &max)
 Clamp given value to specified range <min, max>.
template<typename T>
void Swap (T &a, T &b)
 This template swaps two values.
template<typename T>
void MinMax (const T &a, const T &b, T &min, T &max)
 This template finds minimum and maximum from A,B.
template<typename T>
void MinMidMax (const T &a, const T &b, const T &c, T &min, T &mid, T &max)
 This template finds minimum, middle and maximum from A,B,C.
template<typename T>
void Max (const T &a, const T &b, const T &c, T &max)
 This method finds maximum from three values.
template<typename T>
void Min (const T &a, const T &b, const T &c, T &min)
 This method finds minimum from three values.
template<typename T>
Min (const T &a, const T &b)
 Compare two values and return minimum.
template<typename T>
Max (const T &a, const T &b)
 Compare two values and return maximum.

Variables

const float PI = 3.1415926535897932384626433832795f
 definition of PI
const float E = 2.7182818284590452353602874713527f
 definition of E


Detailed Description

Namespace with fast routines.

It contains small routines which are usually used. Also some constants are contained here.

Not all function in this namespace has special optimization. They are only used for simplifying some tasks.


Function Documentation

float NSRoutines::DegToRad const float &  deg  )  [inline]
 

Converts angle in degrees to radians.

Compute (deg/180.f)*PI

Parameters:
deg [in] angle in degrees
Returns:
angle in radians

Definition at line 38 of file Routines.h.

References PI.

float NSRoutines::FloatClamp const float &  value,
const float &  min,
const float &  max
[inline]
 

Clamp given value to specified range <min, max>.

Parameters:
value [in] value to clamp
min [in] interval minimum
max [in] interval maximum

Definition at line 113 of file Routines.h.

Referenced by NSMath::NSCurves::THermiteCubicSpline::GetIndexByTime(), and NSMath::TEulerAngles::Set().

float NSRoutines::FloatClampNormalize const float &  number  )  [inline]
 

Clamp given number to range <0,1> Compute:.

if(number<0.f) 
{
        return 0.f;
}
else
{
        if(number>1.f)
                return 1.f;
        else
                return number;  
}

Parameters:
number [in] float number to clamp
Returns:
number in range <0,1>

Definition at line 76 of file Routines.h.

Referenced by NSMath::NSCurves::THermiteCubicSpline::GetIndexByUniformTime().

template<typename T>
T NSRoutines::Max const T &  a,
const T &  b
[inline]
 

Compare two values and return maximum.

Parameters:
a [in] first value
b [in] second value

Definition at line 258 of file Routines.h.

template<typename T>
void NSRoutines::Max const T &  a,
const T &  b,
const T &  c,
T &  max
[inline]
 

This method finds maximum from three values.

Warning:
Output parameters cannot be identical with input parameters!!!
Parameters:
a [in] first value
b [in] second value
c [in] third value
max [out] returned maximum

Definition at line 217 of file Routines.h.

Referenced by NSMath::TTriangle::GetMaxX(), NSMath::TTriangle::GetMaxY(), NSMath::TTriangle::GetMaxZ(), and NSMath::TVector3::Maximum().

template<typename T>
T NSRoutines::Min const T &  a,
const T &  b
[inline]
 

Compare two values and return minimum.

Parameters:
a [in] first value
b [in] second value

Definition at line 247 of file Routines.h.

template<typename T>
void NSRoutines::Min const T &  a,
const T &  b,
const T &  c,
T &  min
[inline]
 

This method finds minimum from three values.

Warning:
Output parameters cannot be identical with input parameters!!!
Parameters:
a [in] first value
b [in] second value
c [in] third value
min [out] returned minimum

Definition at line 234 of file Routines.h.

Referenced by NSMath::TTriangle::GetMinX(), NSMath::TTriangle::GetMinY(), NSMath::TTriangle::GetMinZ(), and NSMath::TVector3::Minimum().

template<typename T>
void NSRoutines::MinMax const T &  a,
const T &  b,
T &  min,
T &  max
[inline]
 

This template finds minimum and maximum from A,B.

Warning:
Output parameters cannot be identical with input parameters!!!
Parameters:
a [in] first value
b [in] second value
min [out] returned minimum
max [out] returned maximum

Definition at line 155 of file Routines.h.

Referenced by NSMath::TVector3::MinimumMaximum().

template<typename T>
void NSRoutines::MinMidMax const T &  a,
const T &  b,
const T &  c,
T &  min,
T &  mid,
T &  max
[inline]
 

This template finds minimum, middle and maximum from A,B,C.

Warning:
Output parameters cannot be identical with input parameters!!!
Parameters:
a [in] first value
b [in] second value
c [in] third value
min [out] returned minimum
mid [out] returned middle value
max [out] returned maximum

Definition at line 181 of file Routines.h.

float NSRoutines::RadToDeg const float &  rad  )  [inline]
 

Converts angle in radians to degrees.

Compute (rad/PI)*180.f

Parameters:
rad [in] angle in radians
Returns:
angle in degrees

Definition at line 50 of file Routines.h.

References PI.

template<typename T>
void NSRoutines::Swap T &  a,
T &  b
[inline]
 

This template swaps two values.

Value type must have defined assignment operator.

Parameters:
a [in out] first value
b [in out] second value

Definition at line 138 of file Routines.h.

Referenced by NSMath::TMatrix4::Transpose(), and NSMath::TMatrix3::Transpose().


Variable Documentation

const float NSRoutines::E = 2.7182818284590452353602874713527f
 

definition of E

Definition at line 29 of file Routines.h.

const float NSRoutines::PI = 3.1415926535897932384626433832795f
 

definition of PI

Definition at line 28 of file Routines.h.

Referenced by DegToRad(), RadToDeg(), and NSRandom::TRandomNormal::Random().


Generated on Wed Nov 28 23:09:12 2007 for Joy4D by  doxygen 1.4.6-NO