Explore the hyperbolic space using this module. Checkout the doc for examples.
Module for working with hyperbolic geometry. Uses the Beltrami–Klein model.
Ideal points have Beltrami coordinates with length 1.
Hyper ideal points have Beltrami coordinates with length > 1.
origin : Point
The origin is the point in the center.
pointAtInfinity : Basics.Float -> IdealPoint
An ideal point is a point at infinity, uniquely defined by an angle.
pointsAreEqual : Point -> Point -> Basics.Bool
Returns if two point can be considered equal.
distanceTo : Point -> Point -> Basics.Float
Get the distance between two points
distanceToOrigin : Point -> Basics.Float
Distance to the origin
discFillingPolygon : { vertices : Basics.Int, polygonsAroundAPoint : Basics.Int } -> Basics.Float
If you want to construct a tiling in the hyperbolic space, then the length of the polygon specifies how many polygons fit around a point.
If you look up tilings, you will usually find a Schläfli symbol {p,q}. In that case p = vertices, q = polygonsAroundAPoint.
The resulting length is for BeltramiCoords
( IdealPoint
, IdealPoint
)
We define a line by two ideal points.
An ideal point is a point at infinity and can be represented by an angle
A hyper ideal point is a point that only exists in the euclidean projection of the hyperbolic plane into the Beltrami–Klein model.
( Point, Point )
A line segment is defined by two points
poleOfLine : Line -> Maybe HyperIdealPoint
Any line except lines going through the origin, can be associated by a unique hyper ideal point.
lineFromIdealPoints : IdealPoint -> IdealPoint -> Line
Constructs a line from two ideal points
lineFromIdealPoints : IdealPoint -> IdealPoint -> Line
lineFromIdealPoints =
Tuple.pair
lineSectionTo : Point -> Point -> LineSegment
Constructs a line segment to a point
lineSectionTo : BeltramiPoint -> BeltramiPoint -> LineSegment
lineSectionTo =
Tuple.pair
lineFromPoints : Point -> Point -> Maybe Line
constructs a line from two points
lineFromLineSegment : LineSegment -> Maybe Line
Convert a line segment into a line
midpointOfLine : Line -> Point
Construct the midpoint of a line
midpointOfLineSegment : LineSegment -> Maybe Point
Get the midpoint of a line segment
lineFromHyperIdealPointThrough : Point -> HyperIdealPoint -> Maybe Line
Construct a line using an hyper ideal point
perpendicularLineThrough : Point -> Line -> Maybe Line
Point as to lie on the line
intersectLines : Line -> Line -> Maybe Point
Two lines may intersect at exactly one point
bisectorThrough : Point -> ( Point, Point ) -> Maybe Line
Construct a bisector through a point
reflectBy : Line -> Point -> Point
reflect a point by a line
nearestIdealPointOf : Line -> Point -> IdealPoint
return the nearest ideal point of a line from a given point
Gyrovector in Poincare-Model
vectorTo : Gyrovector -> Gyrovector -> Gyrovector
Creates a vector from two points. The length of the vector
negate : Gyrovector -> Gyrovector
Negate a vector
add : Gyrovector -> Gyrovector -> Gyrovector
Using the Möbius Addition to add two vectors in the poincare disc
length : Gyrovector -> Basics.Float
Return the length of a vector
einsteinVelocityAddition : Point -> Point -> Point
Addition for Gyrovectors in the Beltrami Disc Model.
rotateClockwise : Basics.Float -> Gyrovector -> Gyrovector
Rotate the vector clockwise
rotatePointClockwise : Basics.Float -> Point -> Point
Rotate a point clockwise around the origin
scaleBy : Basics.Float -> Gyrovector -> Gyrovector
scale a vector by a factor
pointsAlongLine : Basics.Int -> Line -> List Point
Constructs a given amount of point along a line
pointsAlongLineSegment : Basics.Int -> LineSegment -> List Point
Constructs a given amount of point along a line segment
fromPolarCoords : { radius : Basics.Float, angle : Basics.Float } -> Point
Constructs a point using polar coordinates.
projectFromEuclideanSpace : ( Basics.Float, Basics.Float ) -> Point
Projects points from euclidean space into hyperbolic space. However, you can not expect the proportions to stay the same.
Points further out experience more distortion.
projectOntoBeltramiKleinDisc : Point -> ( Basics.Float, Basics.Float )
Project Hyperbolic points to the Beltrami klein disc
projectOntoPoincareDisc : Point -> ( Basics.Float, Basics.Float )
Project Hyperbolic points to the Poincare disc
toPoincareVector : Point -> Gyrovector
convert a point into a vector
fromPoincareVector : Gyrovector -> Point
convert a vector into a point
unsafeFromAxialCoord : ( Basics.Float, Basics.Float ) -> Point
Converts Beltrami Coordinates into Axial coordinates.
unsafeFromIdealPoint : IdealPoint -> Point
unsafeFromRecord : { x : Basics.Float, y : Basics.Float } -> Point
unsafeHyperIdealPointToRecord : HyperIdealPoint -> { x : Basics.Float, y : Basics.Float }
unsafePoincareVectorFromRecord : { x : Basics.Float, y : Basics.Float } -> Gyrovector
unsafePoincareVectorToRecord : Gyrovector -> { x : Basics.Float, y : Basics.Float }
unsafeToAxialCoord : Point -> Maybe ( Basics.Float, Basics.Float )
Converts Axial coordinates into Beltrami Coordinates.
unsafeToRecord : Point -> { x : Basics.Float, y : Basics.Float }