A: How to display vertices only as simple 3D-points

Tim Hutton T.Hutton at eastman.ucl.ac.uk
Wed Aug 18 11:46:32 EDT 1999


At 16:10 18/08/99 +0200, you wrote:
>Greetings VTK-gurus!
>
>    I am _very_ new to vtk (-> version 2.0) and I would like to figure
>out how to display a set of about 3000 3D-points just as simple
>points... a la OpenGL GL_POINTS. All I managed to accomplish sofar, was
>to alter the fly.cxx demo to display the points. But in this demo the
>sample points are rendered as spheres. This is way to much geometrical
>data rendered.
>
>    I read in the points with vtkPoints()->InsertNextPoint. But which
>class do I have to use to make my vtkActor() render itself only as a set
>of simple 3D-points?
>
>Thanks in advance for Your time and kind advice!

I managed to do this as below, bit complicated though.

First create a poly data structure and allocate some space for it:

	vtkPolyData *poly = vtkPolyData::New();
	poly->Allocate(MAX_POINTS);

Then at the same time you add the point to the vtkPoints structure, add a
vertex to the poly structure:

		count = points->InsertNextPoint((float*)vertex);
		poly->InsertNextCell(VTK_VERTEX,1,(int*)&count);

Then do this:

	poly->SetPoints(points);

Then you can use a vtkPolyDataMapper to map to a vtkActor and you're away!

The thing is, I'm sure there's a much easier way of doing this, it seems
like an awful hack, no?. Somebody please tell me how to do this properly.

Hope this helps you, good luck.

Cheers,

Tim.

---------------------------------------------------------------------------
Tim Hutton, Research Assistant            Email: T.Hutton at eastman.ucl.ac.uk
MINORI Project                     http://www.eastman.ucl.ac.uk/~dmi/MINORI
Dental and Medical Informatics                   Tel: [+44] (0171) 915 2344
Eastman Dental Institute                         Fax: [+44] (0171) 915 2303
256 Gray's Inn Road, London WC1X 8LD, UK
---------------------------------------------------------------------------
This email represents the views of the sender alone and must not be
construed as representing the views of the Eastman Dental Institute. It may
contain confidential information and may be protected by law as a legally
privileged document and copyright work. Its content should not be disclosed
and it should not be given or copied to anyone other than the person(s)
named or referenced above. If you have received this email in error, please
contact the sender.



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list