graphinglib.Ellipse#

class graphinglib.Ellipse(x_center: float, y_center: float, x_radius: float, y_radius: float, angle: float = 0, fill: bool | Inherit = Inherit, fill_color: str | Inherit = Inherit, edge_color: str | Inherit = Inherit, line_width: float | Inherit = Inherit, line_style: str | Inherit = Inherit, fill_alpha: float | Inherit = Inherit, number_of_points: int = 100)[source]#

This class implements an Ellipse object with a given center, two radii and an optional rotation angle.

Parameters:
x_centerfloat

The x coordinate of the center of the ellipse.

y_centerfloat

The y coordinate of the center of the ellipse.

x_radiusfloat

The radius of the ellipse along the x axis.

y_radiusfloat

The radius of the ellipse along the y axis.

anglefloat, optional

The rotation angle of the ellipse in degrees. Defaults to 0.

fillbool, optional

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

fill_colorstr, optional

The color of the ellipse’s fill. Default depends on the figure_style configuration.

edge_colorstr, optional

The color of the ellipse’s edge. Default depends on the figure_style configuration.

line_widthfloat, optional

The width of the line. Typical range is 0.5 to 4. Default depends on the figure_style configuration.

line_stylestr, optional

The style of the line. Values include "-", "--", "-.", ":", "solid", "dashed", "dashdot", and "dotted". Default depends on the figure_style configuration.

fill_alphafloat, optional

The alpha value of the fill. Range is 0 (transparent) to 1 (opaque). Default depends on the figure_style configuration.

number_of_pointsint, optional

The number of points to use to approximate the ellipse. Default is 100 (covers approximately 99.9% of perfect ellipse area).

Notes

Color parameters accept Matplotlib color formats: named colors ("blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between 0 and 1 ((0, 0, 1) or (0, 0, 1, 0.5)).

Methods

__init__(x_center, y_center, x_radius, y_radius)

copy()

Returns a deep copy of the Polygon object.

copy_with(**kwargs)

Returns a deep copy of the Plottable with specified attributes overridden.

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.