Functions for fitting and minimizing nspheres: circles, spheres, hyperspheres, etc.
- trimesh.nsphere.fit_nsphere(points, prior=None)¶
Fit an n-sphere to a set of points using least squares.
points ((n, d) float) – Points in space
prior ((d,) float) – Best guess for center of nsphere
center ((d,) float) – Location of center
radius (float) – Mean radius across circle
error (float) – Peak to peak value of deviation from mean radius
Check if a list of points is an nsphere.
points ((n, dimension) float) – Points in space
check – True if input points are on an nsphere
- Return type
Compute the minimum n- sphere for a mesh or a set of points.
Uses the fact that the minimum n- sphere will be centered at one of the vertices of the furthest site voronoi diagram, which is n*log(n) but should be pretty fast due to using the scipy/qhull implementations of convex hulls and voronoi diagrams.
obj ((n, d) float or trimesh.Trimesh) – Points or mesh to find minimum bounding nsphere
center ((d,) float) – Center of fitted n- sphere
radius (float) – Radius of fitted n-sphere