Skip to content

Commit

Permalink
Update dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
n3vu0r committed Apr 1, 2023
1 parent b4a3f77 commit 14fa6a0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "miniball"
description = "Minimum enclosing ball"
authors = ["Rouven Spreckels <rs@qu1x.dev>"]
version = "0.1.1"
version = "0.2.0"
edition = "2021"
documentation = "https://docs.rs/miniball"
repository = "https://github.com/qu1x/miniball"
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 0.2.0 (2023-04-01)

* Update dependencies.

# Version 0.1.1 (2022-05-06)

* Add more tests.
Expand Down
10 changes: 4 additions & 6 deletions src/ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,31 @@ impl<R: RealField, const D: usize> Enclosing<R, D> for Ball<R, D> {
distance_squared(&self.center, point) <= self.radius_squared
}
fn with_bounds(bounds: &[Point<R, D>]) -> Option<Self> {
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::<R, D, D>::from_fn(|row, column| {
if column < length {
bounds[column + 1].coords[row].clone() - bounds[0].coords[row].clone()
} else {
R::zero()
}
});
let points = points.slice((0, 0), (D, length));
let points = points.view((0, 0), (D, length));
let matrix = SMatrix::<R, D, D>::from_fn(|row, column| {
if row < length && column < length {
points.column(row).dot(&points.column(column)) * (R::one() + R::one())
} else {
R::zero()
}
});
let matrix = matrix.slice((0, 0), (length, length));
let matrix = matrix.view((0, 0), (length, length));
let vector = SVector::<R, D>::from_fn(|row, _column| {
if row < length {
points.column(row).norm_squared()
} else {
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::<R, D>::zeros();
Expand Down

0 comments on commit 14fa6a0

Please sign in to comment.