Skip to main content

raygeo.geo.shape.circle

Circle geometry queries.

Provides circle-circle and circle-rectangle intersection detection, line-segment-vs-circle intersection points, 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: types.Point, radius: float, rect: types.Rect) -> bool

Check if a circle intersects a rectangle.

Returns: True if the circle intersects the rectangle.

ParameterTypeDescription
centertypes.PointCircle center (x, y).
radiusfloatCircle radius.
recttypes.RectRectangle (x_min, y_min, x_max, y_max).
Returnsbool

get_circle_circle_intersections()

get_circle_circle_intersections(c1: types.Point, r1: float, c2: types.Point, r2: float) -> types.Polygon

Get intersection points of two circles.

Returns: List of intersection points (x, y).

ParameterTypeDescription
c1types.PointCenter of first circle (x, y).
r1floatRadius of first circle.
c2types.PointCenter of second circle (x, y).
r2floatRadius of second circle.
Returnstypes.Polygon

get_line_circle_intersections()

get_line_circle_intersections(p1: types.Point, p2: types.Point, center: types.Point, radius: float) -> types.Polygon

Get intersection points of a line segment with a circle.

Returns: List of intersection points (x, y).

ParameterTypeDescription
p1types.PointStart point of the line segment (x, y).
p2types.PointEnd point of the line segment (x, y).
centertypes.PointCircle center (x, y).
radiusfloatCircle radius.
Returnstypes.Polygon

is_circle_inside_rect()

is_circle_inside_rect(center: types.Point, radius: float, rect: types.Rect) -> bool

Check if a circle is inside a rectangle.

Returns: True if the circle is fully inside the rectangle.

ParameterTypeDescription
centertypes.PointCircle center (x, y).
radiusfloatCircle radius.
recttypes.RectRectangle (x_min, y_min, x_max, y_max).
Returnsbool

line_segment_intersects_circle()

line_segment_intersects_circle(p1: types.Point, p2: types.Point, circle_center: types.Point, circle_radius: float) -> bool

Check if a line segment intersects a circle.

Returns: True if the line segment intersects the circle.

ParameterTypeDescription
p1types.PointStart point of the line segment (x, y).
p2types.PointEnd point of the line segment (x, y).
circle_centertypes.PointCircle center (x, y).
circle_radiusfloatCircle radius.
Returnsbool

project_point_onto_circle()

project_point_onto_circle(point: types.Point, center: types.Point, radius: float) -> Optional[types.Point]

Project a point onto a circle.

Returns: Projected point on the circle (x, y).

ParameterTypeDescription
pointtypes.PointPoint to project (x, y).
centertypes.PointCircle center (x, y).
radiusfloatCircle radius.
ReturnsOptional[types.Point]