<P>
<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>
> "Unhandled exception at 0x006b146a(vtkCommon.dll) in Contour3D.exe<BR>
> 0xC0000005: Access violation writing location 0xde9261d8"<BR>
> <BR>
> The debugger points to line 149 in vtkcelllinks.cxx<BR>
> <BR>
> 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->SetNumberOfPoints(npts);<BR>
<BR>
vtkPolyVertex *pv=vtkPolyVertex::New();<BR>
pv->GetPointIds()->SetNumberOfIds(npts);<BR>
<BR>
vtkDoubleArray *scalar=vtkDoubleArray::New();<BR>
scalar->SetNumberOfTuples(npts);<BR>
<BR>
double *data=new double[npts];<BR>
for (int i=0;i<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<25) scalar->InsertValue(i,0.0);<BR>
if ((i>=25)&&(i<50)) scalar->InsertValue(i,1.0);<BR>
if ((i>=50)&&(i<75)) scalar->InsertValue(i,2.0);<BR>
if ((i>=75)&&(i<100)) scalar->InsertValue(i,3.0);<BR>
<BR>
points->InsertPoint(i,data[i*3+0],data[i*3+1],data[i*3+2]);<BR>
pv->GetPointIds()->SetId(i,i)<BR>
}<BR>
<BR>
vtkUnstructuredGrid *grid=vtkUnstructuredGrid::New();<BR>
grid->Allocate(npts*3);<BR>
grid->SetPoints(points);<BR>
grid->InsertNextCell(pv->GetCellType(),pv->GetPointIds);<BR>
grid->GetPointData()->SetScalars(scalar);<BR>
grid->Modified();<BR>
grid->Update();<BR>
<BR>
vtkDelaunay3D *del=vtkDelaunay3D::New();<BR>
del->SetInput(grid);<BR>
del->SetTolerance(0.00001);<BR>
del->BoundingTriangulationOff();<BR>
<BR>
vtkMarchingContourFilter *contour3D=vtkMarchingContourFilter::New();<BR>
contour3D->SetInput(rev->GetOutput());<BR>
contour3D->GenerateValues(4,0.0,3.0);<BR>
contour3D->Update();<BR>
<BR>
vtkButterflySubdivisionFilter *butr=vtkButterflySubdivisionFilter::New();<BR>
butr->SetInput(del->GetOutput());<BR>
butr->SetNumberOfSubdivisions(3);<BR>
<BR>
<BR>
vtkLookupTable *lut=vtkLookupTable::New();<BR>
lut->SetHueRange(0.6,0);<BR>
lut->SetSaturationRange(1.0,0);<BR>
lut->SetValueRange(0.5,1.0);<BR>
<BR>
vtkPolyDataMapper *mapper=vtkPolyDataMapper::New();<BR>
mapper->SetInput(butr->GetOutput());<BR>
mapper->SetLookupTable(lut);<BR>
mapper->SetScalarRange(0.0,5.0);<BR>
vtkActor *surface=vtkActor::New();<BR>
surface->SetMapper(mapper);<BR>
vtkRenderer *ren=vtkRenderer::New();<BR>
vtkRenderWindow *win=vtkRenderWindow::New();<BR>
win->AddRenderer(ren);<BR>
vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();<BR>
win->SetInteractor(iren);<BR>
iren->Initialize();<BR>
<BR>
ren->AddActor(surface);<BR>
iren->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>