jarvis_step

Function jarvis_step 

Source
pub fn jarvis_step(points: &ArrayView2<'_, f64>, current: usize) -> usize
Expand description

Perform one step of the Jarvis march

Given a current hull point, find the next point in the hull by selecting the most counterclockwise point.

§Arguments

  • points - Input points array
  • current - Index of the current hull point

§Returns

  • Index of the next hull point

§Examples

use scirs2_spatial::convex_hull::algorithms::jarvis_march::jarvis_step;
use scirs2_core::ndarray::array;

let points = array![[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]];
let current = 0; // Start from [0.0, 0.0]

let next = jarvis_step(&points.view(), current);
// Should find either [1.0, 0.0] or [0.0, 1.0] depending on the order
assert!(next == 1 || next == 2);