Ship libccd's notice, and keep the rectangle helpers on purpose

libccd is compiled into libakgl.so and is BSD-3-Clause, so the notice has to
travel with the binary form. cmake --install now puts BSD-LICENSE at
share/doc/akgl/BSD-LICENSE.libccd, and the README says which dependency is in
that position and which are not -- everything else in deps/ is either a separate
shared object carrying its own notice, a header, or compiled into nothing.

The plan's last step was to delete akgl_rectangle_points,
akgl_collide_point_rectangle and akgl_collide_rectangles. That step is not taken,
and TODO.md carries the reasoning rather than leaving it to be rediscovered:
akgl_collide_rectangles has two correct callers in the sidescroller asking a
game-level overlap question that wants a bool, and it was fixed two commits into
this same series -- deleting it now would be a strange thing to do to a caller.
The other two are the weak case and are named as the candidates if a 0.9.0 wants
to trim.

akgl_RectanglePoints' comment still claimed akgl_collide_rectangles works corner
by corner, which stopped being true when the cross case was fixed. Corrected in
place, with the cross case named so the note explains why the shape changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KzBDV2fqgnUAcqCKqKvc71
This commit is contained in:
2026-08-02 07:55:59 -04:00
parent 986c80d0ec
commit 71e18184c0
4 changed files with 64 additions and 3 deletions

34
TODO.md
View File

@@ -2517,3 +2517,37 @@ follow that are true today and would not survive a change:
from a caller who has explicitly asked for EPA's manifold.
`akgl_ccd_arena_highwater()` is public so a game can assert its own ceiling.
## The `util.h` rectangle helpers stay, and why
The collision plan's last step was to **delete `akgl_rectangle_points`,
`akgl_collide_point_rectangle` and `akgl_collide_rectangles`** once the shape API
landed, on the grounds that collision now has a real narrowphase. That step was
not taken, and this is the reasoning rather than an oversight.
- **They still have callers that are correct.** `examples/sidescroller/player.c`
uses `akgl_collide_rectangles` twice, for coins and for hazards. Those are
overlap *questions* asked from an `updatefunc` -- "am I touching this" -- and
the right answer is a `bool`. Routing them through a collision shape would
mean a proxy, a broad-phase insert and a narrowphase call to compute a normal
and a depth that nothing reads.
- **`akgl_collide_rectangles` was fixed in this same series**, not left broken.
It was a corner test that missed the cross case and truncated through
`akgl_Point`'s `int` members; it is a span test now, exact in `float32_t`.
Deleting it two commits after fixing it is a strange thing to do to a caller.
- **A game-level overlap question is not always a physics question.** A minimap
marker, a UI hit test, "is the cursor over this". None of those wants to be
pushed, and none of them belongs in a collision world.
`akgl_rectangle_points` and `akgl_collide_point_rectangle` are the weaker case:
nothing outside `tests/` calls either, and `akgl_collide_rectangles` no longer
does since it stopped working corner by corner. They are kept for symmetry with
the one that is used and because a point-in-rectangle test is the other half of
the same question -- but if a 0.9.0 wants to trim the public surface, those two
are the candidates, not `akgl_collide_rectangles`.
One thing found while writing this and fixed rather than recorded:
`akgl_RectanglePoints`' Doxygen comment still said `akgl_collide_rectangles`
"works corner by corner rather than by comparing edge spans", which had been
false since the fix. [Chapter 19](docs/19-utilities.md) already described the
current behaviour correctly, so the header was the only place saying otherwise.