# Nearest point to a z(x,y) function

Let's see if I can express my problem. I have created a grid mesh and then assigned to each (x,y) a z value (this is how I create z(x,y) function in animation nodes, I don't know if it's the best way).

Now, this is a discrete function, I can't have a value of z(x,y) if that point doesn't belong to my grid mesh. What I want to know is if there is a way to obtain an aproximate value of z(x,y) for all the (x,y) inside the boundaries of my mesh (like you would have in an analytic function, in my case z=sin(x)).

I assume that for creating the surface, Blender has to generate planes that join all the nearest vertices of the grid mesh, so getting the intersection with a vertical line that pass trough the point (x,y) that we want to evaluate (the orange one in the pictures) and those planes should be possible.

• Does it need to be an AN solution or can it be python? And just to clarify, are you looking for the intersection point on a vertical line only? Commented Apr 25, 2021 at 13:37
• A phyton script can work too! Yeah, at the end what I need is the intersection of a line with a mesh Commented Apr 25, 2021 at 14:57
• What kind of output do you want? You could get all the XYZ values at once, with linear or smooth interpolation, using a shader, for output as an image. Commented Apr 25, 2021 at 18:57