PF_API 0.52
Classes | Functions | Variables

OpenSkyNet::Math Namespace Reference

All Math classes, functions, variables, and constants. More...

Classes

class  Interpolator
struct  ILerpOverTime
struct  LerpOverTime1
struct  LerpOverTime3
struct  LerpOverTime3x3
class  Matrix3x3
class  Path
class  Point
class  Quaternion

Functions

const float PI (3.14159265f)
const float PSEUDO_INFINITY (1000000.0f)
const float CLOSE_TO_ZERO (0.00001f)
float getRadFromDeg (float deg_)
float rand01 ()
float randNeg1Pos1 ()
int roundToInt (double num_)
Utils::uint roundToUInt (float num_)
Utils::uint timeStamp ()
template<class T >
clamp (T &num_, const T &min_=0, const T &max_=1)
Matrix3x3 operator* (const Matrix3x3 &lhs_, const Matrix3x3 &rhs_)
Matrix3x3 getRotation (const Math::Point<> &axis_, float radians_)
void getAxisAngle (const Matrix3x3 &rot_, Math::Point<> &axis_, float &radians_)
Math::Point operator* (const Math::Point<> &lhs_, const Matrix3x3 &rhs_)
template<class T , class U >
bool operator== (const Point< T > &lhs_, const Point< U > &rhs_)
template<class T , class U >
bool operator!= (const Point< T > &lhs_, const Point< U > &rhs_)
template<class T , class U >
Point< T > operator+ (const Point< T > &lhs_, const Point< U > &rhs_)
template<class T , class U >
Point< T > operator- (const Point< T > &lhs_, const Point< U > &rhs_)
template<class T , class U >
Point< T > operator* (const Point< T > &lhs_, const Point< U > &rhs_)
template<class T , class U >
Point< T > operator/ (const Point< T > &lhs_, const Point< U > &rhs_)
template<class T , class U >
Point< T > operator* (const Point< T > &lhs_, const U &rhs_)
template<class T , class U >
Point< T > operator/ (const Point< T > &lhs_, const U &rhs_)
template<class T , class U >
getLength (const Point< T > &lhs_, const Point< U > &rhs_)
template<class T , class U >
Point< T > interpolate (const Point< T > &lhs_, const Point< U > &rhs_, float amount_)
Point< float, 2 > RandPointInOrOnCircle (float radius_)
const Point g_xAxis (1.0f, 0.0f, 0.0f)
const Point g_yAxis (0.0f, 1.0f, 0.0f)
const Point g_zAxis (0.0f, 0.0f, 1.0f)

Variables

const Matrix3x3 g_identityMatrix3x3
const Point g_origin
const Point g_xAxis (1.0f, 0.0f, 0.0f)
const Point g_yAxis (0.0f, 1.0f, 0.0f)
const Point g_zAxis (0.0f, 0.0f, 1.0f)
const Math::Quaternion g_multIdentityQuat

Detailed Description

All Math classes, functions, variables, and constants.


Function Documentation

template<class T >
T OpenSkyNet::Math::clamp ( T &  num_,
const T &  min_ = 0,
const T &  max_ = 1 
) [inline]

If a number is out of specified bounds, set it to the nearest bound, and return the difference between the original value and nearest bound.

Parameters:
num_the number to check
min_the minimum bound
max_the maximum bound
const float OpenSkyNet::Math::CLOSE_TO_ZERO ( 0.  00001f)
const Point OpenSkyNet::Math::g_xAxis ( 1.  0f,
0.  0f,
0.  0f 
)
const Point OpenSkyNet::Math::g_yAxis ( 0.  0f,
1.  0f,
0.  0f 
)
const Point OpenSkyNet::Math::g_zAxis ( 0.  0f,
0.  0f,
1.  0f 
)
void OpenSkyNet::Math::getAxisAngle ( const Matrix3x3 &  rot_,
Math::Point<> &  axis_,
float &  radians_ 
) [inline]

Get the axis-angle representation of a matrix. NOTE: rot_ must be orthonormal Based on code from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm

template<class T , class U >
T OpenSkyNet::Math::getLength ( const Point< T > &  lhs_,
const Point< U > &  rhs_ 
) [inline]

Length

float OpenSkyNet::Math::getRadFromDeg ( float  deg_) [inline]

Returns the # of radians equivalent to deg_ degrees.

Matrix3x3 OpenSkyNet::Math::getRotation ( const Math::Point<> &  axis_,
float  radians_ 
) [inline]

Return the rotation matrix corresponding to this axis/angle. NOTE: axis_ must be normalized

template<class T , class U >
Point< T > OpenSkyNet::Math::interpolate ( const Point< T > &  lhs_,
const Point< U > &  rhs_,
float  amount_ 
) [inline]

Interpolation Return a point along a line defined by 2 points (endpoints inclusive)

Parameters:
lhs_1st bounding point to use for interpolation
rhs_2nd bounding point to use for interpolation
amount_from 0 (lhs_) to 1 (rhs_)
template<class T , class U >
bool OpenSkyNet::Math::operator!= ( const Point< T > &  lhs_,
const Point< U > &  rhs_ 
) [inline]

Inequality

template<class T , class U >
Point< T > OpenSkyNet::Math::operator* ( const Point< T > &  lhs_,
const Point< U > &  rhs_ 
) [inline]

Component multiplication

template<class T , class U >
Point< T > OpenSkyNet::Math::operator* ( const Point< T > &  lhs_,
const U &  rhs_ 
) [inline]

Multiplication of all axes by a scalar

Matrix3x3 OpenSkyNet::Math::operator* ( const Matrix3x3 &  lhs_,
const Matrix3x3 &  rhs_ 
) [inline]

Matrix Multiplication

Math::Point OpenSkyNet::Math::operator* ( const Math::Point<> &  lhs_,
const Matrix3x3 &  rhs_ 
) [inline]

Multiplication of a point by a matrix

template<class T , class U >
Point< T > OpenSkyNet::Math::operator+ ( const Point< T > &  lhs_,
const Point< U > &  rhs_ 
) [inline]

Addition

template<class T , class U >
Point< T > OpenSkyNet::Math::operator- ( const Point< T > &  lhs_,
const Point< U > &  rhs_ 
) [inline]

Subtraction

template<class T , class U >
Point< T > OpenSkyNet::Math::operator/ ( const Point< T > &  lhs_,
const U &  rhs_ 
) [inline]

Division of all axes by a scalar

template<class T , class U >
Point< T > OpenSkyNet::Math::operator/ ( const Point< T > &  lhs_,
const Point< U > &  rhs_ 
) [inline]

Component division

template<class T , class U >
bool OpenSkyNet::Math::operator== ( const Point< T > &  lhs_,
const Point< U > &  rhs_ 
) [inline]

Equality

const float OpenSkyNet::Math::PI ( 3.  14159265f)
const float OpenSkyNet::Math::PSEUDO_INFINITY ( 1000000.  0f)
float OpenSkyNet::Math::rand01 ( ) [inline]

Returns a pseudo-random float between 0.0 and 1.0.

float OpenSkyNet::Math::randNeg1Pos1 ( ) [inline]

Returns a pseudo-random float between -1.0 and 1.0.

Point< float, 2 > OpenSkyNet::Math::RandPointInOrOnCircle ( float  radius_) [inline]

Pick a random point in a circle of a given radius. First, try rejection sampling by picking a random point in a square of side 2r and test if it lies in or on the circle. If that fails after a few attempts (see code comments), then use this method: http://stackoverflow.com/questions/5837572/generate-a-random-point-within-a-circle-uniformly/5838055#5838055

int OpenSkyNet::Math::roundToInt ( double  num_) [inline]

Round a double to an int.

Utils::uint OpenSkyNet::Math::roundToUInt ( float  num_) [inline]

Round a positive float to an uint.

Utils::uint OpenSkyNet::Math::timeStamp ( ) [inline]

Returns the number of seconds passed since the process started.


Variable Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines