[vtkusers] simple 3d scatter plot

Luca Pallozzi Lavorante lucapl at rc.unesp.br
Tue Jun 22 15:29:26 EDT 2004


Oturan Boga wrote:

>
>   Hello All,
>
>   I would like to write a simple vtk program that just visualizes 
> points in 3D space. Like a scatter plot, but in 3D and inside a cube. 
> I have looked over examples and documentation and even though there 
> are example code for drawing more complex things, I could not find any 
> example demonstrating how to
> visualize a list of 3D points. (preferable from an array)
>
>   If you could point me to some examples, documentation, or strategy 
> on how to program such a c++
> program, I would greatly appreciate it.
>
>   Thank you very much,
>
>    -O.Boga
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
> http://join.msn.com/?page=features/featuredemail
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
Dear Oturan,

you have to specify connectivity (along with point geometry) even if you 
want to draw simple points. To do that, you will criate geometry with 
vtkPoints and connectivity with vtkCellArray. For each point you will 
insert a Cell with the method vtkCellArray::InsertNextCell(1, PointId). 
The "1" in the above call is because each cell is composed by a single 
point, while PointId will simply be an index varying from 0 to 
numpoints-1. You will invoke such call for each point in the geometry.
Have a look at the c++ example Examples/DataManipulation/Cxx/Cube.cxx. 
You will need to replace the method vtkPolyData::SetPolys with 
vtkPolyData::SetVertices (these methods are explained in the 
vtkPolyData´s documentation).

Hope this helps

        Luca






More information about the vtkusers mailing list