pub struct BBox3D<T = f64> {
pub left: T,
pub bottom: T,
pub right: T,
pub top: T,
pub near: T,
pub far: T,
}Expand description
§3D Bounding Box
§Description
A 3D Bounding Box ensures a min-max range of values and includes a near-far range
The order is (left, bottom, right, top, near, far) when storing as a flattened array.
If WM, then the projection is lon-lat. If S2, then the projection is s-t
Defaults to f64 as the base type.
Implements MValueCompatible as well as Interpolate.
§Usage
§From/To
§Any Type BBox
BBox3D::new: Creates a new BBoxBBox3D::point_overlap: Checks if a point is within the BBoxBBox3D::merge: Merges another bounding box with this oneBBox3D::merge_in_place: Merges in place another bounding box with this oneBBox3D::overlap: Checks if another bounding box overlaps with this oneBBox3D::clip: Clips the bounding box along an axisBBox3D::inside: Checks if this bounding box is inside anotherBBox3D::from_bbox: Creates a new BBox3D from a BBoxBBox3D::area: Returns the area of the bounding box
§f64 Type BBox
Note that all the input geometry uses the GetXY and GetZ traits.
BBox3D::from_point: Creates a new BBox from a pointBBox3D::from_linestring: Creates a new BBox from a linestringBBox3D::from_multi_linestring: Creates a new BBox from a multi-linestringBBox3D::from_polygon: Creates a new BBox from a polygonBBox3D::from_multi_polygon: Creates a new BBox from a multi-polygonBBox3D::extend_from_point: Extends the bounding box with a pointBBox3D::from_uv_zoom: Creates a new BBox from zoom-uv coordinatesBBox3D::from_st_zoom: Creates a new BBox from zoom-st coordinates
Fields§
§left: Tleft most longitude (WM) or S (S2)
bottom: Tbottom most latitude (WM) or T (S2)
right: Tright most longitude (WM) or T (S2)
top: Ttop most latitude (WM) or S (S2)
near: Tnear most height (WM) or T (S2) generic height is relative to the surface of the earth in meters
far: Tfar most height (WM) or T (S2) generic height is relative to the surface of the earth in meters
Implementations§
Source§impl<T> BBox3D<T>
impl<T> BBox3D<T>
Sourcepub fn new(left: T, bottom: T, right: T, top: T, near: T, far: T) -> Selfwhere
T: Copy,
pub fn new(left: T, bottom: T, right: T, top: T, near: T, far: T) -> Selfwhere
T: Copy,
Creates a new BBox3D
Sourcepub fn point_overlap<P: GetXY + GetZ>(&self, point: &P) -> bool
pub fn point_overlap<P: GetXY + GetZ>(&self, point: &P) -> bool
Checks if a point is within the BBox
Sourcepub fn merge(&self, other: &BBox3D<T>) -> BBox3D<T>where
T: PartialOrd + Copy,
pub fn merge(&self, other: &BBox3D<T>) -> BBox3D<T>where
T: PartialOrd + Copy,
Merges another bounding box with this one
Sourcepub fn merge_in_place(&mut self, other: &Self)where
T: PartialOrd + Copy,
pub fn merge_in_place(&mut self, other: &Self)where
T: PartialOrd + Copy,
Merges in place another bounding box with this one
Sourcepub fn overlap(&self, other: &BBox3D<T>) -> Option<BBox3D<T>>where
T: PartialOrd + Copy,
pub fn overlap(&self, other: &BBox3D<T>) -> Option<BBox3D<T>>where
T: PartialOrd + Copy,
Checks if another bounding box overlaps with this one and returns the overlap
Sourcepub fn clip(&self, axis: Axis, k1: T, k2: T) -> BBox3D<T>where
T: PartialOrd + Copy,
pub fn clip(&self, axis: Axis, k1: T, k2: T) -> BBox3D<T>where
T: PartialOrd + Copy,
Clips the bounding box along an axis
Source§impl BBox3D<f64>
impl BBox3D<f64>
Sourcepub fn from_point<P: GetXY + GetZ>(point: &P) -> Self
pub fn from_point<P: GetXY + GetZ>(point: &P) -> Self
Creates a new BBox3D from a point
Sourcepub fn from_linestring<P: GetXY + GetZ>(line: &[P]) -> Self
pub fn from_linestring<P: GetXY + GetZ>(line: &[P]) -> Self
Creates a new BBox from a linestring
Sourcepub fn from_multi_linestring<P: GetXY + GetZ>(lines: &[Vec<P>]) -> Self
pub fn from_multi_linestring<P: GetXY + GetZ>(lines: &[Vec<P>]) -> Self
Creates a new BBox from a multi-linestring
Sourcepub fn from_polygon<P: GetXY + GetZ>(polygon: &[Vec<P>]) -> Self
pub fn from_polygon<P: GetXY + GetZ>(polygon: &[Vec<P>]) -> Self
Creates a new BBox from a polygon
Sourcepub fn from_multi_polygon<P: GetXY + GetZ>(polygons: &[Vec<Vec<P>>]) -> Self
pub fn from_multi_polygon<P: GetXY + GetZ>(polygons: &[Vec<Vec<P>>]) -> Self
Creates a new BBox from a multi-polygon
Sourcepub fn extend_from_point<P: GetXY + GetZ>(&mut self, point: &P)
pub fn extend_from_point<P: GetXY + GetZ>(&mut self, point: &P)
Extends the bounding box with a point
Sourcepub fn from_uv_zoom(u: f64, v: f64, zoom: u8) -> Self
pub fn from_uv_zoom(u: f64, v: f64, zoom: u8) -> Self
Creates a new BBox3D from zoom-uv coordinates
Sourcepub fn from_st_zoom(s: f64, t: f64, zoom: u8) -> Self
pub fn from_st_zoom(s: f64, t: f64, zoom: u8) -> Self
Creates a new BBox from zoom-st coordinates