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

Would it be possible to make this work with a convex hull boundary for the Voronoi cells? #112

Closed
JobLeonard opened this issue Sep 7, 2020 · 2 comments

Comments

@JobLeonard
Copy link

JobLeonard commented Sep 7, 2020

So I've been interested in doing experiments with voronoi "treemaps".

image

So before you say "well, we already have https://github.com/Kcnarf/d3-voronoi-treemap for that", that is true in principle, but the experiments I have in mind are a bit more more "raw" than this data visualization.

For example, I would like to try out what voronoi stippling in a "multiple pass" fashion would look like (first "stipple" with N points, then inside each of those ten cells "stipple" with another N points, and keep recursing like this until a desired number of total points is reached).

Looking at the currently existing methods, delaunay.renderHull already gives me a convex hull of all points, so if I start with a set of points defining a convex hull, then ensure that all points are inside of it, the triangulation part works out fine. But what I basically am asking for is be able to generate voronoi cells with this convex hull as its bounding box. Would it be complicated to do such a thing?

EDIT: so to be clear, the question is "is this already possible with the current library somehow, or would it require a bunch of funky hacks?"

@JobLeonard JobLeonard changed the title Would it be possible to make this work with custom convex hull boundary for the Voronoi cells? Sep 7, 2020
@Fil
Copy link
Member

Fil commented Jun 5, 2021

Here's my take on this https://observablehq.com/@fil/clip-lloyd
I'm using https://github.com/mfogel/polygon-clipping to clip the cells to the original convex hull.

@Fil Fil closed this as completed Jun 5, 2021
@JobLeonard
Copy link
Author

Made to celebrate the release of d3-delaunay@6!

I feel like I'm getting two presents at once! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants