<html>
<body>
Hi David,<br><br>
The points in your data set need to be connected together in order to be
able to create contours. Try running either the vtkDelaunay2D or
vtkDelaunay3D filter on your data set before you try to contour it. Also,
you data needs to have scalar values so that it has values from which to
compute contours.<br><br>
- Amy<br><br>
At 12:22 AM 4/20/2004, david michell wrote:<br><br>
<blockquote type=cite class=cite cite> Hi everyone,<br>
Iam curretnly trying to figure out to use contour filters.<br>
I have written something ,but when I execute it all i get is a popup
window saying "no data to contour".<br>
I dont know what is wrong, I have attached the code, please help me
out.<br>
What Iam trying to do is create a unstructured grid of random points and
then draw a contour. I dont know what mistake I have done.<br>
Thank you,<br>
David Michell<br><br>
main()<br>
{<br>
double data[1500];<br>
for (int i=0;i<1500;i++)<br>
{<br>
data[i*3+0]=rand()/126345.23;<br>
data[i*3+1]=rand()/346345.33;<br>
data[i*3+2]=rand()/456345.34;<br>
}<br><br>
vtkIdType *type;<br>
type=new vtkIdType[500];<br>
for(int counter=0;counter<500;counter++)<br>
{<br>
type[counter]=counter;<br>
}<br><br>
vtkCellArray *cellarray=vtkCellArray::New();<br>
cellarray->Allocate(cellarray->EstimateSize(500,1));<br>
cellarray->InsertNextCell(500);<br>
cellarray->ReplaceCell(0,500,type);<br><br>
int celltype[500];<br>
memset(celltype,1,sizeof(int)*500);<br><br>
vtkDoubleArray *pointset=vtkDoubleArray::New();<br>
pointset->SetNumberOfComponents(3);<br>
pointset->SetNumberOfTuples(500);<br>
pointset->SetArray(data,1500,1);<br><br>
vtkPoints *points=vtkPoints::New();<br>
points->Allocate(1500);<br>
points->SetData(pointset);<br><br>
vtkUnstructuredGrid *grid=vtkUnstructuredGrid::New();<br>
grid->Allocate(1500);<br>
grid->SetPoints(points);<br>
grid->SetCells(celltype,cellarray);<br><br>
vtkCountourFilter *contour=vtkContourFilter::New();<br>
countour->SetInput(grid);<br>
contour->GenerateValues(13,0.0,0.42);<br><br>
//code for mapper ,actor renderer, render window and interactor goes
here<br>
}<br><br>
<br><br>
<br><br>
<br><br>
<a 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" alt="[]"></a> </blockquote></body>
</html>