Open i-make-robots opened 6 years ago
We're essentially drawing a raster grid across the individual voronoi cell, and using that grid to compute the weighted centroid. (Why raster? Because we're comparing it to the original rastered image.) To keep accuracy and computation times reasonable, we scale each cell up (or down) to be about 50-100 pixels across, before creating the grid.
In my code i used an consistent step size (1) regardless of cell shape. produced a very even grid of cells. Unsatisfied, I tried stepSize = maxSize/cellBuffer, but quality varies with number of cells (or relative cell size?). I tried the while loops as you have them and one number kept going to -infinity, never ending loop.
Um, there might be a bug in your code then?
https://github.com/evil-mad/stipplegen/blob/master/StippleGen/StippleGen.pde#L838
What is going on with the scale factor and the maxSize here? The sample rate across a cell greatly affects the change to the voronoi... but I don't get why, it's not intuitive. None of the papers I've found discuss the tweaking you're doing here. Please break it down for me coz I'm lost and I'd really like to improve my weighting results.
I get that the rate is higher for smaller cells, and I have played with different rates. Bad scaling makes points jump around like crazy or settle into a nearly even grid. The sweet spot is hard to find!