Struct crystal_ball::math::Bounds3

source ·
pub struct Bounds3 {
    pub min: Point3,
    pub max: Point3,
}
Expand description

A 3-dimensional bounding box represented by its minimum and maximum corner.

Defaults to f64::INFINITY for min and f64::NEG_INFINITY for max. This way, including any point will result in the correct bounding volume.

Fields§

§min: Point3§max: Point3

Implementations§

source§

impl Bounds3

source

pub fn new(point_a: Point3, point_b: Point3) -> Self

Create a new Bounds3 using the minimum and maximum point coordinate values, respectively.

source

pub fn include_point(self, point: Point3) -> Self

Expand self to include the given Point3.

source

pub fn include_bounds(self, bounds: Bounds3) -> Self

Expand self to include the given Bounds3.

source

pub fn intersection(bounds_a: Bounds3, bounds_b: Bounds3) -> Self

Calculates the intersection of two Bounds3.

source

pub fn overlaps(&self, bounds: Bounds3) -> bool

Checks whether self intersects the given Bounds3.

source

pub fn includes_point(&self, point: Point3) -> bool

Checks whether self includes the given Point3.

source

pub fn diagonal(&self) -> Vec3

Calculate the diagonal from min to max.

source

pub fn surface_area(&self) -> f64

Calculate the Bounds3’s surface area.

source

pub fn maximum_extent(&self) -> XYZEnum

Returns the direction of the longest edge.

source

pub fn offset(&self, point: Point3) -> Vec3

Calculate the position of a Point3 relative to the corners.

(0.0, 0.0, 0.0) represents the min and (1.0, 1.0, 1.0) represents max.

source

pub fn intersects( &self, ray: Ray, max_intersection_distance: f64, inverse_direction: Vec3, direction_is_negative: [bool; 3] ) -> bool

Performs a ray intersection against self.

This only determines whether the Ray intersects self and not where they intersect.

Trait Implementations§

source§

impl Clone for Bounds3

source§

fn clone(&self) -> Bounds3

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Bounds3

source§

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

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

impl Default for Bounds3

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Index<usize> for Bounds3

§

type Output = Point3

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Bounds3

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl PartialEq for Bounds3

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Bounds3

source§

impl StructuralPartialEq for Bounds3

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> 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
source§

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

§

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>,

§

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>,

§

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.