API Docs for: 0.5.5
Show:

kick.math.Mat4 Class

Defined in: kick/math/Mat4.js:53
Module: kick.math

mat4 - 4x4 Matrix
Any javascript array containing at least 16 numeric elements can serve as a Mat4

Item Index

Methods

Methods

adjoint

(
  • out
  • a
)
kick.math.Mat4 static

Calculates the adjugate of a mat4

Parameters:

Returns:

clone

(
  • a
)
kick.math.Mat4 static

Creates a new mat4 initialized with values from an existing matrix

Parameters:

Returns:

kick.math.Mat4:

a new 4x4 matrix

copy

(
  • out
  • a
)
kick.math.Mat4 static

Copies the values of one mat4 to another

Parameters:

Returns:

create

() kick.math.Mat4 static

Creates a new identity Mat4 using the Float32Arrat

Returns:

kick.math.Mat4:

New mat4

decompose

(
  • mat
  • translate
  • rotate
  • scale
)
static

Returns array with translate, rotate scale

Parameters:

Returns:

Array_tranlate_rotate_scale

determinant

(
  • a
)
Number static

Calculates the determinant of a mat4

Parameters:

Returns:

Number:

determinant of mat

fromQuat

(
  • out
  • q
)
kick.math.Mat4 static

Calculates a 4x4 matrix from the given quaternion

Parameters:

Returns:

fromRotationTranslation

(
  • out
  • q
  • v
)
kick.math.Mat4 static

mat4.fromRotationTranslation Creates a matrix from a quaternion rotation and vector translation This is equivalent to (but much faster than):

mat4.identity(dest);
mat4.translate(dest, vec);
var quatMat = mat4.create();
quat.toMat4(quat, quatMat);
mat4.multiply(dest, quatMat);

Parameters:

Returns:

frustum

(
  • out
  • left
  • right
  • bottom
  • top
  • near
  • far
)
kick.math.Mat4 static

Generates a frustum matrix with the given bounds

Parameters:

  • out kick.math.Mat4

    mat4 frustum matrix will be written into

  • left Number

    Left bound of the frustum

  • right Number

    Right bound of the frustum

  • bottom Number

    Bottom bound of the frustum

  • top Number

    Top bound of the frustum

  • near Number

    Near bound of the frustum

  • far Number

    Far bound of the frustum

Returns:

identity

(
  • out
)
kick.math.Mat4 static

Sets a mat4 to an identity matrix

Parameters:

Returns:

invert

(
  • out
  • a
)
kick.math.Mat4 static

Inverts a Mat4

Parameters:

Returns:

lookAt

(
  • out
  • eye
  • center
  • up
)
kick.math.Mat4 static

Generates a look-at matrix with the given eye position, focal point, and up axis

Parameters:

Returns:

multiply

(
  • out
  • a
  • b
)
kick.math.Mat4 static

Performs a matrix multiplication

Parameters:

Returns:

multiplyVec3

(
  • out
  • mat
  • vec
)
kick.math.Vec3 static

Transforms a vec3 with the given matrix
4th vector component is implicitly '1'

Parameters:

Returns:

multiplyVec3Vector

(
  • out
  • mat
  • vec
)
kick.math.Vec3 static

Transforms a vec3 with the given matrix
4th vector component is implicitly '0'

Parameters:

Returns:

multiplyVec4

(
  • out
  • mat
  • vec
)
kick.math.Vec4 static

Transforms a vec4 with the given matrix

Parameters:

Returns:

ortho

(
  • out
  • left
  • right
  • bottom
  • top
  • near
  • far
)
kick.math.Mat4 static

Generates a orthogonal projection matrix with the given bounds

Parameters:

  • out kick.math.Mat4

    mat4 frustum matrix will be written into

  • left Number

    Left bound of the frustum

  • right Number

    Right bound of the frustum

  • bottom Number

    Bottom bound of the frustum

  • top Number

    Top bound of the frustum

  • near Number

    Near bound of the frustum

  • far Number

    Far bound of the frustum

Returns:

perspective

(
  • out
  • fovy
  • aspect
  • near
  • far
)
kick.math.Mat4 static

Generates a perspective projection matrix with the given bounds

Parameters:

  • out kick.math.Mat4

    mat4 frustum matrix will be written into

  • fovy Number

    Vertical field of view in radians

  • aspect Number

    Aspect ratio. typically viewport width/height

  • near Number

    Near bound of the frustum

  • far Number

    Far bound of the frustum

Returns:

rotate

(
  • out
  • a
  • rad
  • axis
)
kick.math.Mat4 static

Rotates a matrix by the given angle around the specified axis
If rotating around a primary axis (X,Y,Z) one of the specialized rotation functions should be used instead for performance

Parameters:

Returns:

rotateX

(
  • out
  • a
  • rad
)
kick.math.Mat4 static

Rotates a matrix by the given angle around the X axis

Parameters:

Returns:

rotateY

(
  • out
  • a
  • rad
)
kick.math.Mat4 static

Rotates a matrix by the given angle around the Y axis

Parameters:

Returns:

rotateZ

(
  • out
  • a
  • rad
)
kick.math.Mat4 static

Rotates a matrix by the given angle around the Z axis

Parameters:

Returns:

scale

(
  • out
  • a
  • v
)
kick.math.Mat4 static

Scales a matrix by the given vector

Parameters:

Returns:

setTRS

(
  • dest
  • translate
  • rotateQuat
  • scale
)
kick.math.Mat4 static

Set translate, rotate, scale

Parameters:

Returns:

setTRSInverse

(
  • out
  • translate
  • rotateQuat
  • scale
)
kick.math.Mat4 static

Set the inverse of translate, rotate, scale

Parameters:

Returns:

str

(
  • mat
)
String static

Returns a string representation of a mat4

Parameters:

Returns:

String:

string representation of mat

strPretty

(
  • mat
)
String static

Returns a string representation of a mat4 printed as a 4x4 matrix (on 4 lines)

Parameters:

Returns:

String:

string representation of mat

toInverseMat3

(
  • mat
  • out
)
kick.math.Mat3 static

Calculates the inverse of the upper 3x3 elements of a mat4 and copies the result into a mat3
The resulting matrix is useful for calculating transformed normals

Parameters:

Returns:

toMat3

(
  • out
  • mat
)
kick.math.Mat3 static

Copies the upper 3x3 elements of a mat4 into a mat3

Parameters:

Returns:

toNormalMat3

(
  • out
  • mat
)
kick.math.Mat3 static

Calculates the normal matrix (that is the transpose of the inverse of the upper 3x3 elements of a mat4) and copies the result into a mat3

Parameters:

Returns:

toRotationMat

(
  • out
  • mat
)
kick.math.Mat4 static

Copies the upper 3x3 elements of a mat4 into another mat4

Parameters:

Returns:

translate

(
  • out
  • a
  • v
)
kick.math.Mat4 static

Translates a matrix by the given vector

Parameters:

Returns:

transpose

(
  • out
  • a
)
kick.math.Mat4 static

Transposes a mat4 (flips the values over the diagonal)

Parameters:

Returns: