[vtkusers] Interpolating scattered 2D data

David Doria daviddoria at gmail.com
Fri May 17 08:19:50 EDT 2013


>> Good afternoon,
>>
>> I'm having a problem which seems like it probably has a pretty simple
>> solution, but I can't for the life of me get a code that works.  I'm quite
>> new to VTK, so not understanding the theory behind the examples isn't
>> helping me much.
>>
>> Essentially, all I am trying to do is interpolate scattered terrain data
>> onto a regular mesh, very similar to using meshgrid and griddata in Matlab
>> (in fact identical).  I have a forum post here that shows what I'm trying to
>> do (including pictures) and what I've tried in some detail:
>> http://forum.codecall.net/topic/75495-c-using-vtk-to-interpolate-terrain-data/
>>
>> I was unable to follow the interpolate terrain example, as it used regular
>> data.  I THINK what I need to be using is the Shepard Method.  I've
>> downloaded and played with the example, but the outputs are contours; I need
>> to be able to grab the interpolated point at particular locations (also it's
>> in 3D instead of 2D, but I think I can overcome that).  I should also note
>> that I need to interpolate everywhere within the domain--NaNs or fillers are
>> not acceptable.
>>
>> If anyone has any advice or a tutorial they can point me to, I would be
>> most appreciative.  The forum link above shows where I got stuck in my code,
>> as well as having the matlab code that does what I want and a picture of
>> what I'm trying to get.  I didn't reproduce it on the email list to avoid
>> sending large attachments to the email users--please let me know if that was
>> an incorrect approach.
>>
>> Thank you so much for any help you can provide.
>>
>> Cheers
>> Andy
>>
>>
>> ----------------------------------------------------------------------------------
>> Mason (Andy) Kass, PhD
>> Research Geophysicist
>> Crustal Geophysics and Geochemistry Science Center
>> US Geological Survey
>>
>> PO Box 25046 Federal Center MS 964
>> Denver, CO 80225-0046
>>
>> +1 303.236.1884
>> mkass at usgs.gov

Hi Andy,

I just made an example of sampling/interpolating a set of points (that
describe a f(x,y)-type surface) onto a grid here:

http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/InterpolateMeshOnGrid

I hope it does what you were looking for.

David



More information about the vtkusers mailing list