How to remove a point form a ccPointCloud object?

Questions related to plugins development
Post Reply
CCNewbieL6
Posts: 23
Joined: Wed Jan 27, 2021 11:11 am

How to remove a point form a ccPointCloud object?

Post by CCNewbieL6 »

Hello daniel,
Now I know how to add/ modify(rotate/ translate) a piont. But I cannot find a method to remove a point by a given index from a ccPointCloud object.
Could you help me?
Thank you very much.
daniel
Site Admin
Posts: 7701
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to remove a point form a ccPointCloud object?

Post by daniel »

You have to use the 'swap' method of ccPointCloud::swapPoints so as to swap the point you want to remove and the last point of the cloud. Then resize the cloud to its original size minus 1.
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7701
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to remove a point form a ccPointCloud object?

Post by daniel »

Well, that's the way to remove one point efficiently. If you want to remove several points in a row, you have to use a CCLib::ReferenceCloud and create a new cloud with only the points referenced by the ReferenceCloud.
Daniel, CloudCompare admin
Post Reply