smat4d.md 3.6 KB


id: smat4d title: SMat4D

sidebar_label: SMat4D

A standard 4x4 transformation matrix.

Constructors

Method New(a:Double, b:Double, c:Double, d:Double, e:Double, f:Double, g:Double, h:Double, i:Double, j:Double, k:Double, l:Double, m:Double, n:Double, o:Double, p:Double)

Creates a new SMat4D from the supplied arguments.


Operators

Method Operator+:SMat4D(z:SMat4D Var)

Adds z to the matrix, returning a new matrix.


Method Operator-:SMat4D(z:SMat4D Var)

Subtracts z from the matrix, returning a new matrix.


Method Operator*:SMat4D(z:SMat4D Var)

Multiplies the matrix by z, the dot product, returning a new matrix.


Methods

Method Apply:SVec2D(v:SVec2D)

Applies the matrix to the vector v, returning a new vector.


Method Apply:SVec3D(v:SVec3D)

Applies the 4x4 matrix b to the vector, returning a new vector.


Method Apply:SVec4D(v:SVec4D)

Applies the 4x4 matrix b to the vector, returning a new vector.


Method Adjoint:SMat4D()

Returns the transposition of the cofactor matrix.


Method CompMul:SMat4D(z:SMat4D Var)

Multiplies the matrix by z by its components, or element-wise matrix multiplication, returning a new matrix.


Method Determinant:Double()

Returns the determinant of the matrix.


Method Invert:SMat4D()

The inverse of this matrix.

An inverted matrix is such that if multiplied by the original would result in identity matrix. If some matrix transforms vectors in a particular way, then the inverse matrix can transform them back.


Method Rotate:SMat4D(axis:SVec3D, angle:Double)

Creates a rotation matrix, rotated angle degrees around the point axis.


Method Scale:SMat4D(s:SVec3D)

Scales the matrix, return the new scaled matrix.


Method Transpose:SMat4D()

Returns the transpose of this matrix.

The transposed matrix is the one that has the columns exchanged with its rows.


Method Translate:SMat4D(s:SVec3D)

Translates the matrix to s.


Method ToString:String() Override

Returns a String representation of the matrix.


Functions

Function Identity:SMat4D()

Returns the identity matrix.


Function Frustum:SMat4D(l:Double, r:Double, b:Double, t:Double, n:Double, f:Double)

Returns a projection matrix with a viewing frustum defined by the plane coordinates passed in.


Function LookAt:SMat4D(eye:SVec3D, pos:SVec3D, upDir:SVec3D)

Computes a transformation matrix that corresponds to a camera viewing the eye from the pos.

The right-hand vector is perpendicular to the up vector.


Function Orthogonal:SMat4D(width:Double, height:Double, zNear:Double, zFar:Double)

Creates an orthogonal projection matrix.

The returned matrix, when used as a Camera's projection matrix, creates a view showing the area between width and height, with zNear and zFar as the near and far depth clipping planes.


Function Perspective:SMat4D(fov:Double, w:Double, h:Double, n:Double, f:Double)

Creates a perspective projection matrix.


Function Rotation:SMat4D(axis:SVec3D, angle:Double)

Returns a rotation matrix on the given axis and angle degrees.


Function Scaling:SMat4D(s:SVec3D)

Creates a scaling matrix.


Function Translation:SMat4D(s:SVec3D)

Creates a translation matrix.