Skip to main content

PointsNearBall

Trait PointsNearBall 

Source
pub trait PointsNearBall<P, K> {
    // Required method
    fn points_near_ball(
        &self,
        position: &P,
        radius: f64,
    ) -> impl Iterator<Item = K>;

    // Provided method
    fn is_all_pairs() -> bool { ... }
}
Expand description

Find all points in the given ball.

Required Methods§

Source

fn points_near_ball(&self, position: &P, radius: f64) -> impl Iterator<Item = K>

Find all the points that might be in the given ball.

points_near_ball will iterate over all points in the given ball and possibly others as well. The spatial data structure may iterate over the points in any order.

§Example
use hoomd_spatial::{PointUpdate, PointsNearBall, VecCell};

let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 0.0].into());
vec_cell.insert(1, [3.25, 0.75].into());
vec_cell.insert(2, [-10.0, 12.0].into());

for key in vec_cell.points_near_ball(&[2.0, 0.0].into(), 1.0) {
    println!("{key}");
}

Prints (in any order):

0
1

Provided Methods§

Source

fn is_all_pairs() -> bool

Is this spatial data structures AllPairs?

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<P, K> PointsNearBall<P, K> for AllPairs<K>
where K: Copy + Eq + Hash,

Source§

impl<const D: usize, K> PointsNearBall<Cartesian<D>, K> for HashCell<K, D>
where K: Copy + Eq + Hash,

Source§

impl<const D: usize, K> PointsNearBall<Cartesian<D>, K> for VecCell<K, D>
where K: Copy + Eq + Hash,