pub fn points_equal<T>(point1: &[T], point2: &[T], tol: Option<T>) -> bool
Expand description
Check if two points are equal within a tolerance
Compares each element of the points to determine if they are approximately equal within a specified tolerance.
§Arguments
point1
- First point as a slicepoint2
- Second point as a slicetol
- Tolerance (default: 1e-8)
§Returns
- True if points are equal within tolerance
§Examples
use scirs2_core::utils::points_equal;
let point1 = [1.0, 2.0, 3.0];
let point2 = [1.0, 2.0, 3.0];
let point3 = [1.0, 2.0, 3.001];
assert!(points_equal(&point1, &point2, None));
assert!(!points_equal(&point1, &point3, None));
assert!(points_equal(&point1, &point3, Some(0.01)));