pub struct BoundingBox3D {
pub min_x: f64,
pub min_y: f64,
pub min_z: f64,
pub max_x: f64,
pub max_y: f64,
pub max_z: f64,
}Expand description
A 3D axis-aligned bounding box.
Represents a rectangular volume defined by minimum and maximum coordinates in three dimensions (x, y, z).
Fields§
§min_x: f64Minimum x coordinate
min_y: f64Minimum y coordinate
min_z: f64Minimum z coordinate (altitude/elevation)
max_x: f64Maximum x coordinate
max_y: f64Maximum y coordinate
max_z: f64Maximum z coordinate (altitude/elevation)
Implementations§
Source§impl BoundingBox3D
impl BoundingBox3D
Sourcepub fn new(
min_x: f64,
min_y: f64,
min_z: f64,
max_x: f64,
max_y: f64,
max_z: f64,
) -> Self
pub fn new( min_x: f64, min_y: f64, min_z: f64, max_x: f64, max_y: f64, max_z: f64, ) -> Self
Create a new 3D bounding box from minimum and maximum coordinates.
§Arguments
min_x- Minimum x coordinatemin_y- Minimum y coordinatemin_z- Minimum z coordinate (altitude/elevation)max_x- Maximum x coordinatemax_y- Maximum y coordinatemax_z- Maximum z coordinate (altitude/elevation)
§Examples
use spatio_types::bbox::BoundingBox3D;
let bbox = BoundingBox3D::new(-74.0, 40.7, 0.0, -73.9, 40.8, 100.0);Sourcepub fn contains_point(&self, x: f64, y: f64, z: f64) -> bool
pub fn contains_point(&self, x: f64, y: f64, z: f64) -> bool
Check if a 3D point is contained within this bounding box.
Sourcepub fn intersects(&self, other: &BoundingBox3D) -> bool
pub fn intersects(&self, other: &BoundingBox3D) -> bool
Check if this bounding box intersects with another 3D bounding box.
Sourcepub fn expand(&self, amount: f64) -> Self
pub fn expand(&self, amount: f64) -> Self
Expand the bounding box by a given amount in all directions.
Sourcepub fn to_2d(&self) -> BoundingBox2D
pub fn to_2d(&self) -> BoundingBox2D
Project the 3D bounding box to a 2D bounding box (discarding z).
Trait Implementations§
Source§impl Clone for BoundingBox3D
impl Clone for BoundingBox3D
Source§fn clone(&self) -> BoundingBox3D
fn clone(&self) -> BoundingBox3D
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BoundingBox3D
impl Debug for BoundingBox3D
Source§impl<'de> Deserialize<'de> for BoundingBox3D
impl<'de> Deserialize<'de> for BoundingBox3D
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for BoundingBox3D
impl PartialEq for BoundingBox3D
Source§impl Serialize for BoundingBox3D
impl Serialize for BoundingBox3D
impl StructuralPartialEq for BoundingBox3D
Auto Trait Implementations§
impl Freeze for BoundingBox3D
impl RefUnwindSafe for BoundingBox3D
impl Send for BoundingBox3D
impl Sync for BoundingBox3D
impl Unpin for BoundingBox3D
impl UnwindSafe for BoundingBox3D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more