[vtkusers] get value at x y z (interpolate)

David Gobbi david.gobbi at gmail.com
Mon Dec 27 16:36:30 EST 2010


On Mon, Dec 27, 2010 at 9:38 AM, David Doria <daviddoria at gmail.com> wrote:
> On Mon, Dec 27, 2010 at 8:29 AM, John Fraser <John.Fraser at icr.ac.uk> wrote:
>> Not sure if this helps or not, I use vtkTupleInterpolator for
>> interpolation of (x,y) and it works fine, e.g.
>>
>> ...
>> interpolator.AddTuple(cps, factor);
>> ...
>> interpolator.InterpolateTuple(value, factor);
>
> Laurent,
>
> As far as I know in VTK you have to have "structured" data to do any
> interpolation (where polydata is "unstructured").
>
> Take a look at these:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/ShepardMethod
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/CardinalSpline
>
> They should convert your polydata into a structured data set that you
> can then perform interpolation on.

VTK can interpolate any data that has cells, but interpolating data
from 2D cells (i.e. polygons, triangles) can be tricky.  The
general-purpose filter for doing interpolation is vtkProbeFilter which
takes two inputs: one input for the data to be interpolated, and
another input that has the points at which you do the interpolation.

There is also a low-level method for doing interpolation: all
vtkDataSets have a FindCell(x,y,z,...) method that can return a cell
(i.e. polygon, FEM element, etc) and the interpolation weights to
apply to each point that makes up the cell.

  David



More information about the vtkusers mailing list