For each “grain” in the diagram, I want to assign a constant value for the whole grain. i.e., define a function f(x,y) on the mesh such that it is constant in the same grain but maybe different for different grains.
Then I want to generate a list of x,y,f(x,y) for x,y are uniform grid points, like (1,0), (2,0), (1,1), (1,2)… If I can do this, I know how to generate text file for another software to read and generate this function.
is easy if I could do 1), i.e. get the function f(x,y). I have check the Mathematica documentation but have no idea how to do this. It seems PropertyValue might help but how? How do I even get those value defined on a mesh?
If it is not possible to assign value to a mesh, is there other ways to generate a labelled Voronoi diagram? If I could label them, maybe I can substitute the labels with my values?
We’ll check it by making a large array of these values and using ArrayPlot to illustrate in color. I do some rearrangement to account for the (in my opinion, counterintuitive) ordering used by ArrayPlot.
I noticed the mesh is not being used in your solution. Does that mean there is no simple ways to extend this question to some arbitrary mesh or diagrams?