Module

GLMatrix.Mat4

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

#Mat4Source

data Mat4 :: Type

#FieldOfViewSource

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

#fieldOfViewSource

add :: Mat4 -> Mat4 -> Mat4

Calculates the adjugate of a Mat4

#determinantSource

determinant :: Mat4 -> Number

Calculates the determinant of a Mat4

#equalsSource

equals :: Mat4 -> Mat4 -> Boolean

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

#frobSource

frob :: Mat4 -> Number

Returns Frobenius norm of a Mat4

#fromRotationSource

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);

#fromScalingSource

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);

#fromTranslationSource

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);

#fromValuesSource

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

#fromXRotationSource

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);

#fromYRotationSource

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);

#fromZRotationSource

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);

#frustumSource

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

Generates a frustum matrix with the given bounds

#getScalingSource

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.

#getTranslationSource

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.

#identitySource

identity :: Mat4

Set a Mat4 to the identity matrix

#invertSource

invert :: Mat4 -> Mat4

Inverts a Mat4

#lookAtSource

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.

#multiplySource

multiply :: Mat4 -> Mat4 -> Mat4

Multiplies two Mat4's

#multiplyScalarSource

multiplyScalar :: Mat4 -> Number -> Mat4

Multiply each element of the matrix by a scalar

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

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

#orthoSource

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

Generates a orthogonal projection matrix with the given bounds

#perspectiveSource

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.

#perspectiveFromFieldOfViewSource

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.

#rotateSource

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

Rotates a mat4 by the given angle around the given axis

#rotateXSource

rotateX :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the X axis

#rotateYSource

rotateY :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the Y axis

#rotateZSource

rotateZ :: Mat4 -> Number -> Mat4

Rotates a matrix by the given angle around the Z axis

#scaleSource

scale :: Mat4 -> Vec3 -> Mat4

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

#subtractSource

subtract :: Mat4 -> Mat4 -> Mat4

Subtracts matrix b from matrix a

#targetToSource

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

Generates a matrix that makes something look at something else.

#translateSource

translate :: Mat4 -> Vec3 -> Mat4

Translate a mat4 by the given vector

#transposeSource

transpose :: Mat4 -> Mat4

Transpose the values of a Mat4

numbers :: Mat4 -> Array Number

Extract a number array

#mapSource

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 :: Partial => Array Number -> Mat4

Create a matrix from an array produced by numbers.

#sliceSource

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

Like Array.slice

#zipWithSource

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