[vtkusers] issue aobut point cloud data visulization!

Shashwath T.R. trshash at gmail.com
Tue Jun 16 00:29:20 EDT 2009


Hi,

On Wed, Jun 10, 2009 at 11:54 AM, njuzg <guangz at u.washington.edu> wrote:

>
> ...
>  vtkCellArray* pts = vtkCellArray::New();
> // pts->InsertNextCell(1);
>  for(int i=0; i<xcoord_array.size();++i)
>          pts->InsertCellPoint(i);
> ...
> vtkPolyData *polydata=vtkPolyData::New();
>   polydata->SetPoints(points);
>   polydata->SetPolys(pts);
>   polydata->GetPointData()->SetScalars(scalars);



>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.

What I usually do for point clouds is something like this:

vtkPolyData * polyData = vtkPolyData::New();
vtkPoints * points = vtkPoints::New();
polyData->SetPoints(points);
polyData->Allocate();

...

vtkIdType id = points->InsertNextPoint(myPt);
polyData->InsertNextCell(VTK_VERTEX, 1, &id);

This usually works quite decently...

Regards,
Shash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090616/d3099810/attachment.htm>


More information about the vtkusers mailing list