mirror of
https://github.com/andreytkachenko/kdtree-rust.git
synced 2024-11-29 04:43:36 +04:00
Make bounds have dims
size
This commit is contained in:
parent
99e465ba6e
commit
19f516bb11
@ -1,9 +1,9 @@
|
|||||||
use num_traits::Float;
|
use num_traits::Float;
|
||||||
use crate::kdtree::KdTreePoint;
|
use crate::kdtree::KdTreePoint;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone)]
|
||||||
pub struct Bounds<F: Float> {
|
pub struct Bounds<F: Float> {
|
||||||
pub bounds: [(F, F); 3],
|
pub bounds: Vec<(F, F)>,
|
||||||
|
|
||||||
widest_dim: usize,
|
widest_dim: usize,
|
||||||
midvalue_of_widest_dim: F,
|
midvalue_of_widest_dim: F,
|
||||||
@ -12,7 +12,7 @@ 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: [(F::zero(), F::zero()), (F::zero(), F::zero()), (F::zero(), F::zero())],
|
bounds: Vec::with_capacity(points[0].dims()),
|
||||||
widest_dim: 0,
|
widest_dim: 0,
|
||||||
midvalue_of_widest_dim: F::zero(),
|
midvalue_of_widest_dim: F::zero(),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user