is_all_collinear

Function is_all_collinear 

Source
pub fn is_all_collinear(points: &ArrayView2<'_, f64>) -> bool
Expand description

Check if all points are collinear

§Arguments

  • points - Input points array

§Returns

  • true if all points lie on the same line, false otherwise

§Examples

use scirs2_spatial::convex_hull::algorithms::special_cases::is_all_collinear;
use scirs2_core::ndarray::array;

let collinear = array![[0.0, 0.0], [1.0, 0.0], [2.0, 0.0]];
assert!(is_all_collinear(&collinear.view()));

let not_collinear = array![[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]];
assert!(!is_all_collinear(&not_collinear.view()));