pub struct Aabb {
pub min: Vec3,
pub max: Vec3,
}Expand description
An axis-aligned bounding box in world space. 世界空间中的轴对齐包围盒。
Fields§
§min: Vec3The corner with the smallest coordinate on every axis. 每个轴上坐标最小的角点。
max: Vec3The corner with the largest coordinate on every axis. 每个轴上坐标最大的角点。
Implementations§
Source§impl Aabb
impl Aabb
Sourcepub fn new(a: Vec3, b: Vec3) -> Self
pub fn new(a: Vec3, b: Vec3) -> Self
Build a box from two opposite corners, ordering them if necessary. 由两个对角点构造包围盒;如有必要会重新排序。
Sourcepub fn from_center_half_extents(center: Vec3, half_extents: Vec3) -> Self
pub fn from_center_half_extents(center: Vec3, half_extents: Vec3) -> Self
Build a box from a center and half extents. 由中心与半长构造包围盒。
Sourcepub fn half_extents(&self) -> Vec3
pub fn half_extents(&self) -> Vec3
The half extents of the box. 包围盒的半长。
Sourcepub fn overlaps(&self, other: &Self) -> bool
pub fn overlaps(&self, other: &Self) -> bool
Whether two boxes share any volume. Touching faces count as overlapping. 两个包围盒是否有体积重叠。面接触算作重叠。
Sourcepub fn merged(&self, other: &Self) -> Self
pub fn merged(&self, other: &Self) -> Self
The smallest box containing both inputs. 包含两者的最小包围盒。
Sourcepub fn contains_point(&self, point: Vec3) -> bool
pub fn contains_point(&self, point: Vec3) -> bool
Whether a point lies inside the box, faces included. 点是否位于包围盒内(含面)。
Trait Implementations§
impl Copy for Aabb
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> 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