C# Class GarrysModLuaShared.Classes.VMatrix

Representation of a mathematical construct that allows Vectors to be transformed. This object can be created with Global.Matrix function.
Inheritance: LuaObject
Datei anzeigen Open project: OmegaExtern/gmod-csharp-binary-module

Public Methods

Method Description
GetAngles ( ) : Angle

Returns the absolute rotation of the matrix.

GetField ( byte row, byte column ) : double

Returns a specific field in the matrix.

GetForward ( ) : Vector

Gets the forward direction of the matrix. ie. The first column of the matrix, excluding the w coordinate.

GetInverse ( ) : VMatrix

Returns an inverted matrix without modifying the original matrix. Inverting the matrix will fail if its determinant is 0 or close to 0. (ie.its "scale" in any direction is 0.) See also GetInverseTR.

GetInverseTR ( ) : VMatrix

Returns an inverted matrix without modifying the original matrix. This function will not fail, but only works correctly on matrices that contain only translation and/or rotation. Using this function on a matrix with modified scale may return an incorrect inverted matrix. To get the inverse of a matrix that contains other modifications, see GetInverse.

GetRight ( ) : Vector

Gets the right direction of the matrix. ie. The second column of the matrix, negated, excluding the w coordinate.

GetScale ( ) : Vector

Returns the absolute scale of the matrix.

GetTranslation ( ) : Vector

Returns the absolute translation of the matrix.

GetUp ( ) : Vector

Gets the up direction of the matrix. ie. The third column of the matrix, excluding the w coordinate.

Identity ( ) : void

Initializes the matrix as Identity matrix.

Invert ( ) : bool

Inverts the matrix. Inverting the matrix will fail if its determinant is 0 or close to 0. (ie.its "scale" in any direction is 0.) If the matrix cannot be inverted, it does not get modified. See also InvertTR.

InvertTR ( ) : void

Inverts the matrix. This function will not fail, but only works correctly on matrices that contain only translation and/or rotation. Using this function on a matrix with modified scale may return an incorrect inverted matrix. To invert a matrix that contains other modifications, see Invert.

IsIdentity ( ) : bool

Returns whether the matrix is equal to Identity matrix or not.

IsRotationMatrix ( ) : bool

Returns whether the matrix is a rotation matrix or not. Technically it checks if the forward, right and up vectors are orthogonal and normalized.

Rotate ( Angle rotation ) : void

Rotates the matrix by the given angle. Postmultiplies the matrix by a rotation matrix(A = AR).

Scale ( Vector scale ) : void

Scales the matrix by the given vector. Postmultiplies the matrix by a scaling matrix(A = AS).

ScaleTranslation ( double scale ) : void

Scales the absolute translation with the given value.

Set ( VMatrix sourceMatrix ) : void

Copies values from the given matrix object.

SetAngles ( Angle angle ) : void

Sets the absolute rotation of the matrix.

SetField ( byte row, byte column, double value ) : void

Sets a specific field in the matrix.

SetForward ( Vector forward ) : void

Sets the forward direction of the matrix. ie. The first column of the matrix, excluding the w coordinate.

SetRight ( Vector forward ) : void

Sets the right direction of the matrix. ie. The second column of the matrix, negated, excluding the w coordinate.

SetScale ( Vector scale ) : void

Modifies the scale of the matrix while preserving the rotation and translation.

SetTranslation ( Vector translation ) : void

Sets the absolute translation of the matrix.

SetUp ( Vector forward ) : void

Sets the up direction of the matrix. ie. The third column of the matrix, excluding the w coordinate.

ToTable ( ) : LuaTable

Converts the matrix to a 4x4 table. See Global.Matrix function.

Translate ( Vector translation ) : void

Translates the matrix by the given vector aka. adds the vector to the translation. Postmultiplies the matrix by a translation matrix(A = AT).

VMatrix ( LuaTable data )
VMatrix ( int index )

Method Details

GetAngles() public method

Returns the absolute rotation of the matrix.
public GetAngles ( ) : Angle
return Angle

GetField() public method

Returns a specific field in the matrix.
public GetField ( byte row, byte column ) : double
row byte Row of the field whose value is to be retrieved, from 1 to 4.
column byte Column of the field whose value is to be retrieved, from 1 to 4.
return double

GetForward() public method

Gets the forward direction of the matrix. ie. The first column of the matrix, excluding the w coordinate.
public GetForward ( ) : Vector
return Vector

GetInverse() public method

Returns an inverted matrix without modifying the original matrix. Inverting the matrix will fail if its determinant is 0 or close to 0. (ie.its "scale" in any direction is 0.) See also GetInverseTR.
public GetInverse ( ) : VMatrix
return VMatrix

GetInverseTR() public method

Returns an inverted matrix without modifying the original matrix. This function will not fail, but only works correctly on matrices that contain only translation and/or rotation. Using this function on a matrix with modified scale may return an incorrect inverted matrix. To get the inverse of a matrix that contains other modifications, see GetInverse.
public GetInverseTR ( ) : VMatrix
return VMatrix

GetRight() public method

Gets the right direction of the matrix. ie. The second column of the matrix, negated, excluding the w coordinate.
public GetRight ( ) : Vector
return Vector

GetScale() public method

Returns the absolute scale of the matrix.
public GetScale ( ) : Vector
return Vector

GetTranslation() public method

Returns the absolute translation of the matrix.
public GetTranslation ( ) : Vector
return Vector

GetUp() public method

Gets the up direction of the matrix. ie. The third column of the matrix, excluding the w coordinate.
public GetUp ( ) : Vector
return Vector

Identity() public method

Initializes the matrix as Identity matrix.
public Identity ( ) : void
return void

Invert() public method

Inverts the matrix. Inverting the matrix will fail if its determinant is 0 or close to 0. (ie.its "scale" in any direction is 0.) If the matrix cannot be inverted, it does not get modified. See also InvertTR.
public Invert ( ) : bool
return bool

InvertTR() public method

Inverts the matrix. This function will not fail, but only works correctly on matrices that contain only translation and/or rotation. Using this function on a matrix with modified scale may return an incorrect inverted matrix. To invert a matrix that contains other modifications, see Invert.
public InvertTR ( ) : void
return void

IsIdentity() public method

Returns whether the matrix is equal to Identity matrix or not.
public IsIdentity ( ) : bool
return bool

IsRotationMatrix() public method

Returns whether the matrix is a rotation matrix or not. Technically it checks if the forward, right and up vectors are orthogonal and normalized.
public IsRotationMatrix ( ) : bool
return bool

Rotate() public method

Rotates the matrix by the given angle. Postmultiplies the matrix by a rotation matrix(A = AR).
public Rotate ( Angle rotation ) : void
rotation Angle Rotation angle.
return void

Scale() public method

Scales the matrix by the given vector. Postmultiplies the matrix by a scaling matrix(A = AS).
public Scale ( Vector scale ) : void
scale Vector Vector to scale with matrix with.
return void

ScaleTranslation() public method

Scales the absolute translation with the given value.
public ScaleTranslation ( double scale ) : void
scale double Value to scale the translation with.
return void

Set() public method

Copies values from the given matrix object.
public Set ( VMatrix sourceMatrix ) : void
sourceMatrix VMatrix The matrix to copy values from.
return void

SetAngles() public method

Sets the absolute rotation of the matrix.
public SetAngles ( Angle angle ) : void
angle Angle New angles.
return void

SetField() public method

Sets a specific field in the matrix.
public SetField ( byte row, byte column, double value ) : void
row byte Row of the field to be set, from 1 to 4.
column byte Column of the field to be set, from 1 to 4.
value double The value to set in that field.
return void

SetForward() public method

Sets the forward direction of the matrix. ie. The first column of the matrix, excluding the w coordinate.
public SetForward ( Vector forward ) : void
forward Vector The forward direction of the matrix.
return void

SetRight() public method

Sets the right direction of the matrix. ie. The second column of the matrix, negated, excluding the w coordinate.
public SetRight ( Vector forward ) : void
forward Vector The right direction of the matrix.
return void

SetScale() public method

Modifies the scale of the matrix while preserving the rotation and translation.
public SetScale ( Vector scale ) : void
scale Vector The scale to set.
return void

SetTranslation() public method

Sets the absolute translation of the matrix.
public SetTranslation ( Vector translation ) : void
translation Vector New translation.
return void

SetUp() public method

Sets the up direction of the matrix. ie. The third column of the matrix, excluding the w coordinate.
public SetUp ( Vector forward ) : void
forward Vector The up direction of the matrix.
return void

ToTable() public method

Converts the matrix to a 4x4 table. See Global.Matrix function.
public ToTable ( ) : LuaTable
return LuaTable

Translate() public method

Translates the matrix by the given vector aka. adds the vector to the translation. Postmultiplies the matrix by a translation matrix(A = AT).
public Translate ( Vector translation ) : void
translation Vector Vector to translate the matrix by.
return void

VMatrix() public method

public VMatrix ( LuaTable data )
data LuaTable

VMatrix() public method

public VMatrix ( int index )
index int