pub struct KnearestClosure<B, C, D, E> {
pub broad: B,
pub fine: C,
pub xline: D,
pub yline: E,
}
Expand description
Construct an object that implements Knearest
from closures.
We pass the tree so that we can infer the type of T
.
fine
is a function that gives the true distance between the point
and the specified tree element.
broad
is a function that gives the distance between the point
and the closest point of a axis aligned rectangle. This function
is used as a conservative estimate to prune out elements which minimizes
how often the fine
function gets called.
xline
is a function that gives the distance between the point and a axis aligned line
that was a fixed x value and spans the y values.
yline
is a function that gives the distance between the point and a axis aligned line
that was a fixed x value and spans the y values.
acc
is a user defined object that is passed to every call to either
the fine
or broad
functions.
Container of closures that implements Knearest
Fields
broad: B
fine: C
xline: D
yline: E
Trait Implementations
sourceimpl<'a, T: Aabb, B, C, D, E> Knearest<T> for KnearestClosure<B, C, D, E> where
B: FnMut(Vec2<T::Num>, AabbPin<&mut T>) -> Option<T::Num>,
C: FnMut(Vec2<T::Num>, AabbPin<&mut T>) -> T::Num,
D: FnMut(Vec2<T::Num>, T::Num) -> T::Num,
E: FnMut(Vec2<T::Num>, T::Num) -> T::Num,
impl<'a, T: Aabb, B, C, D, E> Knearest<T> for KnearestClosure<B, C, D, E> where
B: FnMut(Vec2<T::Num>, AabbPin<&mut T>) -> Option<T::Num>,
C: FnMut(Vec2<T::Num>, AabbPin<&mut T>) -> T::Num,
D: FnMut(Vec2<T::Num>, T::Num) -> T::Num,
E: FnMut(Vec2<T::Num>, T::Num) -> T::Num,
sourcefn distance_to_aaline<A: Axis>(
&mut self,
point: Vec2<T::Num>,
axis: A,
val: T::Num
) -> T::Num
fn distance_to_aaline<A: Axis>(
&mut self,
point: Vec2<T::Num>,
axis: A,
val: T::Num
) -> T::Num
User define distance function from a point to an axis aligned line of infinite length.
sourcefn distance_to_broad(
&mut self,
point: Vec2<T::Num>,
rect: AabbPin<&mut T>
) -> Option<T::Num>
fn distance_to_broad(
&mut self,
point: Vec2<T::Num>,
rect: AabbPin<&mut T>
) -> Option<T::Num>
User defined inexpensive distance function that that can be overly conservative. It may be that the precise distance function is fast enough, in which case you can simply return None. If None is desired, every call to this function for a particular element must always return None. Read more
Auto Trait Implementations
impl<B, C, D, E> RefUnwindSafe for KnearestClosure<B, C, D, E> where
B: RefUnwindSafe,
C: RefUnwindSafe,
D: RefUnwindSafe,
E: RefUnwindSafe,
impl<B, C, D, E> Send for KnearestClosure<B, C, D, E> where
B: Send,
C: Send,
D: Send,
E: Send,
impl<B, C, D, E> Sync for KnearestClosure<B, C, D, E> where
B: Sync,
C: Sync,
D: Sync,
E: Sync,
impl<B, C, D, E> Unpin for KnearestClosure<B, C, D, E> where
B: Unpin,
C: Unpin,
D: Unpin,
E: Unpin,
impl<B, C, D, E> UnwindSafe for KnearestClosure<B, C, D, E> where
B: UnwindSafe,
C: UnwindSafe,
D: UnwindSafe,
E: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more