Graphmath.Mat44

This is the 3D mathematics library for graphmath.

This submodule handles 4x4 matrices using tuples of floats.

Summary

add(a, b)

add(a,b) adds one 4x4 matrix to another

apply(a, v)

apply( a, v ) transforms a vector v by a 4x4 matrix a

apply_left(v, a)

apply_left( v, a ) transforms a vector v by a 4x4 matrix a

apply_left_transpose(v, a)

apply_left_transpose( v, a ) transforms a vector v by a 4x4 matrix a transposed

apply_transpose(a, v)

apply_transpose( a, v ) transforms a vector v by a 4x4 matrix a transposed

at(a, i, j)

at( a, i, j) selects the element of a 4x4 matrix at row i and column j

column0(a)

column0( a ) selects the first column from a matrix 4x4 as a vec4

column1(a)

column1( a ) selects the second column from a matrix 4x4 as a vec4

column2(a)

column2( a ) selects the third column from a matrix 4x4 as a vec4

column3(a)

column3( a ) selects the fourth column from a matrix 4x4 as a vec4

diag(a)

diag( a ) selects the diagonal from a matrix 4x4 as a vec4

identity()

identity() creates a 4x4 identity matrix

multiply(a, b)

multiply( a, b ) multiply two matrices a and b together

multiply_transpose(a, b)

multiply_transpose( a, b ) multiply two matrices a and b transpose together

row0(a)

row0( a ) selects the first row from a matrix 4x4 as a vec4

row1(a)

row1( a ) selects the second row from a matrix 4x4 as a vec4

row2(a)

row2( a ) selects the third row from a matrix 4x4 as a vec4

row3(a)

row3( a ) selects the fourth row from a matrix 4x4 as a vec4

scale(a, k)

scale( a, k ) scales every element in a matrix a by coefficient k

subtract(a, b)

subtract(a,b) subtracts one 4x4 matrix from another

zero()

zero() creates a 4x4 zero matrix

Types

mat44 :: {float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float}

vec4 :: {float, float, float, float}

Functions

add(a, b)

Specs:

add(a,b) adds one 4x4 matrix to another.

apply(a, v)

Specs:

apply( a, v ) transforms a vector v by a 4x4 matrix a.

apply_left(v, a)

Specs:

apply_left( v, a ) transforms a vector v by a 4x4 matrix a.

apply_left_transpose(v, a)

Specs:

apply_left_transpose( v, a ) transforms a vector v by a 4x4 matrix a transposed.

apply_transpose(a, v)

Specs:

apply_transpose( a, v ) transforms a vector v by a 4x4 matrix a transposed.

at(a, i, j)

Specs:

  • at(mat44, Integer, Integer) :: float

at( a, i, j) selects the element of a 4x4 matrix at row i and column j.

column0(a)

Specs:

column0( a ) selects the first column from a matrix 4x4 as a vec4.

column1(a)

Specs:

column1( a ) selects the second column from a matrix 4x4 as a vec4.

column2(a)

Specs:

column2( a ) selects the third column from a matrix 4x4 as a vec4.

column3(a)

Specs:

column3( a ) selects the fourth column from a matrix 4x4 as a vec4.

diag(a)

Specs:

diag( a ) selects the diagonal from a matrix 4x4 as a vec4.

identity()

Specs:

identity() creates a 4x4 identity matrix.

multiply(a, b)

Specs:

multiply( a, b ) multiply two matrices a and b together.

multiply_transpose(a, b)

Specs:

multiply_transpose( a, b ) multiply two matrices a and b transpose together.

row0(a)

Specs:

row0( a ) selects the first row from a matrix 4x4 as a vec4.

row1(a)

Specs:

row1( a ) selects the second row from a matrix 4x4 as a vec4.

row2(a)

Specs:

row2( a ) selects the third row from a matrix 4x4 as a vec4.

row3(a)

Specs:

row3( a ) selects the fourth row from a matrix 4x4 as a vec4.

scale(a, k)

Specs:

scale( a, k ) scales every element in a matrix a by coefficient k.

subtract(a, b)

Specs:

subtract(a,b) subtracts one 4x4 matrix from another..

zero()

Specs:

zero() creates a 4x4 zero matrix.