Skip to main content

BlockLocalAabb

Struct BlockLocalAabb 

Source
pub struct BlockLocalAabb {
    min_x: f64,
    min_y: f64,
    min_z: f64,
    max_x: f64,
    max_y: f64,
    max_z: f64,
}
Expand description

Block-local axis-aligned box used by voxel shapes.

Coordinates are relative to a block position. Vanilla block shapes are usually in 0.0..=1.0 space, but some shapes extend outside that range.

Fields§

§min_x: f64§min_y: f64§min_z: f64§max_x: f64§max_y: f64§max_z: f64

Implementations§

Source§

impl BlockLocalAabb

Source

pub const FULL_BLOCK: Self

A full block from (0, 0, 0) to (1, 1, 1).

Source

pub const EMPTY: Self

A zero-volume box. Empty voxel shapes should prefer an empty box slice.

Source

pub const fn new( min_x: f64, min_y: f64, min_z: f64, max_x: f64, max_y: f64, max_z: f64, ) -> Self

Creates a block-local AABB and normalizes endpoint order like vanilla AABB.

Source

pub const fn min_x(self) -> f64

Returns the minimum X coordinate.

Source

pub const fn min_y(self) -> f64

Returns the minimum Y coordinate.

Source

pub const fn min_z(self) -> f64

Returns the minimum Z coordinate.

Source

pub const fn max_x(self) -> f64

Returns the maximum X coordinate.

Source

pub const fn max_y(self) -> f64

Returns the maximum Y coordinate.

Source

pub const fn max_z(self) -> f64

Returns the maximum Z coordinate.

Source

pub const fn min(self, axis: Axis) -> f64

Returns the minimum coordinate on axis.

Source

pub const fn max(self, axis: Axis) -> f64

Returns the maximum coordinate on axis.

Source

pub const fn is_empty(self) -> bool

Returns true when this box has no positive volume on at least one axis.

Source

pub fn width(self) -> f64

Returns the X size.

Source

pub fn height(self) -> f64

Returns the Y size.

Source

pub fn depth(self) -> f64

Returns the Z size.

Source

pub fn size(self) -> f64

Vanilla equivalent: AABB.getSize().

Source

pub fn move_by(self, dx: f64, dy: f64, dz: f64) -> Self

Returns this box translated by the given delta.

Source

pub fn inflate(self, amount: f64) -> Self

Returns this box expanded by amount in every direction.

Source

pub fn inflate_xyz(self, x: f64, y: f64, z: f64) -> Self

Returns this box expanded independently on each axis.

Source

pub fn deflate(self, amount: f64) -> Self

Returns this box shrunk by amount in every direction.

Source

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

Returns true if this box intersects other.

Source

pub fn contains(self, x: f64, y: f64, z: f64) -> bool

Returns true if the point lies inside this box.

Source

pub fn at_block(self, pos: BlockPos) -> WorldAabb

Converts this block-local box to a world-space box at pos.

Trait Implementations§

Source§

impl Clone for BlockLocalAabb

Source§

fn clone(&self) -> BlockLocalAabb

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 BlockLocalAabb

Source§

impl Debug for BlockLocalAabb

Source§

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

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

impl PartialEq for BlockLocalAabb

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for BlockLocalAabb

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

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more