[vtkusers] Help with picking please!
Beau Sapach
beau.sapach at ualberta.ca
Fri Oct 29 01:13:41 EDT 2004
Hi everyone, I've been beating my head against the wall with this... Anyone
know why (in the following code) pick operation #2 works? Even though the
actor is NOT using that point?
Beau
vtkBMPReader * bmpread = vtkBMPReader::New();
vtkRenderWindow * renwin = vtkRenderWindow::New();
vtkRenderer * ren = vtkRenderer::New();
vtkImageMapper * mapper = vtkImageMapper::New();
vtkActor2D * actor = vtkActor2D::New();
bmpread->SetFileName("d:\\blah.bmp");
mapper->SetInput(bmpread->GetOutput());
actor->SetMapper(mapper);
ren->AddActor2D(actor);
// offset the actor's position so that
// a pick with x or y < 12 should not work...
actor->SetDisplayPosition(12,12);
renwin->AddRenderer(ren);
renwin->SetSize(1000,500);
renwin->Render();
double x,y;
// PICK #1
// First try picking something that's obviously
// outside of the image bounds
x=990; y=499;
int r = 0;
vtkPropPicker * picker = vtkPropPicker::New();
r = picker->Pick(x,y,0,ren);
if(r==1){AfxMessageBox("success");}
// PICK #2
// Again pick a point that the image is not
// using ( less than 12! )
x=y=10;
r = picker->Pick(x,y,0,ren);
if(r==1){AfxMessageBox("success");}
More information about the vtkusers
mailing list