Trait sif_kdtree::Query
source · pub trait Query<P: Point> {
// Required methods
fn aabb(&self) -> &(P, P);
fn test(&self, position: &P) -> bool;
}
Expand description
Defines a spatial query by its axis-aligned bounding box (AABB) and a method to test a single point
The AABB of the query is used to limit the points which are tested and therefore the AABB should be as tight as possible while staying aligned to the coordinate axes. The test method itself can then be relatively expensive like determining the distance of the given position to an arbitrary polygon.
A very simple example of implementing this trait is WithinBoundingBox
whereas a very common example is WithinDistance
.
Required Methods§
sourcefn aabb(&self) -> &(P, P)
fn aabb(&self) -> &(P, P)
Return the axis-aligned bounding box (AABB) of the query
Represented by the corners with first the smallest and then the largest coordinate values.
Note that calling this method is assumed to be cheap, returning a reference to an AABB stored in the interior of the object.
sourcefn test(&self, position: &P) -> bool
fn test(&self, position: &P) -> bool
Check whether a given position
inside the axis-aligned bounding box (AABB) machtes the query.