[vtkusers] Display Pointcloud in 3d

David Doria daviddoria at gmail.com
Mon Mar 5 07:00:56 EST 2012


On Mon, Mar 5, 2012 at 5:21 AM, h0ppel <h0ppel at web.de> wrote:
> okay vtkPointSource looks good, but I get my matrix from another source. So
> how can I put my matrix as source into the pointsource?
>
> thanks

Just add the points to a vtkPoints object:

vtkPoints* points = vtkPoints::New();
for(all of your points)
{
 points->InsertNextPoint(x,y,z);
}

Then add the points to a polydata:

vtkPolyData* polydata = vtkPolyData::New();
polydata->SetPoints(points);

then be sure to add 0D topology (vertices) at each point

vtkVertexGlyphFilter* glyphFilter = vtkVertexGlyphFilter::New();
glyphFilter->SetInputConnection(polydata->GetProducerPort());

Then you can send the output of this glyphFilter to a mapper/actor as
you would have done with the vtkPointSource.

David



More information about the vtkusers mailing list