Trait spade::SpatialObject [−][src]
pub trait SpatialObject { type Point: PointN; fn mbr(&self) -> BoundingRect<Self::Point>; fn distance2(&self, point: &Self::Point) -> <Self::Point as PointN>::Scalar; fn contains(&self, point: &Self::Point) -> bool { ... } }
Describes objects that can be located by r-trees.
See the primitives
module for some basic implementations which can also serve
as useful examples for own implementations.
Associated Types
Required Methods
fn mbr(&self) -> BoundingRect<Self::Point>
Returns the object's minimal bounding rectangle.
The minimal bounding rectangle is the smallest axis aligned rectangle that completely contains the object. Note: The rectangle must be as small as possible, otherwise some queries might fail.
fn distance2(&self, point: &Self::Point) -> <Self::Point as PointN>::Scalar
Returns the squared euclidean distance from the object's contour. Returns a value samller than zero if the point is contained within the object.
Provided Methods
fn contains(&self, point: &Self::Point) -> bool
Returns true if a given point is contained in this object.
Implementors
impl<S> SpatialObject for S where
S: HasPosition, type Point = S::Point;impl<V> SpatialObject for BoundingRect<V> where
V: PointN, type Point = V;impl<V: PointN> SpatialObject for SimpleEdge<V> where
V::Scalar: SpadeFloat, type Point = V;impl<V> SpatialObject for SimpleTriangle<V> where
V: TwoDimensional,
V::Scalar: SpadeFloat, type Point = V;impl<V> SpatialObject for SimpleCircle<V> where
V: PointN,
V::Scalar: SpadeFloat, type Point = V;