raygeo.geo.shape.circle
Circle geometry queries.
Provides circle-circle and circle-rectangle intersection detection, circle-rectangle full-containment checks, line-segment-vs-circle intersection, and point projection onto a circle's circumference.
Functions
does_circle_intersect_rect()
does_circle_intersect_rect(center: Point, radius: float, rect: Rect) -> bool
Check if a circle intersects a rectangle.
Returns: True if the circle intersects the rectangle.
| Parameter | Type | Description |
|---|---|---|
center | Point | Circle center (x, y). |
radius | float | Circle radius. |
rect | Rect | Rectangle (x_min, y_min, x_max, y_max). |
| Returns | bool |
get_circle_circle_intersections()
get_circle_circle_intersections(c1: Point, r1: float, c2: Point, r2: float) -> Polygon
Get intersection points of two circles.
Returns: List of intersection points (x, y).
| Parameter | Type | Description |
|---|---|---|
c1 | Point | Center of first circle (x, y). |
r1 | float | Radius of first circle. |
c2 | Point | Center of second circle (x, y). |
r2 | float | Radius of second circle. |
| Returns | Polygon |
is_circle_inside_rect()
is_circle_inside_rect(center: Point, radius: float, rect: Rect) -> bool
Check if a circle is inside a rectangle.
Returns: True if the circle is fully inside the rectangle.
| Parameter | Type | Description |
|---|---|---|
center | Point | Circle center (x, y). |
radius | float | Circle radius. |
rect | Rect | Rectangle (x_min, y_min, x_max, y_max). |
| Returns | bool |
line_segment_intersects_circle()
line_segment_intersects_circle(p1: Point, p2: Point, circle_center: Point, circle_radius: float) -> bool
Check if a line segment intersects a circle.
Returns: True if the line segment intersects the circle.
| Parameter | Type | Description |
|---|---|---|
p1 | Point | Start point of the line segment (x, y). |
p2 | Point | End point of the line segment (x, y). |
circle_center | Point | Circle center (x, y). |
circle_radius | float | Circle radius. |
| Returns | bool |
project_point_onto_circle()
project_point_onto_circle(point: Point, center: Point, radius: float) -> Optional[Point]
Project a point onto a circle.
Returns: Projected point on the circle (x, y).
| Parameter | Type | Description |
|---|---|---|
point | Point | Point to project (x, y). |
center | Point | Circle center (x, y). |
radius | float | Circle radius. |
| Returns | Optional[Point] |