C# Class MatrixHelper, Bad-Company-2-Map-Editor

显示文件 Open project: Powback/Bad-Company-2-Map-Editor Class Usage Examples

Public Properties

Property Type Description
IdentityMatrix Matrix4x4
IdentityQuaternion Quaternion

Public Methods

Method Description
DecomposeMatrix ( Matrix4x4 matrix, Vector3 &localPosition, Quaternion &localRotation, Vector3 &localScale ) : void

Extract position, rotation and scale from TRS matrix.

ExtractRotationFromMatrix ( Matrix4x4 matrix ) : Quaternion
ExtractScaleFromMatrix ( Matrix4x4 matrix ) : Vector3

Extract scale from transform matrix.

ExtractTranslationFromMatrix ( Matrix4x4 matrix ) : Vector3

Extract translation from transform matrix.

MatrixToQuaternion ( Matrix4x4 m ) : Quaternion
MatrixToRotation ( Matrix4x4 m ) : Quaternion
QuatFromMatrix ( Matrix4x4 m ) : Quaternion
QuaternionFromMatrix ( Matrix4x4 m ) : Quaternion

Extract rotation quaternion from transform matrix.

SetTransformFromMatrix ( Transform transform, Matrix4x4 &matrix ) : void

Set transform component from TRS matrix.

TranslationMatrix ( Vector3 offset ) : Matrix4x4

Get translation matrix.

determinant ( Matrix4x4 m ) : float

Method Details

DecomposeMatrix() public static method

Extract position, rotation and scale from TRS matrix.
public static DecomposeMatrix ( Matrix4x4 matrix, Vector3 &localPosition, Quaternion &localRotation, Vector3 &localScale ) : void
matrix Matrix4x4 Transform matrix. This parameter is passed by reference /// to improve performance; no changes will be made to it.
localPosition Vector3 Output position.
localRotation Quaternion Output rotation.
localScale Vector3 Output scale.
return void

ExtractRotationFromMatrix() public static method

public static ExtractRotationFromMatrix ( Matrix4x4 matrix ) : Quaternion
matrix Matrix4x4
return Quaternion

ExtractScaleFromMatrix() public static method

Extract scale from transform matrix.
public static ExtractScaleFromMatrix ( Matrix4x4 matrix ) : Vector3
matrix Matrix4x4 Transform matrix. This parameter is passed by reference /// to improve performance; no changes will be made to it.
return Vector3

ExtractTranslationFromMatrix() public static method

Extract translation from transform matrix.
public static ExtractTranslationFromMatrix ( Matrix4x4 matrix ) : Vector3
matrix Matrix4x4 Transform matrix. This parameter is passed by reference /// to improve performance; no changes will be made to it.
return Vector3

MatrixToQuaternion() public static method

public static MatrixToQuaternion ( Matrix4x4 m ) : Quaternion
m Matrix4x4
return Quaternion

MatrixToRotation() public static method

public static MatrixToRotation ( Matrix4x4 m ) : Quaternion
m Matrix4x4
return Quaternion

QuatFromMatrix() public static method

public static QuatFromMatrix ( Matrix4x4 m ) : Quaternion
m Matrix4x4
return Quaternion

QuaternionFromMatrix() public static method

Extract rotation quaternion from transform matrix.
public static QuaternionFromMatrix ( Matrix4x4 m ) : Quaternion
m Matrix4x4
return Quaternion

SetTransformFromMatrix() public static method

Set transform component from TRS matrix.
public static SetTransformFromMatrix ( Transform transform, Matrix4x4 &matrix ) : void
transform Transform Transform component.
matrix Matrix4x4 Transform matrix. This parameter is passed by reference /// to improve performance; no changes will be made to it.
return void

TranslationMatrix() public static method

Get translation matrix.
public static TranslationMatrix ( Vector3 offset ) : Matrix4x4
offset Vector3 Translation offset.
return Matrix4x4

determinant() public static method

public static determinant ( Matrix4x4 m ) : float
m Matrix4x4
return float

Property Details

IdentityMatrix public_oe static_oe property

Identity matrix.

It is faster to access this variation than Matrix4x4.identity.

public static Matrix4x4 IdentityMatrix
return Matrix4x4

IdentityQuaternion public_oe static_oe property

Identity quaternion.

It is faster to access this variation than Quaternion.identity.

public static Quaternion IdentityQuaternion
return Quaternion