Source code for ddg.geometry.laguerre_models

"""Laguerre geometry module.

Contains model classes and functions for conversion between the models.
"""
import numpy as np

from ddg.geometry.geometry_model_templates import CayleyKleinGeometry
from ddg.geometry.quadrics import Quadric
from ddg.geometry.subspaces import Point, normal_with_level

__all__ = [
    "ProjectiveModel",
    "EuclideanModel",
    "euclidean_to_projective",
    "projective_to_euclidean",
]


[docs]class ProjectiveModel(CayleyKleinGeometry): """Projective / Blaschke cylinder model of Laguerre geometry. .. rubric:: Model space The model space is the quadric with matrix `diag([1,...,1, 0, -1])` without the point at infinity [0,...,0, 1 ,0]. .. rubric:: Representation of objects Points in this cylinder represent hyperplanes in R^n: In affine coordinates, they have a "direction" v and a "height" h. The point (v, h) corresponds to the hyperplane ``<x, v> = h.`` Parameters ---------- dimension : int Attributes ---------- dimension : int """ @property def absolute(self): """The absolute quadric with matrix ``diag([1,...,1, 0, -1])``. Returns ------- Quadric """ diag = np.ones(self.dimension + 2) diag[-2] = 0 diag[-1] = -1 return Quadric(np.diag(diag)) def __contains__(self, point): return point in self.absolute
[docs]class EuclideanModel: """Euclidean model of Laguerre geometry. .. rubric:: Model space The model space is R^n. .. rubric:: Representation of objects Objects are represented by their Euclidean equivalents, mostly subspaces. """
[docs]def euclidean_to_projective(object_): """Convert from Euclidean model to Projective model / Blaschke cylinder. Parameters ---------- object_ : Subspace of dimension n-1 Returns ------- Point """ return Point([*normal_with_level(object_), 1])
[docs]def projective_to_euclidean(object_): """Convert from Projective model / Blaschke cylinder to Euclidean model. Parameters ---------- object_ : Point Returns ------- Subspace """ p = object_.point[:-1] return Point(p).dualize()