diff --git a/Cargo.toml b/Cargo.toml index 1f9652e..67f9761 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "miniball" description = "Minimum enclosing ball" authors = ["Rouven Spreckels "] -version = "0.1.1" +version = "0.2.0" edition = "2021" documentation = "https://docs.rs/miniball" repository = "https://github.com/qu1x/miniball" @@ -32,8 +32,8 @@ include = [ [dependencies] arrayvec = "0.7.2" -nalgebra = { version = "0.31.0", features = ["rand"] } -stacker = "0.1.14" +nalgebra = { version = "0.32.2", features = ["rand"] } +stacker = "0.1.15" [profile.test] opt-level = 2 diff --git a/RELEASES.md b/RELEASES.md index 5d8dfbe..8ad7533 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,7 @@ +# Version 0.2.0 (2023-04-01) + + * Update dependencies. + # Version 0.1.1 (2022-05-06) * Add more tests. diff --git a/src/ball.rs b/src/ball.rs index f7a4742..f9a7df6 100644 --- a/src/ball.rs +++ b/src/ball.rs @@ -22,9 +22,7 @@ impl Enclosing for Ball { distance_squared(&self.center, point) <= self.radius_squared } fn with_bounds(bounds: &[Point]) -> Option { - let length = (1..=D + 1) - .contains(&bounds.len()) - .then(|| bounds.len() - 1)?; + let length = bounds.len().checked_sub(1).filter(|&length| length <= D)?; let points = SMatrix::::from_fn(|row, column| { if column < length { bounds[column + 1].coords[row].clone() - bounds[0].coords[row].clone() @@ -32,7 +30,7 @@ impl Enclosing for Ball { R::zero() } }); - let points = points.slice((0, 0), (D, length)); + let points = points.view((0, 0), (D, length)); let matrix = SMatrix::::from_fn(|row, column| { if row < length && column < length { points.column(row).dot(&points.column(column)) * (R::one() + R::one()) @@ -40,7 +38,7 @@ impl Enclosing for Ball { R::zero() } }); - let matrix = matrix.slice((0, 0), (length, length)); + let matrix = matrix.view((0, 0), (length, length)); let vector = SVector::::from_fn(|row, _column| { if row < length { points.column(row).norm_squared() @@ -48,7 +46,7 @@ impl Enclosing for Ball { R::zero() } }); - let vector = vector.slice((0, 0), (length, 1)); + let vector = vector.view((0, 0), (length, 1)); matrix.try_inverse().map(|matrix| { let vector = matrix * vector; let mut center = SVector::::zeros();