0
$\begingroup$

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).

enter image description here

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)). enter image description here

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.

enter image description here

$\endgroup$
3
  • $\begingroup$ 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? $\endgroup$
    – HISEROD
    Commented Apr 25, 2021 at 13:37
  • $\begingroup$ A phyton script can work too! Yeah, at the end what I need is the intersection of a line with a mesh $\endgroup$
    – Artichoke
    Commented Apr 25, 2021 at 14:57
  • 1
    $\begingroup$ 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. $\endgroup$
    – Robin Betts
    Commented Apr 25, 2021 at 18:57

1 Answer 1

2
$\begingroup$

You can get an intersection using raycast BVH tree node. I have used your node set up and added an icosphere and an empty and have always execute option ticked in AN as shown. Just grab the empty and move it around. enter image description here Make sure the always executing box is ticked so it updates when moving the empty.

enter image description here

And if you want to find the point on the mesh nearest to the intersection just add these three nodes. enter image description here If you move the empty below the mesh it will not work as the Ray Cast BVH Tree is just projecting downwards in -z direction from the empty. To solve that, tick the"Start in infinity" box in the Ray Cast BVH Tree node, it will then project in the opposite direction aswell.

$\endgroup$
1
  • 1
    $\begingroup$ Thank you very much! That was what I was looking for! $\endgroup$
    – Artichoke
    Commented Apr 26, 2021 at 7:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .