Skip to content
Advertisement

Create Voronoi art with rounded region edges

I’m trying to create some artistic “plots” like the ones below:Red Voronoi art enter image description here

The color of the regions do not really matter, what I’m trying to achieve is the variable “thickness” of the edges along the Voronoi regions (espescially, how they look like a bigger rounded blob where they meet in corners, and thinner at their middle point).

I’ve tried by “painting manually” each pixel based on the minimum distance to each centroid (each associated with a color):

JavaScript

voronoi diagram

Or by scipy.spatial.Voronoi, that also gives me the vertices points, although I still can’t see how I can draw a line through them with the desired variable thickness.

JavaScript

voronoi region plot

Edit:

I’ve managed to get a somewhat satisfying result via erosion + corner smoothing (via median filter as suggested in the comments) on each individual region, then drawing it into a black background.

JavaScript

voronoi art But as you can see the “stretched” line along the boundaries/edges of the regions is not quite there. Any other suggestions?

Advertisement

Answer

This is what @JohanC suggestion looks like. IMO, it looks much better than my attempt with Bezier curves. However, there appears to be a small problem with the RoundedPolygon class, as there are sometimes small defects at the corners (e.g. between blue and purple in the image below).

Edit: I fixed the RoundedPolygon class.

enter image description here

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement