Zum Hauptinhalt springen

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.

ParameterTypeDescription
centerPointCircle center (x, y).
radiusfloatCircle radius.
rectRectRectangle (x_min, y_min, x_max, y_max).
Returnsbool

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).

ParameterTypeDescription
c1PointCenter of first circle (x, y).
r1floatRadius of first circle.
c2PointCenter of second circle (x, y).
r2floatRadius of second circle.
ReturnsPolygon

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.

ParameterTypeDescription
centerPointCircle center (x, y).
radiusfloatCircle radius.
rectRectRectangle (x_min, y_min, x_max, y_max).
Returnsbool

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.

ParameterTypeDescription
p1PointStart point of the line segment (x, y).
p2PointEnd point of the line segment (x, y).
circle_centerPointCircle center (x, y).
circle_radiusfloatCircle radius.
Returnsbool

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).

ParameterTypeDescription
pointPointPoint to project (x, y).
centerPointCircle center (x, y).
radiusfloatCircle radius.
ReturnsOptional[Point]