fix(ucs): object snap tracking rays follow the active UCS

OTRACK alignment rays (0°/90° and polar steps, plus the polar pencil from
the last point) were built along world X/Y. They now rotate with the
active UCS via a Mat4 passed into otrack_snap (scene.viewcube_ucs_mat() —
the UCS in model space, identity in paper), so tracking lines and the
intersection lock align to the user's coordinate system like ortho,
polar, and the grid. sync_ucs_to_scene now reuses UcsXform::rotation_mat.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-22 11:17:55 +03:00
commit 2509396ba0
4 changed files with 21 additions and 10 deletions

View file

@ -118,6 +118,17 @@ impl UcsXform {
pub(super) fn axes(&self) -> (glam::Vec3, glam::Vec3, glam::Vec3, glam::Vec3) {
(self.origin, self.x, self.y, self.z)
}
/// UCS→world rotation matrix (columns = UCS axes). For consumers that take
/// a `Mat4` rotation directly (ViewCube, OTRACK ray directions).
pub(super) fn rotation_mat(&self) -> glam::Mat4 {
glam::Mat4::from_cols(
self.x.extend(0.0),
self.y.extend(0.0),
self.z.extend(0.0),
glam::Vec4::W,
)
}
}
// ── UCS ↔ WCS transforms (thin wrappers over `UcsXform`) ────────────────────