pub struct KdTree<'a> { /* private fields */ }Expand description
A balanced static k-dimensional tree over selected atoms.
Construction uses linear-time median partitioning at each level, for O(n log n) total work and one flat node allocation.
Implementations§
Source§impl<'a> KdTree<'a>
impl<'a> KdTree<'a>
Sourcepub fn build(
positions: &'a [[f32; 3]],
targets: &[u32],
periodic: Option<PeriodicBox>,
) -> Result<Self, SpatialError>
pub fn build( positions: &'a [[f32; 3]], targets: &[u32], periodic: Option<PeriodicBox>, ) -> Result<Self, SpatialError>
Builds a balanced tree over finite target positions.
§Errors
Returns an error when a target index is outside positions.
Sourcepub fn build_with_options(
positions: &'a [[f32; 3]],
targets: &[u32],
periodic: Option<PeriodicBox>,
periodic_options: KdPeriodicOptions,
) -> Result<Self, SpatialError>
pub fn build_with_options( positions: &'a [[f32; 3]], targets: &[u32], periodic: Option<PeriodicBox>, periodic_options: KdPeriodicOptions, ) -> Result<Self, SpatialError>
Builds a balanced tree with an explicit periodic image budget.
§Errors
Returns an error for invalid options or target indices.
Sourcepub fn pairs(
&self,
query: &[u32],
cutoff: f32,
) -> Result<Vec<NeighborPair>, SpatialError>
pub fn pairs( &self, query: &[u32], cutoff: f32, ) -> Result<Vec<NeighborPair>, SpatialError>
Finds all indexed pairs within cutoff.
§Errors
Returns an error for an invalid cutoff or query index.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for KdTree<'a>
impl<'a> RefUnwindSafe for KdTree<'a>
impl<'a> Send for KdTree<'a>
impl<'a> Sync for KdTree<'a>
impl<'a> Unpin for KdTree<'a>
impl<'a> UnsafeUnpin for KdTree<'a>
impl<'a> UnwindSafe for KdTree<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more