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

Don't use trigonometry when sorting half edge records radially #474

Closed
peterstace opened this issue Nov 11, 2022 · 0 comments · Fixed by #492
Closed

Don't use trigonometry when sorting half edge records radially #474

peterstace opened this issue Nov 11, 2022 · 0 comments · Fixed by #492
Labels
DCEL Doubly Connected Edge List improve Improve (or remove) an existing feature

Comments

@peterstace
Copy link
Owner

In doublyConnectedEdgeList's fixVertex method, trigonometry is used to sort edges radially. Specifically, we use the math.Atan2 function to calculate the angle of each edge, and then sort the edges via their angle.

Some alternate approaches are described here: https://stackoverflow.com/questions/6989100/sort-points-in-clockwise-order. These approaches may be better because they don't rely on trigonometry. Using regular multiplication/addition may be more numerically stable for angles that are extremely close together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DCEL Doubly Connected Edge List improve Improve (or remove) an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant