Rigid-transform schema composed from one translation vector and one orientation quaternion. The default alias Pose is the Real32 specialization.
Schema layout
Pose
(-- pose) Constructs a new object with three zero Real32 position components and four zero Real32 quaternion components.- Use
identityPose, not the zero quaternion in this constructor, when an identity orientation is required.
pose
(position orientation -- pose) Constructs a pose from position and orientation.identityPose
(-- pose) Constructs zero translation and the identity orientation.- Uses
Real32position components and quaternion(0,0,0,1).
Fields
position: three-item translation vector. ThePoseandidentityPosespecializations useReal32; other pose values preserve the position schema.orientation: four-component quaternion. ThePoseandidentityPosespecializations useReal32; other pose values preserve the orientation schema.SCHEMA_NAME: staticTextschema-name field,"Pose".
Ordinary numeric construction, casts, and transform results are independent objects. Field reads such as p.position are views into the containing Pose and must not outlive its storage.
Methods
getMatrix
(-- matrix) Returns the receiver's 3×3 orientation matrix, without its translation.scale
(factor --) Multiplies the receiver's position by factor, leaving orientation unchanged.- Casts factor to the position component schema. For example,
2 @p.scalescalesp.
translate
(offset --) Adds offset to the receiver's position, leaving orientation unchanged.- Casts offset to the position vector's schema.
Construction and casting
See the value-ownership rule for the lifetime of field views and independent transform results.
poseCast
(pose schema -- pose) Casts a pose to a numeric component schema.- The target is the numeric component schema. Constructs a three-component position from source indices 0–2 and casts every orientation entry to that schema.
- Extra position components are omitted.
- Use a valid three-component position and four-component orientation in normal operation.
*
(pose0 pose1 -- pose) Composes two poses or applies one pose to a vector.- Supports
(pose0 pose1 -- resultPose)and(vector pose -- resultVector); pose-vector order is not a supported application overload. - Vector application uses
vector × orientationMatrix + position, with orientation and translation converted to the vector's numeric schema. Supply a three-component vector. - Pose-pose composition applies pose0 first, then pose1. Its position is
pose0.position × matrix(pose1.orientation) + pose1.position, and its orientation is pose0.orientation * pose1.orientation, with the second components converted to the first pose's component schemas. The result follows pose0's schemas.
interpolate
(pose0 pose1 blend -- pose) Interpolates position and orientation.- Converts pose1's components and blend to the corresponding pose0 component schemas, linearly interpolates position, and uses
Quaternion.nlerpfor orientation. - The result follows pose0's schemas; blend is not clamped, so values outside [0,1] extrapolate.
inverse
(pose -- pose) Constructs the inverse pose.- Constructs
−position × transpose(orientationMatrix)and theconjorientation. - This is a geometric inverse for a valid unit orientation; the function does not normalize arbitrary quaternion inputs.
mirrorVertically
(pose z -- pose) Reflects a pose across the plane whose z coordinate is z.- Casts z to the position schema and returns position
(px, py, 2z−pz)with quaternion(−x,−y,z,w). - Constructs a new Pose without mutating its input.
Examples
Construction Example
"Pose.pose" use
"Quaternion.identityQuaternion" use
"control" use
{} () {} [
p: (1.0r32 2.0r32 3.0r32) Real32 identityQuaternion pose;
@p.position printStack _:;
@p.orientation printStack _:;
] "main" exportFunction
Expected Output During Compilation
(1.0r32 2.0r32 3.0r32) Cref
{
QUATERNION: ();
entries: (0.0r32 0.0r32 0.0r32 1.0r32);
} Cref
Identity Transform Example
"Pose.*" use
"Pose.identityPose" use
"control" use
{} () {} [
p: identityPose;
(1.0r32 2.0r32 3.0r32) @p * printStack _:;
] "main" exportFunction
Expected Output During Compilation
(1.0r32 2.0r32 3.0r32)
Cast Example
"Pose.pose" use
"Pose.poseCast" use
"Quaternion.identityQuaternion" use
"control" use
{} () {} [
p: (1.0r32 2.0r32 3.0r32) Real32 identityQuaternion pose;
q: @p Real64 poseCast;
@q.position printStack _:;
@q.orientation printStack _:;
] "main" exportFunction
Expected Output During Compilation
(1.0 2.0 3.0) Cref
{
QUATERNION: ();
entries: (0.0 0.0 0.0 1.0);
} Cref
Runtime transform check
"Pose.*" use
"Pose.pose" use
"Quaternion.identityQuaternion" use
"String" use
"algebra" use
"control" use
{} Int32 {} [
p: (1.0r32 2.0r32 3.0r32) Real32 identityQuaternion pose;
transformed: (1.0r32 1.0r32 1.0r32) @p *;
expected: (2.0r32 3.0r32 4.0r32);
transformed expected = print
LF print
0
] "main" exportFunction
Expected Output
TRUE
See also
- Quaternion: Quaternion construction, normalization, interpolation, and matrix conversion.
- algebra: Algebraic operations, vectors, and matrix utilities.