JCash/voronoi

Missing a way to get an indexed diagram

trikko opened this issue · 1 comments

Maybe I'm wrong, but I can't find a way to get an indexed diagram.
I mean an array with the same size of bounding box where each element is the index of the cell.

Am I missing something?

JCash commented

You can get the generated sites as an array:
// Returns an array of sites, where each index is the same as the original input point array.
extern const jcv_site* jcv_diagram_get_sites( const jcv_diagram* diagram );

But since you mention the bounding box, I wonder if you want a voronoi diagram rendered to a texture?
You can render it using your own "color", i.e. the index, see the example in main.c

This library is about generating the core data of a voronoi diagram, with edge and neighbor info. It's easier to go from this data to different renderings, than the other way around.