Math.Matrix4x4

(in ./Carbon/Math/Matrix4x4.lua)

A 4x4 row-major matrix.

Inherits Math.Matrix3x3, Math.Matrix


Methods

class public Matrix4x4:NewFromLooseQuaternion(loose<Quaternion> quaternion)

Returns Matrix4x4

object public Matrix4x4:InitFromLooseQuaternion(loose<Quaternion> quaternion)

Returns void

  • required quaternion: The quaternion to initialize the matrix with.

Creates a new Matrix4x4 from a Quaternion.


class public Matrix4x4:NewFromQuaternion(Quaternion quaternion)

Returns Matrix4x4

object public Matrix4x4:InitFromQuaternion(Quaternion quaternion)

Returns void

  • required quaternion: The quaternion to initialize the matrix with.

Creates a new Matrix4x4 from a Quaternion.


class public Matrix4x4:NewLookAt(Vector3 eye, Vector3 center, Vector3 up)

Returns Matrix4x4

  • required eye: The position of the observer.
  • required center: The focus of the observer.
  • required up: The upwards direction for the observer.

Creates a projection to look at a point from another.


class public Matrix4x4:NewLooseFromLooseQuaternion(loose<Quaternion> quaternion)

Returns loose<Matrix4x4>

  • required quaternion: The quaternion, in loose form, to convert.

Takes a loose Quaternion and returns a loose rotation matrix from it.


class public Matrix4x4:NewLooseFromQuaternion(Quaternion quaternion)

Returns loose<Matrix4x4>

  • required quaternion: The quaternion to convert.

Takes a Quaternion and returns a loose rotation matrix from it.


class public Matrix4x4:NewOrthographic(number l, number r, number t, number b, number near, number far)

Returns Matrix4x4

  • required l: The left edge of the projection.
  • required r: The right edge of the projection.
  • required t: The top edge of the projection.
  • required b: The bottom edge of the projection.
  • required near: The near plane of the projection.
  • required far: The far plane of the projection.

Creates an orthographic projection matrix with the given properties


class public Matrix4x4:NewPerspective(number fov, number aspect, number near, number far)

Returns Matrix4x4

  • required fov: The field of view in radians.
  • required aspect: The aspect ratio of the observer.
  • required near: The near plane of the projection.
  • required far: The far plane of the projection.

Creates a perspective matrix with the given properties.


class public Matrix4x4:LooseRotationX(number t, ...)

Returns loose<Matrix4x4>

  • required t: The amount to rotate, in radians.
  • optional ...: Data to pipe through the method.

Returns a loose<Matrix4x4> representing a rotation t radians around the X axis.


class public Matrix4x4:RotationX(number t, ...)

Returns Matrix4x4

  • required t: The amount to rotate, in radians.
  • optional ...: Data to pipe through the method.

Returns a Matrix4x4 representing a rotation t radians around the X axis.


object public Matrix4x4:RotateX(number t, [Matrix4x4 out])

Returns Matrix4x4

  • required t: The amount to rotate, in radians.
  • optional out: Where to put the resulting data.

Rotates the matrix around the X axis.


object public Matrix4x4:RotateX!(number t)

Returns self

object public Matrix4x4:RotateXInPlace(number t)

Returns self

  • required t: The amount to rotate, in radians.

Rotates the matrix around the X axis in place.


class public Matrix4x4:LooseRotationY(number t, ...)

Returns loose<Matrix4x4>

  • required t: The amount to rotate, in radians.
  • optional ...: Data to pipe through the method.

Returns a loose<Matrix4x4> representing a rotation t radians around the Y axis.


class public Matrix4x4:RotationY(number t, ...)

Returns Matrix4x4

  • required t: The amount to rotate, in radians.
  • optional ...: Data to pipe through the method.

Returns a Matrix4x4 representing a rotation t radians around the Y axis.


object public Matrix4x4:RotateY(number t, [Matrix4x4 out])

Returns Matrix4x4

  • required t: The amount to rotate, in radians.
  • optional out: Where to put the resulting data.

Rotates the matrix around the Y axis.


object public Matrix4x4:RotateY!(number t)

Returns self

object public Matrix4x4:RotateXInPlace(number t)

Returns self

  • required t: The amount to rotate, in radians.

Rotates the matrix around the Y axis in place.


class public Matrix4x4:LooseRotationZ(number t, ...)

Returns loose<Matrix4x4>

  • required t: The amount to rotate, in radians.
  • optional ...: Data to pipe through the method.

Returns a loose<Matrix4x4> representing a rotation t radians around the Z axis.


class public Matrix4x4:RotationZ(number t, ...)

Returns Matrix4x4

  • required t: The amount to rotate, in radians.
  • optional ...: Data to pipe through the method.

Returns a Matrix4x4 representing a rotation t radians around the Z axis.


object public Matrix4x4:RotateZ(number t, [Matrix4x4 out])

Returns Matrix4x4

  • required t: The amount to rotate, in radians.
  • optional out: Where to put the resulting data.

Rotates the matrix around the Z axis.


object public Matrix4x4:RotateZ!(number t)

Returns self

object public Matrix4x4:RotateXInPlace(number t)

Returns self

  • required t: The amount to rotate, in radians.

Rotates the matrix around the Z axis in place.


class public Matrix4x4:LooseScaling(number x, number y, number z)

Returns Matrix4x4

  • required x: The amount to scale on the X axis.
  • required y: The amount to scale on the Y axis.
  • required z: The amount to scale on the Z axis.

Returns a loose<Matrix4x4> representing a scaling transformation.


class public Matrix4x4:Rotation(number x, number y, number z, [Matrix4x4 out])

Returns Matrix4x4

  • required x: The x component of the rotation.
  • required y: The y component of the rotation.
  • required z: The z component of the rotation.
  • optional out: Where to put the data for the rotation.

Creates a rotation matrix with the given Euler angles.


class public Matrix4x4:Scale(number x, number y, number z, [Matrix4x4 out])

Returns Matrix4x4

  • required x: The amount to scale on the X axis.
  • required y: The amount to scale on the Y axis.
  • required z: The amount to scale on the Z axis.
  • optional out: Where to put the resulting data.

Scales the Matrix4x4, optionally outputting to an existing Matrix4x4.


class public Matrix4x4:Scale!(number x, number y, number z)

Returns self

class public Matrix4x4:ScaleInPlace(number x, number y, number z)

Returns self

  • required x: The amount to scale on the X axis.
  • required y: The amount to scale on the Y axis.
  • required z: The amount to scale on the Z axis.

Scales the Matrix4x4 in place.


class public Matrix4x4:Scaling(number x, number y, number z)

Returns Matrix4x4

  • required x: The amount to scale on the X axis.
  • required y: The amount to scale on the Y axis.
  • required z: The amount to scale on the Z axis.

Returns a Matrix4x4 representing a scaling transformation.


class public Matrix4x4:Translation(number x, number y, number z, [Matrix4x4 out])

Returns Matrix4x4

object public Matrix4x4:Translate(number x, number y, number z, [Matrix4x4 out])

Returns Matrix4x4

  • required x: The x coordinate of the translation.
  • required y: The y coordinate of the translation.
  • required z: The z coordinate of the translation.
  • optional out: Where to put the data for the translation.

Creates a translation matrix. The Translate form offsets from an existing matrix.


object public Matrix4x4:GetDeterminant()

Returns number

Returns the determinant of the matrix.


object public Matrix4x4:GetInverse([Matrix4x4 out])

Returns Matrix4x4

  • optional out: Where to put the data, a new matrix if not specified.

Yields the inverse of the matrix, optionally outputting into an existing matrix.


object public Matrix4x4:Rotate(number x, number y, number z, [Matrix4x4 out])

Returns Matrix4x4

  • required x: The x component of the rotation.
  • required y: The y component of the rotation.
  • required z: The z component of the rotation.
  • optional out: Where to put the data for the rotation.

Rotates the Matrix4x4 and outputs its data to out, or a new Matrix4x4 if not given.


object public Matrix4x4:Rotate!(number x, number y, number z)

Returns self

object public Matrix4x4:RotateInPlace(number x, number y, number z)

Returns self

  • required x: The x component of the rotation.
  • required y: The y component of the rotation.
  • required z: The z component of the rotation.

Rotates the Matrix4x4 in place.


Properties

[none]