polygon#

Initialize self. See help(type(self)) for accurate signature.

class flatsurf.graphical.polygon.GraphicalPolygon(polygon, transformation=None)[source]#

Stores data necessary to draw one of the polygons from a surface.

Note that this involves converting between geometric coordinates, defined for the SimilaritySurface, and graphical coordinates. We do this with a similarity (called transformation below).

base_polygon()[source]#

Return the polygon of the surface in geometric coordinates.

bounding_box()[source]#

Return the quadruple (x1,y1,x2,y2) where x1 and y1 are the minimal x and y coordinates and x2 and y2 are the maximal x and y coordinates.

contains(point)[source]#

Return the transformation of point from graphical coordinates to the geometric coordinates of the underlying SimilaritySurface.

copy()[source]#

Return a copy of this GraphicalPolygon.

plot_edge(e, **options)[source]#

Plot the edge e, with e a number 0,…,n-1 with n being the number of edges of the polygon.

Options are processed as in sage.plot.line.line2d.

plot_edge_label(i, label, **options)[source]#

Write label on the i-th edge.

A parameter t in the interval [0,1] can be provided to position the label along the edge. A value of t=0 will position it at the starting vertex and t=1 will position it at the terminating vertex. Defaults to 0.3.

If the parameter position can take the values “outside”, “inside” or “edge” to indicate if the label should be drawn outside the polygon, inside the polygon or on the edge. Defaults to “inside”.

A push_off perturbation parameter controls how far off the edge the label is pushed.

Other options are processed as in sage.plot.text.text.

plot_label(label, **options)[source]#

Write the label of the polygon as text.

Set position to a pair (x,y) to determine where the label is drawn (in graphical coordinates). If this parameter is not provided, the label is positioned in the baricenter of the polygon.

Other options are processed as in sage.plot.text.text.

plot_points(points, **options)[source]#

Plot the points in the given collection of points.

The options are passed to point2d.

If no “zorder” option is provided then we set “zorder” to 50.

By default coordinates are taken in the underlying surface. Call with coordinates=”graphical” to use graphical coordinates instead.

plot_polygon(**options)[source]#

Returns only the filled polygon.

Options are processed as in sage.plot.polygon.polygon2d except that by default axes=False.

plot_zero_flag(**options)[source]#

Draw a line segment from the zero vertex toward the baricenter.

A real parameter t can be provided. If t=1, then the segment will go all the way to the baricenter. The value of t is linear in the length of the segment. Defaults to t=0.5.

Other options are processed as in sage.plot.line.line2d.

set_transformation(transformation=None)[source]#

Set the transformation to be applied to the polygon.

transform(point, double_precision=True)[source]#

Return the transformation of point into graphical coordinates.

By default returned point is in double precision. This can be changed to an exact representation by setting double_precision to False.

transform_back(point)[source]#

Return the transformation of point from graphical coordinates to the geometric coordinates of the underlying SimilaritySurface.

transformation()[source]#

Return the transformation (similarity) which converts from mathematical to graphical coordinates.

transformed_vertex(e)[source]#

Return the graphical coordinates of the vertex in double precision.

xmax()[source]#

Return the maximal x-coordinate of a vertex.

xmin()[source]#

Return the minimal x-coordinate of a vertex.

ymax()[source]#

Return the minimal y-coordinate of a vertex

ymin()[source]#

Return the minimal y-coordinate of a vertex.