Libprimis
Imprimis' 3D destroyable world engine
Loading...
Searching...
No Matches
matrix4x3 Struct Reference

floating point 4x3 matrix object defined as four column vectors, a-d takes the form as follows: [ a1 b1 c1 d1 (x) a2 b2 c2 d2 (y) a3 b3 c3 d3 ] (z) More...

#include <geom.h>

Public Member Functions

 matrix4x3 ()
 Creates an empty matrix4x3 object.
 
 matrix4x3 (const vec &a, const vec &b, const vec &c, const vec &d)
 Creates a matrix4x3 from four three-dimensional vec objects.
 
 matrix4x3 (const matrix3 &rot, const vec &trans)
 Creates a matrix4x3 from a rotation matrix and a translation vector.
 
 matrix4x3 (const dualquat &dq)
 Creates a matrix4x3 that represents a dual quaternion transformation.
 
 matrix4x3 (const matrix4 &m)
 Creates a matrix4x3 by truncating w from a matrix4.
 
void mul (float k)
 Multiplies all values inside the matrix by a scalar constant.
 
void setscale (float x, float y, float z)
 Sets the diagonals a.x, b.y, c.z to the given values.
 
void setscale (const vec &v)
 Sets the diagonals a.x, b.y, c.z to the given vector's x, y, z values.
 
void setscale (float n)
 Sets the diagonals a.x, b.y, c.z identically to a given value.
 
void scale (float x, float y, float z)
 Scales the first three vectors by x, y, and z respectively.
 
void scale (const vec &v)
 Multiplies the first three vectors by v.x, v.y, and v.z respectively.
 
void scale (float n)
 Scales the first three vector elements in the matrix by the specified amount.
 
void settranslation (const vec &p)
 Copies the p vector into the fourth column vector (d).
 
void settranslation (float x, float y, float z)
 Copies x, y, z into the fourth column vector (d).
 
void translate (const vec &p)
 
void translate (float x, float y, float z)
 
void translate (const vec &p, float scale)
 
void accumulate (const matrix4x3 &m, float k)
 
void normalize ()
 Normalizes the first three column vectors.
 
void lerp (const matrix4x3 &to, float t)
 Linearly interpolates between the two matrices according to scale t.
 
void lerp (const matrix4x3 &from, const matrix4x3 &to, float t)
 Linearly interpolates between two other matrices according to scale t.
 
void identity ()
 Sets this matrix to the identity matrix.
 
void mul (const matrix4x3 &m, const matrix4x3 &n)
 
void mul (const matrix4x3 &n)
 
void mul (const matrix3 &m, const matrix4x3 &n)
 
void mul (const matrix3 &rot, const vec &trans, const matrix4x3 &n)
 
void transpose ()
 
void transpose (const matrix4x3 &o)
 
void transposemul (const matrix4x3 &m, const matrix4x3 &n)
 
void multranspose (const matrix4x3 &m, const matrix4x3 &n)
 
void invert (const matrix4x3 &o)
 
void invert ()
 
void rotate (float angle, const vec &d)
 
void rotate (float ck, float sk, const vec &axis)
 
void rotate_around_x (float ck, float sk)
 
void rotate_around_x (float angle)
 
void rotate_around_x (const vec2 &sc)
 
void rotate_around_y (float ck, float sk)
 
void rotate_around_y (float angle)
 
void rotate_around_y (const vec2 &sc)
 
void rotate_around_z (float ck, float sk)
 
void rotate_around_z (float angle)
 
void rotate_around_z (const vec2 &sc)
 
vec transposedtransform (const vec &o) const
 
vec transformnormal (const vec &o) const
 
vec transposedtransformnormal (const vec &o) const
 
vec transform (const vec &o) const
 
vec transform (const vec2 &o) const
 
vec4< float > rowx () const
 Returns the x values of the four vectors as a four-vector.
 
vec4< float > rowy () const
 Returns the y values of the four vectors as a four-vector.
 
vec4< float > rowz () const
 Returns the z values of the four vectors as a four-vector.
 

Public Attributes

vec a
 
vec b
 
vec c
 
vec d
 

Detailed Description

floating point 4x3 matrix object defined as four column vectors, a-d takes the form as follows: [ a1 b1 c1 d1 (x) a2 b2 c2 d2 (y) a3 b3 c3 d3 ] (z)

used in animation along with dualquats

Constructor & Destructor Documentation

◆ matrix4x3() [1/5]

matrix4x3::matrix4x3 ( )

Creates an empty matrix4x3 object.

Creates a matrix4x3 object, where all values within the matrix are set to zero.

◆ matrix4x3() [2/5]

matrix4x3::matrix4x3 ( const vec & a,
const vec & b,
const vec & c,
const vec & d )

Creates a matrix4x3 from four three-dimensional vec objects.

The values of the passed vecs are copied to the new matrix4x3 object.

Parameters
athe vec to assign to matrix4x3::a
bthe vec to assign to matrix4x3::b
cthe vec to assign to matrix4x3::c
dthe vec to assign to matrix4x3::d

◆ matrix4x3() [3/5]

matrix4x3::matrix4x3 ( const matrix3 & rot,
const vec & trans )

Creates a matrix4x3 from a rotation matrix and a translation vector.

The rotation matrix is assigned to members a b c and the translation d. No transformations are made to the values of the passed parameters.

Parameters
rotthe rotation matrix to assign to a b c
transthe translation to assign to d

◆ matrix4x3() [4/5]

matrix4x3::matrix4x3 ( const dualquat & dq)

Creates a matrix4x3 that represents a dual quaternion transformation.

Parameters
dqthe dual quaternion to transform into a matrix4x3

◆ matrix4x3() [5/5]

matrix4x3::matrix4x3 ( const matrix4 & m)
inlineexplicit

Creates a matrix4x3 by truncating w from a matrix4.

The four vecs that make up the matrix4 are copied, omitting the w parameter.

Parameters
mthe matrix4 to truncate into a matrix4x3

Member Function Documentation

◆ identity()

void matrix4x3::identity ( )

Sets this matrix to the identity matrix.

a b c d
x 1 0 0 0
y 0 1 0 0
z 0 0 1 0

◆ lerp() [1/2]

void matrix4x3::lerp ( const matrix4x3 & from,
const matrix4x3 & to,
float t )

Linearly interpolates between two other matrices according to scale t.

If 0 < t < 1 then the matrix will be t% of the way between this and to. Values outside 0..1 imply a linear extrapolation.

Parameters
fromthe first matrix to interpolate from
tothe other matrix to interpolate between
tthe interpolation factor

◆ lerp() [2/2]

void matrix4x3::lerp ( const matrix4x3 & to,
float t )

Linearly interpolates between the two matrices according to scale t.

If 0 < t < 1 then the matrix will be t% of the way between this and to. Values outside 0..1 imply a linear extrapolation.

Parameters
tothe other matrix to interpolate between
tthe interpolation factor

◆ mul()

void matrix4x3::mul ( float k)

Multiplies all values inside the matrix by a scalar constant.

Parameters
kthe scale factor to multiply by

◆ normalize()

void matrix4x3::normalize ( )

Normalizes the first three column vectors.

Sets the three first vectors to have a magnitude of 1. That is, sqrt(x^2 + y^2 + z^2) = 1.

Does not check for a divide-by-zero condition.

◆ rowx()

vec4< float > matrix4x3::rowx ( ) const

Returns the x values of the four vectors as a four-vector.

Returns
a vector containing four x values

◆ rowy()

vec4< float > matrix4x3::rowy ( ) const

Returns the y values of the four vectors as a four-vector.

Returns
a vector containing four y values

◆ rowz()

vec4< float > matrix4x3::rowz ( ) const

Returns the z values of the four vectors as a four-vector.

Returns
a vector containing four z values

◆ scale() [1/3]

void matrix4x3::scale ( const vec & v)

Multiplies the first three vectors by v.x, v.y, and v.z respectively.

Does not modify the fourth matrix element vectord.

Parameters
vthe vector to multiply by

◆ scale() [2/3]

void matrix4x3::scale ( float n)

Scales the first three vector elements in the matrix by the specified amount.

Does not modify the fourth matrix element vectord.

Parameters
nthe scale factor to multiply by

◆ scale() [3/3]

void matrix4x3::scale ( float x,
float y,
float z )

Scales the first three vectors by x, y, and z respectively.

Does not modify the fourth matrix element vectord.

Parameters
xthe scale to multiply the first vector by
ythe scale to multiply the second vector by
zthe scale to multiply the third vector by

◆ setscale() [1/3]

void matrix4x3::setscale ( const vec & v)

Sets the diagonals a.x, b.y, c.z to the given vector's x, y, z values.

Does not modify any of the values except for a.x, b.y, c.z.

Parameters
vthe vector to assign from

◆ setscale() [2/3]

void matrix4x3::setscale ( float n)

Sets the diagonals a.x, b.y, c.z identically to a given value.

@parm n the value to set to

◆ setscale() [3/3]

void matrix4x3::setscale ( float x,
float y,
float z )

Sets the diagonals a.x, b.y, c.z to the given values.

Does not modify any of the values except for a.x, b.y, c.z.

Parameters
xthe first value to set in the diagonal
ythe second value to set in the diagonal
zthe third value to set in the diagonal

◆ settranslation() [1/2]

void matrix4x3::settranslation ( const vec & p)

Copies the p vector into the fourth column vector (d).

Parameters
pthe vector to copy to the d vector.

◆ settranslation() [2/2]

void matrix4x3::settranslation ( float x,
float y,
float z )

Copies x, y, z into the fourth column vector (d).

Parameters
xthe first value to copy into d.x
ythe second value to copy into d.y
zthe third value to copy into d.z

The documentation for this struct was generated from the following file: