Skip to content

Commit

Permalink
small QoL improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenGar committed Aug 13, 2024
1 parent 16b1cae commit 093444d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jagua-rs/src/geometry/primitives/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ impl Circle {
}

/// Returns the smallest possible circle that fully contains all ```circles```
pub fn bounding_circle(circles: &[Circle]) -> Circle {
let mut circles_iter = circles.iter();
let mut bounding_circle = circles_iter.next().expect("no circles provided").clone();
pub fn bounding_circle<'a>(mut circles: impl IntoIterator<Item = &'a Circle>) -> Circle {
let mut circles = circles.into_iter();
let mut bounding_circle = circles.next().expect("no circles provided").clone();

for circle in circles_iter {
for circle in circles {
let distance_between_centers = bounding_circle.center.distance(&circle.center);
if bounding_circle.radius < distance_between_centers + circle.radius {
// circle not contained in bounding circle, expand
Expand Down

0 comments on commit 093444d

Please sign in to comment.