Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds wrong indices array for concave polygon #110

Closed
xahon opened this issue Dec 12, 2022 · 2 comments
Closed

Builds wrong indices array for concave polygon #110

xahon opened this issue Dec 12, 2022 · 2 comments

Comments

@xahon
Copy link

xahon commented Dec 12, 2022

I have a arrow-like polygon
image

Positions are [(-1, -1, 0), (-0.45, 0.45, 0), (1, 1, 0), (-1, 1, 0)] in that order
image

When I pass these points (in that order) to earcut it returns me 6 indices which match these triangles (circle is starting point, red first, yellow second)
image

Indices are [2, 0, 1, 1, 3, 2]

And I get this shape in the end

image

@mrgreywater
Copy link
Collaborator

I'm unable to reproduce the issue. Using x and y of your input i get the following result:

image

@xahon
Copy link
Author

xahon commented Dec 12, 2022

Sorry, my bad. I was indexing into wrong array with earcut's indices

@xahon xahon closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants