[vtkusers] Representing Points in 3D

Christof Mueller mueller at cg.nrcan.gc.ca
Wed Apr 3 17:49:32 EST 2002


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




More information about the vtkusers mailing list