pub struct SRTree<T, M> {
pub root_index: usize,
pub points: Vec<Point<T>>,
pub nodes: Vec<Node<T>>,
pub params: Params,
pub metric: M,
}
Fields§
§root_index: usize
§points: Vec<Point<T>>
§nodes: Vec<Node<T>>
§params: Params
§metric: M
Implementations§
Source§impl<T, M> SRTree<T, M>
impl<T, M> SRTree<T, M>
pub fn query_radius(&self, point_coords: &[T], radius: T) -> Vec<usize>
Source§impl<T, M> SRTree<T, M>
impl<T, M> SRTree<T, M>
pub fn distance(&self, a: &Point<T>, b: &Point<T>) -> T
pub fn distance_squared(&self, a: &Point<T>, b: &Point<T>) -> T
pub fn point_to_rect_min_distance(&self, point: &Point<T>, rect: &Rect<T>) -> T
pub fn point_to_rect_max_distance(&self, point: &Point<T>, rect: &Rect<T>) -> T
pub fn point_to_sphere_min_distance( &self, point: &Point<T>, sphere: &Sphere<T>, ) -> T
pub fn point_to_sphere_max_distance( &self, point: &Point<T>, sphere: &Sphere<T>, ) -> T
pub fn point_to_node_min_distance(&self, point: &Point<T>, node: &Node<T>) -> T
pub fn point_to_node_max_distance(&self, point: &Point<T>, node: &Node<T>) -> T
Source§impl<T, M> SRTree<T, M>
impl<T, M> SRTree<T, M>
pub fn calculate_points_variance(&self, point_indices: &[usize]) -> Vec<T>
Source§impl<T, M> SRTree<T, M>
impl<T, M> SRTree<T, M>
Sourcepub fn new(
pts: &[Vec<T>],
params: Params,
metric: M,
) -> Result<Self, ArrayError>
pub fn new( pts: &[Vec<T>], params: Params, metric: M, ) -> Result<Self, ArrayError>
Builds SRTree
with the given points, params and metric.
§Errors
ArrayError::Empty
if the input array is empty.ArrayError::DimensionMismatch
if the input array contains points of different dimensions.
Sourcepub fn default(pts: &[Vec<T>], metric: M) -> Result<Self, ArrayError>
pub fn default(pts: &[Vec<T>], metric: M) -> Result<Self, ArrayError>
Builds SRTree
with the given points (using default params) and metric.
§Errors
ArrayError::Empty
if the input array is empty.ArrayError::DimensionMismatch
if the input array contains points of different dimensions.
pub fn add_node(&mut self, node: Node<T>) -> usize
pub fn num_nodes(&self) -> usize
pub fn num_points(&self) -> usize
pub fn num_leaves(&self) -> usize
pub fn height(&self) -> usize
pub fn children_of(&self, node_index: usize) -> Option<&[usize]>
pub fn points_of(&self, node_index: usize) -> &[usize]
pub fn node_distance_lower_bound( &self, node_index: usize, other_node_index: usize, ) -> T
pub fn radius_of(&self, node_index: usize) -> T
pub fn compare_nodes( &self, node_index: usize, other_node_index: usize, ) -> Option<Ordering>
Source§impl<T> SRTree<T, Euclidean>
impl<T> SRTree<T, Euclidean>
Sourcepub fn euclidean_with_params(
pts: &[Vec<T>],
params: Params,
) -> Result<Self, ArrayError>
pub fn euclidean_with_params( pts: &[Vec<T>], params: Params, ) -> Result<Self, ArrayError>
Builds SRTree
with the given points, params and Euclidean metric.
§Errors
ArrayError::Empty
if the input array is empty.ArrayError::DimensionMismatch
if the input array contains points of different dimensions.
Auto Trait Implementations§
impl<T, M> Freeze for SRTree<T, M>where
M: Freeze,
impl<T, M> RefUnwindSafe for SRTree<T, M>where
M: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, M> Send for SRTree<T, M>
impl<T, M> Sync for SRTree<T, M>
impl<T, M> Unpin for SRTree<T, M>
impl<T, M> UnwindSafe for SRTree<T, M>where
M: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more