Skip to main content

Bounds

Struct Bounds 

Source
pub struct Bounds {
    pub min: [f64; 2],
    pub max: [f64; 2],
}
Expand description

An axis-aligned bounding box in the plane.

Mirrors the minimum bounding rectangle stored at every node of a Boost rtree.

Fields§

§min: [f64; 2]

Lower corner [x_min, y_min].

§max: [f64; 2]

Upper corner [x_max, y_max].

Implementations§

Source§

impl Bounds

Source

pub const fn new(min: [f64; 2], max: [f64; 2]) -> Self

A box from explicit corners.

Source

pub const fn point(p: [f64; 2]) -> Self

A degenerate box at a single point.

Source

pub fn area(&self) -> f64

The area (2D measure) of the box.

Source

pub fn half_perimeter(&self) -> f64

Half the perimeter — Boost’s “margin”, used by the R* split.

Source

pub fn union(&self, other: &Bounds) -> Bounds

The smallest box containing both self and other.

Source

pub fn enlargement(&self, other: &Bounds) -> f64

How much self’s area would grow to also contain other — Boost’s enlargement metric for choose_next_node.

Source

pub fn intersects(&self, other: &Bounds) -> bool

Whether the two boxes share any point (closed boxes, so touching counts).

Source

pub fn contains(&self, other: &Bounds) -> bool

Whether self fully contains other.

Source

pub fn min_distance_to(&self, p: [f64; 2]) -> f64

The minimum distance from a query point to this box (0 inside). Used by nearest-neighbour pruning.

Source

pub fn center(&self) -> [f64; 2]

The centroid, used by the STR bulk-load sort.

Trait Implementations§

Source§

impl Clone for Bounds

Source§

fn clone(&self) -> Bounds

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Bounds

Source§

impl Debug for Bounds

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Indexable for Bounds

Source§

fn bounds(&self) -> Bounds

The value’s axis-aligned bounding box.
Source§

impl PartialEq for Bounds

Source§

fn eq(&self, other: &Bounds) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Bounds

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SameAs<T> for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.