[vtkusers] Unstructured grid to structured grid?

David Gobbi david.gobbi at gmail.com
Tue Sep 16 19:23:30 EDT 2014


On Tue, Sep 16, 2014 at 4:49 PM, Chris Marsh <chris.marsh at usask.ca> wrote:

> The interpolation doesn't look very good, even after increasing the
> resolution.  As well, it is flipped along the y-axis. Image is a mountain,
> variable is air temp (blue = cold, red = warm).
> See here: http://imgur.com/l1KpcS0

Honestly, I can't see any correspondence at all between the mountain
and the interpolated data on that plane.  Are you sure the size and
position of the plane matches the size and position of your data?
An easy way to check is to call GetBounds() on both of them and
print out the bounds.  They should match.

> Secondly: I need to iterate over the rows/cols of this interpolated grid in
> order to write it to an ArcGIS ascii file. What would be the best way to do
> this? The fact it is now in a delaunay triangulation somewhat doesn't help
> (now that I think about it!)

The interpolated data can be retrieved via GetPointData()->GetScalars(),
but I'm not sure what ordering the vtkPlaneSource uses for its points.
You can print GetPoint(0) and GetPoint(1) to see whether the points
increase in the X direction or Y direction first.

Also, watch for off-by-one mistakes.  SetResolution(1, 1) gives a plane
with 4 points (the corners).  So if you want a plane with 4x4 points, you
would SetResolution(3, 3).

 - David


More information about the vtkusers mailing list