<P>
&nbsp; <BR>
Iam sorry, I just forgot to add in a few lines.<BR>
I dont have internet on my pc, so I have to type in the whole code on the internet machine.<BR>
So missed some lines while typing here is the code.<BR>
<BR>
&gt; &quot;Unhandled exception at 0x006b146a(vtkCommon.dll) in Contour3D.exe<BR>
&gt; 0xC0000005: Access violation writing location 0xde9261d8&quot;<BR>
&gt; <BR>
&gt; The debugger points to line 149 in vtkcelllinks.cxx<BR>
&gt; <BR>
&gt; Iam using vtk4.2 and vc++ 7.1 .net enabled.<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+1]=(double)(i+100)/npts;<BR>
data[i*3+2]=tan((double(i));<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>
points-&gt;InsertPoint(i,data[i*3+0],data[i*3+1],data[i*3+2]);<BR>
pv-&gt;GetPointIds()-&gt;SetId(i,i)<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>
vtkDelaunay3D *del=vtkDelaunay3D::New();<BR>
del-&gt;SetInput(grid);<BR>
del-&gt;SetTolerance(0.00001);<BR>
del-&gt;BoundingTriangulationOff();<BR>
<BR>
vtkMarchingContourFilter *contour3D=vtkMarchingContourFilter::New();<BR>
contour3D-&gt;SetInput(rev-&gt;GetOutput());<BR>
contour3D-&gt;GenerateValues(4,0.0,3.0);<BR>
contour3D-&gt;Update();<BR>
<BR>
vtkButterflySubdivisionFilter *butr=vtkButterflySubdivisionFilter::New();<BR>
butr-&gt;SetInput(del-&gt;GetOutput());<BR>
butr-&gt;SetNumberOfSubdivisions(3);<BR>
<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>
vtkPolyDataMapper *mapper=vtkPolyDataMapper::New();<BR>
mapper-&gt;SetInput(butr-&gt;GetOutput());<BR>
mapper-&gt;SetLookupTable(lut);<BR>
mapper-&gt;SetScalarRange(0.0,5.0);<BR>
vtkActor *surface=vtkActor::New();<BR>
surface-&gt;SetMapper(mapper);<BR>
vtkRenderer *ren=vtkRenderer::New();<BR>
vtkRenderWindow *win=vtkRenderWindow::New();<BR>
win-&gt;AddRenderer(ren);<BR>
vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();<BR>
win-&gt;SetInteractor(iren);<BR>
iren-&gt;Initialize();<BR>
<BR>
ren-&gt;AddActor(surface);<BR>
iren-&gt;Start();<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>