Antiprism 0.23
Public Member Functions | Static Public Member Functions

mat4d Class Reference

Matrix for transformations in 4D. More...

#include <mat4d.h>

List of all members.

Public Member Functions

 mat4d ()
 Constructor.
 mat4d (vec4d r1, vec4d r2, vec4d r3, vec4d r4)
 Constructor.
double operator[] (int idx) const
 Read access to the element array.
double & operator[] (int idx)
 Write access to the element array.
mat4doperator*= (const mat4d &mat)
 Multiply this matrix by another matrix.
mat4doperator*= (double n)
 Multiply this matrix by a scalar.
mat4doperator+= (const mat4d &mat)
 Add another matrix to this matrix.
mat4dtranspose ()
 Transpose the matrix.
mat4dto_unit ()
 Set the matrix to the unit matrix.
mat4dto_zero ()
 Set the matrix to zero.
mat4dset_rot (vec4d u, vec4d v, double angle)
 Set a rotation by plane axis and angle.
mat4dset_rot (vec4d v_from, vec4d v_to)
 Set a rotation by rotating one direction vector onto another.
mat4dset_rot (double xy_ang, double yz_ang, double zw_ang, double wx_ang, double xz_ang, double yw_ang)
 Set a rotation by rotating around the coordinate-plane axes.
mat4dset_transl (vec4d trans)
 Set a translation.
mat4dset_scale (double scal)
 Set a uniform scaling.
mat4dset_scale (double x_scal, double y_scal, double z_scal, double w_scal)
 Set a scaling by components.
mat4dset_inversion ()
 Set an inversion.
void dump (const char *var="", FILE *file=stderr)
 Debugging print of a matrix.

Static Public Member Functions

static mat4d unit ()
 Get a unit matrix.
static mat4d zero ()
 Get a zero matrix.
static mat4d rot (vec4d u, vec4d v, double angle)
 Get a rotation by plane axis and angle.
static mat4d rot (vec4d v_from, vec4d v_to)
 Get a rotation by rotating one direction vector onto another.
static mat4d rot (double xy_ang, double yz_ang, double zw_ang, double wx_ang, double xz_ang, double yw_ang)
 Get a rotation by rotating around the coordinate-plane axes.
static mat4d transl (vec4d trans)
 Get a translation.
static mat4d scale (double scal)
 Get a uniform scaling.
static mat4d scale (double x_scal, double y_scal, double z_scal, double w_scal)
 Get a scaling by components.
static mat4d inversion ()
 Get an inversion.

Detailed Description

Matrix for transformations in 4D.


Constructor & Destructor Documentation

mat4d::mat4d ( ) [inline]

Constructor.

Initialises to the identity

mat4d::mat4d ( vec4d  r1,
vec4d  r2,
vec4d  r3,
vec4d  r4 
) [inline]

Constructor.

Initialise the rows of the rotation part.

Parameters:
r1first row.
r2second row.
r3third row.
r4fourth row.

Member Function Documentation

void mat4d::dump ( const char *  var = "",
FILE *  file = stderr 
)

Debugging print of a matrix.

Parameters:
vara string to identify the matrix variable.
filefile stream to print the variable.
mat4d mat4d::inversion ( ) [inline, static]

Get an inversion.

Inversion through the origin.

Returns:
A matrix with the inversion set.
mat4d & mat4d::operator*= ( double  n) [inline]

Multiply this matrix by a scalar.

Parameters:
nthe scalar.
Returns:
A reference to the result, held in this matrix.
mat4d & mat4d::operator*= ( const mat4d mat) [inline]

Multiply this matrix by another matrix.

Parameters:
matthe matrix to multiply.
Returns:
A reference to the result, held in this matrix.
mat4d & mat4d::operator+= ( const mat4d mat) [inline]

Add another matrix to this matrix.

Parameters:
matthe matrix to add.
Returns:
A reference to the result, held in this matrix.
double& mat4d::operator[] ( int  idx) [inline]

Write access to the element array.

Parameters:
idxindex into the 16 element array.
Returns:
The element.
double mat4d::operator[] ( int  idx) const [inline]

Read access to the element array.

Parameters:
idxindex into the 16 element array.
Returns:
The element.
mat4d mat4d::rot ( double  xy_ang,
double  yz_ang,
double  zw_ang,
double  wx_ang,
double  xz_ang,
double  yw_ang 
) [inline, static]

Get a rotation by rotating around the coordinate-plane axes.

Rotate around the x-axis, y-axis and then z-axis.

Parameters:
xy_angangle in radians to rotate around xy-axis.
yz_angangle in radians to rotate around yz-axis.
zw_angangle in radians to rotate around zw-axis.
wx_angangle in radians to rotate around wx-axis.
xz_angangle in radians to rotate around xz-axis.
yw_angangle in radians to rotate around yw-axis.
Returns:
A matrix with the resulting rotation set.
mat4d mat4d::rot ( vec4d  u,
vec4d  v,
double  angle 
) [inline, static]

Get a rotation by plane axis and angle.

Rotate around an arbitrary plane axis through the origin.

Parameters:
uthe first basis vector of the axis plane to rotate around.
vthe second basis vector of the axis plane to rotate around.
anglethe angle to rotate, in radians.
Returns:
A matrix with the resulting rotation set.
mat4d mat4d::rot ( vec4d  v_from,
vec4d  v_to 
) [inline, static]

Get a rotation by rotating one direction vector onto another.

Parameters:
v_fromthe direction vector to rotate.
v_tothe direction v_from should point after the rotation.
Returns:
A matrix with the resulting rotation set.
mat4d mat4d::scale ( double  scal) [inline, static]

Get a uniform scaling.

Scale uniformly in all directions, away from the origin.

Parameters:
scalthe amount to scale.
Returns:
A matrix with the scaling set.
mat4d mat4d::scale ( double  x_scal,
double  y_scal,
double  z_scal,
double  w_scal 
) [inline, static]

Get a scaling by components.

Scale in the direction of the coordinate axes, away from the origin.

Parameters:
x_scalthe amount to scale in the direction of the x-axis.
y_scalthe amount to scale in the direction of the y-axis.
z_scalthe amount to scale in the direction of the z-axis.
w_scalthe amount to scale in the direction of the z-axis.
Returns:
A reference to this matrix with the scaling set.
mat4d & mat4d::set_inversion ( ) [inline]

Set an inversion.

Inversion through the origin.

Returns:
A reference to this matrix with the inversion set.
mat4d & mat4d::set_rot ( vec4d  u,
vec4d  v,
double  angle 
) [inline]

Set a rotation by plane axis and angle.

Rotate around an arbitrary plane axis through the origin.

Parameters:
uthe first basis vector of the axis plane to rotate around.
vthe second basis vector of the axis plane to rotate around.
anglethe angle to rotate, in radians.
Returns:
A reference to this matrix with the resulting rotation set.
mat4d & mat4d::set_rot ( vec4d  v_from,
vec4d  v_to 
) [inline]

Set a rotation by rotating one direction vector onto another.

Parameters:
v_fromthe direction vector to rotate.
v_tothe direction v_from should point after the rotation.
Returns:
A reference to this matrix with the resulting rotation set.
mat4d & mat4d::set_rot ( double  xy_ang,
double  yz_ang,
double  zw_ang,
double  wx_ang,
double  xz_ang,
double  yw_ang 
) [inline]

Set a rotation by rotating around the coordinate-plane axes.

Rotate around the x-axis, y-axis and then z-axis.

Parameters:
xy_angangle in radians to rotate around xy-axis.
yz_angangle in radians to rotate around yz-axis.
zw_angangle in radians to rotate around zw-axis.
wx_angangle in radians to rotate around wx-axis.
xz_angangle in radians to rotate around xz-axis.
yw_angangle in radians to rotate around yw-axis.
Returns:
A reference to this matrix with the resulting rotation set.
mat4d & mat4d::set_scale ( double  scal) [inline]

Set a uniform scaling.

Scale uniformly in all directions, away from the origin.

Parameters:
scalthe amount to scale.
Returns:
A reference to this matrix with the scaling set.
mat4d & mat4d::set_scale ( double  x_scal,
double  y_scal,
double  z_scal,
double  w_scal 
) [inline]

Set a scaling by components.

Scale in the direction of the coordinate axes, away from the origin.

Parameters:
x_scalthe amount to scale in the direction of the x-axis.
y_scalthe amount to scale in the direction of the y-axis.
z_scalthe amount to scale in the direction of the z-axis.
w_scalthe amount to scale in the direction of the z-axis.
Returns:
A reference to this matrix with the scaling set.
mat4d & mat4d::set_transl ( vec4d  trans) [inline]

Set a translation.

Parameters:
transthe vector to translate by.
Returns:
A reference to this matrix with the translation set.
mat4d mat4d::transl ( vec4d  trans) [inline, static]

Get a translation.

Parameters:
transthe vector to translate by.
Returns:
A matrix with the translation set.

The documentation for this class was generated from the following files: