Skip to main content

raygeo.ops.feature.near

Functions

find_plunge_point()

find_plunge_point(
near: tuple[float, float],
cleared_polygons: Sequence[Sequence[tuple[float, float]]],
boundary: Sequence[tuple[float, float]],
islands: Sequence[Sequence[tuple[float, float]]] | None = None,
tool_radius: float = 3,
search_radius: float = 10,
) -> tuple[float, float] | None

Find a plunge point near the given position within the cleared area.

Searches for a valid tool placement point inside the union of cleared_polygons that is within search_radius of near, fully inside boundary, and does not overlap any island.

The algorithm first checks near itself, then searches outward on concentric rings with a step of tool_radius / 2.

ParameterTypeDescription
neartuple[float, float]Target point (x, y) to search near.
cleared_polygonsSequence[Sequence[tuple[float, float]]]List of cleared-area polygons.
boundarySequence[tuple[float, float]]Outer boundary polygon.
islandsSequence[Sequence[tuple[float, float]]] | None = NoneList of island polygons (optional).
tool_radiusfloat = 3Tool radius in mm.
search_radiusfloat = 10Maximum search distance from near in mm.
Returnstuple[float, float] | None(x, y) plunge point or None if no valid point found.

Three scenarios of find_plunge_point correcting near points: slot, passage, and pocket with island.

Three scenarios of find_plunge_point correcting near points: slot, passage, and pocket with island.