Struct heron::rapier_plugin::rapier3d::parry::bounding_volume::AABB
source · Expand description
An Axis Aligned Bounding Box.
Fields
mins: OPoint<f32, Const<3>>
maxs: OPoint<f32, Const<3>>
Implementations
sourceimpl AABB
impl AABB
sourcepub const EDGES_VERTEX_IDS: [(usize, usize); 12] = [(0, 1), (1, 2), (3, 2), (0, 3), (4, 5), (5, 6), (7, 6), (4, 7), (0, 4),
(1, 5), (2, 6), (3, 7)]
pub const EDGES_VERTEX_IDS: [(usize, usize); 12] = [(0, 1), (1, 2), (3, 2), (0, 3), (4, 5), (5, 6), (7, 6), (4, 7), (0, 4), (1, 5), (2, 6), (3, 7)]
The vertex indices of each edge of this AABB.
This gives, for each edge of this AABB, the indices of its
vertices when taken from the self.vertices()
array.
Here is how the faces are numbered, assuming
a right-handed coordinate system:
y 3 - 2 | 7 − 6 | ___ x | | 1 (the zero is bellow 3 and on the left of 1, hidden by the 4-5-6-7 face.) / 4 - 5 z
sourcepub const FACES_VERTEX_IDS: [(usize, usize, usize, usize); 6] = [(1, 2, 6, 5), (0, 3, 7, 4), (2, 3, 7, 6), (1, 0, 4, 5), (4, 5, 6, 7),
(0, 1, 2, 3)]
pub const FACES_VERTEX_IDS: [(usize, usize, usize, usize); 6] = [(1, 2, 6, 5), (0, 3, 7, 4), (2, 3, 7, 6), (1, 0, 4, 5), (4, 5, 6, 7), (0, 1, 2, 3)]
The vertex indices of each face of this AABB.
This gives, for each face of this AABB, the indices of its
vertices when taken from the self.vertices()
array.
Here is how the faces are numbered, assuming
a right-handed coordinate system:
y 3 - 2 | 7 − 6 | ___ x | | 1 (the zero is bellow 3 and on the left of 1, hidden by the 4-5-6-7 face.) / 4 - 5 z
sourcepub fn new(mins: OPoint<f32, Const<3>>, maxs: OPoint<f32, Const<3>>) -> AABB
pub fn new(mins: OPoint<f32, Const<3>>, maxs: OPoint<f32, Const<3>>) -> AABB
Creates a new AABB.
Arguments:
mins
- position of the point with the smallest coordinates.maxs
- position of the point with the highest coordinates. Each component ofmins
must be smaller than the related components ofmaxs
.
sourcepub fn new_invalid() -> AABB
pub fn new_invalid() -> AABB
Creates an invalid AABB with mins
components set to Real::max_values
and maxs
components set to -Real::max_values
.
This is often used as the initial values of some AABB merging algorithms.
sourcepub fn from_half_extents(
center: OPoint<f32, Const<3>>,
half_extents: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> AABB
pub fn from_half_extents(
center: OPoint<f32, Const<3>>,
half_extents: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> AABB
Creates a new AABB from its center and its half-extents.
sourcepub fn from_points<'a, I>(pts: I) -> AABBwhere
I: IntoIterator<Item = &'a OPoint<f32, Const<3>>>,
pub fn from_points<'a, I>(pts: I) -> AABBwhere
I: IntoIterator<Item = &'a OPoint<f32, Const<3>>>,
Creates a new AABB from a set of points.
sourcepub fn half_extents(
&self
) -> Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
pub fn half_extents(
&self
) -> Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
The half extents of this AABB.
sourcepub fn extents(
&self
) -> Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
pub fn extents(
&self
) -> Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
The extents of this AABB.
sourcepub fn take_point(&mut self, pt: OPoint<f32, Const<3>>)
pub fn take_point(&mut self, pt: OPoint<f32, Const<3>>)
Enlarges this AABB so it also contains the point pt
.
sourcepub fn transform_by(&self, m: &Isometry<f32, Unit<Quaternion<f32>>, 3>) -> AABB
pub fn transform_by(&self, m: &Isometry<f32, Unit<Quaternion<f32>>, 3>) -> AABB
Computes the AABB bounding self
transformed by m
.
pub fn scaled(
self,
scale: &Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> AABB
sourcepub fn bounding_sphere(&self) -> BoundingSphere
pub fn bounding_sphere(&self) -> BoundingSphere
The smallest bounding sphere containing this AABB.
pub fn contains_local_point(&self, point: &OPoint<f32, Const<3>>) -> bool
sourcepub fn intersection(&self, other: &AABB) -> Option<AABB>
pub fn intersection(&self, other: &AABB) -> Option<AABB>
Computes the intersection of this AABB and another one.
sourcepub fn difference(&self, rhs: &AABB) -> ArrayVec<AABB, _>
pub fn difference(&self, rhs: &AABB) -> ArrayVec<AABB, _>
Returns the difference between this AABB and rhs
.
Removing another AABB from self
will result in zero, one, or up to 4 (in 2D) or 8 (in 3D)
new smaller AABBs.
sourcepub fn difference_with_cut_sequence(
&self,
rhs: &AABB
) -> (ArrayVec<AABB, _>, ArrayVec<(i8, f32), _>)
pub fn difference_with_cut_sequence(
&self,
rhs: &AABB
) -> (ArrayVec<AABB, _>, ArrayVec<(i8, f32), _>)
Returns the difference between this AABB and rhs
.
Removing another AABB from self
will result in zero, one, or up to 4 (in 2D) or 8 (in 3D)
new smaller AABBs.
Return
This returns a pair where the first item are the new AABBs and the the second item is
the sequance of cuts applied to self
to obtain the new AABBs. Each cut is performed
along one axis identified by -1, -2, -3
for -X, -Y, -Z
and 1, 2, 3
for +X, +Y, +Z
, and
the plane’s bias.
The cuts are applied sequancially. For example, if result.1[0]
contains 1
, then it means
that result.0[0]
is equal to the piece of self
lying in the negative half-space delimited
by the plane with outward normal +X
. Then, the other piece of self
generated by this cut
(i.e. the piece of self
lying in the positive half-space delimited by the plane with outward
normal +X
) is the one that will be affected by the next cut.
The returned cut sequence will be empty if the aabbs are disjoint.
sourcepub fn split_at_center(&self) -> [AABB; 8]
pub fn split_at_center(&self) -> [AABB; 8]
Splits this AABB at its center, into height parts (as in an octree).
sourcepub fn project_on_axis(
&self,
axis: &Unit<Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>>
) -> (f32, f32)
pub fn project_on_axis(
&self,
axis: &Unit<Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>>
) -> (f32, f32)
Projects every point of AABB on an arbitrary axis.
pub fn intersects_spiral(
&self,
point: &OPoint<f32, Const<3>>,
center: &OPoint<f32, Const<3>>,
axis: &Unit<Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>>,
linvel: &Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>,
angvel: f32
) -> bool
sourceimpl AABB
impl AABB
sourcepub fn clip_segment(
&self,
pa: &OPoint<f32, Const<3>>,
pb: &OPoint<f32, Const<3>>
) -> Option<Segment>
pub fn clip_segment(
&self,
pa: &OPoint<f32, Const<3>>,
pb: &OPoint<f32, Const<3>>
) -> Option<Segment>
Computes the intersection of a segment with this AABB.
Returns None
if there is no intersection.
sourcepub fn clip_line_parameters(
&self,
orig: &OPoint<f32, Const<3>>,
dir: &Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> Option<(f32, f32)>
pub fn clip_line_parameters(
&self,
orig: &OPoint<f32, Const<3>>,
dir: &Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> Option<(f32, f32)>
Computes the parameters of the two intersection points between a line and this AABB.
The parameters are such that the point are given by orig + dir * parameter
.
Returns None
if there is no intersection.
sourcepub fn clip_line(
&self,
orig: &OPoint<f32, Const<3>>,
dir: &Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> Option<Segment>
pub fn clip_line(
&self,
orig: &OPoint<f32, Const<3>>,
dir: &Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> Option<Segment>
Computes the intersection segment between a line and this AABB.
Returns None
if there is no intersection.
sourceimpl AABB
impl AABB
sourcepub fn clip_polygon(&self, points: &mut Vec<OPoint<f32, Const<3>>, Global>)
pub fn clip_polygon(&self, points: &mut Vec<OPoint<f32, Const<3>>, Global>)
Computes the intersections between this AABB and the given polygon.
The results is written into points
directly. The input points are
assumed to form a convex polygon where all points lie on the same plane.
In order to avoid internal allocations, uses self.clip_polygon_with_workspace
instead.
sourcepub fn clip_polygon_with_workspace(
&self,
points: &mut Vec<OPoint<f32, Const<3>>, Global>,
workspace: &mut Vec<OPoint<f32, Const<3>>, Global>
)
pub fn clip_polygon_with_workspace(
&self,
points: &mut Vec<OPoint<f32, Const<3>>, Global>,
workspace: &mut Vec<OPoint<f32, Const<3>>, Global>
)
Computes the intersections between this AABB and the given polygon.
The results is written into points
directly. The input points are
assumed to form a convex polygon where all points lie on the same plane.
sourceimpl AABB
impl AABB
sourcepub fn canonical_split(
&self,
axis: usize,
bias: f32,
epsilon: f32
) -> SplitResult<AABB>
pub fn canonical_split(
&self,
axis: usize,
bias: f32,
epsilon: f32
) -> SplitResult<AABB>
Splits this AABB along the given canonical axis.
This will split the AABB by a plane with a normal with it’s axis
-th component set to 1.
The splitting plane is shifted wrt. the origin by the bias
(i.e. it passes through the point
equal to normal * bias
).
Result
Returns the result of the split. The first AABB returned is the piece lying on the negative half-space delimited by the splitting plane. The second AABB returned is the piece lying on the positive half-space delimited by the splitting plane.
Trait Implementations
sourceimpl BoundingVolume for AABB
impl BoundingVolume for AABB
sourcefn center(&self) -> OPoint<f32, Const<3>>
fn center(&self) -> OPoint<f32, Const<3>>
sourcefn intersects(&self, other: &AABB) -> bool
fn intersects(&self, other: &AABB) -> bool
sourcefn merge(&mut self, other: &AABB)
fn merge(&mut self, other: &AABB)
sourceimpl PointQuery for AABB
impl PointQuery for AABB
sourcefn project_local_point(
&self,
pt: &OPoint<f32, Const<3>>,
solid: bool
) -> PointProjection
fn project_local_point(
&self,
pt: &OPoint<f32, Const<3>>,
solid: bool
) -> PointProjection
self
. Read moresourcefn project_local_point_and_get_feature(
&self,
pt: &OPoint<f32, Const<3>>
) -> (PointProjection, FeatureId)
fn project_local_point_and_get_feature(
&self,
pt: &OPoint<f32, Const<3>>
) -> (PointProjection, FeatureId)
self
and returns the id of the
feature the point was projected on. Read moresourcefn distance_to_local_point(&self, pt: &OPoint<f32, Const<3>>, solid: bool) -> f32
fn distance_to_local_point(&self, pt: &OPoint<f32, Const<3>>, solid: bool) -> f32
self
.sourcefn project_local_point_with_max_dist(
&self,
pt: &OPoint<f32, Const<3>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
fn project_local_point_with_max_dist(
&self,
pt: &OPoint<f32, Const<3>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
self
, unless the projection lies further than the given max distance. Read moresourcefn project_point_with_max_dist(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
fn project_point_with_max_dist(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>,
solid: bool,
max_dist: f32
) -> Option<PointProjection>
self
transformed by m
, unless the projection lies further than the given max distance.sourcefn contains_local_point(&self, pt: &OPoint<f32, Const<3>>) -> bool
fn contains_local_point(&self, pt: &OPoint<f32, Const<3>>) -> bool
self
.sourcefn project_point(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>,
solid: bool
) -> PointProjection
fn project_point(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>,
solid: bool
) -> PointProjection
self
transformed by m
.sourcefn distance_to_point(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>,
solid: bool
) -> f32
fn distance_to_point(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>,
solid: bool
) -> f32
self
transformed by m
.sourcefn project_point_and_get_feature(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>
) -> (PointProjection, FeatureId)
fn project_point_and_get_feature(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
pt: &OPoint<f32, Const<3>>
) -> (PointProjection, FeatureId)
self
transformed by m
and returns the id of the
feature the point was projected on. Read moresourceimpl RayCast for AABB
impl RayCast for AABB
sourcefn cast_local_ray(&self, ray: &Ray, max_toi: f32, solid: bool) -> Option<f32>
fn cast_local_ray(&self, ray: &Ray, max_toi: f32, solid: bool) -> Option<f32>
sourcefn cast_local_ray_and_get_normal(
&self,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<RayIntersection>
fn cast_local_ray_and_get_normal(
&self,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<RayIntersection>
sourcefn intersects_local_ray(&self, ray: &Ray, max_toi: f32) -> bool
fn intersects_local_ray(&self, ray: &Ray, max_toi: f32) -> bool
sourcefn cast_ray(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<f32>
fn cast_ray(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<f32>
sourcefn cast_ray_and_get_normal(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<RayIntersection>
fn cast_ray_and_get_normal(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
ray: &Ray,
max_toi: f32,
solid: bool
) -> Option<RayIntersection>
sourcefn intersects_ray(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
ray: &Ray,
max_toi: f32
) -> bool
fn intersects_ray(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>,
ray: &Ray,
max_toi: f32
) -> bool
impl Copy for AABB
impl StructuralPartialEq for AABB
Auto Trait Implementations
impl RefUnwindSafe for AABB
impl Send for AABB
impl Sync for AABB
impl Unpin for AABB
impl UnwindSafe for AABB
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read morefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read moresourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.