[vtkusers] Representing Points in 3D
Roland Schwarz
roland.schwarz at chello.at
Thu Apr 4 00:28:12 EST 2002
Hi Christof,
Points are best represented by a vtkPolyData object that has exacatly one
cell of type VTK_VERTEX. This Vertex Cell is simply a list of Id's that are
indices to your data.
You should read about writing a reader class. I recommend to derive from
class vtkPolyDataSource then.
I.e.:
class VTK_IO_EXPORT vtkMyReader : public vtkPolyDataSource
{
.... your class definitions
}
This reader will become the starting point of your pipeline. You will then
connect this reader to a mapper and so on.
Tip.: Have a look on the available reader classes in the library to see how
it is done.
Roland
----- Original Message -----
From: "Christof Mueller" <mueller at cg.nrcan.gc.ca>
To: <vtkusers at public.kitware.com>
Sent: Thursday, April 04, 2002 12:49 AM
Subject: [vtkusers] Representing Points in 3D
> I've been trying to represent a number of points in space, but without
> success:
>
> I tried to use vtkAssembly to represent each point by a sphere:
>
> vtkAssembly *actors=vtkAssembly::New();
> vtkSphereSource *sphere=vtkSphereSource::New();
> vtkActor *srcactor = vtkActor::New();
> vtkPolyDataMapper *spheremapper = vtkPolyDataMapper::New();
>
> while(fscanf(srcfp,"%f %f %f",&x,&y,&z)!=EOF){
> sphere->SetCenter(x,y,z);
> sphere->SetRadius(3.0);
> spheremapper->SetInput(sphere->GetOutput());
> srcactor->SetMapper(spheremapper);
> actors->AddPart(srcactor);
>
> }
> ren1->AddActor(actors);
>
> The result shows only the last srcactor.
>
> I assume that I would have to represent each point by it's own actor.
> There must be a simpler way to do this ...
>
> Any suggestions ? Even a completely different approach would be fine,
> since I belive that mine is probably not very smart ...
>
> Cheers,
>
> Christof
>
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list