Page 1 of 1

Could you tell me how to get the closest point in cloud when I click my mouse?

Posted: Sun Apr 02, 2017 2:11 am
by yjf27281181
Hi, Denial

I want to implement a simple function in my plugin.

When I click my mouse, I want to get the index of the closest point in the cloud. I think there must be some functions in the cloudcompare that I could use, please tell me.

Re: Could you tell me how to get the closest point in cloud when I click my mouse?

Posted: Mon Apr 03, 2017 5:20 pm
by daniel
You have to use the point picking mechanism. The best way now is to use the 'PickingHub' class (see how it is used in various places in the code: camera parameters dialog, plane edit dialog, etc.).

EDIT: to see how it's integrated in a plugin more specifically, see the QCompass plugin

Re: Could you tell me how to get the closest point in cloud when I click my mouse?

Posted: Tue Apr 04, 2017 2:12 am
by yjf27281181
daniel wrote:You have to use the point picking mechanism. The best way now is to use the 'PickingHub' class (see how it is used in various places in the code: camera parameters dialog, plane edit dialog, etc.).

EDIT: to see how it's integrated in a plugin more specifically, see the QCompass plugin
Thanks for your reply, but I am still a little confused.
Firstly, I do not see any class called "PickingHub", so did "plane edit dialog". Besides, I find a function called "processPickedItem" in ccCameraParamEditDlg, is it the function that could get the point which is the closest to where my mouse click in cloud or just let me get the point where my mouse click?

Re: Could you tell me how to get the closest point in cloud when I click my mouse?

Posted: Tue Apr 04, 2017 5:20 am
by daniel
You have to work on the latest version of the sources (the picking hub and plane edit dialog have been introduced several months ago). Simply pull the head version. This is all the interest of working with git(hub) ;)