ddg.geometry.elliptic_models module
Elliptic geometry module.
This is the metric Cayley-Klein geometry with empty / positive definite absolute.
- class ddg.geometry.elliptic_models.ProjectiveModel(dimension)[source]
Bases:
MetricCayleyKleinGeometryElliptic geometry.
This is a Cayley-Klein geometry with empty absolute, so the model space is all of RPn.
- Parameters:
- dimensionint
- Attributes:
- dimensionint
- property absolute
The absolute quadric with matrix
diag([1,...,1]).- Returns:
- Quadric
- static metric_to_cayley_klein_distance(d)[source]
Return Metric distance converted to Cayley-Klein “distance”.
Kis given byK = cos(d) ** 2
- Parameters:
- dfloat
- Returns:
- Kfloat
- static cayley_klein_distance_to_metric(K)[source]
Return Cayley-Klein distance converted to metric distance.
dis given by the equationd = arccos(sqrt(K))
- Parameters:
- Kfloat
- Returns:
- dfloat
- Raises:
- ValueError
If K is not in [0, 1]
- to_moebius(object_, embedded=False)[source]
Alias for
projective_to_spherical()
- from_moebius(object_, embedded=False)[source]
Alias for
spherical_to_projective()
- sphere_through_points(*points)[source]
Find the k-spheres through given points.
Returns all the spheres of minimal dimension that contain the given points. There might be up to
2 ** (len(points) - 1)of these which are returned as a list ordered by increasing radius. The spheres might degenerate to subspaces which are considered to have infinite radius.Generically, n points define an (n-2)-sphere.
- Parameters:
- *pointsiterable of type
ddg.geometry.Point The points for which to find the sphere.
- *pointsiterable of type
- Returns:
- list of ddg.geometry.spheres.MetricCaleyKleinSphere or ddg.geometry.Subspace
The length of this list varies from 1 to
2 ** (len(points) - 1).
- Raises:
- ValueError
If the points are not contained in a sphere.
If a given point is not an element of the according geometry.
- orthogonal_sphere(*spheres)[source]
Find the set of minimal orthogonal spheres for the given
*spheres.If the output of this function is not an empty list, then any sphere of positive radius in the output list possesses the following property: Any higher-dimensional sphere containing the former sphere is orthogonal to all spheres given in the input. Thus, it is an orthogonal sphere of minimal dimension, if it is unique.
This function returns all such spheres of minimal dimension. The list is sorted by increasing radius. Subspaces can also be inserted and returned as they can be thought of as spheres with maximal radius. Returns the empty list if the set is empty (including the case when there is no orthogonal spheres).
Works by lifting
*spheresto SphericalModel. Since each lift is a pair of antipodal spheres, there are 2**len(spheres) possible lifts (the complementary lifts are antipodal and then their ort spheres are projected back to the same ones, so the maximal possible output consist of 2**(len(spheres) - 1) spheres), each of which could provide a minimal orthogonal sphere or not. A minimal orthogonal sphere for a lift is defined as the intersection of all spheres orthogonal to all lifted ones. This definition matchesddg.geometry.euclidean_models.ProjectiveModel.orthogonal_sphere.For example, m non-intersecting hyperspheres in general position in n-dimensional elliptic space have 2**(m - 1) orthogonal (m-2)-spheres, which are returned by this function.
- Parameters:
- *spheres: iterable of type ddg.geometry.spheres.MetricCayleyKleinSphere or
- ddg.geometry.Subspace
Cayley Klein spheres or subspaces
- Returns:
- list of ddg.geometry.spheres.MetricCayleyKleinSphere or ddg.geometry.Subspace
List of spheres orthogonal to the given spheres sorted by increasing radius. The length of the list varies from 0 to 2**(len(spheres) - 1).
- property ambient_dimension
- cayley_klein_distance(v, w)
Alias for self.absolute.cayley_klein_distance.
- cayley_klein_sphere(center, radius, subspace=None, atol=None, rtol=None)
Create a Cayley-Klein sphere.
- Parameters:
- centerddg.geometry.Point or numpy.ndarray of shape (n+1,)
- radiusfloat
Cayley-Klein radius
- subspaceddg.geometry.Subspace or list of numpy.ndarray of shape (k,)
- (default=None)
- Returns:
- ddg.geometry.spheres.CayleyKleinSphere
- d(v, w) float
Cayley-Klein metric
- Parameters:
- v, wnumpy.ndarray or ddg.geometry.Point
Homogeneous coordinate vectors or Point instances. Both points must be either inside or outside the absolute quadric.
- Returns:
- float
- generalized_cayley_klein_sphere(center, radius, subspace=None, atol=None, rtol=None)
Create a generalized Cayley-Klein sphere.
- Parameters:
- centerddg.geometry.Point or numpy.ndarray of shape (n+1,)
- radiusfloat
Generalized radius
- subspaceddg.geometry.Subspace or list of numpy.ndarray of shape (k,)
- (default=None)
- Returns:
- ddg.geometry.spheres.GeneralizedCayleyKleinSphere
- inner_product(v, w)
Alias for self.absolute.inner_product.
- sphere(center, radius, subspace=None, atol=None, rtol=None)
Create a sphere with metric radius.
- Parameters:
- centerddg.geometry.Point or numpy.ndarray of shape (n+1,)
- radiusfloat
Radius in terms of the Cayley-Klein Metric
self.d.- subspaceddg.geometry.Subspace or array_like of shape (m,n) (default=None)
- Returns:
- ddg.geometry.spheres.MetricCayleyKleinSphere
- class ddg.geometry.elliptic_models.SphericalModel(dimension)[source]
Bases:
_ProjectiveSubgeometrySpherical model of elliptic geometry.
Also known as the Möbius model because this is a subgeometry of Möbius geometry.
Model space
The model space is the unit sphere where antipodal points are identified. More precisely:
S^n/{±1} = { {[x], [y]} ⊆ S^n : dehomogenize([x]) = − dehomogenize([y]) }where
S^n = Quadric(diag([1,...,1, -1]))is the Möbius quadric.Representation of objects
All geometric objects (except for points) are represented by Möbius spheres, i.e. Quadric objects contained in the Möbius quadric.
- Parameters:
- dimensionint
Notes
This class supports comparison with
==. Two geometries are equal if and only if they have the same type, anddimension.This class also supports the
inoperator to check whether a point is in the model space.- Attributes:
- dimensionint
- property fixed_point
Point inside the Möbius quadric used for computation of the metric.
This is the point with representative [0,…,0, 1].
- Returns:
- ddg.geometry.Point
- d(v, w)[source]
Elliptic metric in spherical model
Given by the formula
| <x, y> + <x, p> <y, p> | | ---------------------- | = cos(d([x],[y]) | <x, p> <y, p> |
Where
pisself.fixed_point.point.- Parameters:
- v, wddg.geometry.Point or array_like of shape (n,)
- Returns:
- float
- property absolute
The absolute quadric with matrix
diag([1,...,1, -1]).- Returns:
- ddg.geometry.Quadric
- property ambient_dimension
- angle(s1, s2)
Angle between two Möbius spheres.
- Parameters:
- s1, s2ddg.geometry.Quadric
Möbius spheres.
- Returns:
- float
- cayley_klein_distance(v, w)
Alias for self.absolute.cayley_klein_distance.
- cayley_klein_sphere(center, radius, subspace=None, atol=None, rtol=None)
Create a Cayley-Klein sphere.
- Parameters:
- centerddg.geometry.Point or numpy.ndarray of shape (n+1,)
- radiusfloat
Cayley-Klein radius
- subspaceddg.geometry.Subspace or list of numpy.ndarray of shape (k,)
- (default=None)
- Returns:
- ddg.geometry.spheres.CayleyKleinSphere
- elliptic()
Corresponding projective model of elliptic geometry.
- property elliptic_point
- property elliptic_subspace
- euclidean()
Corresponding projective model of Euclidean geometry.
- property euclidean_point
- property euclidean_subspace
- from_elliptic(object_, embedded=False)
Alias for
elliptic_models.projective_to_moebius()
- from_euclidean(object_, embedded=False)
Alias for
euclidean_models.projective_to_moebius()
- from_hyperbolic(object_, embedded=False)
- from_hyperbolic_half_space(object_, embedded=False)
- from_hyperbolic_poincare(object_, embedded=False)
- from_lie(object_, embedded=False)
- from_paraboloid(object_)
Alias for
paraboloid_to_projective_and_back()
- generalized_cayley_klein_sphere(center, radius, subspace=None, atol=None, rtol=None)
Create a generalized Cayley-Klein sphere.
- Parameters:
- centerddg.geometry.Point or numpy.ndarray of shape (n+1,)
- radiusfloat
Generalized radius
- subspaceddg.geometry.Subspace or list of numpy.ndarray of shape (k,)
- (default=None)
- Returns:
- ddg.geometry.spheres.GeneralizedCayleyKleinSphere
- hyperbolic()
Corresponding projective model of hyperbolic geometry.
- hyperbolic_half_space()
Corresponding Poincare disk model of hyperbolic geometry.
- hyperbolic_poincare()
Corresponding Poincare disk model of hyperbolic geometry.
- property hyperbolic_point
- property hyperbolic_subspace
- inner_product(v, w)
Alias for self.absolute.inner_product.
- lie()
Corresponding projective model of Lie geometry.
- paraboloid()
Corresponding paraboloid model of Möbius geometry.
- pole_of_sphere(sphere)
Return pole corresponding to sphere.
- Parameters:
- sphereddg.geometry.Quadric
- Returns:
- ddg.geometry.Subspace
- sphere_from_pole(subspace) Quadric
Get a Möbius sphere from its pole.
Returns intersection of
QandQ.polarize(subspace), whereQis the Möbius quadric.- Parameters:
- subspaceddg.geometry.Subspace
- Returns:
- ddg.geometry.Quadric
- to_elliptic(object_, embedded=False)
Alias for
elliptic_models.moebius_to_projective()
- to_euclidean(object_, embedded=False)
Alias for
euclidean_models.moebius_to_projective()
- to_hyperbolic(object_, embedded=False)
- to_hyperbolic_half_space(object_, embedded=False)
- to_hyperbolic_poincare(object_, embedded=False)
- to_lie(object_, embedded=False)
- to_paraboloid(object_)
Alias for
paraboloid_to_projective_and_back()
- ddg.geometry.elliptic_models.spherical_to_projective(object_, embedded=False)[source]
Convert from spherical model to projective model.
Works by centrally projecting from the Möbius quadric to the hyperplane at infinity and computing coordinates.
If a quadric is given which is contained in the Möbius quadric, the result will be converted to a corresponding Caley-Klein sphere.
- Parameters:
- object_ddg.geometry.Quadric or ddg.geometry.Point
- embeddedbool (default=False)
Whether to return the object in the hyperplane at infinity or in n-dim. ambient space.
- Returns:
- ddg.geometry.Quadric,
- ddg.geometry.Point,
- ddg.geometry.Subspace or
- ddg.geometry.spheres.MetricCayleyKleinSphere
- ddg.geometry.elliptic_models.projective_to_spherical(object_)[source]
- ddg.geometry.elliptic_models.projective_to_spherical(subspace: Subspace, embedded=False)
- ddg.geometry.elliptic_models.projective_to_spherical(point: Point, embedded=False)
- ddg.geometry.elliptic_models.projective_to_spherical(sphere: SphereLike, embedded=False)
Projective to hemisphere model conversion.hyperconv
This is a dispatcher, see type-specific functions for details.