Find the point on a shape closest to a target location or angle.
Arguments
- x
A matrix (nx2), list of matrices, or tibble with coo columns.
- ...
Additional arguments (reserved for future use).
- .cols
Column name(s) to process when
xis a tibble. IfNULL, automatically detects columns containing coo objects.- target
A numeric vector of length 2 (x, y) or a list with
$xand$y(e.g., fromlocator()).- theta
Numeric. Angle in radians for angular search.
Value
If
xis a single matrix: returns an integer (row index of closest point)If
xis a list: returns a numeric vector of integersIf
xis a tibble: returns a numeric vector of integers extracted from coo column
Details
get_closest(): finds point closest to spatial target using Euclidean distance. Compatible withlocator()for interactive selection.get_closest_angle(): finds point closest to a specified angle direction.
For tibbles, these functions extract values without modifying the tibble.
