Skip to content

Struct Trs

Namespace: Apogee.Core.Numerics
Assembly: Apogee.Core.dll

A placement in the double-precision world: a position, a rotation and a scale (not a matrix, so a position far from the origin keeps its precision). A point is scaled, then rotated, then moved. Non-uniform scale is allowed, but there is no shear: the scale of a child under a rotated, non-uniformly scaled parent is the product of the two scales, which is exact only when the parent's scale is uniform or its rotation lines up with the child's axes (the usual rule of game engines).

public struct Trs

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

Trs(Double3, Quaternion, Vector3)

A placement in the double-precision world: a position, a rotation and a scale (not a matrix, so a position far from the origin keeps its precision). A point is scaled, then rotated, then moved. Non-uniform scale is allowed, but there is no shear: the scale of a child under a rotated, non-uniformly scaled parent is the product of the two scales, which is exact only when the parent's scale is uniform or its rotation lines up with the child's axes (the usual rule of game engines).

public Trs(Double3 position, Quaternion rotation, Vector3 scale)

Parameters

position Double3

rotation Quaternion

scale Vector3

Fields

Identity

public static readonly Trs Identity

Field Value

Trs

Position

public Double3 Position

Field Value

Double3

Rotation

public Quaternion Rotation

Field Value

Quaternion

Scale

public Vector3 Scale

Field Value

Vector3

Methods

InLocalOf(in Trs)

The inverse of : this world placement as a local placement inside parent (the transform an entity needs under a new parent to stay where it is). The position is subtracted in double, so a far-away placement stays exact; it is exact under the conditions is.

public readonly Trs InLocalOf(in Trs parent)

Parameters

parent Trs

Returns

Trs

InWorldOf(in Trs)

This placement seen from parent's space, as a world placement: the child's own transform inside the parent's.

public readonly Trs InWorldOf(in Trs parent)

Parameters

parent Trs

Returns

Trs

InverseTransformPoint(Double3)

A point of the outer space in this placement's local space. The subtraction is done in double, so a far-away placement stays exact.

public readonly Vector3 InverseTransformPoint(Double3 point)

Parameters

point Double3

Returns

Vector3

ToMatrix(Double3)

The float matrix for the GPU, with the translation taken relative to origin (the camera): row-vector, scale first, then rotation, then translation, as composes.

public readonly Matrix4x4 ToMatrix(Double3 origin)

Parameters

origin Double3

Returns

Matrix4x4

TransformPoint(Vector3)

A point of this placement's local space in the space around it.

public readonly Double3 TransformPoint(Vector3 local)

Parameters

local Vector3

Returns

Double3

TransformVector(Vector3)

A vector (a difference, not a position) scaled and rotated, without the translation.

public readonly Vector3 TransformVector(Vector3 local)

Parameters

local Vector3

Returns

Vector3