mirror of
https://github.com/andreytkachenko/kdtree-rust.git
synced 2024-11-22 17:36:24 +04:00
parent
ab6c6b1174
commit
7f5b320db9
@ -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];
|
||||||
|
Loading…
Reference in New Issue
Block a user