Skip to main content

raygeo.geo.shape.arc

Arc geometry queries and conversions.

Provides bounding rectangle computation, intersection tests (arc-rect, arc-circle, arc-polygons), arc linearization into line segments for rendering or further processing, angle utilities (normalize, direction, containment), and arc midpoint / closest-point lookups.

Functions

does_arc_intersect_circle()

does_arc_intersect_circle(arc_start: Point, arc_end: Point, arc_center: Point, clockwise: bool, circle_center: Point, circle_radius: float) -> bool

Check if an arc intersects a circle.

Returns: True if the arc intersects the circle.

ParameterTypeDescription
arc_startPointArc start point (x, y).
arc_endPointArc end point (x, y).
arc_centerPointArc center point (x, y).
clockwiseboolWhether the arc is clockwise.
circle_centerPointCircle center (x, y).
circle_radiusfloatCircle radius.
Returnsbool

does_arc_intersect_rect()

does_arc_intersect_rect(arc_start: Point, arc_end: Point, arc_center: Point, clockwise: bool, rect: Rect) -> bool

Check if an arc intersects a rectangle.

Returns: True if the arc intersects the rectangle.

ParameterTypeDescription
arc_startPointArc start point (x, y).
arc_endPointArc end point (x, y).
arc_centerPointArc center point (x, y).
clockwiseboolWhether the arc is clockwise.
rectRectRectangle (x_min, y_min, x_max, y_max).
Returnsbool

get_arc_angles()

get_arc_angles(start: Point, end: Point, center: Point, clockwise: bool) -> Point3D

Get the start, end, and sweep angles of an arc.

Returns: Tuple of (start_angle, end_angle, sweep_angle) in radians.

ParameterTypeDescription
startPointArc start point (x, y).
endPointArc end point (x, y).
centerPointArc center point (x, y).
clockwiseboolWhether the arc is clockwise.
ReturnsPoint3D

get_arc_bounds()

get_arc_bounds(start: Point, end: Point, center: Point, clockwise: bool) -> Rect

Get the bounding rectangle of an arc.

Returns: Bounding rectangle as (x_min, y_min, x_max, y_max).

ParameterTypeDescription
startPointArc start point (x, y).
endPointArc end point (x, y).
centerPointArc center point (x, y).
clockwiseboolWhether the arc is clockwise.
ReturnsRect

get_arc_closest_point()

get_arc_closest_point(arc_cmd: Any, start_pos: Point3D, x: float, y: float) -> Optional[tuple[float, Point, float]]

Get the closest point on an arc to a given point.

Returns: Tuple of (parameter, closest_point, distance) or None.

ParameterTypeDescription
arc_cmdAnyArc command row or MockArc-like object.
start_posPoint3DStart position (x, y, z).
xfloatX coordinate of target point.
yfloatY coordinate of target point.
ReturnsOptional[tuple[float, Point, float]]

get_arc_direction()

get_arc_direction(center: Point, start: Point, mouse: Point) -> bool

Get the direction (CW/CCW) of an arc at a mouse point.

Returns: True if clockwise, False if counter-clockwise.

ParameterTypeDescription
centerPointArc center (x, y).
startPointArc start point (x, y).
mousePointMouse point (x, y).
Returnsbool

get_arc_midpoint()

get_arc_midpoint(start: Point, end: Point, center: Point, clockwise: bool) -> Point

Get the midpoint of an arc.

Returns: Midpoint (x, y).

ParameterTypeDescription
startPointArc start point (x, y).
endPointArc end point (x, y).
centerPointArc center point (x, y).
clockwiseboolWhether the arc is clockwise.
ReturnsPoint

is_angle_between()

is_angle_between(angle: float, start: float, end: float, clockwise: bool) -> bool

Check if an angle is between two other angles.

Returns: True if angle is between start and end.

ParameterTypeDescription
anglefloatAngle to test.
startfloatStart angle.
endfloatEnd angle.
clockwiseboolWhether the arc is clockwise.
Returnsbool

is_arc_clockwise()

is_arc_clockwise(points: Sequence[Point], center: Point) -> bool

Check if an arc is clockwise.

Returns: True if the arc is clockwise.

ParameterTypeDescription
pointsSequence[Point]Sequence of (x, y) points on the arc.
centerPointArc center (x, y).
Returnsbool

is_arc_inside_polygons()

is_arc_inside_polygons(arc_start: Point, arc_end: Point, arc_center: Point, clockwise: bool, polygons: Any) -> bool

Check if an arc is inside a set of polygons.

Returns: True if the arc is inside all polygons.

ParameterTypeDescription
arc_startPointArc start point (x, y).
arc_endPointArc end point (x, y).
arc_centerPointArc center point (x, y).
clockwiseboolWhether the arc is clockwise.
polygonsAnyList of polygons to check against.
Returnsbool

linearize_arc()

linearize_arc(arc_cmd: Any, start_point: Point3D, resolution: float = 0.1) -> list[tuple[Point3D, Point3D]]

Linearize an arc into line segments.

Returns: List of (p1, p2) segment pairs.

ParameterTypeDescription
arc_cmdAnyArc command row or MockArc-like object.
start_pointPoint3DStart point (x, y, z).
resolutionfloat = 0.1Maximum segment length.
Returnslist[tuple[Point3D, Point3D]]

normalize_angle()

normalize_angle(angle: float) -> float

Normalize an angle to the range [0, 2*pi).

Returns: Normalized angle in [0, 2*pi).

ParameterTypeDescription
anglefloatAngle in radians.
Returnsfloat