Classes | Typedefs | Enumerations | Functions | Variables

Mathlib.h File Reference

#include <cmath>
#include "Mathlib.inl"
Include dependency graph for Mathlib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Vector3< Real >
class  Matrix4x4< Real >
class  Quaternion< Real >

Typedefs

typedef Vector3< float > Vector3f
typedef Vector3< double > Vector3d
typedef Matrix4x4< float > Matrix4x4f
typedef Matrix4x4< double > Matrix4x4d
typedef Quaternion< float > Quaternionf
typedef Quaternion< double > Quaterniond

Enumerations

enum  Axis {
  kXaxis,
  kYaxis,
  kZaxis
}

Functions

template<typename Real >
Real wrapPi (Real theta)
template<typename Real >
Real safeAcos (Real x)
template<typename Real >
void canonizeEulerAngles (Real &roll, Real &pitch, Real &yaw)
template<typename Real >
Real degToRad (Real deg)
template<typename Real >
Real radToDeg (Real rad)
template<typename Real >
Real fovToZoom (Real fov)
template<typename Real >
Real zoomToFov (Real zoom)
static const Vector3f kZeroVectorf (0.0f, 0.0f, 0.0f)
static const Vector3d kZeroVectord (0.0, 0.0, 0.0)
template<typename Real >
Vector3< Real > operator* (Real k, Vector3< Real > v)
template<typename Real >
Real VectorMag (const Vector3< Real > &v)
template<typename Real >
Real DotProduct (const Vector3< Real > &a, const Vector3< Real > &b)
template<typename Real >
Vector3< Real > CrossProduct (const Vector3< Real > &a, const Vector3< Real > &b)
template<typename Real >
Vector3< Real > ComputeNormal (const Vector3< Real > &p1, const Vector3< Real > &p2, const Vector3< Real > &p3)
template<typename Real >
Real Distance (const Vector3< Real > &a, const Vector3< Real > &b)
template<typename Real >
Real DistanceSquared (const Vector3< Real > &a, const Vector3< Real > &b)
template<typename Real >
Matrix4x4< Real > operator* (const Matrix4x4< Real > &a, const Matrix4x4< Real > &b)
template<typename Real >
Matrix4x4< Real > & operator*= (Matrix4x4< Real > &a, const Matrix4x4< Real > &b)
template<typename Real >
Vector3< Real > operator* (const Matrix4x4< Real > &m, const Vector3< Real > &p)
template<typename Real >
Matrix4x4< Real > Transpose (const Matrix4x4< Real > &m)
template<typename Real >
Matrix4x4< Real > Invert (const Matrix4x4< Real > &m)
template<typename Real >
Matrix4x4< Real > RotationMatrix (Axis axis, Real theta)
template<typename Real >
Matrix4x4< Real > RotationMatrix (const Vector3< Real > &axis, Real theta)
template<typename Real >
Matrix4x4< Real > TranslationMatrix (Real x, Real y, Real z)
template<typename Real >
Matrix4x4< Real > TranslationMatrix (const Vector3< Real > &v)
template<typename Real >
Matrix4x4< Real > ScaleMatrix (const Vector3< Real > &s)
template<typename Real >
Matrix4x4< Real > ScaleAlongAxisMatrix (const Vector3< Real > &axis, Real k)
template<typename Real >
Matrix4x4< Real > ShearMatrix (Axis axis, Real s, Real t)
template<typename Real >
Matrix4x4< Real > ProjectionMatrix (const Vector3< Real > &n)
template<typename Real >
Matrix4x4< Real > ReflectionMatrix (Axis axis, Real k)
template<typename Real >
Matrix4x4< Real > AxisReflectionMatrix (const Vector3< Real > &n)
template<typename Real >
Matrix4x4< Real > LookAtMatrix (const Vector3< Real > &camPos, const Vector3< Real > &target, const Vector3< Real > &camUp)
template<typename Real >
Matrix4x4< Real > FrustumMatrix (Real l, Real r, Real b, Real t, Real n, Real f)
template<typename Real >
Matrix4x4< Real > PerspectiveMatrix (Real fovY, Real aspect, Real n, Real f)
template<typename Real >
Matrix4x4< Real > OrthoMatrix (Real l, Real r, Real b, Real t, Real n, Real f)
template<typename Real >
Matrix4x4< Real > OrthoNormalMatrix (const Vector3< Real > &xdir, const Vector3< Real > &ydir, const Vector3< Real > &zdir)
static const Quaternionf kQuaternionIdentityf (1.0f, 0.0f, 0.0f, 0.0f)
static const Quaterniond kQuaternionIdentityd (1.0f, 0.0f, 0.0f, 0.0f)
template<typename Real >
Quaternion< Real > operator* (Real k, const Quaternion< Real > &q)
template<typename Real >
Real DotProduct (const Quaternion< Real > &a, const Quaternion< Real > &b)
template<typename Real >
Quaternion< Real > Conjugate (const Quaternion< Real > &q)
template<typename Real >
Quaternion< Real > Inverse (const Quaternion< Real > &q)
template<typename Real >
Quaternion< Real > RotationQuaternion (Axis axis, Real theta)
template<typename Real >
Quaternion< Real > RotationQuaternion (const Vector3< Real > &axis, Real theta)
template<typename Real >
Quaternion< Real > Log (const Quaternion< Real > &q)
template<typename Real >
Quaternion< Real > Exp (const Quaternion< Real > &q)
template<typename Real >
Quaternion< Real > Pow (const Quaternion< Real > &q, Real exponent)
template<typename Real >
Quaternion< Real > Slerp (const Quaternion< Real > &q0, const Quaternion< Real > &q1, Real t)
template<typename Real >
Quaternion< Real > Squad (const Quaternion< Real > &q0, const Quaternion< Real > &qa, const Quaternion< Real > &qb, const Quaternion< Real > &q1, Real t)
template<typename Real >
void Intermediate (const Quaternion< Real > &qprev, const Quaternion< Real > &qcurr, const Quaternion< Real > &qnext, Quaternion< Real > &qa, Quaternion< Real > &qb)

Variables

const float kPi = 3.14159265358979323846f
const float k2Pi = kPi * 2.0f
const float kPiOver2 = kPi / 2.0f
const float k1OverPi = 1.0f / kPi
const float k1Over2Pi = 1.0f / k2Pi
const float kPiOver180 = kPi / 180.0f
const float k180OverPi = 180.0f / kPi

Typedef Documentation

typedef Vector3<float> Vector3f

Definition at line 135 of file Mathlib.h.

typedef Vector3<double> Vector3d

Definition at line 136 of file Mathlib.h.

typedef Matrix4x4<float> Matrix4x4f

Definition at line 246 of file Mathlib.h.

typedef Matrix4x4<double> Matrix4x4d

Definition at line 247 of file Mathlib.h.

typedef Quaternion<float> Quaternionf

Definition at line 378 of file Mathlib.h.

typedef Quaternion<double> Quaterniond

Definition at line 379 of file Mathlib.h.


Enumeration Type Documentation

enum Axis
Enumerator:
kXaxis 
kYaxis 
kZaxis 

Definition at line 31 of file Mathlib.h.


Function Documentation

template<typename Real >
Real wrapPi ( Real  theta  ) 
template<typename Real >
Real safeAcos ( Real  x  ) 
template<typename Real >
void canonizeEulerAngles ( Real &  roll,
Real &  pitch,
Real &  yaw 
)
template<typename Real >
Real degToRad ( Real  deg  )  [inline]

Definition at line 59 of file Mathlib.h.

template<typename Real >
Real radToDeg ( Real  rad  )  [inline]

Definition at line 62 of file Mathlib.h.

template<typename Real >
Real fovToZoom ( Real  fov  )  [inline]

Definition at line 67 of file Mathlib.h.

template<typename Real >
Real zoomToFov ( Real  zoom  )  [inline]

Definition at line 70 of file Mathlib.h.

static const Vector3f kZeroVectorf ( 0.  0f,
0.  0f,
0.  0f 
) [static]
static const Vector3d kZeroVectord ( 0.  0,
0.  0,
0.  0 
) [static]
template<typename Real >
Vector3<Real> operator* ( Real  k,
Vector3< Real >  v 
)
template<typename Real >
Real VectorMag ( const Vector3< Real > &  v  ) 
template<typename Real >
Real DotProduct ( const Vector3< Real > &  a,
const Vector3< Real > &  b 
)
template<typename Real >
Vector3<Real> CrossProduct ( const Vector3< Real > &  a,
const Vector3< Real > &  b 
)
template<typename Real >
Vector3<Real> ComputeNormal ( const Vector3< Real > &  p1,
const Vector3< Real > &  p2,
const Vector3< Real > &  p3 
)
template<typename Real >
Real Distance ( const Vector3< Real > &  a,
const Vector3< Real > &  b 
)
template<typename Real >
Real DistanceSquared ( const Vector3< Real > &  a,
const Vector3< Real > &  b 
)
template<typename Real >
Matrix4x4<Real> operator* ( const Matrix4x4< Real > &  a,
const Matrix4x4< Real > &  b 
)
template<typename Real >
Matrix4x4<Real>& operator*= ( Matrix4x4< Real > &  a,
const Matrix4x4< Real > &  b 
)
template<typename Real >
Vector3<Real> operator* ( const Matrix4x4< Real > &  m,
const Vector3< Real > &  p 
)
template<typename Real >
Matrix4x4<Real> Transpose ( const Matrix4x4< Real > &  m  ) 
template<typename Real >
Matrix4x4<Real> Invert ( const Matrix4x4< Real > &  m  ) 
template<typename Real >
Matrix4x4<Real> RotationMatrix ( Axis  axis,
Real  theta 
)
template<typename Real >
Matrix4x4<Real> RotationMatrix ( const Vector3< Real > &  axis,
Real  theta 
)
template<typename Real >
Matrix4x4<Real> TranslationMatrix ( Real  x,
Real  y,
Real  z 
)
template<typename Real >
Matrix4x4<Real> TranslationMatrix ( const Vector3< Real > &  v  ) 
template<typename Real >
Matrix4x4<Real> ScaleMatrix ( const Vector3< Real > &  s  ) 
template<typename Real >
Matrix4x4<Real> ScaleAlongAxisMatrix ( const Vector3< Real > &  axis,
Real  k 
)
template<typename Real >
Matrix4x4<Real> ShearMatrix ( Axis  axis,
Real  s,
Real  t 
)
template<typename Real >
Matrix4x4<Real> ProjectionMatrix ( const Vector3< Real > &  n  ) 
template<typename Real >
Matrix4x4<Real> ReflectionMatrix ( Axis  axis,
Real  k 
)
template<typename Real >
Matrix4x4<Real> AxisReflectionMatrix ( const Vector3< Real > &  n  ) 
template<typename Real >
Matrix4x4<Real> LookAtMatrix ( const Vector3< Real > &  camPos,
const Vector3< Real > &  target,
const Vector3< Real > &  camUp 
)
template<typename Real >
Matrix4x4<Real> FrustumMatrix ( Real  l,
Real  r,
Real  b,
Real  t,
Real  n,
Real  f 
)
template<typename Real >
Matrix4x4<Real> PerspectiveMatrix ( Real  fovY,
Real  aspect,
Real  n,
Real  f 
)
template<typename Real >
Matrix4x4<Real> OrthoMatrix ( Real  l,
Real  r,
Real  b,
Real  t,
Real  n,
Real  f 
)
template<typename Real >
Matrix4x4<Real> OrthoNormalMatrix ( const Vector3< Real > &  xdir,
const Vector3< Real > &  ydir,
const Vector3< Real > &  zdir 
)
static const Quaternionf kQuaternionIdentityf ( 1.  0f,
0.  0f,
0.  0f,
0.  0f 
) [static]
static const Quaterniond kQuaternionIdentityd ( 1.  0f,
0.  0f,
0.  0f,
0.  0f 
) [static]
template<typename Real >
Quaternion<Real> operator* ( Real  k,
const Quaternion< Real > &  q 
)
template<typename Real >
Real DotProduct ( const Quaternion< Real > &  a,
const Quaternion< Real > &  b 
)
template<typename Real >
Quaternion<Real> Conjugate ( const Quaternion< Real > &  q  ) 
template<typename Real >
Quaternion<Real> Inverse ( const Quaternion< Real > &  q  ) 
template<typename Real >
Quaternion<Real> RotationQuaternion ( Axis  axis,
Real  theta 
)
template<typename Real >
Quaternion<Real> RotationQuaternion ( const Vector3< Real > &  axis,
Real  theta 
)
template<typename Real >
Quaternion<Real> Log ( const Quaternion< Real > &  q  ) 
template<typename Real >
Quaternion<Real> Exp ( const Quaternion< Real > &  q  ) 
template<typename Real >
Quaternion<Real> Pow ( const Quaternion< Real > &  q,
Real  exponent 
)
template<typename Real >
Quaternion<Real> Slerp ( const Quaternion< Real > &  q0,
const Quaternion< Real > &  q1,
Real  t 
)
template<typename Real >
Quaternion<Real> Squad ( const Quaternion< Real > &  q0,
const Quaternion< Real > &  qa,
const Quaternion< Real > &  qb,
const Quaternion< Real > &  q1,
Real  t 
)
template<typename Real >
void Intermediate ( const Quaternion< Real > &  qprev,
const Quaternion< Real > &  qcurr,
const Quaternion< Real > &  qnext,
Quaternion< Real > &  qa,
Quaternion< Real > &  qb 
) [inline]

Variable Documentation

const float kPi = 3.14159265358979323846f

Definition at line 36 of file Mathlib.h.

const float k2Pi = kPi * 2.0f

Definition at line 37 of file Mathlib.h.

const float kPiOver2 = kPi / 2.0f

Definition at line 38 of file Mathlib.h.

const float k1OverPi = 1.0f / kPi

Definition at line 39 of file Mathlib.h.

const float k1Over2Pi = 1.0f / k2Pi

Definition at line 40 of file Mathlib.h.

const float kPiOver180 = kPi / 180.0f

Definition at line 41 of file Mathlib.h.

const float k180OverPi = 180.0f / kPi

Definition at line 42 of file Mathlib.h.