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

Questions related to plugins development
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?

Postby yjf27281181 » Sun Apr 02, 2017 2:11 am

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: 3443
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?

Postby daniel » Mon Apr 03, 2017 5:20 pm

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?

Postby yjf27281181 » Tue Apr 04, 2017 2:12 am

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: 3443
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?

Postby daniel » Tue Apr 04, 2017 5:20 am

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


Return to “Plugins”

Who is online

Users browsing this forum: No registered users and 1 guest