Build the plane's world matrix from its current pos/dir.
Called by the gizmo at attach-time and whenever it needs to
re-read the target's transform (e.g. after external
plane.pos = …).
Decompose the gizmo-supplied matrix back into pos + dir
and write through to the section plane. The plane's
dist recomputes automatically inside the setters.
Bridges a SectionPlane to the TransformControls adapter contract —
{getMatrix, setMatrix}. The gizmo manipulates a 4×4 world matrix; we synthesise that matrix from the plane'spos+diron read, and decompose it back intopos+diron write.Matrix convention: the plane's local +Z axis equals its
dir(the side fragments are discarded in). The other two axes (X, Y) span the plane's surface — they're arbitrary (any orthonormal basis on the plane works), so we pick one deterministically by Gram-Schmidt-ing against a fixed world-up vector.In this frame the gizmo's handles map naturally onto the useful operations:
dir).Translate X/Y and rotate Z are "no-ops" on the rendered section (the plane is infinite, so sliding it within its own surface or spinning it about its normal leaves the clipping geometry unchanged) — they still update the matrix, but the plane proxy's translucent quad rotates with them, which is the intuitive behaviour.