[vtkusers] Pick points and cells at one time ?
    de Boer Ingo 
    I.deBoer at polytec.de
       
    Wed Jun  2 03:22:11 EDT 2004
    
    
  
Okay, I'll try that.. Thanks !!
greets
  Ingo
---
Dr.-Ing. Ingo H. de Boer
Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax  : ++49 7243 604 255
 
> Here is a proposal that works fine for me:
> 
> 1.
> To be able to rapidly pick world coordinates on 3D and 2D actors I use
> vtkPropPicker as default picker for my interactor:
> 
> ...
> vtkPropPicker *pPropPicker = vtkPropPicker::New();
> vtkCallbackCommand *PickCallBackCommand = vtkCallbackCommand::New();
> PickCallBackCommand->SetCallback(MyVtkView::PickCallBack);
> pPropPicker->AddObserver(vtkCommand::EndPickEvent, 
> PickCallBackCommand);
> MyVtkInteractor->SetPicker(pPropPicker);
> ...
> 
> 2.
> When picking occurs, in my callback function I then pick again
> with new pickers to get the ids of the picked cell or point:
> 
> vtkPropPicker *pPicker = (vtkPropPicker *) 
> MyVtkInteractor->GetPicker();
> ...
> vtkCellPicker *pCellPicker = vtkCellPicker::New();
> pCellPicker->Pick(pPicker->GetSelectionPoint(), MyVtkRenderer);
> vtkIdType lCellId = pCellPicker->GetCellId();
> ...
> vtkPointPicker *pPointPicker = vtkPointPicker::New();
> pPointPicker->Pick(pPicker->GetSelectionPoint(), MyVtkRenderer);
> vtkIdType lPointId = pPointPicker->GetCellId();
> ...
> 
> Maybe this helps.
> 
> 
    
    
More information about the vtkusers
mailing list