Struct vek::geom::repr_c::Aabb [−][src]
Axis-aligned Bounding Box (3D), represented by min
and max
points.
N.B: You are responsible for ensuring that all respective elements of
min
are indeed less than or equal to those of max
.
The is_valid()
, make_valid()
and made_valid()
methods are designed to help you
with this.
Fields
min: Vec3<T>
Minimum coordinates of bounds.
max: Vec3<T>
Maximum coordinates of bounds.
Implementations
impl<T> Aabb<T>
[src]
pub fn is_valid(&self) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Is this bounding shape valid ?
True only if all elements of self.min
are less than or equal to those of self.max
.
pub fn make_valid(&mut self) where
T: PartialOrd,
[src]
T: PartialOrd,
Makes this bounding shape valid by swapping elements of self.min
with self.max
as needed.
pub fn made_valid(mut self: Self) -> Self where
T: PartialOrd,
[src]
T: PartialOrd,
Returns this bounding shape made valid by swapping elements of self.min
with self.max
as needed.
pub fn new_empty(p: Vec3<T>) -> Self where
T: Copy,
[src]
T: Copy,
Creates a new bounding shape from a single point.
pub fn into_rect3(self) -> Rect3<T, T> where
T: Copy + Sub<T, Output = T>,
[src]
T: Copy + Sub<T, Output = T>,
Converts this bounding shape to the matching rectangle representation.
pub fn center(self) -> Vec3<T> where
T: Copy + One + Add<T, Output = T> + Div<T, Output = T>,
[src]
T: Copy + One + Add<T, Output = T> + Div<T, Output = T>,
Gets this bounding shape's center.
pub fn size(self) -> Extent3<T> where
T: Copy + Sub<T, Output = T>,
[src]
T: Copy + Sub<T, Output = T>,
Gets this bounding shape's total size.
pub fn half_size(self) -> Extent3<T> where
T: Copy + Sub<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T>,
[src]
T: Copy + Sub<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T>,
Gets this bounding shape's half size.
pub fn union(self, other: Self) -> Self where
T: PartialOrd,
[src]
T: PartialOrd,
Gets the smallest bounding shape that contains both this one and another.
pub fn intersection(self, other: Self) -> Self where
T: PartialOrd,
[src]
T: PartialOrd,
Gets the largest bounding shape contained by both this one and another.
pub fn expand_to_contain(&mut self, other: Self) where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Sets this bounding shape to the union of itself with another.
pub fn intersect(&mut self, other: Self) where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Sets this bounding shape to the intersection of itself with another.
pub fn expanded_to_contain_point(self, p: Vec3<T>) -> Self where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Gets a copy of this shape so that it contains the given point.
pub fn expand_to_contain_point(&mut self, p: Vec3<T>) where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Expands this shape so that it contains the given point.
pub fn contains_point(self, p: Vec3<T>) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this bounding shape contain the given point ?
pub fn contains_aabb(self, other: Self) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this bounding shape fully contain another ?
pub fn collides_with_aabb(self, other: Self) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this bounding shape collide with another ?
pub fn collision_vector_with_aabb(self, other: Self) -> Vec3<T> where
T: Copy + PartialOrd + Sub<T, Output = T> + One + Add<T, Output = T> + Div<T, Output = T>,
[src]
T: Copy + PartialOrd + Sub<T, Output = T> + One + Add<T, Output = T> + Div<T, Output = T>,
Gets a vector that tells how much self
penetrates other
.
pub fn projected_point(self, p: Vec3<T>) -> Vec3<T> where
T: Clamp,
[src]
T: Clamp,
Project the given point into the bounding shape (equivalent to 'snapping' the point to the closest point in the bounding shape).
pub fn distance_to_point(self, p: Vec3<T>) -> T where
T: Clamp + Real + Add<T, Output = T> + RelativeEq,
[src]
T: Clamp + Real + Add<T, Output = T> + RelativeEq,
Get the smallest distance between the bounding shape and a point.
pub fn split_at_x(self, sp: T) -> [Self; 2] where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Splits this shape in two, by a straight plane along the
x
axis.
The returned tuple is (low, high)
.
Panics
sp
is assumed to be a position along the
x
axis that is within this shape's bounds.
pub fn split_at_y(self, sp: T) -> [Self; 2] where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Splits this shape in two, by a straight plane along the
y
axis.
The returned tuple is (low, high)
.
Panics
sp
is assumed to be a position along the
y
axis that is within this shape's bounds.
pub fn split_at_z(self, sp: T) -> [Self; 2] where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Splits this shape in two, by a straight plane along the
z
axis.
The returned tuple is (low, high)
.
Panics
sp
is assumed to be a position along the
z
axis that is within this shape's bounds.
pub fn map<D, F>(self, mut f: F) -> Aabb<D> where
F: FnMut(T) -> D,
[src]
F: FnMut(T) -> D,
Returns this bounding shape, converted element-wise using the given closure.
pub fn as_<D>(self) -> Aabb<D> where
T: AsPrimitive<D>,
D: 'static + Copy,
[src]
T: AsPrimitive<D>,
D: 'static + Copy,
Converts this rectangle to a rectangle of another type, using the as
conversion.
Trait Implementations
impl<T: Clone> Clone for Aabb<T>
[src]
impl<T: Copy> Copy for Aabb<T>
[src]
impl<T: Debug> Debug for Aabb<T>
[src]
impl<T: Default> Default for Aabb<T>
[src]
impl<'de, T> Deserialize<'de> for Aabb<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: Eq> Eq for Aabb<T>
[src]
impl<T> From<Aabb<T>> for Aabr<T>
[src]
impl<T> From<Aabb<T>> for Rect3<T, T> where
T: Copy + Sub<T, Output = T>,
[src]
T: Copy + Sub<T, Output = T>,
impl<T> From<Rect3<T, T>> for Aabb<T> where
T: Copy + Add<T, Output = T>,
[src]
T: Copy + Add<T, Output = T>,
impl<T: Hash> Hash for Aabb<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: PartialEq> PartialEq<Aabb<T>> for Aabb<T>
[src]
impl<T> Serialize for Aabb<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<T> StructuralEq for Aabb<T>
[src]
impl<T> StructuralPartialEq for Aabb<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Aabb<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Aabb<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Aabb<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Aabb<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Aabb<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,