<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 target="_blank" HREF="http://clients.rediff.com/signature/track_sig.asp"><IMG SRC="http://ads.rediff.com/RealMedia/ads/adstream_nx.cgi/www.rediffmail.com/inbox.htm@Bottom" BORDER=0 VSPACE=0 HSPACE=0></a>