Make BoundingBox::from_points accept any IntoIterator<Point3<T>>
...instead of only Vec<Point3<T>>
This commit is contained in:
parent
e5d7a1098d
commit
e67204b96e
|
|
@ -115,9 +115,12 @@ impl<T: RealField> BoundingBox<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_points(points: &Vec<Point3<T>>) -> Self {
|
pub fn from_points<'a, I>(points: I) -> Self
|
||||||
|
where
|
||||||
|
I: IntoIterator<Item = &'a Point3<T>>,
|
||||||
|
{
|
||||||
points
|
points
|
||||||
.iter()
|
.into_iter()
|
||||||
.fold(BoundingBox::empty(), |acc, p| acc.expand_to_point(p))
|
.fold(BoundingBox::empty(), |acc, p| acc.expand_to_point(p))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue