Skip to content

Fix segments contains#1354

Open
Kubuzer wants to merge 2 commits into
HeapsIO:masterfrom
Kubuzer:fix-segments-contains
Open

Fix segments contains#1354
Kubuzer wants to merge 2 commits into
HeapsIO:masterfrom
Kubuzer:fix-segments-contains

Conversation

@Kubuzer

@Kubuzer Kubuzer commented Jun 25, 2026

Copy link
Copy Markdown

This Pull Request implements the missing non-convex (concave) shape support in h2d.col.Segments.containsPoint and introduces a headless unit testing suite.

Changes:

  • h2d.col.Segments: Replaced the placeholder throw "TODO" exception in containsPoint (when isConvex = false) with a ray-casting (winding number) algorithm to support concave polygons.
  • Testing Suite: Created a lightweight testing framework under test/ running on the Haxe compiler interpreter (--interp) to ensure headless tests can run on any platform.
    • Added math tests for hxd.Math (clamp, nextPOT, isPOT, lerp, etc.).
    • Added collision tests for h2d.col.Segments verifying both convex and concave polygon containment.
    • Added regression test for h3d.impl.ShaderCache ensuring shaders are cached in memory when allowSave = false.

@yuxiaomao

Copy link
Copy Markdown
Contributor

I think we'll not accept unit test files for the moment, please remove it from this PR

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.

2 participants