Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2012-11-19 0:05

Namespace SpiderGL.Math.Mat4

The SpiderGL.Math.Mat4 namespace defines operations on 4x4 matrices.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
The SpiderGL.Math.Mat4 namespace.

Method Summary

Method Attributes Method Name and Description
<static>  
SpiderGL.Math.Mat4.add(a, b)
Component-wise addition of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.add$(a, b)
In-place addition of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.col(m, col)
Gets a column of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.col$(m, col, v)
Sets a column of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.compDiv(a, b)
Component-wise division of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.compDiv$(a, b)
In-place component-wise division of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.compMul(a, b)
Component-wise multiplication of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.compMul$(a, b)
In-place component-wise multiplication of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.copy$(dst, src)
Copies a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.determinant(m)
Calculates the determinant of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.diag(d)
Creates a diagonal 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.dup(n)
Duplicates the input 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.elem(m, row, col)
Gets an element of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.elem$(m, row, col, value)
Sets an element of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.frustum(min, max)
Creates a column-major 4x4 frustum matrix.
<static>  
SpiderGL.Math.Mat4.identity()
Creates an identity 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.identity$(m)
Sets a 4x4 matrix as the identity matrix.
<static>  
SpiderGL.Math.Mat4.inverse(m)
Calculates the inverse of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.inverseTranspose33(m)
Calculates the inverse transpose of the upper-left 3x3 matrix of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.invert$(m)
In-place inversion of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.isIdentity(m)
Tests whether a 4x4 matrix is the identity matrix.
<static>  
SpiderGL.Math.Mat4.lookAt(position, target, position)
Creates a column-major 4x4 look-at matrix.
<static>  
SpiderGL.Math.Mat4.mul(a, b)
Multiplies of two column-major 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.mul$(a, b)
In-place multiplication of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.mul3(m, v, w)
Pre-multiplies a 3-dimensional vector by a column-major 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.mul4(m, v)
Pre-multiplies a 4-dimensional vector by a column-major 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.muls(m, s)
Component-wise multiplication of a 4x4 matrix and a scalar.
<static>  
SpiderGL.Math.Mat4.muls$(m, s)
In-place subtraction of a 4x4 matrix and a scalar.
<static>  
SpiderGL.Math.Mat4.neg(m)
Component-wise negation of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.neg$(m)
In-place negation of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.one()
Creates a 4x4 matrix initialized with one.
<static>  
SpiderGL.Math.Mat4.ortho(min, max)
Creates a column-major 4x4 orthographic projection matrix.
<static>  
SpiderGL.Math.Mat4.perspective(fovY, aspectRatio, zNear, zFar)
Creates a column-major 4x4 perspective projection matrix.
<static>  
SpiderGL.Math.Mat4.rcp(m)
Component-wise reciprocal of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.rotateAngleAxis$(m, angle, axis)
In-place column-major rotation of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.rotationAngleAxis(angle, axis)
Creates a column-major 4x4 rotation matrix.
<static>  
SpiderGL.Math.Mat4.row(m, row)
Gets a row of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.row$(m, row, v)
Sets a row of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.scalar(s)
Creates a 4x4 matrix initialized with a scalar.
<static>  
SpiderGL.Math.Mat4.scale$(m, v)
In-place column-major scaling of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.scaling(v)
Creates a column-major 4x4 scaling matrix.
<static>  
SpiderGL.Math.Mat4.sub(a, b)
Component-wise addition of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.sub$(a, b)
In-place subtraction of two 4x4 matrices.
<static>  
SpiderGL.Math.Mat4.to33(m)
Extracts the upper-left 3x3 matrix from a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.trace(m)
Calculates the trace (i.e.
<static>  
SpiderGL.Math.Mat4.translate$(m, v)
In-place column-major translation of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.translation(v)
Creates a column-major 4x4 translation matrix.
<static>  
SpiderGL.Math.Mat4.transpose(m)
Creates the transpose of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.transpose$(m)
In-place transpose of a 4x4 matrix.
<static>  
SpiderGL.Math.Mat4.zero()
Creates a 4x4 matrix initialized with zero.

Namespace Detail

SpiderGL.Math.Mat4
The SpiderGL.Math.Mat4 namespace. The provided functions operate on 4x4 matrices, represented as standard JavaScript arrays of length 16. In general, matrices are considered in column-major format.

Method Detail

  • <static> {array} SpiderGL.Math.Mat4.add(a, b)
    Component-wise addition of two 4x4 matrices.
    Parameters:
    {array} a
    The first input matrix.
    {array} b
    The first input matrix.
    Returns:
    {array} A new 4x4 matrix r, where r[i] = a[i] + b[i].
  • <static> {array} SpiderGL.Math.Mat4.add$(a, b)
    In-place addition of two 4x4 matrices.
    Parameters:
    {array} a
    The first 4x4 input matrix.
    {array} b
    The second 4x4 input matrix.
    Returns:
    {array} The input matrix a, where a[i] = a[i] + b[i].
  • <static> {array} SpiderGL.Math.Mat4.col(m, col)
    Gets a column of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    {number} col
    The column index.
    Returns:
    {array} A new 4-component array representing the col-th column of m.
  • <static> SpiderGL.Math.Mat4.col$(m, col, v)
    Sets a column of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    {number} col
    The column index.
    {array} v
    A 4-component array that will be copied to the col-th column of m.
  • <static> {array} SpiderGL.Math.Mat4.compDiv(a, b)
    Component-wise division of two 4x4 matrices.
    Parameters:
    {array} a
    The first matrix.
    {array} b
    The second matrix.
    Returns:
    {array} A new 4x4 matrix r, where r[i] = a[i] / b[i].
  • <static> {array} SpiderGL.Math.Mat4.compDiv$(a, b)
    In-place component-wise division of two 4x4 matrices.
    Parameters:
    {array} a
    The first 4x4 input matrix.
    {array} b
    The second 4x4 input matrix.
    Returns:
    {array} The input matrix a, where a[i] = a[i] / b[i].
  • <static> {array} SpiderGL.Math.Mat4.compMul(a, b)
    Component-wise multiplication of two 4x4 matrices.
    Parameters:
    {array} a
    The first matrix.
    {array} b
    The second matrix.
    Returns:
    {array} A new 4x4 matrix r, where r[i] = a[i] * b[i].
  • <static> {array} SpiderGL.Math.Mat4.compMul$(a, b)
    In-place component-wise multiplication of two 4x4 matrices.
    Parameters:
    {array} a
    The first 4x4 input matrix.
    {array} b
    The second 4x4 input matrix.
    Returns:
    {array} The input matrix a, where a[i] = a[i] * b[i].
  • <static> {array} SpiderGL.Math.Mat4.copy$(dst, src)
    Copies a 4x4 matrix.
    Parameters:
    {array} dst
    The destination 4x4 matrix.
    {array} src
    The source 4x4 matrix.
    Returns:
    {array} The input matrix dst, where dst[i] = src[i].
  • <static> {number} SpiderGL.Math.Mat4.determinant(m)
    Calculates the determinant of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {number} The determinant of m.
  • <static> {array} SpiderGL.Math.Mat4.diag(d)
    Creates a diagonal 4x4 matrix.
    Parameters:
    {array} d
    A 4-dimensional vector
    Returns:
    {array} A new 16-component array representing a 4x4 matrix with diagonal elements set to d.
  • <static> {array} SpiderGL.Math.Mat4.dup(n)
    Duplicates the input 4x4 matrix.
    Parameters:
    {array} n
    The input matrix.
    Returns:
    {array} A new 16-component array r, where r[i] = m[i] (same as m.slice(0, 16)).
  • <static> {number} SpiderGL.Math.Mat4.elem(m, row, col)
    Gets an element of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    {number} row
    The element row index.
    {number} col
    The element column index.
    Returns:
    {number} The value of the (i-th, j-th) element of m.
  • <static> SpiderGL.Math.Mat4.elem$(m, row, col, value)
    Sets an element of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    {number} row
    The element row index.
    {number} col
    The element column index.
    {number} value
    The element value to set.
  • <static> {array} SpiderGL.Math.Mat4.frustum(min, max)
    Creates a column-major 4x4 frustum matrix.
    Parameters:
    {array} min
    A 3-component array with the minimum coordinates of the frustum volume.
    {array} max
    A 3-component array with the maximum coordinates of the frustum volume.
    Returns:
    {array} A new column-major 4x4 frustum matrix.
  • <static> {array} SpiderGL.Math.Mat4.identity()
    Creates an identity 4x4 matrix.
    Returns:
    {array} A new 16-component array representing an identity 4x4 matrix.
  • <static> {array} SpiderGL.Math.Mat4.identity$(m)
    Sets a 4x4 matrix as the identity matrix.
    Parameters:
    {array} m
    The input 4x4 matrix to be set as identity.
    Returns:
    {array} The input matrix m.
  • <static> {array} SpiderGL.Math.Mat4.inverse(m)
    Calculates the inverse of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {array} A new 4x4 matrix representing the inverse of m.
  • <static> {array} SpiderGL.Math.Mat4.inverseTranspose33(m)
    Calculates the inverse transpose of the upper-left 3x3 matrix of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {array} A new 3x3 matrix representing the inverse transpose of the upper-left 3x3 matrix of m.
  • <static> {array} SpiderGL.Math.Mat4.invert$(m)
    In-place inversion of a 4x4 matrix.
    Parameters:
    {array} m
    The 4x4 input matrix.
    Returns:
    {array} The inverted input matrix m.
  • <static> {bool} SpiderGL.Math.Mat4.isIdentity(m)
    Tests whether a 4x4 matrix is the identity matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {bool} True if the input matrix is the identity matrix, false otherwise.
  • <static> {array} SpiderGL.Math.Mat4.lookAt(position, target, position)
    Creates a column-major 4x4 look-at matrix.
    Parameters:
    {array} position
    The viewer's position as a 3-dimensional vector.
    {array} target
    The viewer's look-at point as a 3-dimensional vector.
    {array} position
    The viewer's up vector as a 3-dimensional vector.
    Returns:
    {array} A new column-major 4x4 look-at matrix.
  • <static> {array} SpiderGL.Math.Mat4.mul(a, b)
    Multiplies of two column-major 4x4 matrices.
    Parameters:
    {array} a
    The first input matrix.
    {array} b
    The first input matrix.
    Returns:
    {array} A new 4x4 matrix r, result of matrix multiplication r = a * b.
  • <static> {array} SpiderGL.Math.Mat4.mul$(a, b)
    In-place multiplication of two 4x4 matrices.
    Parameters:
    {array} a
    The first 4x4 input matrix.
    {array} b
    The second 4x4 input matrix.
    Returns:
    {array} The input matrix a, where a = a * b.
  • <static> {array} SpiderGL.Math.Mat4.mul3(m, v, w)
    Pre-multiplies a 3-dimensional vector by a column-major 4x4 matrix.
    Parameters:
    {array} m
    The input column-major 4x4 matrix.
    {array} v
    The input 3-dimensional vector.
    {number} w Optional, Default: 1
    The 4th component of the input 3-dimensional vector.
    Returns:
    {array} A new 3-dimensional vector r, where r = m * v.
  • <static> {array} SpiderGL.Math.Mat4.mul4(m, v)
    Pre-multiplies a 4-dimensional vector by a column-major 4x4 matrix.
    Parameters:
    {array} m
    The input column-major 4x4 matrix.
    {array} v
    The input 4-dimensional vector.
    Returns:
    {array} A new 4-dimensional vector r, where r = m * v.
  • <static> {array} SpiderGL.Math.Mat4.muls(m, s)
    Component-wise multiplication of a 4x4 matrix and a scalar.
    Parameters:
    {array} m
    The matrix operand.
    {number} s
    The scalar operand.
    Returns:
    {array} A new 4x4 matrix r, where r[i] = m[i] * s.
  • <static> {array} SpiderGL.Math.Mat4.muls$(m, s)
    In-place subtraction of a 4x4 matrix and a scalar.
    Parameters:
    {array} m
    The 4x4 input matrix.
    {number} s
    The input scalar.
    Returns:
    {array} The input matrix m, where m[i] = m[i] * s.
  • <static> {array} SpiderGL.Math.Mat4.neg(m)
    Component-wise negation of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {array} A new 4x4 matrix r, where r[i] = -m[i].
  • <static> {array} SpiderGL.Math.Mat4.neg$(m)
    In-place negation of a 4x4 matrix.
    Parameters:
    {array} m
    The input 4x4 matrix.
    Returns:
    {array} The input matrix m, where m[i] = -m[i].
  • <static> {array} SpiderGL.Math.Mat4.one()
    Creates a 4x4 matrix initialized with one.
    Returns:
    {array} A new 16-component array r, where r[i] = 1.
  • <static> {array} SpiderGL.Math.Mat4.ortho(min, max)
    Creates a column-major 4x4 orthographic projection matrix.
    Parameters:
    {array} min
    A 3-component array with the minimum coordinates of the parallel viewing volume.
    {array} max
    A 3-component array with the maximum coordinates of the parallel viewing volume.
    Returns:
    {array} A new column-major 4x4 orthographic projection matrix.
  • <static> {array} SpiderGL.Math.Mat4.perspective(fovY, aspectRatio, zNear, zFar)
    Creates a column-major 4x4 perspective projection matrix.
    Parameters:
    {number} fovY
    The vertical field-of-view angle, in radians.
    {number} aspectRatio
    The projection plane aspect ratio.
    {number} zNear
    The distance of the near clipping plane.
    {number} zFar
    The distance of the far clipping plane.
    Returns:
    {array} A new column-major 4x4 perspective projection matrix.
  • <static> {array} SpiderGL.Math.Mat4.rcp(m)
    Component-wise reciprocal of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {array} A new 4x4 matrix r, where r[i] = 1 / m[i].
  • <static> {array} SpiderGL.Math.Mat4.rotateAngleAxis$(m, angle, axis)
    In-place column-major rotation of a 4x4 matrix. The input matrix m will be post-multiplied by a matrix r representing a counter-clockwise rotation about the input axis by the input angle in radians. The input axis need not to be normalized.
    Parameters:
    {array} m
    The input 4x4 matrix.
    {number} angle
    The counter-clockwise rotation angle, in radians.
    {array} axis
    A 3-dimensional vector representing the rotation axis.
    Returns:
    {array} The rotated input matrix m with the same result as m = m * r, where r is a rotation matrix.
  • <static> {array} SpiderGL.Math.Mat4.rotationAngleAxis(angle, axis)
    Creates a column-major 4x4 rotation matrix. The returned matrix will represent a counter-clockwise rotation about the input axis by the input angle in radians. The input axis need not to be normalized.
    Parameters:
    {number} angle
    The counter-clockwise rotation angle, in radians.
    {array} axis
    A 3-dimensional vector representing the rotation axis.
    Returns:
    {array} A new column-major 4x4 rotation matrix.
  • <static> {array} SpiderGL.Math.Mat4.row(m, row)
    Gets a row of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    {number} row
    The row index.
    Returns:
    {array} A new 4-component array representing the row-th row of m.
  • <static> SpiderGL.Math.Mat4.row$(m, row, v)
    Sets a row of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    {number} row
    The row index.
    {array} v
    A 4-component array that will be copied to the row-th row of m.
  • <static> {array} SpiderGL.Math.Mat4.scalar(s)
    Creates a 4x4 matrix initialized with a scalar.
    Parameters:
    {number} s
    The input scalar.
    Returns:
    {array} A new 16-component array r, where r[i] = s.
  • <static> {array} SpiderGL.Math.Mat4.scale$(m, v)
    In-place column-major scaling of a 4x4 matrix.
    Parameters:
    {array} m
    The 4x4 input matrix.
    {array} v
    The scaling amount as a 3-dimensional array.
    Returns:
    {array} The scaled input matrix m with the same result as m = m * s, where s is a scaling matrix.
  • <static> {array} SpiderGL.Math.Mat4.scaling(v)
    Creates a column-major 4x4 scaling matrix.
    Parameters:
    {array} v
    The scaling amount as a 3-dimensional array.
    Returns:
    {array} A new column-major 4x4 scaling matrix.
  • <static> {array} SpiderGL.Math.Mat4.sub(a, b)
    Component-wise addition of two 4x4 matrices.
    Parameters:
    {array} a
    The first input matrix.
    {array} b
    The first input matrix.
    Returns:
    {array} A new 4x4 matrix r, where r[i] = a[i] - b[i].
  • <static> {array} SpiderGL.Math.Mat4.sub$(a, b)
    In-place subtraction of two 4x4 matrices.
    Parameters:
    {array} a
    The first 4x4 input matrix.
    {array} b
    The second 4x4 input matrix.
    Returns:
    {array} The input matrix a, where a[i] = a[i] - b[i].
  • <static> {array} SpiderGL.Math.Mat4.to33(m)
    Extracts the upper-left 3x3 matrix from a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {array} A new 9-component array representing the upper-left 3x3 matrix.
  • <static> {number} SpiderGL.Math.Mat4.trace(m)
    Calculates the trace (i.e. the sum of the diagonal elements) of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {number} The trace of m.
  • <static> {array} SpiderGL.Math.Mat4.translate$(m, v)
    In-place column-major translation of a 4x4 matrix.
    Parameters:
    {array} m
    The 4x4 input matrix.
    {array} v
    The 3-dimensional translation vector.
    Returns:
    {array} The translated input matrix m with the same result as m = m * t, where t is a translation matrix.
  • <static> {array} SpiderGL.Math.Mat4.translation(v)
    Creates a column-major 4x4 translation matrix. The input translation vector will be placed on the 4th column of an identity matrix.
    Parameters:
    {array} v
    A 3-dimensional vector with translation offsets.
    Returns:
    {array} A new column-major 4x4 translation matrix.
  • <static> {array} SpiderGL.Math.Mat4.transpose(m)
    Creates the transpose of a 4x4 matrix.
    Parameters:
    {array} m
    The input matrix.
    Returns:
    {array} A new 4x4 matrix representing the transpose of m.
  • <static> {array} SpiderGL.Math.Mat4.transpose$(m)
    In-place transpose of a 4x4 matrix.
    Parameters:
    {array} m
    The 4x4 input matrix.
    Returns:
    {array} The transposed input matrix m.
  • <static> {array} SpiderGL.Math.Mat4.zero()
    Creates a 4x4 matrix initialized with zero.
    Returns:
    {array} A new 16-component array r, where r[i] = 0.