Module

GLMatrix.Mat4

Package
purescript-gl-matrix
Repository
dirkz/purescript-gl-matrix

#Mat4 Source

data Mat4 :: Type

Instances

#FieldOfView Source

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

#add Source

add :: Mat4 -> Mat4 -> Mat4

Adds two Mat4's

#adjoint Source

adjoint :: Mat4 -> Mat4

Calculates the adjugate of a Mat4

#determinant Source

determinant :: Mat4 -> Number

Calculates the determinant of a Mat4

#equals Source

equals :: Mat4 -> Mat4 -> Boolean

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

#frob Source

frob :: Mat4 -> Number

Returns Frobenius norm of a Mat4

#fromRotation Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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 Source

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

Generates a frustum matrix with the given bounds

#getScaling Source

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 Source

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 Source

identity :: Mat4

Set a Mat4 to the identity matrix

#invert Source

invert :: Mat4 -> Mat4

Inverts a Mat4

#lookAt Source

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 Source

multiply :: Mat4 -> Mat4 -> Mat4

Multiplies two Mat4's

#multiplyScalar Source

multiplyScalar :: Mat4 -> Number -> Mat4

Multiply each element of the matrix by a scalar

#multiplyScalarAndAdd Source

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

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

#ortho Source

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

Generates a orthogonal projection matrix with the given bounds

#perspective Source

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 Source

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 Source

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

Rotates a mat4 by the given angle around the given axis

#rotateX Source

rotateX :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the X axis

#rotateY Source

rotateY :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the Y axis

#rotateZ Source

rotateZ :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the Z axis

#scale Source

scale :: Mat4 -> Vec3 -> Mat4

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

#subtract Source

subtract :: Mat4 -> Mat4 -> Mat4

Subtracts matrix b from matrix a

#targetTo Source

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

Generates a matrix that makes something look at something else.

#translate Source

translate :: Mat4 -> Vec3 -> Mat4

Translate a mat4 by the given vector

#transpose Source

transpose :: Mat4 -> Mat4

Transpose the values of a Mat4

#numbers Source

numbers :: Mat4 -> Array Number

Extract a number array

#map Source

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 Source

unsafeFromNumbers :: Partial => Array Number -> Mat4

Create a matrix from an array produced by numbers.

#slice Source

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

Like Array.slice

#zipWith Source

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