I am looking for a way to best fit a sphere through a no of cloud points in space. Actually these cloud points are a part of either a concave or convex surface, however not perfectly concave or convex. I have tried using Matlab function 'pcfitsphere' but every time it fits a different sphere as because it is based on RANSAC, and it also doesn't respect the concavity/convexity of the cloud points.

Can someone recommend a better alternative to fit a sphere probably in least square sense?

Similar questions and discussions