Search Results for

    Show / Hide Table of Contents

    Struct Transform

    Describes transformation in a 3D space.

    Assembly: FlaxEngine.dll
    File: Engine/Core/Math/Transform.h
    Syntax
    public struct Transform

    Constructors

    Transform()

    Empty constructor.

    Declaration
    public Transform() = default

    Transform(const Vector3& position)

    Initializes a new instance of the Transform struct.

    Declaration
    public Transform(const Vector3& position)
    Parameters
    Vector3 position

    3D position

    Transform(const Vector3& position, const Matrix3x3& rotationScale)

    Declaration
    public Transform(const Vector3& position, const Matrix3x3& rotationScale)
    Parameters
    Vector3 position

    Matrix3x3 rotationScale

    Transform(const Vector3& position, const Quaternion& rotation)

    Initializes a new instance of the Transform struct.

    Declaration
    public Transform(const Vector3& position, const Quaternion& rotation)
    Parameters
    Vector3 position

    3D position

    Quaternion rotation

    Transform rotation

    Transform(const Vector3& position, const Quaternion& rotation, const Float3& scale)

    Initializes a new instance of the Transform struct.

    Declaration
    public Transform(const Vector3& position, const Quaternion& rotation, const Float3& scale)
    Parameters
    Vector3 position

    3D position

    Quaternion rotation

    Transform rotation

    Float3 scale

    Transform scale

    Fields

    Identity

    An identity transform.

    Declaration
    public static Transform Identity
    Field Value
    Transform

    Orientation

    The rotation of the transform.

    Declaration
    public Quaternion Orientation
    Field Value
    Quaternion

    Scale

    The scale vector of the transform.

    Declaration
    public Float3 Scale
    Field Value
    Float3

    Translation

    The translation vector of the transform.

    Declaration
    public Vector3 Translation
    Field Value
    Vector3

    Methods

    Add(const Transform& other)

    Adds transformation to this transform.

    Declaration
    public Transform Add(const Transform& other) const
    Parameters
    Transform other

    The other transformation.

    Returns
    Transform

    The sum of two transformations.

    Add(const Vector3& translation)

    Adds translation to this transform.

    Declaration
    public Transform Add(const Vector3& translation) const
    Parameters
    Vector3 translation

    The translation.

    Returns
    Transform

    The result.

    AlignRotationToNormalAndSnapToGrid(const Vector3& point, const Vector3& normal, const Vector3& normalOffset, const Transform& relativeTo, const Vector3& gridSize, const Float3& scale=Float3::One)

    Combines the functions:
    SnapToGrid,
    GetRotationFromNormal.

    Declaration
    public static Transform AlignRotationToNormalAndSnapToGrid(const Vector3& point, const Vector3& normal, const Vector3& normalOffset, const Transform& relativeTo, const Vector3& gridSize, const Float3& scale=Float3::One)
    Parameters
    Vector3 point

    The position to snap.

    Vector3 normal

    The normal vector.

    Vector3 normalOffset

    The local grid offset to apply after snapping.

    Transform relativeTo

    The relative transform.

    Vector3 gridSize

    The size of the grid.

    Float3 scale

    The scale to apply to the transform.

    Returns
    Transform

    The rotated and snapped transform.

    GetBackward()

    Declaration
    public Float3 GetBackward() const
    Returns
    Float3

    GetDeterminant()

    Calculates the determinant of this transformation.

    Declaration
    public float GetDeterminant() const
    Returns
    float

    GetDown()

    Declaration
    public Float3 GetDown() const
    Returns
    Float3

    GetForward()

    Declaration
    public Float3 GetForward() const
    Returns
    Float3

    GetLeft()

    Declaration
    public Float3 GetLeft() const
    Returns
    Float3

    GetRight()

    Declaration
    public Float3 GetRight() const
    Returns
    Float3

    GetRotation()

    Gets rotation matrix (from Orientation).

    Declaration
    public Matrix GetRotation() const
    Returns
    Matrix

    Rotation matrix

    GetRotation(Matrix& result)

    Gets rotation matrix (from Orientation).

    Declaration
    public void GetRotation(Matrix& result) const
    Parameters
    Matrix result

    Matrix to set

    GetUp()

    Declaration
    public Float3 GetUp() const
    Returns
    Float3

    GetWorld()

    Gets world matrix that describes transformation as a 4 by 4 matrix.

    Declaration
    public Matrix GetWorld() const
    Returns
    Matrix

    World matrix

    GetWorld(Double4x4& result)

    Gets world matrix that describes transformation as a 4 by 4 matrix.

    Declaration
    public void GetWorld(Double4x4& result) const
    Parameters
    Double4x4 result

    World matrix

    GetWorld(Matrix& result)

    Gets world matrix that describes transformation as a 4 by 4 matrix.

    Declaration
    public void GetWorld(Matrix& result) const
    Parameters
    Matrix result

    World matrix

    IsIdentity()

    Checks if transform is an identity transformation.

    Declaration
    public bool IsIdentity() const
    Returns
    bool

    IsNanOrInfinity()

    Returns true if transform has one or more components equal to +/- infinity or NaN.

    Declaration
    public bool IsNanOrInfinity() const
    Returns
    bool

    Lerp(const Transform& t1, const Transform& t2, float amount)

    Declaration
    public static Transform Lerp(const Transform& t1, const Transform& t2, float amount)
    Parameters
    Transform t1

    Transform t2

    float amount

    Returns
    Transform

    Lerp(const Transform& t1, const Transform& t2, float amount, Transform& result)

    Declaration
    public static void Lerp(const Transform& t1, const Transform& t2, float amount, Transform& result)
    Parameters
    Transform t1

    Transform t2

    float amount

    Transform result

    LocalToWorld(const Transform& other)

    Performs transformation of the given transform in local space to the world space of this transform.

    Declaration
    public Transform LocalToWorld(const Transform& other) const
    Parameters
    Transform other

    The local space transformation.

    Returns
    Transform

    The world space transformation.

    LocalToWorld(const Transform& other, Transform& result)

    Performs transformation of the given transform in local space to the world space of this transform.

    Declaration
    public void LocalToWorld(const Transform& other, Transform& result) const
    Parameters
    Transform other

    The local space transformation.

    Transform result

    The world space transformation.

    LocalToWorld(const Vector3& point)

    Performs transformation of the given point in local space to the world space of this transform.

    Declaration
    public Vector3 LocalToWorld(const Vector3& point) const
    Parameters
    Vector3 point

    The local space point.

    Returns
    Vector3

    The world space point.

    LocalToWorld(const Vector3& point, Vector3& result)

    Performs transformation of the given point in local space to the world space of this transform.

    Declaration
    public void LocalToWorld(const Vector3& point, Vector3& result) const
    Parameters
    Vector3 point

    The local space point.

    Vector3 result

    The world space point.

    LocalToWorldVector(const Vector3& vector)

    Performs transformation of the given vector in local space to the world space of this transform.

    Declaration
    public Vector3 LocalToWorldVector(const Vector3& vector) const
    Parameters
    Vector3 vector

    The local space vector.

    Returns
    Vector3

    The world space vector.

    LocalToWorldVector(const Vector3& vector, Vector3& result)

    Performs transformation of the given vector in local space to the world space of this transform.

    Declaration
    public void LocalToWorldVector(const Vector3& vector, Vector3& result) const
    Parameters
    Vector3 vector

    The local space vector.

    Vector3 result

    The world space vector.

    NearEqual(const Transform& a, const Transform& b)

    Declaration
    public static bool NearEqual(const Transform& a, const Transform& b)
    Parameters
    Transform a

    Transform b

    Returns
    bool

    NearEqual(const Transform& a, const Transform& b, float epsilon)

    Declaration
    public static bool NearEqual(const Transform& a, const Transform& b, float epsilon)
    Parameters
    Transform a

    Transform b

    float epsilon

    Returns
    bool

    operator!=(const Transform& other)

    Declaration
    public bool operator!=(const Transform& other) const
    Parameters
    Transform other

    Returns
    bool

    operator-(const Transform& other)

    Declaration
    public Transform operator-(const Transform& other) const
    Parameters
    Transform other

    Returns
    Transform

    operator*(const Transform& other)

    Declaration
    public Transform operator*(const Transform& other) const
    Parameters
    Transform other

    Returns
    Transform

    operator+(const Transform& other)

    Declaration
    public Transform operator+(const Transform& other) const
    Parameters
    Transform other

    Returns
    Transform

    operator+(const Vector3& other)

    Declaration
    public Transform operator+(const Vector3& other) const
    Parameters
    Vector3 other

    Returns
    Transform

    operator==(const Transform& other)

    Declaration
    public bool operator==(const Transform& other) const
    Parameters
    Transform other

    Returns
    bool

    SetRotation(const Matrix& value)

    Sets rotation matrix (from Orientation).

    Declaration
    public void SetRotation(const Matrix& value)
    Parameters
    Matrix value

    Rotation matrix

    Subtract(const Transform& other)

    Subtracts transformation from this transform.

    Declaration
    public Transform Subtract(const Transform& other) const
    Parameters
    Transform other

    The other transformation.

    Returns
    Transform

    The difference of two transformations.

    ToString()

    Declaration
    public String ToString() const
    Returns
    String

    WorldToLocal(const Quaternion& rotation)

    Performs transformation of the given rotation in world space to the local space of this transform.

    Declaration
    public Quaternion WorldToLocal(const Quaternion& rotation) const
    Parameters
    Quaternion rotation

    The world space rotation.

    Returns
    Quaternion

    The local space rotation.

    WorldToLocal(const Quaternion& rotation, Quaternion& result)

    Performs transformation of the given rotation in world space to the local space of this transform.

    Declaration
    public void WorldToLocal(const Quaternion& rotation, Quaternion& result) const
    Parameters
    Quaternion rotation

    The world space rotation.

    Quaternion result

    The local space rotation.

    WorldToLocal(const Transform& other)

    Performs transformation of the given transform in local space to the world space of this transform.

    Declaration
    public Transform WorldToLocal(const Transform& other) const
    Parameters
    Transform other

    The world space transformation.

    Returns
    Transform

    The local space transformation.

    WorldToLocal(const Transform& other, Transform& result)

    Performs transformation of the given transform in world space to the local space of this transform.

    Declaration
    public void WorldToLocal(const Transform& other, Transform& result) const
    Parameters
    Transform other

    The world space transformation.

    Transform result

    The local space transformation.

    WorldToLocal(const Vector3& point)

    Performs transformation of the given point in world space to the local space of this transform.

    Declaration
    public Vector3 WorldToLocal(const Vector3& point) const
    Parameters
    Vector3 point

    The world space point.

    Returns
    Vector3

    The local space point.

    WorldToLocal(const Vector3& point, Vector3& result)

    Performs transformation of the given point in world space to the local space of this transform.

    Declaration
    public void WorldToLocal(const Vector3& point, Vector3& result) const
    Parameters
    Vector3 point

    The world space point.

    Vector3 result

    The local space point.

    WorldToLocalVector(const Vector3& vector)

    Performs transformation of the given vector in world space to the local space of this transform.

    Declaration
    public Vector3 WorldToLocalVector(const Vector3& vector) const
    Parameters
    Vector3 vector

    The world space vector.

    Returns
    Vector3

    The local space vector.

    WorldToLocalVector(const Vector3& vector, Vector3& result)

    Performs transformation of the given vector in world space to the local space of this transform.

    Declaration
    public void WorldToLocalVector(const Vector3& vector, Vector3& result) const
    Parameters
    Vector3 vector

    The world space vector.

    Vector3 result

    The local space vector.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat