CloudCompare / CloudComPy

Python wrapper for CloudCompare
Other
265 stars 38 forks source link

how to get the radius of detected sphere on RANSAC_SD plugin results #131

Open ys31jp opened 9 months ago

ys31jp commented 9 months ago

Hi,

I am using python script to perform this to detect sphere: meshes, clouds= cc.RANSAC_SD.computeRANSAC_SD(pointCloud, params)

however, as in the software the results would consists of the points and also the sphere radius.

How can I get the radius of the detected sphere?

Thanks

prascle commented 9 months ago

Hi, Please see the corresponding use case and the sample Python script. For each object identified, you obtain a cloud and a mesh, which is of type ccPrimitive, and, more precisely, ccCylinder, ccSphere... For each of these primitives, there are methods for finding the relevant parameters. Regards, Paul

ys31jp commented 9 months ago

Hi, Paul. Thanks so much!

I would like to ask another question, is there anyway to get the global box center. Thank you very much

image
prascle commented 9 months ago

Hi, You get first the shiftedBox with getOwnBB on the cloud (see cloud.introspection). The ccBox object gives the min and max corner of the shifted box: the Shifted box center is the middle. then you get the shift with getGlobalShift (see Getting the shift value). The Global Box Center is the sum of the Shifted box center and the shift.

Paul