Skip to main content

vrmatrix4

Module: Maths

A matrix.

#include <lua_api.h>

Public Functions

TypeName
vrmatrix4applyScale(Any v)
(vrMatScale) Return M scaled by vector V. If V is a scalar then a vector in which x=v, y=v, z=v will be used.
Anycopy()
(vrCopy) Returns a copy of a Vector, Matrix, Ray, Sphere, AABBox, Quaternion or Plane
numberdeterminant()
(vrMatDeterminant) Returns the determinant of the matrix
numberget(number x, number y)
(vrMatGetValue) Get the value of an element of a matrix.
vrmatrix4getInverse()
(vrMatInverse) Returns the inverse of a 4x4 matrix.
AnygetTranspose()
(vrMatTranspose) Returns the tranpose of a 3x3 matrix, or a 4x4 matrix with the 3x3 component transposed.
Anynormalise()
(vrNormalise) Returns normalised vector/matrix.
Anyoperator*()
Anyoperator+()
Anyoperator-()
Anyoperator/()
Anyoperator=()
AnyorthoNormalise()
(vrMatOrthoNormalise) Returns an orthogonal matrix.
vrmatrix4rotateX(number v)
(vrMatRotateEulerX) Return M rotated on the X axis by angle V.
vrmatrix4rotateY(number v)
(vrMatRotateEulerY) Return M rotated on the Y axis by angle V.
vrmatrix4rotateZ(number v)
(vrMatRotateEulerZ) Return M rotated on the Z axis by angle V.
voidset(number x, number y, number v)
(vrMatSetValue) Set the value of an element of a matrix.
stringtoString()
(vrMatToString) Get a string representation of a matrix.
vrmatrix4translate(vrvec3](../classes/vrvec3.mdx) v)
(vrMatTranslate) Return M translated by the vector V.

Public Attributes

TypeName
vrvec3forward
Forward vector.
vrvec3position
Position vector.
vrvec3right
Right vector.
vrvec3rotation
Rotation component (Euler angles)
vrvec3scale
Scale component.
vrvec3up
Up vector.

Public Functions Documentation

applyScale

vrmatrix4 applyScale(
Any v
)

(vrMatScale) Return M scaled by vector V. If V is a scalar then a vector in which x=v, y=v, z=v will be used.

Parameters:

  • v The vector or scalar to scale M by.

copy

Any copy()

(vrCopy) Returns a copy of a Vector, Matrix, Ray, Sphere, AABBox, Quaternion or Plane

determinant

number determinant()

(vrMatDeterminant) Returns the determinant of the matrix

get

number get(
number x,
number y
)

(vrMatGetValue) Get the value of an element of a matrix.

Parameters:

  • x The column of the element to select.
  • y The row of the element to select.

getInverse

vrmatrix4 getInverse()

(vrMatInverse) Returns the inverse of a 4x4 matrix.

getTranspose

Any getTranspose()

(vrMatTranspose) Returns the tranpose of a 3x3 matrix, or a 4x4 matrix with the 3x3 component transposed.

Return: vrmat3 or vrmat4 depending on the type passed in

normalise

Any normalise()

(vrNormalise) Returns normalised vector/matrix.

Return: Normalised vector or matrix depending on the type passed in

operator*

Any operator*()

operator+

Any operator+()

operator-

Any operator-()

operator/

Any operator/()

operator=

Any operator=()

orthoNormalise

Any orthoNormalise()

(vrMatOrthoNormalise) Returns an orthogonal matrix.

Return: Orthogonal mat3 or mat4 depending on the type passed in

rotateX

vrmatrix4 rotateX(
number v
)

(vrMatRotateEulerX) Return M rotated on the X axis by angle V.

Parameters:

  • v The angle to rotate M by.

rotateY

vrmatrix4 rotateY(
number v
)

(vrMatRotateEulerY) Return M rotated on the Y axis by angle V.

Parameters:

  • v The angle to rotate M by.

rotateZ

vrmatrix4 rotateZ(
number v
)

(vrMatRotateEulerZ) Return M rotated on the Z axis by angle V.

Parameters:

  • v The angle to rotate M by.

set

void set(
number x,
number y,
number v
)

(vrMatSetValue) Set the value of an element of a matrix.

Parameters:

  • x The column of the element to select.
  • y The row of the element to select.
  • v The value to set the element.

toString

string toString()

(vrMatToString) Get a string representation of a matrix.

translate

vrmatrix4 translate(
vrvec3 v
)

(vrMatTranslate) Return M translated by the vector V.

Parameters:

  • v The vector to translate the matrix by.

Public Attributes Documentation

forward

vrvec3 forward;

Forward vector.

position

vrvec3 position;

Position vector.

vrvec3 right;

Right vector.

rotation

vrvec3 rotation;

Rotation component (Euler angles)

scale

vrvec3 scale;

Scale component.

up

vrvec3 up;

Up vector.