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
Add voronoi.topology. #1819
Add voronoi.topology. #1819
Conversation
Also, fix the case where the polygon surrounds the viewport.
Actually, it might even be in topojson.merge. Because this still appears to work correctly: svg.append("path")
.datum(topojson.feature(topology, {type: "GeometryCollection", geometries: topology.objects.voronoi.geometries.filter(function(d, i) { return i & 1; })}))
.attr("class", "voronoi-cell")
.attr("d", d3.geo.path().projection(null)); |
The closing coordinate of the polygon wasn’t exactly the starting coordinate, and so topojson.merge was having problems stitching things back together.
You beat me to it! :) |
Fixed in b1284d4. The topojson.merge algorithm requires exact matches between the starting and closing coordinate of each polygon ring (in order to stitch them together). Normally this happens with quantized integer coordinates so small precision problems don’t occur. Here we’re doing the merging in non-quantized coordinates so I made sure that the first & last coordinate are exactly the same. |
5 points to Gryffindor! |
I’m unsure whether to add this as a new method, though it does seem nice to piggy-back off of TopoJSON’s representation of topologies. My main concern is whether the d3.geom.voronoi API is sufficient doing things with Voronoi diagrams, or if we need to expose the lower-level concepts of edges & half-edges. |
This makes voronoi.topology more consistent with the non-topological version, and has the nice side-effect that you ignore coincident points by default. Fixes #1861.
I wish you expose half-edges so that we can write Marching Squares algorithm (my current concern) upon it. |
I’d still love to ship this feature for 3.5, but I think the API needs further thought. |
Is there any update on this? I'd love to be able to run this awesome functionality on a node backend. It seems that the old build that contained this functionality is not node compatible. I get lots of errors. Document not being defined and such. Any suggestions for how I could proceed? I love how D3 and topojson has become very rich with functionality for manipulating topology. Keep up the great work! |
I’m thinking about the new API over in the d3-voronoi module; see d3/d3-voronoi#1 and d3/d3-voronoi#2. |
Hey Mike, Thanks for the awesome work on this project! Thanks! |
Although I opted not to build this functionality into d3-voronoi directly, the latest release 0.3 of d3-voronoi makes the underlying Voronoi diagram available, so it’s now possible to do this in “user land” without touching the d3-voronoi implementation. For example: If there’s demand, I’ll consider adding this to d3-voronoi, but I think it makes sense as an optional extension to d3-voronoi at the moment. |
No description provided.