-
Notifications
You must be signed in to change notification settings - Fork 56
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
Implement lazy walk. #46
Conversation
Last year I called this I did find it really useful for navigating the delaunay triangulation (both to find the points neighboring a point, and to find the triangles touching a point), so I'd recommend putting it into |
Thanks for the feedback. I moved the indexes up to Delaunay and renamed them to “inedges” and “outedges”. I dropped the typed array representation of the hull in favor of Delaunator’s linked list. I moved voronoi.find up to delaunay.find (though I left voronoi.contains where it is, since the name seemed more appropriate there). |
Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love how this makes the code simpler!
Instead of precomputing the sequence of halfedges for each input site, the Voronoi constructor now computes an index from point id to starting halfedge id, such that the neighboring points can be computed lazily. For points on the hull, the starting halfedge is the incoming edge on the hull; a separate hull index is also needed to store the outgoing hull edge.
To handle coincident input points, these indexes are initialized with -1.
Open questions:
Should these indexes be computed in the Delaunay constructor rather than the Voronoi constructor? It’d be nice to have them for traversing the Delaunay triangulation, for example to construct the nearest neighbor graph. Then the Voronoi constructor would only be responsible for computing the circumcenters and hull vectors. And then I could add neighbor iteration and nearest-neighbor computation to the Delaunay class, and move voronoi.find to delaunay.find, without needing to compute circumcenters.
Suggestions for better names than “halfedgeIndex” and “hullIndex”? I’m tempted to name them “incoming” and “outgoing” but that’s a little vague…
Fixes #34. /cc @redblobgames