diff --git a/src/kdtree/bounds.rs b/src/kdtree/bounds.rs index d6bb9a1..f9a0413 100644 --- a/src/kdtree/bounds.rs +++ b/src/kdtree/bounds.rs @@ -12,7 +12,14 @@ pub struct Bounds { impl Bounds { pub fn new_from_points>(points: &[T]) -> Bounds { let mut bounds = Bounds { - bounds: Vec::with_capacity(points[0].dims()), + bounds: { + let dims = points[0].dims(); + let mut v = Vec::with_capacity(dims); + for _ in 0..dims{ + v.push((F::zero(), F::zero())); + } + v + }, widest_dim: 0, midvalue_of_widest_dim: F::zero(), };