mirror of
https://github.com/andreytkachenko/kdtree-rust.git
synced 2024-11-22 09:26:25 +04:00
Merge branch 'develop' of https://github.com/fulara/kdtree-rust into develop
This commit is contained in:
commit
666fb5b83a
@ -1,7 +1,7 @@
|
|||||||
use ::kdtree::*;
|
use ::kdtree::*;
|
||||||
|
|
||||||
pub struct Bounds {
|
pub struct Bounds {
|
||||||
pub bounds: Vec<(f64, f64)>,
|
pub bounds: [(f64,f64);3],
|
||||||
|
|
||||||
widest_dim : usize,
|
widest_dim : usize,
|
||||||
midvalue_of_widest_dim : f64,
|
midvalue_of_widest_dim : f64,
|
||||||
@ -10,13 +10,11 @@ pub struct Bounds {
|
|||||||
impl Bounds {
|
impl Bounds {
|
||||||
pub fn new_from_points<T: KdtreePointTrait>(points: &Vec<T>) -> Bounds {
|
pub fn new_from_points<T: KdtreePointTrait>(points: &Vec<T>) -> Bounds {
|
||||||
let mut bounds = Bounds {
|
let mut bounds = Bounds {
|
||||||
bounds: vec![],
|
bounds: [(0.,0.),(0.,0.),(0.,0.)],
|
||||||
widest_dim : 0,
|
widest_dim : 0,
|
||||||
midvalue_of_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() {
|
for i in 0..points[0].dims().len() {
|
||||||
bounds.bounds[i].0 = points[0].dims()[i];
|
bounds.bounds[i].0 = points[0].dims()[i];
|
||||||
bounds.bounds[i].1 = 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());
|
assert_eq!(1, bounds.get_widest_dim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user