[vtkusers] Picker
David Gobbi
david.gobbi at gmail.com
Sat Aug 20 09:50:01 EDT 2011
What version of VTK are you using? In VTK 5.6, you can do this:
vtkIdType pointId = picker->GetPointId();
The returned pointId will be in the cell returned by GetCellId().
- David
On Sat, Aug 20, 2011 at 7:34 AM, seaer <wuweitianye at yahoo.com.cn> wrote:
> Hello everyone
> I am trying to do the following things. when I click the Interactor
> Window, I need get (x,y,z) of a vertex which is closet cliked-place in a
> cell which has lots of vertexs. so I used vtkCellPicker to pick the cell
> ,how can i do next step?
>
> int *Pos = this->GetInteractor()->GetEventPosition();
> vtkRenderer *ren = iren->FindPokedRenderer(Pos[0],Pos[1]);
>
> vtkCellPicker *picker =
> vtkCellPicker::SafeDownCast((iren->GetPicker()));
> picker->SetTolerance(0.0001);
> picker->Pick(Pos[0],Pos[1],0.0,ren);
>
> double *worldPostion = picker->GetPickPosition();
> int cellId = picker->GetCellId();
>
> thanks a lot !!!!
More information about the vtkusers
mailing list