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.
| Parameter | Type | Description |
|---|---|---|
arc_start | Point | Arc start point (x, y). |
arc_end | Point | Arc end point (x, y). |
arc_center | Point | Arc center point (x, y). |
clockwise | bool | Whether the arc is clockwise. |
circle_center | Point | Circle center (x, y). |
circle_radius | float | Circle radius. |
| Returns | bool |
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.
| Parameter | Type | Description |
|---|---|---|
arc_start | Point | Arc start point (x, y). |
arc_end | Point | Arc end point (x, y). |
arc_center | Point | Arc center point (x, y). |
clockwise | bool | Whether the arc is clockwise. |
rect | Rect | Rectangle (x_min, y_min, x_max, y_max). |
| Returns | bool |
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.
| Parameter | Type | Description |
|---|---|---|
start | Point | Arc start point (x, y). |
end | Point | Arc end point (x, y). |
center | Point | Arc center point (x, y). |
clockwise | bool | Whether the arc is clockwise. |
| Returns | Point3D |
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).
| Parameter | Type | Description |
|---|---|---|
start | Point | Arc start point (x, y). |
end | Point | Arc end point (x, y). |
center | Point | Arc center point (x, y). |
clockwise | bool | Whether the arc is clockwise. |
| Returns | Rect |
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.
| Parameter | Type | Description |
|---|---|---|
arc_cmd | Any | Arc command row or MockArc-like object. |
start_pos | Point3D | Start position (x, y, z). |
x | float | X coordinate of target point. |
y | float | Y coordinate of target point. |
| Returns | Optional[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.
| Parameter | Type | Description |
|---|---|---|
center | Point | Arc center (x, y). |
start | Point | Arc start point (x, y). |
mouse | Point | Mouse point (x, y). |
| Returns | bool |
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).
| Parameter | Type | Description |
|---|---|---|
start | Point | Arc start point (x, y). |
end | Point | Arc end point (x, y). |
center | Point | Arc center point (x, y). |
clockwise | bool | Whether the arc is clockwise. |
| Returns | Point |
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.
| Parameter | Type | Description |
|---|---|---|
angle | float | Angle to test. |
start | float | Start angle. |
end | float | End angle. |
clockwise | bool | Whether the arc is clockwise. |
| Returns | bool |
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.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[Point] | Sequence of (x, y) points on the arc. |
center | Point | Arc center (x, y). |
| Returns | bool |
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.
| Parameter | Type | Description |
|---|---|---|
arc_start | Point | Arc start point (x, y). |
arc_end | Point | Arc end point (x, y). |
arc_center | Point | Arc center point (x, y). |
clockwise | bool | Whether the arc is clockwise. |
polygons | Any | List of polygons to check against. |
| Returns | bool |
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.
| Parameter | Type | Description |
|---|---|---|
arc_cmd | Any | Arc command row or MockArc-like object. |
start_point | Point3D | Start point (x, y, z). |
resolution | float = 0.1 | Maximum segment length. |
| Returns | list[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).
| Parameter | Type | Description |
|---|---|---|
angle | float | Angle in radians. |
| Returns | float |