Circle
The Circle
class represents an SVG circle element. It supports setting the center position and radius, and provides computed properties such as diameter and area.
Info
This class inherits from SvgElement
.
pydreamplet.core.Circle
Initializes a new circle. If pos is provided in kwargs, it sets the circle's center coordinates.
Parameters
**kwargs
: Attributes for the circle, including pos (aVector
) and other SVG properties (e.g., r for radius).
from pydreamplet import SVG, Circle
svg = SVG(200, 200)
svg.append(Circle(cx=100, cy=100, r=50, fill="#a00344"))
pos
Getter: Returns the center of the circle as a Vector
.
Setter: Updates the center coordinates.
radius
Getter: Returns the radius of the circle.
Setter: Updates the radius.
center
Alias for pos, returning the circle's center.
diameter
Returns the circle's diameter (2 × radius).
area
Returns the area of the circle, computed as \(\pi \times (\text{radius})^2\).