# Weighted Voronoi Diagram - Wrapping

So this question may sound very complex, and it is! I have very limited knowledge on math.

I’ve got a problem where I’m representing weather systems as points on a map, and each weather system has a positon (2D point) with a weight value (float). Where the systems intersect is where precipitation and pressure builds up, the movement of the points are solved later using convection.

EDIT:
I want to use the voronoi map to output distance and essentially create a “precipitation intensity” which will be masked to an erosion function then added to a heightmap. The rest of these things are sorted out, just need the voronoi map now… :persecutioncomplex:

My problem is that the weighted voronoi map needs to:
1). Output to a grayscale color map
2). Wrap around on itself

(Forgive me if the link breaks)

https://www.researchgate.net/profile/Pinliang_Dong/publication/222188379/figure/fig4/Fig-8-Examples-of-weighted-Voronoi-diagrams-and-distance-rasters-for-point-features.png

The image has edges, and the segments that are off bounds just get clipped. But I want it to sample from the other side. I can’t find any documentation on this or really any useful information.

I can’t even begin to think how to implement this, but here are some IO prerequisites.
1). It will take in a Vector2f array as positions
2). It will take in a int array as weights
3). It will take in a non-square size (width =/= height)
3). It will output as a float[][] (heightmap between -1 and 1)

Thanks for any replies in advance!

On a lower level, what are you using?

Are you using shaders? If so what are you trying to do with the image? Gather the pixel data which represents weight?

They’re not images they’re double float arrays. And I explained my problem in the OP.

I need to convert a Vector and weight array into a height map using weighted voronoi diagrams. But the hardest part is making them wrap.

Wrapping, to my understanding, is easy if you do it in subsets of row.length or column.length.

I don’t know enough to understand your situation and there is nothing I can provide given what you have provided. I don’t think I speak for others, but I could be wrong.

Any time you want a wrapping rectangular plane, it’s a torus.

Not always. Corner wang tiles is an example or some layers of tiles (or integer lattice) such that they are integer multiples in size. When you do need to resort to the torus…it’s not a 3D torus, but the Clifford torus (didn’t click through to see if that’s mentioned).

As inefficient as it is, I’m mostly dealing with a small amounts of points, therefore I can probably use what one of the users of higher space suggested and generate a 3x3 voronoi map and sample the centre tile. That’s the best thing I can come up with, but I’m pretty tired so I’ll get some rest and test it out later.

Thanks for the help BurntPizza!

I’m starting to get mildly impressed with my programming ability… :

If you try to connect it in gimp it probably won’t work because of my dumb screen-shotting capabilities.

Now for the squared distance and I’m done! Woo!

Can’t remember if I’ve posted it, but this reminded me of a render I did a year ago of movement along an axis of 3D worley noise:

EDIT: and inverted: http://gfycat.com/CooperativeAridGodwit

That was easy.

Everyone gets a medal! <3

wow, this is really cool!

I’ll set up a repo on github and share it later if I can get some fake internet points for it :-*

Check it :o