Skip to main content

Box

Struct Box 

Source
pub struct Box {
    pub min: Vec3,
    pub max: Vec3,
}

Fields§

§min: Vec3§max: Vec3

Implementations§

Source§

impl Box

Source

pub fn new() -> Self

Default is an infinite box containing all space.

Source

pub fn from_points(p1: Vec3, p2: Vec3) -> Self

Box containing the two given points.

Source

pub fn from_point(p: Vec3) -> Self

A box containing a single point.

Source

pub fn is_empty(&self) -> bool

True when the box has no volume (min > max on any axis).

Source

pub fn size(&self) -> Vec3

Source

pub fn center(&self) -> Vec3

Source

pub fn scale(&self) -> f64

Absolute-largest coordinate value.

Source

pub fn contains_point(&self, p: Vec3) -> bool

Source

pub fn contains_box(&self, other: &Box) -> bool

Source

pub fn union_point(&mut self, p: Vec3)

Expand in-place to include the given point.

Source

pub fn union_box(&self, other: &Box) -> Box

Return the union of this box with another.

Source

pub fn transform(&self, t: &Mat3x4) -> Box

Transform by axis-aligned affine transform (Mat3x4 * vec4(pt, 1)).

Source

pub fn does_overlap_box(&self, other: &Box) -> bool

Source

pub fn does_overlap_point_xy(&self, p: Vec3) -> bool

Does the given point project within the XY extent (including equality)?

Source

pub fn is_finite(&self) -> bool

Trait Implementations§

Source§

impl Add<Vec3> for Box

Source§

type Output = Box

The resulting type after applying the + operator.
Source§

fn add(self, shift: Vec3) -> Box

Performs the + operation. Read more
Source§

impl AddAssign<Vec3> for Box

Source§

fn add_assign(&mut self, shift: Vec3)

Performs the += operation. Read more
Source§

impl Clone for Box

Source§

fn clone(&self) -> Box

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Box

Source§

impl Debug for Box

Source§

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

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

impl Default for Box

Source§

fn default() -> Self

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

impl Mul<Vec3> for Box

Source§

type Output = Box

The resulting type after applying the * operator.
Source§

fn mul(self, scale: Vec3) -> Box

Performs the * operation. Read more
Source§

impl MulAssign<Vec3> for Box

Source§

fn mul_assign(&mut self, scale: Vec3)

Performs the *= operation. Read more
Source§

impl PartialEq for Box

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Box

Auto Trait Implementations§

§

impl Freeze for Box

§

impl RefUnwindSafe for Box

§

impl Send for Box

§

impl Sync for Box

§

impl Unpin for Box

§

impl UnsafeUnpin for Box

§

impl UnwindSafe for Box

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

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

Source§

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

Source§

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

Source§

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.