pub struct Vect {
pub x: f32,
pub y: f32,
}
Expand description
Vect is 2D vector and is used all over the place. I choose to use f32 because opengl also accepts only f32
Fields§
§x: f32
§y: f32
Implementations§
Source§impl Vect
impl Vect
pub const ZERO: Self
pub const LEFT: Self
pub const RIGHT: Self
pub const UP: Self
pub const DOWN: Self
pub const MAX: Self
pub const MIN: Self
pub fn lerp(self, o: Vect, t: f32) -> Vect
Sourcepub fn normal(&self) -> Self
pub fn normal(&self) -> Self
normal on the other hand returns normal vector to vector of same length
Trait Implementations§
Source§impl AddAssign for Vect
impl AddAssign for Vect
Source§fn add_assign(&mut self, rhs: Vect)
fn add_assign(&mut self, rhs: Vect)
Performs the
+=
operation. Read moreSource§impl DivAssign<f32> for Vect
impl DivAssign<f32> for Vect
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/=
operation. Read moreSource§impl DivAssign for Vect
impl DivAssign for Vect
Source§fn div_assign(&mut self, rhs: Vect)
fn div_assign(&mut self, rhs: Vect)
Performs the
/=
operation. Read moreSource§impl MulAssign<f32> for Vect
impl MulAssign<f32> for Vect
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*=
operation. Read moreSource§impl MulAssign for Vect
impl MulAssign for Vect
Source§fn mul_assign(&mut self, rhs: Vect)
fn mul_assign(&mut self, rhs: Vect)
Performs the
*=
operation. Read moreSource§impl SubAssign for Vect
impl SubAssign for Vect
Source§fn sub_assign(&mut self, rhs: Vect)
fn sub_assign(&mut self, rhs: Vect)
Performs the
-=
operation. Read moreimpl Copy for Vect
impl StructuralPartialEq for Vect
Auto Trait Implementations§
impl Freeze for Vect
impl RefUnwindSafe for Vect
impl Send for Vect
impl Sync for Vect
impl Unpin for Vect
impl UnwindSafe for Vect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more