Circle
A representation of a circle shape with basic geometric operations and collision detection.
-
Circle(pos: Vec2, radius: float)
Properties
Name | Description | Type |
---|---|---|
pos | The circle's position | Vec2 |
radius | The circle's radius | float |
area | The area of the circle | float |
circumference | The circumference of the circle | float |
Methods
Collide Point
collide_point(point: Vec2) → bool
Check if a point is inside the circle.
Parameters
point
: The point to check.
Returns
bool
: True
if the point is inside the circle, otherwise False
.
Collide Circle
collide_circle(other: Circle) → bool
Check if another circle intersects with this circle.
Parameters
other
: The other circle to check.
Returns
bool
: True
if the circles intersect, otherwise False
.
Collide Rect
collide_rect(rect: Rect) → bool
Check if a rectangle intersects with this circle.
Parameters
rect
: The rectangle to check.
Returns
bool
: True
if the circle and rectangle intersect, otherwise False
.
Collide Line
collide_line(start: Vec2, end: Vec2) → bool
Check if a line segment intersects with this circle.
Parameters
start
: The start point of the line segment.end
: The end point of the line segment.
Returns
bool
: True
if the line segment intersects the circle, otherwise False
.
Contains
contains(shape: Vec2 | Circle | Rect | Line) → bool
Check if a shape is completely contained within the circle.
Parameters
shape
: The shape to check.
Returns
bool
: True
if the shape is contained within the circle, otherwise False
.
As Rect
as_rect() → Rect
Get the bounding rectangle of the circle.
Returns
Rect
: The bounding rectangle of the circle.
Copy
copy() → Circle
Create a copy of the circle.
Returns
Circle
: A new circle with the same properties.