coords.Coords.bounding_sphere#

Coords.bounding_sphere()#

Return the radius of the bounding sphere of the Coords.

The bounding sphere used here is the smallest sphere with center in the center() of the Coords, and such that no points of the Coords are lying outside the sphere.

Returns#

float

The maximum distance of any point to the Coords.center.

Notes#

This is not necessarily the absolute smallest bounding sphere, because we use the center from looking only in the global axes directions.

Examples#

>>> X = Coords([[0.,0.,0.],[3.,0.,0.],[0.,3.,0.]])
>>> print(X.diag_size(), X.bounding_sphere())
4.2426405 2.1213202
>>> X = Coords([[0.5,0.],[1.,0.5],[0.5,1.0],[0.0,0.5]])
>>> print(X.diag_size(), X.bounding_sphere())
1.4142135 0.5