Page 1 of 1

How to remove a point form a ccPointCloud object?

Posted: Mon Apr 26, 2021 4:49 am
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.

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

Posted: Mon Apr 26, 2021 7:30 pm
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.

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

Posted: Mon Apr 26, 2021 7:31 pm
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.