graphinglib.Polygon#

class graphinglib.Polygon(vertices: list[tuple[float, float]], fill: bool = 'default', edge_color: str = 'default', fill_color: str = 'default', line_width: float | Literal['default'] = 'default', line_style: str = 'default', fill_alpha: float | Literal['default'] = 'default')[source]#

This class implements a Polygon object.

Parameters:
verticeslist[tuple[float, float]]

List of coordinates that define the polygon.

fillbool, optional

Whether the polygon should be filled or not. Default depends on the figure_style configuration.

colorstr, optional

The color of the polygon (both the line and the fill). Default depends on the figure_style configuration.

line_widthfloat, optional

The width of the line. Default depends on the figure_style configuration.

line_stylestr, optional

The style of the line. Default depends on the figure_style configuration.

fill_alphafloat, optional

The alpha value of the fill. Default depends on the figure_style configuration.

Methods

__init__(vertices[, fill, edge_color, ...])

copy()

Returns a deep copy of the Polygon object.

create_centroid_point()

Returns the center point of the polygon.

create_difference(other[, copy_style])

Returns the difference of the polygon with another polygon.

create_intersection(other[, copy_style])

Returns the intersection of the polygon with another polygon.

create_intersection_points(other)

Returns the intersection points of the borders of the two polygons.

create_symmetric_difference(other[, copy_style])

Returns the symmetric difference of the polygon with another polygon.

create_union(other[, copy_style])

Returns the union of the polygon with another polygon.

get_centroid_coordinates()

Returns the center coordinates of the polygon.

get_intersection_coordinates(other)

Returns the coordinates of the intersection points of the borders of the two polygons.

linear_transformation(matrix)

Applies a transformation matrix to the polygon.

rotate(angle[, center, use_rad])

Rotates the polygon by the specified angle.

scale(x_scale, y_scale[, center])

Scales the polygon by the specified factors.

skew(x_skew, y_skew[, center, use_rad])

Skews the polygon by the specified factors.

split(curve[, copy_style])

Splits the polygon by a curve.

translate(dx, dy)

Translates the polygon by the specified amount.