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

Questions related to plugins development
Post Reply
yjf27281181
Posts: 16
Joined: Mon Sep 26, 2016 12:46 am

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

Post 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.
daniel
Site Admin
Posts: 7660
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Post 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
Daniel, CloudCompare admin
yjf27281181
Posts: 16
Joined: Mon Sep 26, 2016 12:46 am

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

Post 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?
daniel
Site Admin
Posts: 7660
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Post 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) ;)
Daniel, CloudCompare admin
Post Reply