[vtkusers] Own data structure as point source

Johannes Strecha j.strecha at gmail.com
Tue Jan 8 03:35:22 EST 2013


Hello,

You can use a vtkPointSet. Also create vtkPoints where you can insert the
points from your own data structure. However, I don't know how to remove a
point from vtkPoints, but maybe you can rebuild vtkPoints each time
something changes. Call SetPoints(your vtkPoints) on the vtkPointSet to set
the Points. Information like color should  go into an array in the
vtkPointData (vtkPointSet.GetPointData.AddArray ...). Lastly use a
vtkTrivialProducer to properly insert it as source in the rendering
pipeline.

If you changed your vtkPoints and the Array holding the color information
just call Modified() on the vtkPointSet and re-render. This should suffice.

I've gone through a similar process as you, having to construct a dataset
manually and visualize it. It was very frustrating at times because the
best information is contained in the vtk reference where it is strewn
across many different places. Other information sources (blogs, wikis) are
often outdated or wrong. As I figured out everything for myself it is
possible that there is a better solution to your problem.

N.B.: Unless you're stuck to C++ consider using python with vtk bindings to
visualize your data. VTK is complex enough, maybe you needn't add the
complexity of a language such as C++ to your work.

Kind regards,
Johannes Strecha.


On Tue, Jan 8, 2013 at 1:08 AM, Eddy Ilg <me at eddy-ilg.net> wrote:

> Dear VTK users,
>
> I am new to VTK and overwhelmed by the possibilities it offers. I would
> like to render a point cloud with colored points.
>
> The points are changing (insertions, deletions, modifications) all the
> time. My algorithm manages a list of points (C++ vector).
>
> How could I point VTK to display the points in my list?
>
> Do I have to recreate all VTK datastructures anew in each rendering
> iteration?
>
>
> Best regards,
>
>
> Eddy Ilg
> ______________________________**_________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_**FAQ <http://www.vtk.org/Wiki/VTK_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/**listinfo/vtkusers<http://www.vtk.org/mailman/listinfo/vtkusers>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130108/77f59faa/attachment.htm>


More information about the vtkusers mailing list