Commit Graph

1107 Commits

Author SHA1 Message Date
94xhn 1c260ceb7d box/aabb2d: fix wrong face selected below AABB min bound in sphere/circle test
glm_aabb_sphere() and glm_aabb2d_circle() pick which box face to
measure axis distance to via `!(a - 1)`, where
`a = (s[i] < box[0][i]) + (s[i] > box[1][i])` is 1 for either
out-of-range direction. `!(a - 1)` always resolves to index 1
(the max face) whenever a == 1, so when the query point is below
the box's min bound on an axis, distance is measured to the wrong
(max) face instead of the min face, inflating dmin and producing
false-negative intersection results.

The above-max direction happens to pick the correct face already,
which is why this went unnoticed since the index-selection logic
was introduced in #180 (fix for #179).

Fix: index directly with the "above max" boolean
(s[i] > box[1][i]) instead of the derived !(a - 1) expression --
it's 0 for below-min (selects box[0], correct) and 1 for
above-max (selects box[1], correct), and is already computed as
part of `a`/`b`/`c` so no extra branching is introduced. Same fix
applied to both the 3D (box.h) and 2D (aabb2d.h) variants since
they share the identical pattern.

Verified against a hand-written Ericson/Graphics-Gems reference
point-AABB distance test: 200k randomized box/sphere fuzz cases
show 3418/200000 false negatives before this fix and 0/200000
after, with no change to the already-correct above-max and
fully-enclosed cases.
2026-07-18 18:06:58 +08:00
Davide Del Zompo a97af506ce address review comments
- use relative includes for cglm/call/ headers
 - explicitly include stdio in cglm/call/io.h
 - update call documentation
2026-04-18 10:11:03 +03:00
Davide Del Zompo 454f032310 call API: don't include inline functions in header 2026-03-22 11:24:45 +02:00
Davide Del Zompo f0f05dadc5 Move glm_euler_seq to types.h 2026-03-22 11:11:46 +02:00
Ali Emre Gülcü 0dc17e5d47 Implement default infinite perspective projection matrix creation functions 2026-02-10 16:35:50 +03:00
Ali Emre Gülcü d6c6b4c542 Implement infinite perspective projection matrix creation functions 2026-02-10 12:30:11 +03:00
lesleyrs 5ff0d80c85 fix -ffast-math with -Wextra warnings 2026-01-22 16:09:11 +01:00
tayoky 3aad5823ca add glm_vecx_swap functions 2025-11-15 10:39:14 +01:00
Ali Emre Gülcü 47e5d48749 Add missing glmc_perspective_resize_**_**() call/clipspace functions 2025-11-05 09:56:28 +03:00
Vincent Davis Jr ec5f8074c4 mat2: docs cleanup
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-17 18:08:50 -04:00
Vincent Davis Jr 5d530cd8e0 mat2: add tables to docs & fix comments
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-11 00:13:54 -04:00
Recep Aslantas 9fb418bcac Update include/cglm/mat3.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-05 13:36:12 +03:00
Recep Aslantas 5fde20d65c build texture transform matrix helper 2025-04-05 13:32:47 +03:00
Recep Aslantas 1bd04c819b some apple simd framework integration helpers 2025-04-04 23:02:12 +03:00
Recep Aslantas 8560da0e70 define __cglm__ to publish cglm availability universally
in this way we wont need to check arbitrary header check e.g. cglm_common_h
2025-04-04 23:01:55 +03:00
Recep Aslantas ed7a658637 Merge pull request #465 from under-view/feature/mat4x3-tables
mat4x3: add tables to docs & fix comments
2025-04-04 22:57:01 +03:00
Vincent Davis Jr bdca98ba48 mat4x2: add tables to docs & fix comments
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-04 13:29:10 -04:00
Vincent Davis Jr b33e29d50f mat4x3: add tables to docs & fix comments
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-04 13:22:27 -04:00
Vincent Davis Jr 4b3e9bb779 mat3x2: fix scale comment
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-04 11:04:44 -04:00
Recep Aslantas 214842db27 Merge pull request #462 from under-view/feature/mat3x4-tables
mat3x4: add tables to docs & fix comments
2025-04-03 21:42:27 +03:00
Recep Aslantas 60e4d6c188 Merge pull request #461 from under-view/feature/mat3x2-tables
mat3x2: add tables to docs & fix comments
2025-04-03 21:41:44 +03:00
Recep Aslantas 5063d4b2b0 Merge pull request #460 from under-view/feature/mat2x4-tables
mat2x4: add tables to docs & fix comments
2025-04-03 21:40:57 +03:00
Vincent Davis Jr b694c97204 mat2x4: add tables to docs & fix comments
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-03 11:30:34 -04:00
Vincent Davis Jr 4791fe3f24 mat3x4: add tables to docs & fix comments
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-03 11:27:00 -04:00
Vincent Davis Jr b64067a94d mat3x2: add tables to docs & fix comments
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-03 01:22:55 -04:00
Vincent Davis Jr 43363e8c43 mat2x3: add tables to docs & fix comments
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
2025-04-02 19:59:20 -04:00
Recep Aslantas f3094cdc65 add missing almm_*_set1() to arm and wasm 2025-03-19 23:28:58 +03:00
Recep Aslantas 4141298161 Merge pull request #452 from RolandMarchand/add-tau-constants
Added Tau constant definitions to types.h
2025-03-19 17:27:45 +03:00
Marcin cfb8cd9447 more mat4's 2025-03-18 14:17:35 +00:00
Roland Marchand 44b5952ec3 Added Tau constant definitions to types.h 2025-03-11 08:05:51 -04:00
Artemii Miasoedov e96b6a382d Added tests for 2D affine post transformations (translate, rotate, scale) 2025-02-16 15:50:53 +03:00
Artemii Miasoedov 091c475422 Implemented 2D affine post transformations (translate, rotate, scale) 2025-02-16 14:39:10 +03:00
Recep Aslantas 643700c05e now working on v0.9.6 2025-02-13 12:25:10 +03:00
Recep Aslantas 4d0a0a7025 Update wasm.h 2025-02-09 15:30:49 +03:00
Recep Aslantas a88d32c776 Merge branch 'master' into optimize-inv 2025-02-09 15:13:28 +03:00
Recep Aslantas 70a1a946ee arm: use glmm_div where possible to fix ARMv7 <-> ARM64 2025-01-24 22:21:11 +03:00
Recep Aslantas 8ca1f19aa2 arm: use glmm_div where possible to fix ARMv7 <-> ARM64 2025-01-24 22:20:57 +03:00
Recep Aslantas adb3ac18c0 Merge branch 'master' into optimize-inv 2025-01-24 16:04:49 +03:00
Recep Aslantas 441f2657ab suppress param-name warns 2025-01-24 11:20:49 +03:00
Recep Aslantas e8c791e91e Merge pull request #441 from MarcinKonowalczyk/perlin
Implement Perlin noise
2025-01-22 23:23:03 +03:00
Marcin dfc9969f85 vectorise fades
fix fade for vec2
2025-01-22 16:49:27 +00:00
Marcin 2b4aef2a29 glm__noiseDetail_fade_vec2 arg restrict 2025-01-22 16:49:26 +00:00
Marcin fd0131734f fix granNorm arg order 2025-01-22 16:49:26 +00:00
Marcin 9cfa40f423 glm__noiseDetail_taylorInvSqrt 2025-01-22 16:49:26 +00:00
Marcin b79347eb13 vdivq_f32 2025-01-22 16:49:26 +00:00
Marcin 450d747867 1/7 patch 2025-01-22 14:40:18 +00:00
Recep Aslantas e605c1d585 Update aabb2d.h 2025-01-21 09:59:48 +03:00
duarm f815918a74 rename struct/aabb2d.h functions to match aabb2d.h, add tests 2025-01-20 13:29:21 -03:00
Marcin 948642ff33 _glm_ -> glm__ for internal macros 2025-01-20 14:09:05 +00:00
Marcin d3ad1645fc purged // comments in noise.h 2025-01-18 20:11:00 +00:00