Module

GLMatrix.Mat4

#Mat4

data Mat4 :: Type

Instances

#FieldOfView

type FieldOfView = { downDegrees :: Number, leftDegrees :: Number, rightDegrees :: Number, upDegrees :: Number }

#fieldOfView

#add

add :: Mat4 -> Mat4 -> Mat4

Adds two Mat4's

#adjoint

adjoint :: Mat4 -> Mat4

Calculates the adjugate of a Mat4

#determinant

determinant :: Mat4 -> Number

Calculates the determinant of a Mat4

#equals

equals :: Mat4 -> Mat4 -> Boolean

Returns whether or not the matrices have approximately the same elements in the same position

#frob

frob :: Mat4 -> Number

Returns Frobenius norm of a Mat4

#fromRotation

fromRotation :: Number -> Vec3 -> Mat4

Creates a matrix from a given angle around a given axis This is equivalent to (but much faster than): mat4.identity(dest); mat4.rotate(dest, dest, rad, axis);

#fromScaling

fromScaling :: Vec3 -> Mat4

Creates a matrix from a vector scaling This is equivalent to (but much faster than): mat4.identity(dest); mat4.scale(dest, dest, vec);

#fromTranslation

fromTranslation :: Vec3 -> Mat4

Creates a matrix from a vector translation This is equivalent to (but much faster than): mat4.identity(dest); mat4.translate(dest, dest, vec);

#fromValues

fromValues :: Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Mat4

Create a new Mat4 with the given values

#fromXRotation

fromXRotation :: Number -> Mat4

Creates a matrix from the given angle around the X axis This is equivalent to (but much faster than): mat4.identity(dest); mat4.rotateX(dest, dest, rad);

#fromYRotation

fromYRotation :: Number -> Mat4

Creates a matrix from the given angle around the Y axis This is equivalent to (but much faster than): mat4.identity(dest); mat4.rotateY(dest, dest, rad);

#fromZRotation

fromZRotation :: Number -> Mat4

Creates a matrix from the given angle around the Z axis This is equivalent to (but much faster than): mat4.identity(dest); mat4.rotateZ(dest, dest, rad);

#frustum

frustum :: Number -> Number -> Number -> Number -> Number -> Number -> Mat4

Generates a frustum matrix with the given bounds

#getScaling

getScaling :: Mat4 -> Vec3

Returns the scaling factor component of a transformation matrix. If a matrix is built with fromRotationTranslationScale with a normalized Quaternion paramter, the returned vector will be the same as the scaling vector originally supplied.

#getTranslation

getTranslation :: Mat4 -> Vec3

Returns the translation vector component of a transformation matrix. If a matrix is built with fromRotationTranslation, the returned vector will be the same as the translation vector originally supplied.

#identity

identity :: Mat4

Set a Mat4 to the identity matrix

#invert

invert :: Mat4 -> Mat4

Inverts a Mat4

#lookAt

lookAt :: Vec3 -> Vec3 -> Vec3 -> Mat4

Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that actually makes an object look at another object, you should use targetTo instead.

#multiply

multiply :: Mat4 -> Mat4 -> Mat4

Multiplies two Mat4's

#multiplyScalar

multiplyScalar :: Mat4 -> Number -> Mat4

Multiply each element of the matrix by a scalar

#multiplyScalarAndAdd

multiplyScalarAndAdd :: Mat4 -> Mat4 -> Number -> Mat4

Adds two Mat4's after multiplying each element of the second operand by a scalar value

#ortho

ortho :: Number -> Number -> Number -> Number -> Number -> Number -> Mat4

Generates a orthogonal projection matrix with the given bounds

#perspective

perspective :: Number -> Number -> Number -> Number -> Mat4

Generates a perspective projection matrix with the given bounds. Passing null/undefined/no value for far will generate infinite projection matrix.

#perspectiveFromFieldOfView

perspectiveFromFieldOfView :: FieldOfView -> Number -> Number -> Mat4

Generates a perspective projection matrix with the given field of view. This is primarily useful for generating projection matrices to be used with the still experiemental WebVR API.

#rotate

rotate :: Mat4 -> Number -> Vec3 -> Mat4

Rotates a mat4 by the given angle around the given axis

#rotateX

rotateX :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the X axis

#rotateY

rotateY :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the Y axis

#rotateZ

rotateZ :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the Z axis

#scale

scale :: Mat4 -> Vec3 -> Mat4

Scales the mat4 by the dimensions in the given vec3 not using vectorization

#subtract

subtract :: Mat4 -> Mat4 -> Mat4

Subtracts matrix b from matrix a

#targetTo

targetTo :: Vec3 -> Vec3 -> Vec3 -> Mat4

Generates a matrix that makes something look at something else.

#translate

translate :: Mat4 -> Vec3 -> Mat4

Translate a mat4 by the given vector

#transpose

transpose :: Mat4 -> Mat4

Transpose the values of a Mat4

#numbers

numbers :: Mat4 -> Array Number

Extract a number array

#map

map :: (Number -> Number) -> Mat4 -> Mat4

Map a function from Number to Number over it. Note: Since this is not a general container, it cannot be a Functor.

#unsafeFromNumbers

unsafeFromNumbers :: Partial => Array Number -> Mat4

Create a matrix from an array produced by numbers.

#slice

slice :: Int -> Int -> Mat4 -> Array Number

Like Array.slice

#zipWith

zipWith :: (Number -> Number -> Number) -> Mat4 -> Mat4 -> Mat4

Modules