Circle
pykraken.Circle Represents a circle shape with position and radius.
More about Circle
Supports collision detection with points, rectangles, other circles, and lines.
At a glance
12 membersReference
PYTHON APIOverloaded function.
Circle()
Create a circle with default position (0, 0) and radius 0.
Circle(radius: float)
Create a circle with a specified radius at the default position (0, 0).
Args
- radius (
float) — The radius of the circle.
Circle(pos: Vec2, radius: float)
Create a circle at a given position and radius.
Args
- pos (
Vec2) — Center position of the circle. - radius (
float) — Radius of the circle.
Circle(x: float, y: float, radius: float)
Create a circle at given x and y coordinates with a specified radius.
Args
- x (
float) — X coordinate of the circle's center. - y (
float) — Y coordinate of the circle's center. - radius (
float) — Radius of the circle.
area
propertyarea: floatGet the area of the circle.
bottom
propertybottom: floatGet or set the y coordinate of the bottommost point of the circle.
circumference
propertycircumference: floatGet the circumference of the circle.
diameter
propertydiameter: floatGet or set the diameter of the circle.
left
propertyleft: floatGet or set the x coordinate of the leftmost point of the circle.
pos
propertypos: Vec2The center position of the circle as a Vec2.
radius
propertyradius: floatThe radius of the circle.
right
propertyright: floatGet or set the x coordinate of the rightmost point of the circle.
top
propertytop: floatGet or set the y coordinate of the topmost point of the circle.
as_rect
methodas_rect(self) -> RectReturn the smallest rectangle that fully contains the circle.
copy
methodcopy(self) -> CircleReturn a copy of the circle.