mappings

Mappings between translation surfaces.

class flatsurf.geometry.mappings.CanonicalizePolygonsMapping(s)[source]

This is a mapping to a surface with the polygon vertices canonically determined. A canonical labeling is when the canonocal_first_vertex is the zero vertex.

pull_vector_back(tangent_vector)[source]

Applies the pullback mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

class flatsurf.geometry.mappings.GL2RMapping(s, m, category=None)[source]

This class pushes a surface forward under a matrix.

Note that for matrices of negative determinant we need to relabel edges (because edges must have a counterclockwise cyclic order). For each n-gon in the surface, we relabel edges according to the involution \(e \mapsto n-1-e\).

EXAMPLE:

sage: from flatsurf import translation_surfaces
sage: s=translation_surfaces.veech_2n_gon(4)
sage: from flatsurf.geometry.mappings import GL2RMapping
sage: mat=Matrix([[2,1],[1,1]])
sage: m=GL2RMapping(s,mat)
sage: TestSuite(m.codomain()).run()
pull_vector_back(tangent_vector)[source]

Applies the inverse of the mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

class flatsurf.geometry.mappings.IdentityMapping(domain, codomain)[source]

Construct an identity map between two “equal” surfaces.

pull_vector_back(tangent_vector)[source]

Applies the pullback mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

class flatsurf.geometry.mappings.ReindexMapping(s, relabler, new_base_label=None)[source]

Apply a dictionary to relabel the polygons.

pull_vector_back(tangent_vector)[source]

Applies the pullback mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

class flatsurf.geometry.mappings.SimilarityJoinPolygonsMapping(s, p1, e1)[source]

Return a SurfaceMapping joining two polygons together along the edge provided to the constructor.

EXAMPLES:

sage: from flatsurf import MutableOrientedSimilaritySurface, Polygon
sage: s = MutableOrientedSimilaritySurface(QQ)
sage: s.add_polygon(Polygon(edges=[(1,0),(0,1),(-1,-1)]))
0
sage: s.add_polygon(Polygon(edges=[(-1,0),(0,-1),(1,1)]))
1
sage: s.glue((0, 0), (1, 0))
sage: s.glue((0, 1), (1, 1))
sage: s.glue((0, 2), (1, 2))
sage: s.set_immutable()

sage: from flatsurf.geometry.mappings import SimilarityJoinPolygonsMapping
sage: m=SimilarityJoinPolygonsMapping(s, 0, 2)
sage: s2=m.codomain()
sage: s2.labels()
(0,)
sage: s2.polygons()
(Polygon(vertices=[(0, 0), (1, 0), (1, 1), (0, 1)]),)
sage: s2.gluings()
(((0, 0), (0, 2)), ((0, 1), (0, 3)), ((0, 2), (0, 0)), ((0, 3), (0, 1)))
glued_vertices()[source]

Return the vertices of the newly glued polygon which bound the diagonal formed by the glue.

pull_vector_back(tangent_vector)[source]

Applies the inverse of the mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

removed_label()[source]

Return the label that was removed in the joining process.

class flatsurf.geometry.mappings.SplitPolygonsMapping(s, p, v1, v2, new_label=None)[source]

Class for cutting a polygon along a diagonal.

EXAMPLES:

sage: from flatsurf import translation_surfaces
sage: s=translation_surfaces.veech_2n_gon(4)
sage: from flatsurf.geometry.mappings import SplitPolygonsMapping
sage: m = SplitPolygonsMapping(s,0,0,2)
sage: s2=m.codomain()
sage: TestSuite(s2).run()
sage: s2.labels()
(0, 1)
sage: s2.polygons()
(Polygon(vertices=[(0, 0), (1/2*a + 1, 1/2*a), (1/2*a + 1, 1/2*a + 1), (1, a + 1), (0, a + 1), (-1/2*a, 1/2*a + 1), (-1/2*a, 1/2*a)]), Polygon(vertices=[(0, 0), (-1/2*a - 1, -1/2*a), (-1/2*a, -1/2*a)]))
sage: s2.gluings()
(((0, 0), (1, 0)), ((0, 1), (0, 5)), ((0, 2), (0, 6)), ((0, 3), (1, 1)), ((0, 4), (1, 2)), ((0, 5), (0, 1)), ((0, 6), (0, 2)), ((1, 0), (0, 0)), ((1, 1), (0, 3)), ((1, 2), (0, 4)))
pull_vector_back(tangent_vector)[source]

Applies the pullback mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

class flatsurf.geometry.mappings.SurfaceMapping(domain, codomain)[source]

Abstract class for any mapping between surfaces.

codomain()[source]

Return the range of the mapping.

domain()[source]

Return the domain of the mapping.

pull_vector_back(tangent_vector)[source]

Applies the inverse of the mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

class flatsurf.geometry.mappings.SurfaceMappingComposition(mapping1, mapping2)[source]

Composition of two mappings between surfaces.

factors()[source]

Return the two factors of this surface mapping as a pair (f,g), where the original map is f o g.

pull_vector_back(tangent_vector)[source]

Applies the inverse of the mapping to the provided vector.

push_vector_forward(tangent_vector)[source]

Applies the mapping to the provided vector.

flatsurf.geometry.mappings.canonical_first_vertex(polygon)[source]

Return the index of the vertex with smallest y-coordinate. If two vertices have the same y-coordinate, then the one with least x-coordinate is returned.

flatsurf.geometry.mappings.canonicalize_translation_surface_mapping(s)[source]

Return the translation surface in a canonical form.

EXAMPLES:

sage: from flatsurf import translation_surfaces
sage: s = translation_surfaces.octagon_and_squares().canonicalize()

sage: TestSuite(s).run()

sage: a = s.base_ring().gen()  # a is the square root of 2.

sage: from flatsurf.geometry.mappings import GL2RMapping
sage: from flatsurf.geometry.mappings import canonicalize_translation_surface_mapping
sage: mat=Matrix([[1,2+a],[0,1]])
sage: from flatsurf.geometry.mappings import GL2RMapping
sage: m1=GL2RMapping(s, mat)
sage: m2=canonicalize_translation_surface_mapping(m1.codomain())
sage: m=m2*m1
sage: m.domain().cmp(m.codomain())
0
sage: TestSuite(m.codomain()).run()
sage: s=m.domain()
sage: v=s.tangent_vector(0,(0,0),(1,1))
sage: w=m.push_vector_forward(v)
sage: print(w)
SimilaritySurfaceTangentVector in polygon 0 based at (0, 0) with vector (a + 3, 1)
flatsurf.geometry.mappings.delaunay_decomposition_mapping(s)[source]

Returns a mapping to a Delaunay decomposition or possibly None if the surface already is Delaunay.

flatsurf.geometry.mappings.delaunay_triangulation_mapping(s)[source]

Returns a mapping to a Delaunay triangulation or None if the surface already is Delaunay triangulated.

flatsurf.geometry.mappings.flip_edge_mapping(s, p1, e1)[source]

Return a mapping whose domain is s which flips the provided edge.

flatsurf.geometry.mappings.my_sgn(val)[source]
flatsurf.geometry.mappings.one_delaunay_flip_mapping(s)[source]

Returns one delaunay flip, or none if no flips are needed.

flatsurf.geometry.mappings.polygon_compare(poly1, poly2)[source]

Compare two polygons first by area, then by number of sides, then by lexicographical ordering on edge vectors.

flatsurf.geometry.mappings.subdivide_a_polygon(s)[source]

Return a SurfaceMapping which cuts one polygon along a diagonal or None if the surface is triangulated.

flatsurf.geometry.mappings.triangulation_mapping(s)[source]

Return a SurfaceMapping triangulating s.

EXAMPLES:

sage: from flatsurf import translation_surfaces
sage: s=translation_surfaces.veech_2n_gon(4)
sage: from flatsurf.geometry.mappings import triangulation_mapping
sage: m=triangulation_mapping(s)
sage: s2=m.codomain()
sage: TestSuite(s2).run()
sage: s2.polygons()
(Polygon(vertices=[(0, 0), (-1/2*a, 1/2*a + 1), (-1/2*a, 1/2*a)]),
 Polygon(vertices=[(0, 0), (1/2*a, -1/2*a - 1), (1/2*a, 1/2*a)]),
 Polygon(vertices=[(0, 0), (-1/2*a - 1, -1/2*a - 1), (0, -1)]),
 Polygon(vertices=[(0, 0), (-1, -a - 1), (1/2*a, -1/2*a)]),
 Polygon(vertices=[(0, 0), (0, -a - 1), (1, 0)]),
 Polygon(vertices=[(0, 0), (-1/2*a - 1, -1/2*a), (-1/2*a, -1/2*a)]))