Skip to main content

Module pose

Module pose 

Source
Expand description

Where something is, and which way it faces.

The kernel had fields — functions of position — and Interface for a discretised boundary, and no way to say where either of them was. A domain’s coordinates were world coordinates, implicitly, so two grids could not be placed against each other at all: not rotated, not offset, not stacked. Almost everything a scene wants sits behind this.

§A rigid motion, and nothing more

A Pose is a rotation and a translation. It is deliberately not a general transform:

  • No scale. A scaled metre is not a metre. Every quantity in this workspace carries its dimension in its type precisely so a factor of a thousand appears in exactly one place, and a transform that could stretch space would put one everywhere — silently, in a matrix.
  • No shear, no projection. Both change lengths and angles, and a conservation law stated over a sheared volume is a different law.

What is left is an isometry, which preserves every distance and angle exactly. That is the only class of placement a physics can be moved by without its physics changing, and it is why this type is this small.

§Which placement this is

This is physical placement: a pose changes what the physics computes. Two solids in contact, a lens at a distance, a grid rotated against its neighbour.

The other kind — a position handed to something that has no geometry, purely so a viewer can draw it — is deliberately not here. A ThermalNetwork node has a capacity and not a position, and a conductance is not a distance; giving one a coordinate is a statement about a diagram, not about heat. That belongs to the scene layer, above this one, where the physics cannot reach it. If the two shared a type, a drawing coordinate would eventually arrive in a conductance and nothing would fail loudly.

use pantometry_core::Pose;
use pantometry_units::{Length, LengthVec};
use glam::{DQuat, DVec3};

// A grid whose own origin sits 2 m along x, turned a quarter turn about z.
let placed = Pose::new(
    LengthVec::m(2.0, 0.0, 0.0),
    DQuat::from_rotation_z(std::f64::consts::FRAC_PI_2),
);

// Its local +x axis points along world +y.
let facing = placed.direction_to_world(DVec3::X);
assert!((facing - DVec3::Y).length() < 1e-15);

// And a point one metre out along that axis lands at (2, 1, 0).
let p = placed.point_to_world(LengthVec::m(1.0, 0.0, 0.0));
assert!((p.to_si() - DVec3::new(2.0, 1.0, 0.0)).length() < 1e-15);

Structs§

Pose
A rotation and a translation: where a domain’s own coordinates sit in the world.