HyperPolygon
The HyperPolygon object encapsulates vertices and center points of a hyperbolic polygon, as well as (if applicable) some additional variables, such as the angle in the complex plane or the layer in the tiling. It is used by some of the construction kernels, especially SRS and SRG.
- class hypertiling.kernel.hyperpolygon.HyperPolygon(p, vertices=None, idx=None, layer=None, sector=None, angle=None, val=None, orientation=None)
Represents a hyperbolic polygon with operations suitable for tiling hyperbolic planes.
- p
The number of edges of the polygon.
- Type:
int
- idx
The unique identifier of the polygon.
- Type:
int
- layer
The layer number in the tiling where the polygon belongs.
- Type:
int
- sector
The sector of the tiling where the polygon is located.
- Type:
int
- angle
The internal angle of the polygon.
- Type:
float
- val
The value associated with the polygon (custom usage).
- Type:
float
- orientation
The orientation of the polygon in the tiling.
- Type:
float
- _vertices
The center and vertices in Poincare disk coordinates.
- Type:
np.ndarray[np.complex128]
- centerW()
Returns the center of the polygon in Weierstrass coordinates.
- Returns:
The Weierstrass coordinate of the polygon center.
- Return type:
Weierstrass coordinate
- find_angle()
Compute angle between center and the positive x-axis. The angle is adjusted to ensure it’s non-negative. The result is stored as an instance variable.
- find_orientation()
Finds the orientation of the polygon.
This function computes the orientation of the polygon (the angle between the first vertex and the center of the polygon) and stores the result in the orientation attribute. The returned value is between -pi and pi.
- find_sector(k, offset=0)
Compute - based on complex angle -in which sector out of k sectors the polygon is located
- Parameters:
k (int) – number of equal-sized sectors
offset (float, optional) – rotate sectors by an angle
- get_center()
Returns the center of the polygon in Poincare coordinates.
- Returns:
The center of the polygon.
- Return type:
np.complex128
- get_polygon()
Returns an array containing center + outer vertices in Poincare coordinates.
- Returns:
An array of the center and outer vertices of the polygon.
- Return type:
np.array[np.complex128]
- get_vertices()
Returns an array containing the outer vertices in Poincare coordinates.
- Returns:
An array of the outer vertices of the polygon.
- Return type:
np.array[np.complex128]
- mirror()
Mirror on the x-axis.
This function mirrors the polygon on the x-axis and updates the angle attribute.
- moeb_origin(z0)
Transforms the entire polygon such that z0 is mapped to origin.
- Parameters:
z0 (complex) – The point that is to be mapped to the origin.
- moeb_rotate(phi)
Rotates each point of the polygon by phi.
- Parameters:
phi (float) – The angle of rotation in radians.
- set_center(center)
Sets the center of the polygon in Poincare coordinates.
- Parameters:
center (np.complex128) – The center of the polygon in Poincare coordinates.
- set_polygon(polygon)
Sets the entire polygon: center + outer vertices in Poincare coordinates.
- Parameters:
polygon (np.array[np.complex128]) – An array of the center and outer vertices of the polygon.
- Raises:
ValueError – If the number of points provided is not equal to the number of polygon edges plus one (center point).
- set_vertices(vertices)
Sets the outer vertices of the polygon in Poincare coordinates.
- Parameters:
vertices (np.array[np.complex128]) – An array of the outer vertices of the polygon.
- Raises:
ValueError – If the number of vertices provided is not equal to the number of polygon edges.
- tf_full(ind, phi)
Transforms the entire polygon: to the origin, rotate it and back again.
- Parameters:
ind (int) – Index of the vertex that defines the Moebius Transform.
phi (float) – Angle of rotation.