diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-06 09:42:30 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-06 09:42:30 +0100 |
| commit | f87fed4fb8dbaba2406143168de6629d3d0a5a00 (patch) | |
| tree | 328ff1d1c248da3a63c491b06d229b4b00ef29cb /assets/final/shaders/render/scene_query_bvh.wgsl | |
| parent | 4e10d1c0b7718509ba8197b869fc88a5f94b0630 (diff) | |
fix(math): Normalize axis in quat::from_axis to prevent scaling artifacts
Fixed critical bug causing mesh and bounding box stretching during rotation.
ROOT CAUSE:
quat::from_axis() did not normalize the input axis vector. When called
with non-unit vectors (e.g., {0.5, 1.0, 0.0}), it created invalid
quaternions that encoded scaling transformations instead of pure rotations.
SYMPTOMS:
- Mesh vertices stretched during rotation (non-uniform scaling)
- Bounding boxes deformed and stretched
- Transform matrices became non-orthogonal
ISSUE LOCATIONS:
- src/tests/test_mesh.cc:309 - axis {0.5, 1.0, 0.0} (length ≈1.118)
- src/gpu/effects/flash_cube_effect.cc:79 - axis {0.3, 1, 0.2} (length ≈1.044)
FIX:
Added automatic normalization in quat::from_axis():
a = a.normalize(); // Ensure axis is unit vector
RESULT:
- All quaternions now represent pure rotations
- No scaling artifacts during rotation
- Bounding boxes remain orthogonal
- Fixes Task A (test_mesh stretching bug)
SAFETY:
This change is backward compatible. Code that already passed normalized
axes will work identically (normalizing a unit vector = identity).
handoff(Claude): Rotation stretching bug fixed. Both shader normal
transformation (previous commit) and quaternion creation (this commit)
now work correctly. test_mesh should display properly rotated meshes
without distortion.
Diffstat (limited to 'assets/final/shaders/render/scene_query_bvh.wgsl')
0 files changed, 0 insertions, 0 deletions
