I used VtkDelaunay2D to generate a mesh (vtkPolyData?) from a set of points. I am now looking for a way to be able to interpolate z values (in my case these correspond to elevations) from a set of xs and ys. What would be the most optimal way of doing this?
It sort of depends on how the ps=(xs,ys) values are produced. Do you know which triangles the ps are in? This can save some work as you can simply interpolate from the triangle’s points. Another approach, you can perform a vertical ray cast (in the +/- z direction) to determine the point (use a static cell locator or equivalent). Finally, and this is likely the fastest, there are rendering tricks that can be used (render/color based on elevation, or obtain z-buffer values etc.). The particulars of the application will likely dictate which approach you use.
Thank you for your reply!
No, I do not know the triangles on which the ps are. The ps are arbitrary points withing the x and y ranges defining the delaunay2d triangulation.
Not sure if this will help but checkout VTK Classes used in the Examples and search for vtkDelaunay2D
.
Not sure if this will help but checkout VTK Classes used in the Examples and search for
vtkDelaunay2D
.
In particular, I would suggest looking into https://kitware.github.io/vtk-examples/site/Cxx/PolyData/InterpolateMeshOnGrid/
Will do! Thanks for the suggestion!