Skip to content

fix: fix triangulate#1103

Open
dragoncoder047 wants to merge 8 commits into
kaplayjs:masterfrom
dragoncoder047:fix-triangulate
Open

fix: fix triangulate#1103
dragoncoder047 wants to merge 8 commits into
kaplayjs:masterfrom
dragoncoder047:fix-triangulate

Conversation

@dragoncoder047

Copy link
Copy Markdown
Contributor

closes #1100

  • Changeloged

@dragoncoder047

Copy link
Copy Markdown
Contributor Author

before:

Screenshot 2026-06-02 at 12 52 44 AM

after:

Screenshot 2026-06-02 at 12 52 58 AM

Comment thread examples/polygon.js Outdated
Comment thread CHANGELOG.md Outdated
Comment thread src/core/contextType.ts
* @returns flattened list of indices of each of the decomposed triangles, list will always have a multiple of 3 length
*/
triangulate(pts: Vec2[]): Vec2[][];
triangulate(pts: Vec2[]): number[];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would you explain why it doesnt return Vec2 anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the only place that triangulate was used really inside kaplay at least is to compute the indices for the polygon triangulation and making triangulate() return the format that the polygon needs results in less conversion overhead and less wasted memory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

see drawPolygon.ts

Comment thread src/math/math.ts Outdated
@lajbel

lajbel commented Jun 30, 2026

Copy link
Copy Markdown
Member

If you have time would be cool your review here @mflerackers

@lajbel lajbel self-assigned this Jun 30, 2026
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.

bug: polygon triangulate is bugged

2 participants