pub fn find_most_counterclockwise(
points: &ArrayView2<'_, f64>,
current: usize,
candidate: usize,
) -> usizeExpand description
Find the most counterclockwise point from a given point
Given a current point and a candidate next point, find the point in the set that is most counterclockwise relative to the line from current to candidate.
§Arguments
points- Input points arraycurrent- Index of the current pointcandidate- Index of the candidate next point
§Returns
- Index of the most counterclockwise point
§Examples
use scirs2_spatial::convex_hull::algorithms::jarvis_march::find_most_counterclockwise;
use scirs2_core::ndarray::array;
let points = array![[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]];
let current = 0; // [0.0, 0.0]
let candidate = 1; // [1.0, 0.0]
let most_ccw = find_most_counterclockwise(&points.view(), current, candidate);
assert_eq!(most_ccw, 2); // [0.0, 1.0] is most counterclockwise