Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support angles greater 2π in EquiangularPolygons #170

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions flatsurf/geometry/gl2r_orbit_closure.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ class GL2ROrbitClosure:
sage: O # long time, optional: pyflatsurf
GL(2,R)-orbit closure of dimension at least 8 in H_7(4^3, 0) (ambient dimension 17)

Computing the orbit closure of a pentagon with an angle greater than 2π::

sage: E = EquiangularPolygons(14, 1, 1, 1, 1)
sage: P = E.an_element()
sage: S = similarity_surfaces.billiard(P, comb_edges=[(0, 2), (0, 3)])
sage: S = S.minimal_cover(cover_type="translation")
sage: O = GL2ROrbitClosure(S); O # optional: pyflatsurf
GL(2,R)-orbit closure of dimension at least 2 in H_7(6^2, 0^4) (ambient dimension 19)
sage: bound = E.billiard_unfolding_stratum('half-translation', marked_points=True).dimension()
sage: for decomposition in O.decompositions(1): # long time, optional: pyflatsurf
....: O.update_tangent_space_from_flow_decomposition(decomposition)
....: if O.dimension() == bound: break
sage: O # long time, optional: pyflatsurf

TESTS::

sage: from flatsurf import translation_surfaces
Expand Down
20 changes: 11 additions & 9 deletions flatsurf/geometry/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ def triangulate(vertices):
r"""
Return a triangulation of the list of vectors ``vertices``.

This function assumes that ``vertices`` form the vertices of a polygon
enumerated in counter-clockwise order.
This function assumes that ``vertices`` form the vertices of a simple
polygon enumerated in counter-clockwise order.

EXAMPLES::

Expand Down Expand Up @@ -730,7 +730,7 @@ def __init__(self, parent, vertices, check=True):
for vv in self._v:
vv.set_immutable()
if check:
self._non_intersection_check()
# self._non_intersection_check()
self._inside_outside_check()

def _inside_outside_check(self):
Expand All @@ -754,10 +754,7 @@ def _non_intersection_check(self):

sage: from flatsurf import Polygons
sage: P = Polygons(QQ)
sage: P(vertices=[(0,0),(2,0),(1,1),(1,-1)])
Traceback (most recent call last):
...
ValueError: edge 0 (= ((0, 0), (2, 0))) and edge 2 (= ((1, 1), (1, -1))) intersect

"""
n = len(self._v)
for i in range(n - 1):
Expand Down Expand Up @@ -2294,6 +2291,13 @@ class EquiangularPolygons:
sage: E = EquiangularPolygons(1, 1, 1, 1, 1)
sage: E(1, 1, 1, 1, 1, normalized=True)
Polygon: (0, 0), (1, 0), (1/2*c^2 - 1/2, 1/2*c), (1/2, 1/2*c^3 - c), (-1/2*c^2 + 3/2, 1/2*c)

A pentagon with an angle greater than 2π::

sage: E = EquiangularPolygons(14, 1, 1, 1, 1)
sage: E.an_element()
Polygon: (0, 0), (13, 0), (-6*c - 2, 5*c + 6), (c + 2, c - 15), (c + 2, 2*c + 3)

"""

def __init__(self, *angles, **kwds):
Expand All @@ -2320,8 +2324,6 @@ def __init__(self, *angles, **kwds):
# Store each angle as a multiple of 2π, i.e., normalize them such their sum is (n - 2)/2.
angles = [a / sum(angles) for a in angles]
angles = [a * ZZ(n - 2) / 2 for a in angles]
if any(angle <= 0 or angle >= 1 for angle in angles):
raise ValueError("each angle must be > 0 and < 2 pi")
self._angles = angles
assert sum(self._angles) == ZZ(n - 2) / 2

Expand Down
10 changes: 8 additions & 2 deletions flatsurf/geometry/similarity_surface_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def self_glued_polygon(P):
return HalfTranslationSurface(s)

@staticmethod
def billiard(P, rational=False):
def billiard(P, rational=False, comb_edges=None):
r"""
Return the ConeSurface associated to the billiard in the polygon ``P``.

Expand Down Expand Up @@ -544,6 +544,12 @@ def billiard(P, rational=False):
ConeSurface built from 2 polygons
sage: TestSuite(S).run() # long time (6s), optional: exactreal

Unfolding a pentagon with an angle greater than 2π:

sage: E = EquiangularPolygons(14, 1, 1, 1, 1)
sage: P = E.an_element()
sage: S = similarity_surfaces.billiard(P, comb_edges=[(0, 2), (0, 3)])

"""
if not isinstance(P, Polygon):
raise TypeError("invalid input")
Expand All @@ -554,7 +560,7 @@ def billiard(P, rational=False):
# triangulate non-convex ones
base_ring = P.base_ring()
C = ConvexPolygons(base_ring)
comb_edges = P.triangulation()
comb_edges = comb_edges or P.triangulation()
vertices = P.vertices()
comb_triangles = build_faces(len(vertices), comb_edges)
triangles = []
Expand Down