pub struct Bounds3<T> {
pub p_min: Point3<T>,
pub p_max: Point3<T>,
}
Expand description
Generic type for 3D bounding boxes.
Fields§
§p_min: Point3<T>
point representing the minimum x,y,z value of the bounds.
p_max: Point3<T>
point representing the maximum x,y,z value of the bounds.
Implementations§
Source§impl<T> Bounds3<T>where
T: Number,
impl<T> Bounds3<T>where
T: Number,
Sourcepub fn inside_exclusive(&self, p: Point3<T>) -> bool
pub fn inside_exclusive(&self, p: Point3<T>) -> bool
Determine if p
inside self
excluding upper-bounds.
§Examples
use pbrt::core::geometry::Bounds3i;
use pbrt::core::geometry::Point3i;
let b = Bounds3i::from([[2, 2, 2], [4, 4, 4]]);
assert!(b.inside_exclusive(Point3i::from([2, 2, 2])));
assert!(!b.inside_exclusive(Point3i::from([4, 4, 4])));
Trait Implementations§
Source§impl<T> From<[[T; 3]; 2]> for Bounds3<T>where
T: Number,
impl<T> From<[[T; 3]; 2]> for Bounds3<T>where
T: Number,
Source§fn from(ps: [[T; 3]; 2]) -> Self
fn from(ps: [[T; 3]; 2]) -> Self
Create Bounds3<T>
from tuple of slices. It also ensures min/max are correct, regardless of
how they’re arranged in the incoming slices.
§Examples
use pbrt::core::geometry::Bounds3f;
use pbrt::core::geometry::Point3f;
let b = Bounds3f::from([[2., 3., 4.], [4., 5.,6.]]);
assert_eq!(
b,
Bounds3f {
p_min: Point3f { x: 2., y: 3.,z:4. },
p_max: Point3f { x: 4., y: 5.,z:6. }
}
);
let b = Bounds3f::from([[5., 4., 1.], [3., 2.,3.]]);
assert_eq!(b, Bounds3f::from([[3., 2.,1.], [5., 4.,3.]]));
Source§impl<T> From<[Point3<T>; 2]> for Bounds3<T>where
T: Number,
impl<T> From<[Point3<T>; 2]> for Bounds3<T>where
T: Number,
Source§fn from(ps: [Point3<T>; 2]) -> Self
fn from(ps: [Point3<T>; 2]) -> Self
Create Bounds3<T>
from slice of Point3<t>
. It also ensures min/max are correct, regardless of
how they’re arranged in the incoming Point3<t>
.
§Examples
use pbrt::core::geometry::Bounds3f;
use pbrt::core::geometry::Point3f;
let b = Bounds3f::from([Point3f::from([2., 3.,4.]), Point3f::from([4., 5.,6.])]);
assert_eq!(
b,
Bounds3f {
p_min: Point3f { x: 2., y: 3. ,z:4.},
p_max: Point3f { x: 4., y: 5.,z:6. }
}
);
let b = Bounds3f::from([Point3f::from([5., 4.,1.]), Point3f::from([3., 2.,3.])]);
assert_eq!(b, Bounds3f::from([[3., 2.,1.], [5., 4.,3.]]));
impl<T: Copy> Copy for Bounds3<T>
impl<T> StructuralPartialEq for Bounds3<T>
Auto Trait Implementations§
impl<T> Freeze for Bounds3<T>where
T: Freeze,
impl<T> RefUnwindSafe for Bounds3<T>where
T: RefUnwindSafe,
impl<T> Send for Bounds3<T>where
T: Send,
impl<T> Sync for Bounds3<T>where
T: Sync,
impl<T> Unpin for Bounds3<T>where
T: Unpin,
impl<T> UnwindSafe for Bounds3<T>where
T: UnwindSafe,
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