This commit is contained in:
khmhmm 2021-03-10 17:39:00 +04:00
parent 19f516bb11
commit aef4f8c834

View File

@ -12,7 +12,14 @@ pub struct Bounds<F: Float> {
impl<F: Float> Bounds<F> { impl<F: Float> Bounds<F> {
pub fn new_from_points<T: KdTreePoint<F>>(points: &[T]) -> Bounds<F> { pub fn new_from_points<T: KdTreePoint<F>>(points: &[T]) -> Bounds<F> {
let mut bounds = 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, widest_dim: 0,
midvalue_of_widest_dim: F::zero(), midvalue_of_widest_dim: F::zero(),
}; };