feat: add reusable Polygon abstraction - #454
Conversation
427e299 to
11b6d11
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11b6d117f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c17c1f11e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Polygonclass with builder and vararg constructionrectafter sealingvec2/vec3to globalpathingCellconversion and cell bounds/centerclassifyLinearbeside the acceleratedclassifyas the exact reference and safe fallbackvec2.isInPolygonandvec3.isInPolygon2dAPIs for source compatibilityCell semantics
A cell is
INSIDEonly when its entire area is inside without touching an edge,OUTSIDEonly when disjoint from the polygon, andMIXEDwhen any polygon edge touches or crosses it.classifyresolvesMIXEDcells exactly.10,000-query evaluation
The accelerated and linear implementations returned identical relations for all 10,000 deterministic points against a 64-edge polygon. The linear path considered 506,048 edges for in-bounds queries; the accelerated path considered 22,486 candidate edges (about 22.5x fewer). 1,978 queries needed edge candidates, so 8,022 were answered without an exact edge scan.
Ownership
Polygonowns its cached bounds and grid allocation. Untimed debug rendering returns a caller-ownedArrayList<lightning>; timed rendering owns and cleans its handles.Verification
Run inside
nix develop /home/daniel/Repositories/tever/tever_main:grill typecheck --quiet— passedgrill test PathingGridTests— 3/3 passedgrill test ShardedIntStorageTests— 3/3 passedgrill test PolygonTests— 20/20 passedgrill test testIsInPolygon— 1/1 passedgrill test --quiet— passedBuild— passedgit diff --check upstream/master...HEAD— passedThe non-quiet compiler output intentionally reports six deprecation warnings from the restored legacy API test. Warcraft-native lightning creation, coloring, and timed destruction are compile-checked but not Warcraft-runtime verified because Grill cannot execute those natives.