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
impl Bounds
Sourcepub fn half_perimeter(&self) -> f64
pub fn half_perimeter(&self) -> f64
Half the perimeter — Boost’s “margin”, used by the R* split.
Sourcepub fn enlargement(&self, other: &Bounds) -> f64
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.
Sourcepub fn intersects(&self, other: &Bounds) -> bool
pub fn intersects(&self, other: &Bounds) -> bool
Whether the two boxes share any point (closed boxes, so touching counts).
Sourcepub fn covered_by(&self, other: &Bounds) -> bool
pub fn covered_by(&self, other: &Bounds) -> bool
Whether self is covered by other, including coincident
boundaries and degenerate boxes.
This is Boost.Geometry’s box-level covered_by relation.
Sourcepub fn within(&self, other: &Bounds) -> bool
pub fn within(&self, other: &Bounds) -> bool
Whether self is within other under Boost.Geometry’s box
semantics.
Boundaries may coincide, but the geometry on the within side
must have a non-empty two-dimensional interior. This is the
distinction between within and covered_by
for point-like boxes.
Sourcepub fn disjoint(&self, other: &Bounds) -> bool
pub fn disjoint(&self, other: &Bounds) -> bool
Whether the two closed boxes have no point in common.
Sourcepub fn overlaps(&self, other: &Bounds) -> bool
pub fn overlaps(&self, other: &Bounds) -> bool
Whether the interiors overlap in two dimensions while neither box covers the other.
Touching only at a boundary and containment are not overlaps.
Sourcepub fn min_distance_to(&self, p: [f64; 2]) -> f64
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.
Sourcepub fn comparable_min_distance_to(&self, p: [f64; 2]) -> f64
pub fn comparable_min_distance_to(&self, p: [f64; 2]) -> f64
The SQUARED minimum distance from a query point to this box —
same ordering as min_distance_to
without the square root, for hot comparison paths. The analogue
of boost::geometry::comparable_distance.