Skip to main content

Box3

Struct Box3 

Source
pub struct Box3 {
    pub min: Vector3,
    pub max: Vector3,
}
Expand description

Port of three.js/src/math/Box3.js’s Box3 class: an axis-aligned bounding box (AABB) in 3D space.

Fields§

§min: Vector3

The lower boundary of the box.

§max: Vector3

The upper boundary of the box.

Implementations§

Source§

impl Box3

Source

pub const IS_BOX3: bool = true

Box3.isBox3.

Source

pub const fn new(min: Vector3, max: Vector3) -> Self

new Box3().

Source

pub fn set(&mut self, min: &Vector3, max: &Vector3) -> &mut Self

Box3.set().

Source

pub fn set_from_array(&mut self, array: &[f64]) -> &mut Self

Box3.setFromArray().

Source

pub fn set_from_buffer_attribute( &mut self, attribute: &BufferAttribute, ) -> &mut Self

Box3.setFromBufferAttribute().

Source

pub fn set_from_points(&mut self, points: &[Vector3]) -> &mut Self

Box3.setFromPoints().

Source

pub fn set_from_center_and_size( &mut self, center: &Vector3, size: &Vector3, ) -> &mut Self

Box3.setFromCenterAndSize().

Source

pub fn set_from_object( &mut self, object: &ObjectRef, precise: bool, ) -> &mut Self

Box3.setFromObject( object, precise ): the world-axis-aligned box of a scene-graph subtree.

precise puts every vertex of every geometry through its node’s matrix_world; the default walks each geometry’s own bounding box through the same matrix, which is cheaper and can be larger than strictly necessary.

Source

pub fn expand_by_object( &mut self, object: &ObjectRef, precise: bool, ) -> &mut Self

Box3.expandByObject( object, precise ).

Two divergences from three.js, both because the port has no Object3D.getVertexPosition() yet: the precise path reads the position attribute directly, so it does not apply morph targets or skinning (the non-precise path does get morphs, through BufferGeometry::compute_bounding_box()), and there is no object-level boundingBox to prefer over the geometry’s, since only SkinnedMesh has one here and it is not a Payload variant. An InstancedMesh takes the conservative path in three.js too.

Source

pub fn copy(&mut self, box_: &Self) -> &mut Self

Box3.copy().

Source

pub fn make_empty(&mut self) -> &mut Self

Box3.makeEmpty().

Source

pub fn is_empty(&self) -> bool

Box3.isEmpty().

Source

pub fn get_center(&self) -> Vector3

Box3.getCenter().

Source

pub fn get_size(&self) -> Vector3

Box3.getSize().

Source

pub fn expand_by_point(&mut self, point: &Vector3) -> &mut Self

Box3.expandByPoint().

Source

pub fn expand_by_vector(&mut self, vector: &Vector3) -> &mut Self

Box3.expandByVector().

Source

pub fn expand_by_scalar(&mut self, scalar: f64) -> &mut Self

Box3.expandByScalar().

Source

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

Box3.containsPoint().

Source

pub fn contains_box(&self, box_: &Self) -> bool

Box3.containsBox().

Source

pub fn get_parameter(&self, point: &Vector3) -> Vector3

Box3.getParameter().

Source

pub fn intersects_box(&self, box_: &Self) -> bool

Box3.intersectsBox().

Source

pub fn intersects_sphere(&self, sphere: &Sphere) -> bool

Box3.intersectsSphere().

Source

pub fn intersects_plane(&self, plane: &Plane) -> bool

Box3.intersectsPlane().

Source

pub fn intersects_triangle(&self, triangle: &Triangle) -> bool

Box3.intersectsTriangle().

Source

pub fn clamp_point(&self, point: &Vector3) -> Vector3

Box3.clampPoint().

Source

pub fn distance_to_point(&self, point: &Vector3) -> f64

Box3.distanceToPoint().

Source

pub fn get_bounding_sphere(&self) -> Sphere

Box3.getBoundingSphere().

Source

pub fn intersect(&mut self, box_: &Self) -> &mut Self

Box3.intersect().

Source

pub fn union(&mut self, box_: &Self) -> &mut Self

Box3.union().

Source

pub fn apply_matrix4(&mut self, matrix: &Matrix4) -> &mut Self

Box3.applyMatrix4().

Source

pub fn translate(&mut self, offset: &Vector3) -> &mut Self

Box3.translate().

Source

pub fn equals(&self, box_: &Self) -> bool

Box3.equals().

Trait Implementations§

Source§

impl Clone for Box3

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 Box3

Source§

impl Debug for Box3

Source§

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

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

impl Default for Box3

Source§

fn default() -> Self

new Box3() — min (+Infinity, +Infinity, +Infinity), max (-Infinity, -Infinity, -Infinity).

Source§

impl PartialEq for Box3

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 Box3

Auto Trait Implementations§

§

impl Freeze for Box3

§

impl RefUnwindSafe for Box3

§

impl Send for Box3

§

impl Sync for Box3

§

impl Unpin for Box3

§

impl UnsafeUnpin for Box3

§

impl UnwindSafe for Box3

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,