[−][src]Function broccoli::query::knearest::from_closure
pub fn from_closure<Acc, T: Aabb>(
_tree: &Tree<'_, T>,
acc: Acc,
broad: impl FnMut(&mut Acc, Vec2<T::Num>, PMut<'_, T>) -> Option<T::Num>,
fine: impl FnMut(&mut Acc, Vec2<T::Num>, PMut<'_, T>) -> T::Num,
xline: impl FnMut(&mut Acc, Vec2<T::Num>, T::Num) -> T::Num,
yline: impl FnMut(&mut Acc, Vec2<T::Num>, T::Num) -> T::Num
) -> impl Knearest<T = T, N = T::Num>
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.