The Nebula Device 3: Math::matrix44 Class Reference

The Nebula Device 3

Math::matrix44 Class Reference

#include <xna_matrix44.h>


Detailed Description

A matrix44 class on top of Xbox360 math functions.

(C) 2007 Radon Labs GmbH

Public Member Functions

 matrix44 ()
 default constructor, NOTE: does NOT setup components!
 matrix44 (float4 const &row0, float4 const &row1, float4 const &row2, float4 const &row3)
 construct from components
 matrix44 (const XMMATRIX &rhs)
 construct from XMMATRIX
void operator= (const matrix44 &rhs)
 assignment operator
void operator= (const XMMATRIX &rhs)
 assign XMMATRIX
bool operator== (const matrix44 &rhs) const
 equality operator
bool operator!= (const matrix44 &rhs) const
 inequality operator
void load (const scalar *ptr)
 load content from 16-byte-aligned memory
void loadu (const scalar *ptr)
 load content from unaligned memory
void store (scalar *ptr) const
 write content to 16-byte-aligned memory through the write cache
void storeu (scalar *ptr) const
 write content to unaligned memory through the write cache
void stream (scalar *ptr) const
 stream content to 16-byte-aligned memory circumventing the write-cache
void set (float4 const &row0, float4 const &row1, float4 const &row2, float4 const &row3)
 set content
void setrow0 (float4 const &row0)
 write access to x component
void setrow1 (float4 const &row1)
 write access to y component
void setrow2 (float4 const &row2)
 write access to z component
void setrow3 (float4 const &row3)
 write access to w component
const float4getrow0 () const
 read-only access to x component
const float4getrow1 () const
 read-only access to y component
const float4getrow2 () const
 read-only access to z component
const float4getrow3 () const
 read-only access to w component
void set_xaxis (float4 const &x)
 write access to x component
void set_yaxis (float4 const &y)
 write access to y component
void set_zaxis (float4 const &z)
 write access to z component
void set_position (float4 const &pos)
 write access to w component / pos component
const float4get_xaxis () const
 read access to x component
const float4get_yaxis () const
 read access to y component
const float4get_zaxis () const
 read access to z component
const float4get_position () const
 read access to w component / pos component
void translate (float4 const &t)
 add a translation to pos_component
void scale (float4 const &v)
 scale matrix
bool isidentity () const
 return true if matrix is identity
scalar determinant () const
 return determinant of matrix
void decompose (float4 &outScale, quaternion &outRotation, float4 &outTranslation) const
template<typename T>
as () const
 convert to any type

Static Public Member Functions

static matrix44 identity ()
 build identity matrix
static matrix44 affinetransformation (scalar scaling, float4 const &rotationCenter, const quaternion &rotation, float4 const &translation)
 build matrix from affine transformation
static matrix44 inverse (const matrix44 &m)
 compute the inverse of a matrix
static matrix44 lookatlh (float4 const &eye, float4 const &at, float4 const &up)
 build left handed lookat matrix
static matrix44 lookatrh (float4 const &eye, float4 const &at, float4 const &up)
 build right handed lookat matrix
static matrix44 multiply (const matrix44 &m0, const matrix44 &m1)
 multiply 2 matrices
static matrix44 ortholh (scalar w, scalar h, scalar zn, scalar zf)
 build left handed orthogonal projection matrix
static matrix44 orthorh (scalar w, scalar h, scalar zn, scalar zf)
 build right handed orthogonal projection matrix
static matrix44 orthooffcenterlh (scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
 build left-handed off-center orthogonal projection matrix
static matrix44 orthooffcenterrh (scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
 build right-handed off-center orthogonal projection matrix
static matrix44 perspfovlh (scalar fovy, scalar aspect, scalar zn, scalar zf)
 build left-handed perspective projection matrix based on field-of-view
static matrix44 perspfovrh (scalar fovy, scalar aspect, scalar zn, scalar zf)
 build right-handed perspective projection matrix based on field-of-view
static matrix44 persplh (scalar w, scalar h, scalar zn, scalar zf)
 build left-handed perspective projection matrix
static matrix44 persprh (scalar w, scalar h, scalar zn, scalar zf)
 build right-handed perspective projection matrix
static matrix44 perspoffcenterlh (scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
 build left-handed off-center perspective projection matrix
static matrix44 perspoffcenterrh (scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
 build right-handed off-center perspective projection matrix
static matrix44 reflect (const plane &p)
 build matrix that reflects coordinates about a plance
static matrix44 rotationaxis (float4 const &axis, scalar angle)
 build rotation matrix around arbitrary axis
static matrix44 rotationquaternion (const quaternion &q)
 build rotation matrix from quaternion
static matrix44 rotationx (scalar angle)
 build x-axis-rotation matrix
static matrix44 rotationy (scalar angle)
 build y-axis-rotation matrix
static matrix44 rotationz (scalar angle)
 build z-axis-rotation matrix
static matrix44 rotationyawpitchroll (scalar yaw, scalar pitch, scalar roll)
 build rotation matrix from yaw, pitch and roll
static matrix44 scaling (scalar sx, scalar sy, scalar sz)
 build a scaling matrix from components
static matrix44 scaling (float4 const &s)
 build a scaling matrix from float4
static matrix44 transformation (float4 const &scalingCenter, const quaternion &scalingRotation, float4 const &scaling, float4 const &rotationCenter, const quaternion &rotation, float4 const &translation)
 build a transformation matrix
static matrix44 translation (scalar x, scalar y, scalar z)
 build a translation matrix
static matrix44 translation (float4 const &t)
 build a translation matrix from point
static matrix44 transpose (const matrix44 &m)
 return the transpose of a matrix
static float4 transform (const float4 &v, const matrix44 &m)
 transform 4d vector by matrix44, faster inline version than float4::transform
static quaternion rotationmatrix (const matrix44 &m)
 return a quaternion from rotational part of the 4x4 matrix
static plane transform (const plane &p, const matrix44 &m)
 transform a plane with a matrix
static bool ispointinside (const float4 &p, const matrix44 &m)
 check if point lies inside matrix frustum

Member Function Documentation

void Math::matrix44::decompose ( float4 outScale,
quaternion outRotation,
float4 outTranslation 
) const

decompose into scale, rotation and translation !!! Note: