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: Vector3The lower boundary of the box.
max: Vector3The upper boundary of the box.
Implementations§
Source§impl Box3
impl Box3
Sourcepub fn set_from_array(&mut self, array: &[f64]) -> &mut Self
pub fn set_from_array(&mut self, array: &[f64]) -> &mut Self
Box3.setFromArray().
Sourcepub fn set_from_buffer_attribute(
&mut self,
attribute: &BufferAttribute,
) -> &mut Self
pub fn set_from_buffer_attribute( &mut self, attribute: &BufferAttribute, ) -> &mut Self
Box3.setFromBufferAttribute().
Sourcepub fn set_from_points(&mut self, points: &[Vector3]) -> &mut Self
pub fn set_from_points(&mut self, points: &[Vector3]) -> &mut Self
Box3.setFromPoints().
Sourcepub fn set_from_center_and_size(
&mut self,
center: &Vector3,
size: &Vector3,
) -> &mut Self
pub fn set_from_center_and_size( &mut self, center: &Vector3, size: &Vector3, ) -> &mut Self
Box3.setFromCenterAndSize().
Sourcepub fn set_from_object(
&mut self,
object: &ObjectRef,
precise: bool,
) -> &mut Self
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.
Sourcepub fn expand_by_object(
&mut self,
object: &ObjectRef,
precise: bool,
) -> &mut Self
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.
Sourcepub fn make_empty(&mut self) -> &mut Self
pub fn make_empty(&mut self) -> &mut Self
Box3.makeEmpty().
Sourcepub fn get_center(&self) -> Vector3
pub fn get_center(&self) -> Vector3
Box3.getCenter().
Sourcepub fn expand_by_point(&mut self, point: &Vector3) -> &mut Self
pub fn expand_by_point(&mut self, point: &Vector3) -> &mut Self
Box3.expandByPoint().
Sourcepub fn expand_by_vector(&mut self, vector: &Vector3) -> &mut Self
pub fn expand_by_vector(&mut self, vector: &Vector3) -> &mut Self
Box3.expandByVector().
Sourcepub fn expand_by_scalar(&mut self, scalar: f64) -> &mut Self
pub fn expand_by_scalar(&mut self, scalar: f64) -> &mut Self
Box3.expandByScalar().
Sourcepub fn contains_point(&self, point: &Vector3) -> bool
pub fn contains_point(&self, point: &Vector3) -> bool
Box3.containsPoint().
Sourcepub fn contains_box(&self, box_: &Self) -> bool
pub fn contains_box(&self, box_: &Self) -> bool
Box3.containsBox().
Sourcepub fn get_parameter(&self, point: &Vector3) -> Vector3
pub fn get_parameter(&self, point: &Vector3) -> Vector3
Box3.getParameter().
Sourcepub fn intersects_box(&self, box_: &Self) -> bool
pub fn intersects_box(&self, box_: &Self) -> bool
Box3.intersectsBox().
Sourcepub fn intersects_sphere(&self, sphere: &Sphere) -> bool
pub fn intersects_sphere(&self, sphere: &Sphere) -> bool
Box3.intersectsSphere().
Sourcepub fn intersects_plane(&self, plane: &Plane) -> bool
pub fn intersects_plane(&self, plane: &Plane) -> bool
Box3.intersectsPlane().
Sourcepub fn intersects_triangle(&self, triangle: &Triangle) -> bool
pub fn intersects_triangle(&self, triangle: &Triangle) -> bool
Box3.intersectsTriangle().
Sourcepub fn clamp_point(&self, point: &Vector3) -> Vector3
pub fn clamp_point(&self, point: &Vector3) -> Vector3
Box3.clampPoint().
Sourcepub fn distance_to_point(&self, point: &Vector3) -> f64
pub fn distance_to_point(&self, point: &Vector3) -> f64
Box3.distanceToPoint().
Sourcepub fn get_bounding_sphere(&self) -> Sphere
pub fn get_bounding_sphere(&self) -> Sphere
Box3.getBoundingSphere().
Sourcepub fn apply_matrix4(&mut self, matrix: &Matrix4) -> &mut Self
pub fn apply_matrix4(&mut self, matrix: &Matrix4) -> &mut Self
Box3.applyMatrix4().