Hi,<br><br><div class="gmail_quote">On Wed, Jun 10, 2009 at 11:54 AM, njuzg <span dir="ltr"><<a href="mailto:guangz@u.washington.edu">guangz@u.washington.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">...<br>
vtkCellArray* pts = vtkCellArray::New();<br>
// pts->InsertNextCell(1);<br>
for(int i=0; i<xcoord_array.size();++i)<br>
pts->InsertCellPoint(i);<br>
...<br>
vtkPolyData *polydata=vtkPolyData::New();<br>
polydata->SetPoints(points);<br>
polydata->SetPolys(pts);<br>
polydata->GetPointData()->SetScalars(scalars);</blockquote><div><br><br>From the above lines, it looks like you're trying to add the points to a set of polys in the polydata. Try adding to vertices instead.<br>
<br>What I usually do for point clouds is something like this:<br><br>vtkPolyData * polyData = vtkPolyData::New();<br>vtkPoints * points = vtkPoints::New();<br>polyData->SetPoints(points);<br>polyData->Allocate();<br>
<br>...<br><br>vtkIdType id = points->InsertNextPoint(myPt);<br>polyData->InsertNextCell(VTK_VERTEX, 1, &id);<br><br>This usually works quite decently...<br><br>Regards,<br>Shash<br></div></div>