Using a Voronoi tessellation to represent a density field

Hi all,

I have a set of 2D points (x,y) with a density value associated to them. I want to create a 2D density field from that, using a Voronoi tessellation. I am then interested to be able to query the density value for any arbitrary 2D point.

So far I have attempted to use the package but I am struggling to understand how am I suppose to store the density data. Ideally, each Voronoi cell would have a density value associated to it, and I can then have a function that given a point, it finds the Voronoi cell it belongs to. However, if I haven’t missed something, the mentioned package does not incorporate such functionality, as the locate function finds you the Delaunay triangle but not the Voronoi cell, and one can only store information on the points, but not the cells per se.

Any tips on how I could make this work?

Thanks a lot.