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

Refactor ear clipping algorithm to improve concave and flat triangle detection #2841

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iory
Copy link
Member

@iory iory commented May 30, 2024

  • Updated the condition to detect concave vertices: If the z component of the cross product is less than or equal to zero, the triangle is considered concave, indicating that the angle between the vectors is greater than 180 degrees.

Correct the decomposition part of the polygon and resolve the following issues.
#2840

…detection

- Updated the condition to detect concave vertices:
  If the z component of the cross product is less than or equal to zero,
  the triangle is considered concave, indicating that the angle between the vectors is greater than 180 degrees.

- Improved the condition to detect flat triangles:
  If the norm (length) of the cross product is close to zero, the vectors are collinear, making the triangle flat with no area.

- Added detailed comments to explain the conditions for concave and flat triangles for better readability and maintainability.
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