<!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>&nbsp;</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.&nbsp;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># 
------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>package require vtk</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># Create the RenderWindow, Renderer and both 
Actors<BR>#<BR>vtkRenderer ren1<BR>vtkRenderWindow renWin<BR>&nbsp;&nbsp;&nbsp; 
renWin AddRenderer ren1<BR>vtkRenderWindowInteractor iren<BR>&nbsp;&nbsp;&nbsp; 
iren SetRenderWindow renWin</FONT></DIV>
<DIV>&nbsp;</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&lt;50} {incr i 1} {<BR>&nbsp;&nbsp;&nbsp; eval points InsertPoint $i [math 
Random 0 1] [math Random 0 1] [math Random 0 0.25]<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkPolyData pd<BR>&nbsp;&nbsp;&nbsp; pd SetPoints points</DIV>
<DIV>&nbsp;</DIV>
<DIV># ------------------------------------------------------<BR># you start 
here<BR>#<BR>vtkElevationFilter elev<BR>&nbsp;elev SetInput pd</DIV>
<DIV>&nbsp;</DIV>
<DIV># reset z to 0.0 for shepard method<BR>vtkTransform 
transform<BR>&nbsp;transform Scale 1.0 1.0 0.0<BR>vtkTransformPolyDataFilter 
tpf<BR>&nbsp;tpf SetInput [elev GetOutput]<BR>&nbsp;tpf SetTransform 
transform</DIV>
<DIV>&nbsp;</DIV>
<DIV># filter&nbsp;requires domensions to be a volume&nbsp;-&nbsp;use min z 
dimension (2)<BR># make sure bottom layer is at 0.0 
elevation<BR>vtkShepardMethod shepard<BR>&nbsp;shepard SetInput [tpf 
GetOutput]<BR>&nbsp;shepard SetModelBounds 0 1 0 1 0.0 0.1<BR>&nbsp;shepard 
SetMaximumDistance 0.75<BR>&nbsp;shepard SetSampleDimensions $res $res 
2<BR>&nbsp;shepard Update</DIV>
<DIV>&nbsp;</DIV>
<DIV># extract bottom layer<BR>vtkExtractVOI voi<BR>&nbsp;voi SetInput [shepard 
GetOutput]<BR>&nbsp;voi SetVOI 0 $res 0 $res 0 0</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkGeometryFilter gf<BR>&nbsp;gf SetInput [voi GetOutput]<BR>vtkWarpScalar 
ws<BR>&nbsp;ws SetInput [gf GetOutput]</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkDataSetMapper map<BR>&nbsp;&nbsp;&nbsp; map SetInput [ws 
GetOutput]</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkActor block<BR>&nbsp;&nbsp;&nbsp; block SetMapper map</DIV>
<DIV>&nbsp;</DIV>
<DIV># glyph original points<BR>vtkSphereSource ss<BR>&nbsp;ss SetRadius 
0.025</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkGlyph3D g3d<BR>&nbsp;g3d SetInput pd<BR>&nbsp;g3d SetSource [ss 
GetOutput]</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkPolyDataMapper pdm<BR>&nbsp;pdm SetInput [g3d GetOutput]</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkActor glyphs<BR>&nbsp;glyphs SetMapper pdm</DIV>
<DIV>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV>renWin Render</DIV>
<DIV>&nbsp;</DIV>
<DIV>wm withdraw .</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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.&nbsp; 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.&nbsp; Stringing filters 
  together to tweak data in the pipeline seems easy in vtk.&nbsp; 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> &lt;<A 
  href="mailto:malcolm@geovision.co.za">malcolm@geovision.co.za</A>&gt; 
  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>&nbsp;</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).&nbsp;This will give you a triangulated mesh&nbsp;as 
    vtkPolyData output. The points do not need to be regular.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</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.&nbsp; 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.&nbsp; What options are available for 
      doing this?&nbsp; 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>