I’m sorry for asking so many questions recently.
But when I before asking a question, please understand that I have tested with sample code and googling.
My question is …
I want to display the point coordinate information of PCD data depending on the mouse cursor position.
I referred the link:
But the rendering speed is so slow when GetPickPosition API is called continuously by OnMouseMove() event.
My code is as below:
class CCustomMouseInteractorStyle : public vtkInteractorStyleTrackballCamera
static CCustomMouseInteractorStyle* New();
selectedMapper = vtkSmartPointer<vtkDataSetMapper>::New();
selectedActor = vtkSmartPointer<vtkActor>::New();
virtual void OnMouseMove() override
// Get the location of the click (in window coordinates)
int* pos = this->GetInteractor()->GetEventPosition();
vtkSmartPointer<vtkPointPicker> picker =
// Pick from this location.
picker->Pick(pos, pos, 0, this->GetDefaultRenderer());
if (picker->GetPointId() != -1)
double* worldPosition = picker->GetPickPosition();
How to speed up the rendering while getting the point coordinate information?
Could you please advise for me?
You can experiment with the many pickers VTK has. Some are faster (e.g., hardware-based pickers and those that are accelerated by using locator), some are more accurate or simpler.
vtkPointPicker is accurate, but I think it does not use a locator so it can be extremely slow if you have many points. vtkCellPicker can use a locator to speed up its operation. If vtkCellPicker does not work on a point cloud (require cells) then you can try to add a locator to vtkPointPicker or just use a locator directly (without a picker).
Hi Andras Lasso!
Thank you for your reply.
So… what can I do to the test?
It can’t use with vtkCellPicker because there are no cells, and I can use vtkPointPicker but rendering speed is so slow with Pick API in the OnMouseMove event().
I still don’t know how to speed up the 3D rendering while getting point information.
There are so many options. For example, you may try adding a vertex cell for each point and see if cell picker or hardware-accelerated picker work (vtkScenePicker has some additional caching to speed up hardware-accelerated picking). You may also add a timer to only pick if the mouse is stopped over a point (vtkHoverWidget does something similar). You may also project all your points to the display plane and then use a locator to quickly find the closest point (the disadvantage is that you need to recompute each time you rotate the camera).
So thank you for your guide!
I will try all of that.
Hello, I have met the same problem as you describe. Have you solved it?