Skip to content

affine: preserve translation in glm_spin - #504

Open
fhgffy wants to merge 1 commit into
recp:masterfrom
fhgffy:fix/glm-spin-translation-502
Open

fhgffy wants to merge 1 commit into
recp:masterfrom
fhgffy:fix/glm-spin-translation-502

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 4, 2026

Copy link
Copy Markdown

Fixes #502.

glm_spin currently right-multiplies a rotation built around the matrix's translation. Translating to (5, 0, 0) and spinning 90 degrees about Z changes the position to (10, -5, 0).

Build an origin-centered rotation instead. For an affine matrix [A, t; 0, 1], the existing right multiplication then produces [A R, t; 0, 1], preserving translation and the pre-transform multiplication order. The shared implementation also fixes glmc_spin and glms_spin.

Add five registered regressions covering translated matrices, an existing rotation with nonuniform scale, a nonunit axis, inverse and zero angles, rotation at the origin, and struct input preservation. Expected matrices are written explicitly.

Validation on the unchanged patch:

  • Original Linux suite: 1131/1131. With only the new tests, all five regressions fail while the original 1131 pass.
  • Linux GCC 13.3, C99: 1136/1136; also 1136/1136 with AddressSanitizer and UndefinedBehaviorSanitizer.
  • Windows MinGW GCC 15.1, complete official suite compiled directly with GCC: 1136/1136. Focused C99 checks with -Wconversion -Werror: 9/9.
  • Additional double-precision Rodrigues checks on both Windows and Linux: 515 affine cases, three APIs, 4635 matrix comparisons per platform, zero failures. The Linux run also uses ASan/UBSan.

The Windows CMake MinGW generator failed before compilation in the Unicode workspace path; its build is not claimed as passing. The Linux C99 suite retains pre-existing anonymous-struct warnings. MSVC, macOS, ARM/NEON, WebAssembly, the full SIMD build matrix, and upstream CI have not been run.

@fhgffy
fhgffy marked this pull request as ready for review October 4, 2026 12:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

glm_spin changes the translation of a translated matrix

1 participant