bestfit_sphere_numpy
- compas.geometry.bestfit_sphere_numpy(points)[source]
Returns the sphere’s center and radius that fits best through a set of points.
- Parameters
points (list of points) – XYZ coordinates of the points.
- Returns
tuple (center, radius) – sphere center (XYZ coordinates) and sphere radius.
Notes
For more information see 1.
References
- 1
Least Squares Sphere Fit. Available at: https://jekel.me/2015/Least-Squares-Sphere-Fit/.
Examples
>>> from compas.geometry import bestfit_sphere_numpy >>> points = [(291.580, -199.041, 120.194), (293.003, -52.379, 33.599), (514.217, 26.345, 29.143), (683.253, 26.510, -6.194), (683.247, -327.154, 179.113), (231.606, -430.659, 115.458), (87.278, -419.178, -18.863), (24.731, -340.222, -127.158)] >>> center, radius = bestfit_sphere_numpy(points)