I have this point cloud that represents {x,y,z} coordinates of the surface of a convex lens. I would like to compute the deviations of each point from a spherical cap that would be the best fit to the data. I tried using FindFit, but the results don't make any sense and I get widely different results depending on my initial guesses. Any suggestions?
FindFit[{#[[1]], #[[2]], #[[3]], 1} & /@ centerA, ((x - a)^2 + (y - b)^2 + (z - c)^2)/r^2, {{a, 0.005}, {b, 0.005}, {c, 1}, {r, 1}}, {x, y, z}]
Attachments: