ddg.geometry.spheres module

class ddg.geometry.spheres.Sphere(center, radius, subspace=None, geometry='euclidean', atol=None, rtol=None)[source]

Bases: NonExact

Basic k-sphere in Euclidean space or any Cayley-Klein geometry.

Parameters:
centerddg.Point or numpy.ndarray of shape (n+1,)

Center of Sphere given in homogeneous coordinates.

radiusfloat

Radius of Sphere.

subspaceddg.Subspace or iterable of numpy.ndarray of shape (n+1,), optional

A (k+1)-dimensional Subspace of n-dimensional projective space used to define k-Sphere. If given as an iterable of numpy.ndarray, its elements will be interpreted as the spanning points in homogeneous coordinates.

geometryddg.Geometry (default=’euclidean’)

Geometry to which Sphere belongs, can be set to any CayleyKleinGeometry.

atolfloat (default=None)

Absolute tolerance.

rtolfloat (default=None)

Relative tolerance.

Notes

This class supports comparison with <, >, <=, >= and ==. These implement the subset relation “⊆”. This class also supports the “in” keyword, which implements the element relation “∈”.

Attributes:
center
radius
subspace
ambient_dimensionint

Dimension of ambient projective space.

dimensionint

Dimension of Sphere.

property ambient_dimension
property dimension
cayley_klein_radius()[source]

Return radius in terms of the Cayley-Klein distance.

Returns:
float
is_hypersphere()[source]

Checks if the sphere is a hypersphere.

Returnsbool

True, if dimension of Sphere is one less than dimension of ambient space.

is_circle()[source]

Checks if the sphere is a circle.

Returnsbool

True, if Sphere is 1-dimensional Circle.

set_geometry(geometry)[source]

Resets geometry attribute after initialization.

Parameters:
geometryddg.Geometry, str or tuple (str, int)

Geometry of the Sphere, set to ‘euclidean’ at initialization.

property atol
atol_default = 1e-07

Absolute tolerance default.

Used for all purposes if atol is None.

classmethod nonexact_function(f)

Decorator to use global tolerance defaults in functions.

If None is given to the wrapped function as the value for atol or rtol, it will be replaced by the global default.

Parameters:
fcallable

Function that takes atol and rtol arguments.

Returns:
callable
classmethod reset_tol_defaults()
property rtol
rtol_default = 0.0

Relative tolerance default.

Used for all purposes if rtol is None.

ddg.geometry.spheres.sphere_from_affine_point_and_normals(point, radius, normals=[], affine_component=-1)[source]

Create an Euclidean sphere from an affine point and normal directions.

Parameters:
pointnumpy.ndarray of shape (n,)

Affine point in n-dimensional space.

radiusfloat

Radius of Sphere.

normalslist of numpy.ndarray of shape (n,).

Used to define (n-k) directions as a basis for orthogonal complement of k-dimensional span of list of normals of length k. If given as 2-dimensional numpy.ndarray of shape (k,n), the rows(!) of matrix will be interpreted as the normal vectors.

affine_componentint, default=-1.
Returns:
ddg.Sphere

An Euclidean (n-k-1)-sphere contained in a (n-k)-dimensional projective subspace spanned by affine point and directions.