<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Here's the script I knocked together several years
ago, hacked a bit to work with 4.2. If you play around with the shepard filter
parameters you should get something much better. Also keep in mind that I'm
using randomized values here - so the dataset is unrealistically
spikey.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>If you have directional bias you'll either have to
do some research into other algorithms or use a commercial package like Surfer
for interploation. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>HTH</FONT></DIV>
<DIV><FONT face=Arial size=2>Malcolm Drummond</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#
------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>package require vtk</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2># Create the RenderWindow, Renderer and both
Actors<BR>#<BR>vtkRenderer ren1<BR>vtkRenderWindow renWin<BR>
renWin AddRenderer ren1<BR>vtkRenderWindowInteractor iren<BR>
iren SetRenderWindow renWin</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>set res 50<BR>#
------------------------------------------------------<BR># create some points -
this would be read in <BR>#<BR>vtkMath math<BR>vtkPoints points<BR>for {set i 0}
{$i<50} {incr i 1} {<BR> eval points InsertPoint $i [math
Random 0 1] [math Random 0 1] [math Random 0 0.25]<BR>}</DIV>
<DIV> </DIV>
<DIV>vtkPolyData pd<BR> pd SetPoints points</DIV>
<DIV> </DIV>
<DIV># ------------------------------------------------------<BR># you start
here<BR>#<BR>vtkElevationFilter elev<BR> elev SetInput pd</DIV>
<DIV> </DIV>
<DIV># reset z to 0.0 for shepard method<BR>vtkTransform
transform<BR> transform Scale 1.0 1.0 0.0<BR>vtkTransformPolyDataFilter
tpf<BR> tpf SetInput [elev GetOutput]<BR> tpf SetTransform
transform</DIV>
<DIV> </DIV>
<DIV># filter requires domensions to be a volume - use min z
dimension (2)<BR># make sure bottom layer is at 0.0
elevation<BR>vtkShepardMethod shepard<BR> shepard SetInput [tpf
GetOutput]<BR> shepard SetModelBounds 0 1 0 1 0.0 0.1<BR> shepard
SetMaximumDistance 0.75<BR> shepard SetSampleDimensions $res $res
2<BR> shepard Update</DIV>
<DIV> </DIV>
<DIV># extract bottom layer<BR>vtkExtractVOI voi<BR> voi SetInput [shepard
GetOutput]<BR> voi SetVOI 0 $res 0 $res 0 0</DIV>
<DIV> </DIV>
<DIV>vtkGeometryFilter gf<BR> gf SetInput [voi GetOutput]<BR>vtkWarpScalar
ws<BR> ws SetInput [gf GetOutput]</DIV>
<DIV> </DIV>
<DIV>vtkDataSetMapper map<BR> map SetInput [ws
GetOutput]</DIV>
<DIV> </DIV>
<DIV>vtkActor block<BR> block SetMapper map</DIV>
<DIV> </DIV>
<DIV># glyph original points<BR>vtkSphereSource ss<BR> ss SetRadius
0.025</DIV>
<DIV> </DIV>
<DIV>vtkGlyph3D g3d<BR> g3d SetInput pd<BR> g3d SetSource [ss
GetOutput]</DIV>
<DIV> </DIV>
<DIV>vtkPolyDataMapper pdm<BR> pdm SetInput [g3d GetOutput]</DIV>
<DIV> </DIV>
<DIV>vtkActor glyphs<BR> glyphs SetMapper pdm</DIV>
<DIV> </DIV>
<DIV># Add the actors to the renderer, set the background and size<BR>ren1
AddActor block<BR>ren1 AddActor glyphs<BR>ren1 SetBackground 1 1 1<BR>renWin
SetSize 500 500</DIV>
<DIV> </DIV>
<DIV>set cam1 [ren1 GetActiveCamera]<BR>#$cam1 Azimuth 160<BR>$cam1 Roll
60<BR>$cam1 Elevation -45<BR>#$cam1 Azimuth 135<BR>$cam1 Zoom 1.5<BR>ren1
ResetCameraClippingRange</DIV>
<DIV> </DIV>
<DIV>renWin Render</DIV>
<DIV> </DIV>
<DIV>wm withdraw .</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=brilligent@gmail.com href="mailto:brilligent@gmail.com">Doug
Henry</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=malcolm@geovision.co.za
href="mailto:malcolm@geovision.co.za">Malcolm Drummond</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=vtkusers@vtk.org
href="mailto:vtkusers@vtk.org">vtkusers</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, June 30, 2005 10:26
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [vtkusers] data for 3D
surface</DIV>
<DIV><BR></DIV>thanks, code is always helpful if its easy for you to find,
otherwise I'll figure it out. I'm always looking for different ways to
do things with vtk, sometimes the code that doesn't solve the immediate
problem will teach me something I can use later. Stringing filters
together to tweak data in the pipeline seems easy in vtk. I don't quite
have my hands around how to get my data in to a useable form by vtk yet, but I
imagine (or hope) the light will turn on eventually.<BR><BR>-thanks
again<BR><BR><BR>
<DIV><SPAN class=gmail_quote>On 6/30/05, <B class=gmail_sendername>Malcolm
Drummond</B> <<A
href="mailto:malcolm@geovision.co.za">malcolm@geovision.co.za</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV><FONT face=Arial size=2>Hi Doug</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'd convert your data into x,y,z then run it
through vtkDelaunay2D (which just uses x and y for the
triangulation). This will give you a triangulated mesh as
vtkPolyData output. The points do not need to be regular.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>If you want a regular grid you could convert
the z values to scalars with vtkElevation filter and resample with
vtkShepardMethod. I did this a long, long time ago but could probably dig
out some demo code if you want it.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>HTH</FONT></DIV>
<DIV>Malcolm Drummond<BR>GeoVision cc</DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV><SPAN class=e id=q_104cedabeb0aaeb7_1>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial"><B>From:</B>
<A title=brilligent@gmail.com
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:brilligent@gmail.com" target=_blank>Doug Henry</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B>
<A title=vtkusers@vtk.org
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:vtkusers@vtk.org" target=_blank>VTK</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Thursday, June 30, 2005 2:46 PM</DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B>
[vtkusers] data for 3D surface</DIV>
<DIV><BR></DIV>I am looking to make a surface plot similar to matlab's
surf function. I have location (az,el) and magnitude data, which can
easily be turned in to x,y,z data if needed, and I would like to create a
simple surface (mesh) from this data. What options are available for
doing this? Do I need data at regular intervals, I saw reference to
structured and unstructured grids.<BR><BR>-thanks<BR><BR></SPAN></DIV>
<P></P>
<HR>
<P></P>_______________________________________________<BR>This is the
private VTK discussion list. <BR>Please keep messages on-topic. Check the
FAQ at: <A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.vtk.org/Wiki/VTK_FAQ"
target=_blank>http://www.vtk.org/Wiki/VTK_FAQ</A><BR>Follow this link to
subscribe/unsubscribe:<BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.vtk.org/mailman/listinfo/vtkusers"
target=_blank>http://www.vtk.org/mailman/listinfo/vtkusers</A><BR>
<P></P></BLOCKQUOTE><BR>_______________________________________________<BR>This
is the private VTK discussion list.<BR>Please keep messages on-topic. Check
the FAQ at: <A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.vtk.org/Wiki/VTK_FAQ"
target=_blank>http://www.vtk.org/Wiki/VTK_FAQ</A><BR>Follow this link to
subscribe/unsubscribe:<BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.vtk.org/mailman/listinfo/vtkusers"
target=_blank>http://www.vtk.org/mailman/listinfo/vtkusers
</A><BR><BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>