Skip to main content

Aabb

Struct Aabb 

Source
pub struct Aabb {
    pub min: Vec3,
    pub max: Vec3,
}
Expand description

An axis-aligned bounding box in world space. 世界空间中的轴对齐包围盒。

Fields§

§min: Vec3

The corner with the smallest coordinate on every axis. 每个轴上坐标最小的角点。

§max: Vec3

The corner with the largest coordinate on every axis. 每个轴上坐标最大的角点。

Implementations§

Source§

impl Aabb

Source

pub fn new(a: Vec3, b: Vec3) -> Self

Build a box from two opposite corners, ordering them if necessary. 由两个对角点构造包围盒;如有必要会重新排序。

Source

pub fn from_center_half_extents(center: Vec3, half_extents: Vec3) -> Self

Build a box from a center and half extents. 由中心与半长构造包围盒。

Source

pub fn center(&self) -> Vec3

The center of the box. 包围盒的中心。

Source

pub fn half_extents(&self) -> Vec3

The half extents of the box. 包围盒的半长。

Source

pub fn overlaps(&self, other: &Self) -> bool

Whether two boxes share any volume. Touching faces count as overlapping. 两个包围盒是否有体积重叠。面接触算作重叠。

Source

pub fn merged(&self, other: &Self) -> Self

The smallest box containing both inputs. 包含两者的最小包围盒。

Source

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

Whether a point lies inside the box, faces included. 点是否位于包围盒内(含面)。

Source

pub fn expanded(&self, margin: f32) -> Self

Grow the box by margin on every axis. 每个轴向外扩展 margin。

Trait Implementations§

Source§

impl Clone for Aabb

Source§

fn clone(&self) -> Self

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 Aabb

Source§

impl Debug for Aabb

Source§

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

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

impl PartialEq for Aabb

Source§

fn eq(&self, other: &Self) -> 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 Aabb

Auto Trait Implementations§

§

impl Freeze for Aabb

§

impl RefUnwindSafe for Aabb

§

impl Send for Aabb

§

impl Sync for Aabb

§

impl Unpin for Aabb

§

impl UnsafeUnpin for Aabb

§

impl UnwindSafe for Aabb

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.