mirror of
https://github.com/andreytkachenko/kdtree-rust.git
synced 2024-11-22 09:26:25 +04:00
parent
ab6c6b1174
commit
7f5b320db9
@ -1,7 +1,7 @@
|
||||
use ::kdtree::*;
|
||||
|
||||
pub struct Bounds {
|
||||
pub bounds: Vec<(f64, f64)>,
|
||||
pub bounds: [(f64,f64);3],
|
||||
|
||||
widest_dim : usize,
|
||||
midvalue_of_widest_dim : f64,
|
||||
@ -10,13 +10,11 @@ pub struct Bounds {
|
||||
impl Bounds {
|
||||
pub fn new_from_points<T: KdtreePointTrait>(points: &Vec<T>) -> Bounds {
|
||||
let mut bounds = Bounds {
|
||||
bounds: vec![],
|
||||
bounds: [(0.,0.),(0.,0.),(0.,0.)],
|
||||
widest_dim : 0,
|
||||
midvalue_of_widest_dim : 0.,
|
||||
};
|
||||
|
||||
bounds.bounds.resize(points[0].dims().len(), (0., 0.));
|
||||
|
||||
for i in 0..points[0].dims().len() {
|
||||
bounds.bounds[i].0 = points[0].dims()[i];
|
||||
bounds.bounds[i].1 = points[0].dims()[i];
|
||||
@ -108,4 +106,4 @@ mod tests {
|
||||
|
||||
assert_eq!(1, bounds.get_widest_dim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user