pub struct CuPoint<T, const N: usize>{ /* private fields */ }
Expand description
Represents a point in N-dimensional Euclidean space whose coordinates are numeric type T Wrapping CuPoint<i64, 3> or CuPoint<f64, 3> is a good way to get started quickly if you don’t need a topologically exotic implementation
Implementations§
Trait Implementations§
source§impl<T, const N: usize> Default for CuPoint<T, N>
impl<T, const N: usize> Default for CuPoint<T, N>
Generate a default point (all coordinates zero)
source§impl<T, const N: usize> Distribution<CuPoint<T, N>> for Uniform<T>
impl<T, const N: usize> Distribution<CuPoint<T, N>> for Uniform<T>
Generate a random point in a square/cube/etc. Given a Uniform distribution sampling from a range, this adds the ability to randomly generate CuPoints whose coordinates are iid (independent and identically distributed) from that range
source§impl<T, const N: usize> KdPoint for CuPoint<T, N>
impl<T, const N: usize> KdPoint for CuPoint<T, N>
§type Distance = T
type Distance = T
The type used by sqdist and related KdRegion functions to represent (squared) distance.
Must be totally ordered, where greater distances mean points are farther apart.
Also must be Clone and have a meaningful minimum value (0)
source§fn cmp(&self, other: &Self, layer: usize) -> Ordering
fn cmp(&self, other: &Self, layer: usize) -> Ordering
Compare two points in some layer of the tree. This generalizes splitting
different layers of the tree in different dimensions and is tied to KdRegion::split.
Traditionally, points in a KD tree are compared by their 1st coordinate in layer 0,
their 2nd in layer 1, …, onto their Kth in layer k - 1, and then in layer K it wraps
around to 0 and repeats. So for a 3D KD tree, layer 0 would compare x coordinates
with the root having the median x coordinate, all points in the first subtree having
x coordinate <=, and all points in the second subtree having x coordinate >=.
This method allows for more general strategies, but pushes some of the burden of
layer-dependent behavior onto the point type. It’s still possible to just implement
a by-coordinate cmp function of course, and this is what the prebuilt CuPoint does.
source§fn sqdist(&self, other: &Self) -> Self::Distance
fn sqdist(&self, other: &Self) -> Self::Distance
The squared distance is more computationally convenient than the proper distance
in many cases. The distance function only has to be topologically consistent
and totally ordered. See KdRegion::min_sqdist for more info. The return value should be >= Distance::zero().
source§impl<T, const N: usize> PartialEq for CuPoint<T, N>
impl<T, const N: usize> PartialEq for CuPoint<T, N>
impl<T: Ord + Copy + NumRef, const N: usize> Copy for CuPoint<T, N>
impl<T: Ord + Clone + NumRef, const N: usize> Eq for CuPoint<T, N>
impl<T, const N: usize> StructuralPartialEq for CuPoint<T, N>
Auto Trait Implementations§
impl<T, const N: usize> RefUnwindSafe for CuPoint<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for CuPoint<T, N>where
T: Send,
impl<T, const N: usize> Sync for CuPoint<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for CuPoint<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for CuPoint<T, N>where
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