Trait spatial::tree::mbr::MbrLeafGeometry

source ·
pub trait MbrLeafGeometry<P: FP, const DIM: usize> {
    // Required methods
    fn dim(&self) -> usize;
    fn area(&self) -> P;
    fn min_for_axis(&self, dim: usize) -> P;
    fn max_for_axis(&self, dim: usize) -> P;
    fn expand_mbr_to_fit(&self, mbr: &mut Rect<P, DIM>);
    fn distance_from_mbr_center(&self, mbr: &Rect<P, DIM>) -> P;
    fn contained_by_mbr(&self, mbr: &Rect<P, DIM>) -> bool;
    fn overlapped_by_mbr(&self, mbr: &Rect<P, DIM>) -> bool;
    fn area_overlapped_with_mbr(&self, mbr: &Rect<P, DIM>) -> P;
}
Expand description

The minimum functionality required to insert leaf geometry into MbrMap Until the rust compiler allows compile-time generic integers, we’ll be using generic_array’s ArrayLength to specify geometry dimensions at compile time.

The parameter mbr represents a minimum bounding rectangle. An mbr whose corners are at (x1, y1), (x2, y2) will have the corresponding edges: (x1, x2), (y1, y2)

Required Methods§

source

fn dim(&self) -> usize

The geometry’s dimension count

source

fn area(&self) -> P

Determine the area of the geometry

source

fn min_for_axis(&self, dim: usize) -> P

the minimum extent for a given axis

source

fn max_for_axis(&self, dim: usize) -> P

the maximum extent for a given axis

source

fn expand_mbr_to_fit(&self, mbr: &mut Rect<P, DIM>)

Expand the mbr to minimally fit the leaf

source

fn distance_from_mbr_center(&self, mbr: &Rect<P, DIM>) -> P

Determine the distance from the mbr’s center

source

fn contained_by_mbr(&self, mbr: &Rect<P, DIM>) -> bool

Determine if the leaf is completely contained in the mbr

source

fn overlapped_by_mbr(&self, mbr: &Rect<P, DIM>) -> bool

Determine if the leaf overlaps the mbr

source

fn area_overlapped_with_mbr(&self, mbr: &Rect<P, DIM>) -> P

Determines the leaf area shared with the rectangle. In cases where the leaf and mbr overlap, but the leaf has no area (point or a line, for example), return 0

Implementors§

source§

impl<P: FP, const DIM: usize> MbrLeafGeometry<P, DIM> for Shapes<P, DIM>

source§

impl<P: FP, const DIM: usize> MbrLeafGeometry<P, DIM> for LineSegment<P, DIM>

source§

impl<P: FP, const DIM: usize> MbrLeafGeometry<P, DIM> for Point<P, DIM>

source§

impl<P: FP, const DIM: usize> MbrLeafGeometry<P, DIM> for Rect<P, DIM>

source§

impl<P: FP, const DIM: usize, LG, T> MbrLeafGeometry<P, DIM> for RTreeNode<P, DIM, LG, T>
where LG: MbrLeafGeometry<P, DIM>,

source§

impl<P: FP, const DIM: usize, LG, T> MbrLeafGeometry<P, DIM> for MbrLeaf<P, DIM, LG, T>
where LG: MbrLeafGeometry<P, DIM>,