<!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.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi David</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Have a look at vtkWarpScalar.</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</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=davidmichell@rediffmail.com 
  href="mailto:davidmichell@rediffmail.com">david michell</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org 
  href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, April 24, 2004 6:18 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] 3D Contours?</DIV>
  <DIV><BR></DIV>
  <P>&nbsp; Hi Everyone,<BR>I have taken all your reply and used them to make 
  the 2D contour plot.<BR>Thanks a lot for the help.<BR><BR>The contour plots 
  are now 2D, they are just lines.<BR>What should I do to make them 3D ie to 
  show surfaces?<BR>Also tell me if i can improve this code anyway?<BR>I have 
  put the code that I did for 2D Contour plot.<BR><BR>Please help me.<BR>Thank 
  you,<BR>David Michell<BR><BR>void main()<BR>{<BR>int 
  npts=100;<BR><BR>vtkPoints * 
  points=vtkPoints::New();<BR>points-&gt;SetNumberOfPoints(npts);<BR><BR>vtkPolyVertex 
  *pv=vtkPolyVertex::New();<BR>pv-&gt;GetPointIds()-&gt;SetNumberOfIds(npts);<BR><BR>vtkDoubleArray 
  *scalar=vtkDoubleArray::New();<BR>scalar-&gt;SetNumberOfTuples(npts);<BR><BR>double 
  *data=new double[npts];<BR>for (int 
  i=0;i&lt;npts;i++)<BR>{<BR>data[i*3+0]=sin((double)i);<BR>data[i*3+0]=cos((double)i);<BR>data[i*3+0]=0.0;//(double)i/npts;<BR><BR>if 
  (i&lt;25) scalar-&gt;InsertValue(i,0.0);<BR>if ((i&gt;=25)&amp;&amp;(i&lt;50)) 
  scalar-&gt;InsertValue(i,1.0);<BR>if ((i&gt;=50)&amp;&amp;(i&lt;75)) 
  scalar-&gt;InsertValue(i,2.0);<BR>if ((i&gt;=75)&amp;&amp;(i&lt;100)) 
  scalar-&gt;InsertValue(i,3.0);<BR>}<BR><BR>vtkUnstructuredGrid 
  *grid=vtkUnstructuredGrid::New();<BR>grid-&gt;Allocate(npts*3);<BR>grid-&gt;SetPoints(points);<BR>grid-&gt;InsertNextCell(pv-&gt;GetCellType(),pv-&gt;GetPointIds);<BR>grid-&gt;GetPointData()-&gt;SetScalars(scalar);<BR>grid-&gt;Modified();<BR>grid-&gt;Update();<BR><BR>vtkDelaunay2D 
  *del=vtkDelaunay2D::New();<BR>del-&gt;SetInput(grid);<BR>del-&gt;SetTolerance(0.00001);<BR><BR>/*********TO 
  MAKE THE CONTOUR LINES WITH SMOOTH 
  CURVES************/<BR>vtkButterflySubdivisionFilter 
  *butr=vtkButterflySubdivisionFilter::New();<BR>butr-&gt;SetInput(del-&gt;GetOutput());<BR>butr-&gt;SetNumberOfSubdivisions(3);<BR><BR>vtkReverseSense 
  *rev=vtkReverseSense::New();<BR>rev-&gt;SetInput(rev-&gt;GetOutput());<BR>rev-&gt;ReverseCellsOn();<BR>rev-&gt;ReverseNormalsOn();<BR>/*************************OK 
  DONE! CURVES***************************/<BR><BR>vtkMarchingContourFilter 
  *contour2D=vtkMarchingContourFilter::New();<BR>contour2D-&gt;SetInput(rev-&gt;GetOutput());<BR>contour2D-&gt;GenerateValues(4,0.0,3.0);<BR>contour2D-&gt;Update();<BR><BR>vtkLookupTable 
  *lut=vtkLookupTable::New();<BR>lut-&gt;SetHueRange(0.6,0);<BR>lut-&gt;SetSaturationRange(1.0,0);<BR>lut-&gt;SetValueRange(0.5,1.0);<BR><BR>/*<BR>The 
  rest of the code PolyDataMapper, Actor, Renderer, RenderWindow and 
  RenderWindowInteractor go here!<BR>*/<BR><BR>} 
  <BR><BR><BR><BR><BR></P><BR><BR><A 
  href="http://clients.rediff.com/signature/track_sig.asp" target=_blank><IMG 
  hspace=0 
  src="http://ads.rediff.com/RealMedia/ads/adstream_nx.cgi/www.rediffmail.com/inbox.htm@Bottom" 
  border=0></A> </BLOCKQUOTE></BODY></HTML>