TriLib
Search Results for

    Show / Hide Table of Contents

    Class MatrixExtensions

    Represents a series of Matrix extension methods.

    Inheritance
    object
    MatrixExtensions
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: TriLibCore.Extensions
    Assembly: TriLibCore.dll
    Syntax
    public static class MatrixExtensions

    Methods

    Decompose(Matrix4x4, out Vector3, out Quaternion, out Vector3)

    Decomposes the given Matrix4x4 into TRS values.

    Declaration
    public static void Decompose(this Matrix4x4 matrix, out Vector3 position, out Quaternion rotation, out Vector3 scale)
    Parameters
    Type Name Description
    Matrix4x4 matrix

    The Matrix4x4 to be decomposed.

    Vector3 position

    The decomposed position.

    Quaternion rotation

    The decomposed rotation.

    Vector3 scale

    The decomposed scale.

    DecomposeSimple(Matrix4x4, out Vector3, out Quaternion, out Vector3)

    Decomposes the given Matrix4x4 into TRS values using simpler methods.

    Declaration
    public static void DecomposeSimple(this Matrix4x4 matrix, out Vector3 position, out Quaternion rotation, out Vector3 scale)
    Parameters
    Type Name Description
    Matrix4x4 matrix

    The Matrix4x4 to be decomposed.

    Vector3 position

    The decomposed position.

    Quaternion rotation

    The decomposed rotation.

    Vector3 scale

    The decomposed scale.

    FitToBounds(float, Bounds, float)

    Creates a Matrix to frame the given Bounds.

    Declaration
    public static Matrix4x4 FitToBounds(float fov, Bounds bounds, float distance)
    Parameters
    Type Name Description
    float fov

    The view field-of-view.

    Bounds bounds

    The Bounds to frame.

    float distance

    The distance to keep from Game Object center.

    Returns
    Type Description
    Matrix4x4

    The framed Matrix.

    GetMatrixPosition(Matrix4x4)

    Extracts the position from this Matrix.

    Declaration
    public static Vector3 GetMatrixPosition(this Matrix4x4 m)
    Parameters
    Type Name Description
    Matrix4x4 m

    The source Matrix.

    Returns
    Type Description
    Vector3

    The extracted position.

    GetMatrixPositionSimple(Matrix4x4)

    Extracts the position from this Matrix.

    Declaration
    public static Vector3 GetMatrixPositionSimple(this Matrix4x4 m)
    Parameters
    Type Name Description
    Matrix4x4 m

    The source Matrix.

    Returns
    Type Description
    Vector3

    The extracted position.

    GetMatrixRotation(Matrix4x4, bool, Vector3?)

    Extracts the rotation from this Matrix.

    Declaration
    public static Quaternion GetMatrixRotation(this Matrix4x4 m, bool ignoreScale = false, Vector3? scale = null)
    Parameters
    Type Name Description
    Matrix4x4 m

    The source Matrix.

    bool ignoreScale

    Turn on this field to ignore the scale fixing algorithm.

    Vector3? scale

    The original Matrix scale.

    Returns
    Type Description
    Quaternion

    The extracted rotation

    GetMatrixScale(Matrix4x4)

    Extracts the scale from this Matrix.

    Declaration
    public static Vector3 GetMatrixScale(this Matrix4x4 m)
    Parameters
    Type Name Description
    Matrix4x4 m

    The source Matrix.

    Returns
    Type Description
    Vector3

    The extracted scale

    IsNegative(Matrix4x4)

    Indicates whether the given Matrix4x4 scale is negative.

    Declaration
    public static bool IsNegative(this Matrix4x4 m)
    Parameters
    Type Name Description
    Matrix4x4 m

    The Matrix4x4 to check the scale from.

    Returns
    Type Description
    bool

    true if any matrix scale component is negative.

    In this article
    Back to top Generated by DocFX