[vtkusers] problems picking vtkFollower after rotation

Stephan.Rau at mycrona.de Stephan.Rau at mycrona.de
Thu Nov 14 10:15:33 EST 2002


Dear vtkusers,

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.

Could anyone give a hint?

Thanks!

Stephan Rau 
Mycrona GmbH

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

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/20021114/d1caff1f/attachment.htm>


More information about the vtkusers mailing list