Struct vek::geom::repr_simd::Aabr [−][src]
Expand description
Axis-aligned Bounding Rectangle (2D), 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: Vec2<T>
Expand description
Minimum coordinates of bounds.
max: Vec2<T>
Expand description
Maximum coordinates of bounds.
Implementations
impl<T> Aabr<T>
[src]
impl<T> Aabr<T>
[src]pub fn is_valid(&self) -> bool where
T: PartialOrd,
[src]
pub fn is_valid(&self) -> bool where
T: PartialOrd,
[src]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]
pub fn make_valid(&mut self) where
T: PartialOrd,
[src]Makes this bounding shape valid by swapping elements of self.min
with self.max
as needed.
pub fn made_valid(self) -> Self where
T: PartialOrd,
[src]
pub fn made_valid(self) -> Self where
T: PartialOrd,
[src]Returns this bounding shape made valid by swapping elements of self.min
with self.max
as needed.
pub fn new_empty(p: Vec2<T>) -> Self where
T: Copy,
[src]
pub fn new_empty(p: Vec2<T>) -> Self where
T: Copy,
[src]Creates a new bounding shape from a single point.
pub fn into_rect(self) -> Rect<T, T> where
T: Copy + Sub<T, Output = T>,
[src]
pub fn into_rect(self) -> Rect<T, T> where
T: Copy + Sub<T, Output = T>,
[src]Converts this bounding shape to the matching rectangle representation.
pub fn center(self) -> Vec2<T> where
T: Copy + One + Add<T, Output = T> + Div<T, Output = T>,
[src]
pub fn center(self) -> Vec2<T> where
T: Copy + One + Add<T, Output = T> + Div<T, Output = T>,
[src]Gets this bounding shape’s center.
pub fn size(self) -> Extent2<T> where
T: Copy + Sub<T, Output = T>,
[src]
pub fn size(self) -> Extent2<T> where
T: Copy + Sub<T, Output = T>,
[src]Gets this bounding shape’s total size.
pub fn half_size(self) -> Extent2<T> where
T: Copy + Sub<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T>,
[src]
pub fn half_size(self) -> Extent2<T> where
T: Copy + Sub<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T>,
[src]Gets this bounding shape’s half size.
pub fn union(self, other: Self) -> Self where
T: PartialOrd,
[src]
pub fn union(self, other: Self) -> Self where
T: PartialOrd,
[src]Gets the smallest bounding shape that contains both this one and another.
pub fn intersection(self, other: Self) -> Self where
T: PartialOrd,
[src]
pub fn intersection(self, other: Self) -> Self where
T: PartialOrd,
[src]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]
pub fn expand_to_contain(&mut self, other: Self) where
T: Copy + PartialOrd,
[src]Sets this bounding shape to the union of itself with another.
pub fn intersect(&mut self, other: Self) where
T: Copy + PartialOrd,
[src]
pub fn intersect(&mut self, other: Self) where
T: Copy + PartialOrd,
[src]Sets this bounding shape to the intersection of itself with another.
pub fn expanded_to_contain_point(self, p: Vec2<T>) -> Self where
T: Copy + PartialOrd,
[src]
pub fn expanded_to_contain_point(self, p: Vec2<T>) -> Self where
T: Copy + PartialOrd,
[src]Gets a copy of this shape so that it contains the given point.
pub fn expand_to_contain_point(&mut self, p: Vec2<T>) where
T: Copy + PartialOrd,
[src]
pub fn expand_to_contain_point(&mut self, p: Vec2<T>) where
T: Copy + PartialOrd,
[src]Expands this shape so that it contains the given point.
pub fn contains_point(self, p: Vec2<T>) -> bool where
T: PartialOrd,
[src]
pub fn contains_point(self, p: Vec2<T>) -> bool where
T: PartialOrd,
[src]Does this bounding shape contain the given point ?
pub fn contains_aabr(self, other: Self) -> bool where
T: PartialOrd,
[src]
pub fn contains_aabr(self, other: Self) -> bool where
T: PartialOrd,
[src]Does this bounding shape fully contain another ?
pub fn collides_with_aabr(self, other: Self) -> bool where
T: PartialOrd,
[src]
pub fn collides_with_aabr(self, other: Self) -> bool where
T: PartialOrd,
[src]Does this bounding shape collide with another ?
pub fn collision_vector_with_aabr(self, other: Self) -> Vec2<T> where
T: Copy + PartialOrd + Sub<T, Output = T> + One + Add<T, Output = T> + Div<T, Output = T>,
[src]
pub fn collision_vector_with_aabr(self, other: Self) -> Vec2<T> where
T: Copy + PartialOrd + Sub<T, Output = T> + One + Add<T, Output = T> + Div<T, Output = T>,
[src]Gets a vector that tells how much self
penetrates other
.
pub fn projected_point(self, p: Vec2<T>) -> Vec2<T> where
T: Clamp,
[src]
pub fn projected_point(self, p: Vec2<T>) -> Vec2<T> where
T: Clamp,
[src]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: Vec2<T>) -> T where
T: Clamp + Real + Add<T, Output = T> + RelativeEq,
[src]
pub fn distance_to_point(self, p: Vec2<T>) -> T where
T: Clamp + Real + Add<T, Output = T> + RelativeEq,
[src]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]
pub fn split_at_x(self, sp: T) -> [Self; 2] where
T: Copy + PartialOrd,
[src]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]
pub fn split_at_y(self, sp: T) -> [Self; 2] where
T: Copy + PartialOrd,
[src]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 map<D, F>(self, f: F) -> Aabr<D> where
F: FnMut(T) -> D,
[src]
pub fn map<D, F>(self, f: F) -> Aabr<D> where
F: FnMut(T) -> D,
[src]Returns this bounding shape, converted element-wise using the given closure.
pub fn as_<D>(self) -> Aabr<D> where
T: AsPrimitive<D>,
D: 'static + Copy,
[src]
pub fn as_<D>(self) -> Aabr<D> where
T: AsPrimitive<D>,
D: 'static + Copy,
[src]Converts this rectangle to a rectangle of another type, using the as
conversion.
Trait Implementations
impl<'de, T> Deserialize<'de> for Aabr<T> where
T: Deserialize<'de>,
[src]
impl<'de, T> Deserialize<'de> for Aabr<T> where
T: Deserialize<'de>,
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl<T: Copy> Copy for Aabr<T>
[src]
impl<T: Eq> Eq for Aabr<T>
[src]
impl<T> StructuralEq for Aabr<T>
[src]
impl<T> StructuralPartialEq for Aabr<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Aabr<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Aabr<T> where
T: Send,
T: Send,
impl<T> Sync for Aabr<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Aabr<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Aabr<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,