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

Improve polygon/convex hull clipping algorithm #19

Open
khanghugo opened this issue Oct 17, 2024 · 1 comment
Open

Improve polygon/convex hull clipping algorithm #19

khanghugo opened this issue Oct 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@khanghugo
Copy link
Owner

Works for most cases but the algorithm is pretty messy since it is very original.

Convex hull clipping algorithm is fine. Polygon clipping is not. If anything, convex hull clipping algorithm should be based on that polygon clipping. Right now, they are both different and independent.

@khanghugo khanghugo added the enhancement New feature or request label Oct 17, 2024
@khanghugo
Copy link
Owner Author

khanghugo commented Oct 17, 2024

At the moment, polygon clipping algorithm is copied straight from ChatGPT (with tons of modification of course) but it doesn't quite work

7dd6c56

That is why there is this line

// that means chatgpt copy pasted result does not work very good
// but anyways
.filter(|polygon| polygon.vertices().len() >= 3)

Convex hull clipping algorithm looks like it works but the current problem is that the new face from result of clipping does not have sorted vertices. In the original algorithm generated by ChatGPT, it does not even account for that face (in another word, the algorithm is bogus along with explanation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant