Skip to content

feat: add reusable Polygon abstraction - #454

Open
Donach wants to merge 2 commits into
wurstscript:masterfrom
Donach:feat/polygon
Open

feat: add reusable Polygon abstraction#454
Donach wants to merge 2 commits into
wurstscript:masterfrom
Donach:feat/polygon

Conversation

@Donach

@Donach Donach commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an arbitrary-size Polygon class with builder and vararg construction
  • cache and own the polygon's boundary rect after sealing
  • provide exact even-odd contains / containsStrict queries for convex, concave, degenerate, reversed, and self-intersecting paths
  • add overridable debug rendering with optional color, caller-owned handles, and timed automatic cleanup
  • remove the obsolete vec2.isInPolygon(vararg vec2) and vec3.isInPolygon2d(vararg vec3) APIs

Ownership

Polygon owns its cached bounds. Untimed debug rendering returns a caller-owned ArrayList<lightning>; timed rendering owns and cleans its handles.

Verification

  • grill install — passed
  • grill typecheck --quiet — passed
  • grill test PolygonTests — 15/15 passed
  • grill test vectorTests — 1/1 passed
  • git diff --check upstream/master...HEAD — passed

grill test --quiet still reports five SQLite interpreter-native failures. The exact same failures reproduce on upstream/master, so they are unrelated to this PR.

Warcraft-native lightning creation, coloring, and timed destruction are compile-checked but not Warcraft-runtime verified because Grill cannot execute those natives.

@Donach
Donach force-pushed the feat/polygon branch 9 times, most recently from 427e299 to 11b6d11 Compare August 3, 2026 05:44
@Donach
Donach marked this pull request as ready for review August 3, 2026 05:53
@Frotty

Frotty commented Aug 3, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread wurst/math/Vectors.wurst
@Frotty

Frotty commented Aug 3, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread wurst/math/Polygon.wurst Outdated
var previous = vertices.get(vertices.size() - 1)
for i = 0 to vertices.size() - 1
let current = vertices.get(i)
let border = addLightning("DBRC", false, previous, current)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Replace the invalid polygon-border lightning rawcode

With stock Warcraft lightning data, DBRC is not a valid built-in lightning rawcode; the imported Lightning package exposes the drain type as LIGHTNING_DRAIN (DRAB). Consequently, calling debugRender creates a null lightning handle and the following setColor call aborts the thread, so both timed and untimed rendering fail in-game. Use one of the package's defined lightning constants instead of this raw string.

AGENTS.md reference: AGENTS.md:L69-L69

Useful? React with 👍 / 👎.

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