[vtkusers] Re: converting a TIN to a rectangular regular grid?

Malcolm Drummond malcolm at geovision.co.za
Wed Dec 12 18:17:18 EST 2001


Hi Terence (and anyone else following this thread)

Here's a Tcl script - hack of shepard.tcl - that shows how to do it. I don't
know of any filter that allows you to set the points to zero elevation so I
set them manually. They have to be at zero (or some set elevation that you
can force the Shepards filter to sample through) so that you mimic the
result of doing Shepards in 2D. If anyone who knows Shepards method sees a
booboo here, please shout.

I was thinking about what would be involved in writing a filter to do this
job. It appears to me that the best approach (ie. in terms of flexibility
and reusability) would be to adapt a couple of existing filters. A method
could be added to the elevation filter that optionally resets all point
elevations after creating the scalars - I regularly shift points to a
uniform elevation for probing etc. so would find this quite useful. Would
anyone else? Also the Shepards filter could be adapted to handle 2D (ie
dimensions m n 1). Any comments?

Malcolm

 ----- Original Message -----
From: Terence Lim <tlim at mda.ca>
To: <malcolm at geovision.co.za>
Sent: Wednesday, December 12, 2001 12:22 AM
Subject: converting a TIN to a rectangular regular grid?


> Hi Malcolm,
>
> Thank you for your prompt and helpful advice.  I just some further
> clarification if you have the time.  I am still unable to view a grid.
> Would you have any insight on what I am doing wrong?
>
>
> vtkElevationFilter *ef = vtkElevationFilter::New();
> ef->SetInput(Delaunay2D->GetOutput()); file://Delaunay2D->GetOutput =
polydata
> ef->SetLowPoint(0,0,0);
> ef->SetHighPoint(0,0,500);
>
> vtkShepardMethod *sm = vtkShepardMethod::New();
> sm->SetInput(ef->GetOutput());
> sm->SetModelBounds(xmin,xmax,ymin,ymax,0,200);
> sm->SetMaximumDistance(.5);
> sm->Update();
>
> vtkStructuredPointsGeometryFilter *geometry =
> vtkStructuredPointsGeometryFilter::New();
> geometry->SetInput(sm->GetOutput());
>
> vtkWarpScalar *warp = vtkWarpScalar::New();
> warp->SetInput(geometry->GetOutput());
> warp->XYPlaneOn();
> warp->SetScaleFactor(0.5);
>
> vtkDataSet...vtkActor... etc...
>
> Thanks again for your help.
>
> Regards,
>
> Terence
>
> >>
>
> Hi Terence
>
> You should be able to use a vtkElevation filter to get the z values into
> scalars, after which you can use the vtkShepardMethod to resample to a
> structured-points dataset. You might have to do a bit of scripting - like
> setting all z values to 0.0 so you can sample on a 2D grid. Finally use a
> vtkWarpScalar or script to set the z values to the scalar values.
>
> I've used almost the same process before -  except I used Surfer for the
> re-sampling, so I don't have any experience with the vtkShepardMethod
> filter.
>
> If you have any problems let me know and I'll try and help.
>
> Malcolm
>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: terence_dtm.tcl
Type: application/octet-stream
Size: 2016 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20011213/41190fe5/attachment.obj>


More information about the vtkusers mailing list