[−][src]Struct block_breaker::Vector
A 2D vector
Methods
impl Vector
[src]
pub fn new(x: f64, y: f64) -> Vector
[src]
Create a new vector
pub fn x(&self) -> f64
[src]
Get the x value
pub fn y(&self) -> f64
[src]
Get the y value
pub fn dot(&self, other: &Vector) -> f64
[src]
Perform the inner product with another vector
pub fn negate(&mut self)
[src]
Negate the vector, negating each of the components
pub fn magnitude(&self) -> f64
[src]
Get the length (magnitude) of the vector
pub fn normalise(&mut self)
[src]
Normalise the vector
Trait Implementations
impl PartialEq<Vector> for Vector
[src]
impl<'a, 'b> Add<&'b Vector> for &'a Position
[src]
type Output = Position
The resulting type after applying the +
operator.
fn add(self, other: &'b Vector) -> Position
[src]
impl Add<Vector> for Vector
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[src]
impl<'a, 'b> Add<&'b Vector> for &'a Vector
[src]
type Output = Vector
The resulting type after applying the +
operator.
fn add(self, other: &'b Vector) -> Vector
[src]
impl<'a, 'b> Add<&'b Position> for &'a Vector
[src]
type Output = Position
The resulting type after applying the +
operator.
fn add(self, other: &'b Position) -> Position
[src]
impl Sub<Vector> for Vector
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self
[src]
impl Mul<f64> for Vector
[src]
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, scalar: f64) -> Vector
[src]
impl Mul<Vector> for f64
[src]
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, vector: Vector) -> Vector
[src]
impl AddAssign<Vector> for Vector
[src]
fn add_assign(&mut self, other: Self)
[src]
impl<'a> AddAssign<&'a Vector> for Vector
[src]
fn add_assign(&mut self, other: &Self)
[src]
impl SubAssign<Vector> for Vector
[src]
fn sub_assign(&mut self, other: Self)
[src]
impl Debug for Vector
[src]
Auto Trait Implementations
impl Sync for Vector
impl Send for Vector
impl Unpin for Vector
impl RefUnwindSafe for Vector
impl UnwindSafe for Vector
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,