Class FixedTransform
- Namespace
- FixedMathSharp
- Assembly
- FixedMathSharp.dll
Provides a mutable deterministic transform snapshot with optional hierarchy composition.
public class FixedTransform
- Inheritance
-
FixedTransform
- Inherited Members
Remarks
This engine-neutral shell stores local components and a parent reference only. It does not own children, scene state, synchronization, caches, or dirty propagation.
Constructors
FixedTransform(Vector2d, Fixed64, Vector2d, FixedTransform?)
Initializes an X/Z local transform at zero Y position with unit Y scale.
public FixedTransform(Vector2d localPositionXZ, Fixed64 localRotationXZRadians, Vector2d localScaleXZ, FixedTransform? parent = null)
Parameters
localPositionXZVector2dlocalRotationXZRadiansFixed64localScaleXZVector2dparentFixedTransform
FixedTransform(Vector3d, FixedQuaternion, Vector3d, FixedTransform?)
Initializes a transform from authoritative 3D local components.
public FixedTransform(Vector3d localPosition, FixedQuaternion localRotation, Vector3d localScale, FixedTransform? parent = null)
Parameters
localPositionVector3dlocalRotationFixedQuaternionlocalScaleVector3dparentFixedTransform
Properties
LocalEulerAngles
Gets or sets the local rotation as Euler angles in degrees.
public Vector3d LocalEulerAngles { get; set; }
Property Value
LocalMatrix
Gets the matrix rebuilt from the authoritative local components.
public Fixed4x4 LocalMatrix { get; }
Property Value
LocalPosition
Gets or sets the authoritative local translation.
public Vector3d LocalPosition { get; set; }
Property Value
LocalPositionXZ
Gets or sets local X/Z position while preserving local Y.
public Vector2d LocalPositionXZ { get; set; }
Property Value
LocalRotation
Gets or sets the authoritative normalized local rotation.
public FixedQuaternion LocalRotation { get; set; }
Property Value
LocalRotationXZRadians
Gets or sets local X/Z rotation in radians from planar right toward planar forward.
public Fixed64 LocalRotationXZRadians { get; set; }
Property Value
Remarks
The setter replaces pitch and roll with a pure Y-axis rotation.
LocalScale
Gets or sets the authoritative exact signed local scale.
public Vector3d LocalScale { get; set; }
Property Value
LocalScaleXZ
Gets or sets local X/Z scale while preserving local Y.
public Vector2d LocalScaleXZ { get; set; }
Property Value
LocalToWorldMatrix
Gets the iteratively composed local-to-world matrix.
public Fixed4x4 LocalToWorldMatrix { get; }
Property Value
Remarks
Row-vector order multiplies this local matrix by its parent local matrix and then each ancestor local matrix. Reading is linear in hierarchy depth and allocation-free.
LossyScale
Gets canonical signed lossy scale from the composed matrix.
public Vector3d LossyScale { get; }
Property Value
Remarks
Zero magnitudes are preserved and reflected handedness is canonicalized to negative X.
Parent
Gets the optional parent transform.
public FixedTransform? Parent { get; }
Property Value
WorldPosition
Gets world translation from the composed matrix.
public Vector3d WorldPosition { get; }
Property Value
WorldPositionXZ
Gets world position projected onto X/Z.
public Vector2d WorldPositionXZ { get; }
Property Value
WorldRotation
Gets the normalized rotational parent-to-child quaternion chain.
public FixedQuaternion WorldRotation { get; }
Property Value
Remarks
This is an orientation chain derived only from stored local quaternions. It is independent of scale, reflections, and any shear in LocalToWorldMatrix, so it is not a decomposition of that matrix.
WorldRotationXZRadians
Gets world X/Z rotation in radians from planar right toward planar forward.
public Fixed64 WorldRotationXZRadians { get; }
Property Value
Methods
InverseTransformPoint(Vector3d)
Transforms a point from world space to local space through the complete composed affine hierarchy.
public Vector3d InverseTransformPoint(Vector3d point)
Parameters
pointVector3d
Returns
Exceptions
- InvalidOperationException
The composed transform is singular or unrepresentable, or the final local-space point is not representable.
InverseTransformPointXZ(Vector2d)
Transforms a point from world X/Z space to local X/Z space through a plane-preserving affine hierarchy.
public Vector2d InverseTransformPointXZ(Vector2d point)
Parameters
pointVector2d
Returns
Exceptions
- InvalidOperationException
The hierarchy couples X/Z with Y, is singular or unrepresentable, or the final local-space point is not representable.
SetParentKeepingLocal(FixedTransform?)
Changes the parent without changing any local component.
public void SetParentKeepingLocal(FixedTransform? parent)
Parameters
parentFixedTransform
Exceptions
- ArgumentException
The proposed parent would create a cycle.
TransformPoint(Vector3d)
Transforms a point from local space to world space through the complete composed affine hierarchy.
public Vector3d TransformPoint(Vector3d point)
Parameters
pointVector3d
Returns
Exceptions
- InvalidOperationException
The composed transform or final world-space point is not representable.
TransformPointXZ(Vector2d)
Transforms a point from local X/Z space to world X/Z space through a plane-preserving affine hierarchy.
public Vector2d TransformPointXZ(Vector2d point)
Parameters
pointVector2d
Returns
Exceptions
- InvalidOperationException
The hierarchy couples X/Z with Y, or the composed transform or final world-space point is not representable.
TryCreateFromLocalMatrix(Fixed4x4, out FixedTransform?, FixedTransform?)
Attempts to create a transform from a strict, nonsingular local TRS matrix.
public static bool TryCreateFromLocalMatrix(Fixed4x4 localMatrix, out FixedTransform? transform, FixedTransform? parent = null)
Parameters
localMatrixFixed4x4transformFixedTransformparentFixedTransform
Returns
Remarks
Perspective, shear, singular, and non-round-trippable inputs return null and false.
TryGetLocalToWorldMatrix(out Fixed4x4)
Attempts to get the iteratively composed local-to-world matrix without intermediate saturation.
public bool TryGetLocalToWorldMatrix(out Fixed4x4 matrix)
Parameters
matrixFixed4x4
Returns
Remarks
Failure returns a zero matrix and does not mutate this transform or any ancestor.
TryGetLossyScale(out Vector3d)
Attempts to get canonical signed lossy scale from strict hierarchy composition.
public bool TryGetLossyScale(out Vector3d scale)
Parameters
scaleVector3d
Returns
Remarks
Failure returns zero and does not mutate this transform or any ancestor.
TryGetWorldToLocalMatrix(out Fixed4x4)
Attempts to get a verified inverse of the composed local-to-world matrix.
public bool TryGetWorldToLocalMatrix(out Fixed4x4 matrix)
Parameters
matrixFixed4x4
Returns
Remarks
The inverse candidate must multiply to identity in both orders within CanonicalSinCosErrorBound. Singular, saturated, and unrepresentable candidates return identity and false.
TryInverseTransformPoint(Vector3d, out Vector3d)
Attempts to transform a point from world space to local space through the complete composed affine hierarchy.
public bool TryInverseTransformPoint(Vector3d point, out Vector3d result)
Parameters
Returns
TryInverseTransformPointXZ(Vector2d, out Vector2d)
Attempts to transform a point from world X/Z space to local X/Z space through a plane-preserving affine hierarchy.
public bool TryInverseTransformPointXZ(Vector2d point, out Vector2d result)
Parameters
Returns
TrySetParentKeepingWorld(FixedTransform?)
Attempts to change the parent while preserving the complete world matrix.
public bool TrySetParentKeepingWorld(FixedTransform? parent)
Parameters
parentFixedTransform
Returns
Remarks
Failure leaves the parent and every local component unchanged.
Exceptions
- ArgumentException
The proposed parent would create a cycle.
TrySetWorldPose(Vector3d, FixedQuaternion)
Attempts to set world position and normalized world rotation atomically.
public bool TrySetWorldPose(Vector3d position, FixedQuaternion rotation)
Parameters
positionVector3drotationFixedQuaternion
Returns
Remarks
Relative rotation is derived from the parent's stored rotational hierarchy, independent of scale and shear. Failure leaves both local position and local rotation unchanged.
TrySetWorldPosition(Vector3d)
Attempts to set world position through the verified parent inverse.
public bool TrySetWorldPosition(Vector3d position)
Parameters
positionVector3d
Returns
Remarks
Failure leaves local position unchanged.
TryTransformPoint(Vector3d, out Vector3d)
Attempts to transform a point from local space to world space through the complete composed affine hierarchy.
public bool TryTransformPoint(Vector3d point, out Vector3d result)
Parameters
Returns
TryTransformPointXZ(Vector2d, out Vector2d)
Attempts to transform a point from local X/Z space to world X/Z space through a plane-preserving affine hierarchy.
public bool TryTransformPointXZ(Vector2d point, out Vector2d result)