peterstace/simplefeatures

Don't use trigonometry when sorting half edge records radially

peterstace opened this issue · 0 comments

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.