Source code for projgeom.hyp_object
from .pg_object import PgObject
[docs]
class HyperbolicPoint(PgObject["HyperbolicLine"]):
"""
.. svgbob::
:align: center
\\ | /
\\ | /
\\|/
-----o-----
/|\\
/ | \\
/ | \\
"""
[docs]
def dual_type(self) -> type:
"""Returns the type of the dual object (HyperbolicLine for HyperbolicPoint).
:return: The type of the dual geometric object.
Examples:
>>> from projgeom.hyp_object import HyperbolicPoint
>>> pt = HyperbolicPoint([1, 2, 3])
>>> pt.dual_type()
<class 'projgeom.hyp_object.HyperbolicLine'>
"""
return HyperbolicLine
[docs]
def perp(self) -> "HyperbolicLine":
"""Polar line of the point.
Note: This represents the polar operation in projective geometry, not perpendicular.
:return: a HyperbolicLine object.
Examples:
>>> from projgeom.hyp_object import HyperbolicPoint, HyperbolicLine
>>> p = HyperbolicPoint([1, 2, 3])
>>> p.perp()
HyperbolicLine(1 : 2 : -3)
"""
return self.polar()
[docs]
def polar(self) -> "HyperbolicLine":
"""Polar line of the point.
:return: a HyperbolicLine object.
Examples:
>>> from projgeom.hyp_object import HyperbolicPoint, HyperbolicLine
>>> p = HyperbolicPoint([1, 2, 3])
>>> p.polar()
HyperbolicLine(1 : 2 : -3)
"""
return HyperbolicLine([self.coord[0], self.coord[1], -self.coord[2]])
[docs]
class HyperbolicLine(PgObject[HyperbolicPoint]):
"""
The HyperbolicLine class represents a line in Hyperbolic geometry and provides methods for finding its
pole.
.. svgbob::
:align: center
\\ | /
\\ | /
\\|/
-----o-----
/|\\
/ | \\
/ | \\
"""
[docs]
def dual_type(self) -> type:
"""Returns the type of the dual object (HyperbolicPoint for HyperbolicLine).
:return: The type of the dual geometric object.
Examples:
>>> from projgeom.hyp_object import HyperbolicLine
>>> ln = HyperbolicLine([1, 2, 3])
>>> ln.dual_type()
<class 'projgeom.hyp_object.HyperbolicPoint'>
"""
return HyperbolicPoint
[docs]
def perp(self) -> HyperbolicPoint:
"""
The `perp` function returns a HyperbolicPoint object that represents the pole to the given line.
Note: This represents the pole operation in projective geometry, not perpendicular.
:return: The `perp` method returns a `HyperbolicPoint` object.
Examples:
>>> from projgeom.hyp_object import HyperbolicPoint, HyperbolicLine
>>> l = HyperbolicLine([1, 2, 3])
>>> l.perp()
HyperbolicPoint(1 : 2 : -3)
"""
return self.pole()
[docs]
def pole(self) -> HyperbolicPoint:
"""
The `pole` function returns a HyperbolicPoint object that represents the pole to the given line.
:return: The `pole` method returns a `HyperbolicPoint` object.
Examples:
>>> from projgeom.hyp_object import HyperbolicPoint, HyperbolicLine
>>> l = HyperbolicLine([1, 2, 3])
>>> l.pole()
HyperbolicPoint(1 : 2 : -3)
"""
return HyperbolicPoint([self.coord[0], self.coord[1], -self.coord[2]])