Rigid/similarity transform metadata, not applied to points by this library.
Codecs may embed transforms in headers when a format supports it. Application of transforms is left to higher-level code.
Fields
:translation—{float(), float(), float()}Cartesian offset; defaults to{0.0, 0.0, 0.0}. Units match the associated spatial coordinates.:rotation—{float(), float(), float(), float()}scalar-first{w, x, y, z}quaternion; defaults to identity{1.0, 0.0, 0.0, 0.0}. Unit length is not enforced.:scale—float()uniform dimensionless scale; defaults to1.0.
This module stores transform metadata but does not define composition order or apply transforms; consumers must follow the enclosing format's convention.
Example
iex> ExCodecs.Spatial.Transform.new(
...> translation: {10, 0, -2},
...> rotation: {1, 0, 0, 0},
...> scale: 0.5
...> )
%ExCodecs.Spatial.Transform{
translation: {10.0, 0.0, -2.0},
rotation: {1.0, 0.0, 0.0, 0.0},
scale: 0.5
}
Summary
Types
Transform metadata with translation, scalar-first quaternion rotation, and uniform scale. See the module documentation for all fields, defaults, units and conventions, and a construction example.
Types
@type t() :: %ExCodecs.Spatial.Transform{ rotation: {float(), float(), float(), float()}, scale: float(), translation: {float(), float(), float()} }
Transform metadata with translation, scalar-first quaternion rotation, and uniform scale. See the module documentation for all fields, defaults, units and conventions, and a construction example.
Functions
@spec identity() :: t()
Identity transform.
Arguments
None.
Returns
%Transform{} with zero translation, identity quaternion, scale 1.0.
Raises
None.
Examples
iex> t = ExCodecs.Spatial.Transform.identity()
iex> t.scale
1.0
Builds a transform.
Arguments
opts— a keyword list with::translation— numeric{x, y, z}; defaults to the origin and is stored as floats.:rotation— numeric{w, x, y, z}scalar-first quaternion; defaults to identity and is stored as floats.:scale—number(); defaults to1.0and is stored as a float.
Returns
%Transform{}
Raises
FunctionClauseErrorfor malformed or non-numeric translation/rotation tuples, or ifoptsis not a keyword list.ArithmeticErrorif:scaleis not numeric.
Examples
iex> t = ExCodecs.Spatial.Transform.new(translation: {1, 0, 0}, scale: 2)
iex> t.translation
{1.0, 0.0, 0.0}