Struct vek::geom::repr_c::Aabr
[−]
[src]
pub struct Aabr<T> { pub min: Vec2<T>, pub max: Vec2<T>, }
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>
Minimum coordinates of bounds.
max: Vec2<T>
Maximum coordinates of bounds.
Methods
impl<T> Aabr<T>
[src]
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
.
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.
fn made_valid(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.
fn new_empty(p: Vec2<T>) -> Self where
T: Copy,
[src]
T: Copy,
Creates a new bounding shape from a single point.
fn into_rect(self) -> Rect<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.
fn center(self) -> Vec2<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.
fn size(self) -> Extent2<T> where
T: Copy + Sub<T, Output = T>,
[src]
T: Copy + Sub<T, Output = T>,
Gets this bounding shape's total size.
fn half_size(self) -> Extent2<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.
fn union(self, other: Self) -> Self where
T: PartialOrd,
[src]
T: PartialOrd,
Gets the smallest bounding shape that contains both this one and another.
fn intersection(self, other: Self) -> Self where
T: PartialOrd,
[src]
T: PartialOrd,
Gets the largest bounding shape contained by both this one and another.
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.
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.
fn expanded_to_contain_point(self, p: Vec2<T>) -> Self where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Gets a copy of this shape so that it contains the given point.
fn expand_to_contain_point(&mut self, p: Vec2<T>) where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Expands this shape so that it contains the given point.
fn contains_point(self, p: Vec2<T>) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this bounding shape contain the given point ?
fn contains_aabr(self, other: Self) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this bounding shape fully contain another ?
fn collides_with_aabr(self, other: Self) -> bool where
T: PartialOrd,
[src]
T: PartialOrd,
Does this bounding shape collide with another ?
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]
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
.
fn split_at_x(self, sp: T) -> (Self, Self) where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Splits this shape in two, by a straight plane along the
axis.
The returned tuple is (low, high)
.
Panics
sp
is assumed to be a position along the
axis that is within this shape's bounds.
fn split_at_y(self, sp: T) -> (Self, Self) where
T: Copy + PartialOrd,
[src]
T: Copy + PartialOrd,
Splits this shape in two, by a straight plane along the
axis.
The returned tuple is (low, high)
.
Panics
sp
is assumed to be a position along the
axis that is within this shape's bounds.
fn map<D, F>(self, f: F) -> Aabr<D> where
F: FnMut(T) -> D,
[src]
F: FnMut(T) -> D,
Returns this bounding shape, converted element-wise using the given closure.
Trait Implementations
impl<T> From<Rect<T, T>> for Aabr<T> where
T: Copy + Add<T, Output = T>,
[src]
T: Copy + Add<T, Output = T>,
impl<T: Debug> Debug for Aabr<T>
[src]
impl<T: Default> Default for Aabr<T>
[src]
impl<T: Clone> Clone for Aabr<T>
[src]
fn clone(&self) -> Aabr<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Copy> Copy for Aabr<T>
[src]
impl<T: Hash> Hash for Aabr<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more