[vtkusers] problems picking vtkFollower after rotation (2nd trial)

Stephan.Rau at mycrona.de Stephan.Rau at mycrona.de
Wed Nov 20 02:49:33 EST 2002


Dear all,

I already sent this mail, but got no reply.

Is there nobody, who has experience with vtkFollower? Or should I have
to explain the problem in more detail? At present it seems to be a bug 
in the transformation of vtkFollower.

Any help appreciated!

Stefan Rau


On 2002/11/14 I wrote:

I still have the problem not being able to pick a vtkFollower
after having it rotated. When using vtkActor instead all works
fine.

Below is a sample code to clarify the problem. In the scene
I have an axis actor (vtkActor) and a cone (vtkFollower).
Picking can be done by pressing 'p' over the actors.

Before any rotation I can pick both actors without problems.
After rotating the scene I can pick the axes (vtkActor)
but not the cone (vtkFollower). 

I do not know, if this is a normal behaviour of vtkFollower.

I would like to use vtkFollower in conjunction with 
vtkVectorText to display 3D text and 3D dimensioning. 
After positioning the text I would like to allow picking 
and dragging it to another position.

--------------------------------------------------------------------------------------

void main( int argc, char *argv[] )
{ 
  // cone
  vtkConeSource *cone = vtkConeSource::New(); 
  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
    coneMapper->SetInput(cone->GetOutput());
  vtkFollower *coneActor = vtkFollower::New();
    coneActor->PickableOn();
    coneActor->SetMapper(coneMapper);
    coneActor->SetPosition(2.0,0,0);

  // axes
  vtkAxes *axes = vtkAxes::New();
  vtkPolyDataMapper *axesMapper = vtkPolyDataMapper::New();
    axesMapper->SetInput(axes->GetOutput());
  vtkActor *axesActor = vtkActor::New();
    axesActor->GetProperty()->SetLineWidth(4);
    axesActor->SetMapper(axesMapper);

  vtkRenderer *renderer = vtkRenderer::New();
  vtkWin32OpenGLRenderWindow *renWin = vtkWin32OpenGLRenderWindow::New();
    renWin->AddRenderer(renderer);
  vtkWin32RenderWindowInteractor *interactor = 
vtkWin32RenderWindowInteractor::New();
    interactor->SetRenderWindow(renWin);
  vtkInteractorStyleTrackballCamera *style = 
vtkInteractorStyleTrackballCamera::New();
    interactor->SetInteractorStyle(style);

  // scene
  coneActor->SetCamera(renderer->GetActiveCamera());
  renderer->AddActor(coneActor);
  renderer->AddActor(axesActor);
  renderer->SetBackground(0,0,0.35);
  renderer->ResetCamera();

  // render
  renWin->Render();
  interactor->Start(); 

  cone->Delete();
  axes->Delete();
  coneMapper->Delete();
  axesMapper->Delete();
  coneActor->Delete();
  axesActor->Delete();
  renderer->Delete();
  renWin->Delete(); 
  style->Delete();
  interactor->Delete();
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021120/70e53ddb/attachment.htm>


More information about the vtkusers mailing list