pub trait Point: Copy + Clone + PartialEq + Debug {
type Scalar: RTreeNum;
const DIMENSIONS: usize;
fn generate<F>(f: F) -> Self
where
F: Fn(usize) -> Self::Scalar;
fn nth(&self, index: usize) -> Self::Scalar;
fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar;
}
Expand description
Defines a point type that is compatible with rstar.
rstar works out of the box with arrays of numbers like [f32; 2]
or [f64; 7]
(up to dimension 8).
Required Associated Types
Required Associated Constants
sourceconst DIMENSIONS: usize
const DIMENSIONS: usize
The number of dimensions of this point type.
Required Methods
sourcefn generate<F>(f: F) -> Selfwhere
F: Fn(usize) -> Self::Scalar,
fn generate<F>(f: F) -> Selfwhere
F: Fn(usize) -> Self::Scalar,
Creates a new point value with given values for each dimension.
The value that each dimension should be initialized with is given by the parameter f
.
Calling f(n)
returns the value of dimension n
, n
will be in the range 0 .. Self::DIMENSIONS
.