[][src]Struct axgeom::Vec2

#[must_use]
pub struct Vec2<N> {
    pub x: N,
    pub y: N,
}

A 2D vector.

Fields

x: Ny: N

Methods

impl<S: Copy + Neg<Output = S> + PartialOrd + Zero> Vec2<S>[src]

pub fn abs(&self) -> Vec2<S>[src]

pub fn rotate_90deg_right(&self) -> Vec2<S>[src]

pub fn rotate_90deg_left(&self) -> Vec2<S>[src]

pub fn split_into_components(&self) -> [Vec2<S>; 2][src]

impl<S: Add<Output = S> + Sub<Output = S> + PartialOrd + Copy> Vec2<S>[src]

pub fn manhattan_dis(&self, other: Vec2<S>) -> S[src]

impl<T: Copy + PartialOrd + Sub<Output = T> + Mul<Output = T> + Add<Output = T>> Vec2<T>[src]

pub fn distance_squared_to_point(&self, point: Vec2<T>) -> T[src]

If the point is outisde the rectangle, returns the squared distance from a point to a rectangle. If the point is inside the rectangle, it will return None.

impl<S: Mul<Output = S> + Div<Output = S> + Add<Output = S> + Copy> Vec2<S>[src]

pub fn scale(&self, other: Vec2<S>) -> Vec2<S>[src]

pub fn inv_scale(&self, other: Vec2<S>) -> Vec2<S>[src]

pub fn magnitude2(&self) -> S[src]

pub fn dot(&self, other: Vec2<S>) -> S[src]

impl<S: Float> Vec2<S>[src]

pub fn truncate_at(&self, mag: S) -> Vec2<S>[src]

pub fn normalize_to(&self, mag: S) -> Vec2<S>[src]

pub fn magnitude(&self) -> S[src]

impl<B: Copy> Vec2<B>[src]

pub fn inner_as<A: PrimitiveFrom<B>>(&self) -> Vec2<A>[src]

impl<B> Vec2<B>[src]

pub fn get_axis(&self, axis: impl Axis) -> &B[src]

Get the range of one axis.

pub fn get_axis_mut(&mut self, axis: impl Axis) -> &mut B[src]

Get the mutable range of one axis.

pub fn inner_into<A: From<B>>(self) -> Vec2<A>[src]

pub fn inner_try_into<A: TryFrom<B>>(self) -> Result<Vec2<A>, A::Error>[src]

Trait Implementations

impl<S: Add<Output = S> + Copy> Add<Vec2<S>> for Vec2<S>[src]

type Output = Self

The resulting type after applying the + operator.

impl<S: AddAssign<S> + Copy> AddAssign<Vec2<S>> for Vec2<S>[src]

impl<B> AsMut<[B; 2]> for Vec2<B>[src]

impl<B> AsRef<[B; 2]> for Vec2<B>[src]

impl<N: Float> AsRef<Vec2<N>> for Vec2<NotNan<N>>[src]

impl<N: Clone> Clone for Vec2<N>[src]

impl<N: Copy> Copy for Vec2<N>[src]

impl<N: Debug> Debug for Vec2<N>[src]

impl<S: Div<Output = S> + Copy> Div<S> for Vec2<S>[src]

type Output = Self

The resulting type after applying the / operator.

impl<S: DivAssign<S> + Copy> DivAssign<S> for Vec2<S>[src]

impl<N: Eq> Eq for Vec2<N>[src]

impl<'a, B> From<&'a [B; 2]> for &'a Vec2<B>[src]

impl<'a, B> From<&'a mut [B; 2]> for &'a mut Vec2<B>[src]

impl<B> From<[B; 2]> for Vec2<B>[src]

impl<N: Hash> Hash for Vec2<N>[src]

impl<B> Into<[B; 2]> for Vec2<B>[src]

impl<S: Mul<Output = S> + Copy> Mul<S> for Vec2<S>[src]

type Output = Self

The resulting type after applying the * operator.

impl<S: MulAssign<S> + Copy> MulAssign<S> for Vec2<S>[src]

impl<S: Neg<Output = S>> Neg for Vec2<S>[src]

type Output = Vec2<S>

The resulting type after applying the - operator.

impl<N: PartialEq> PartialEq<Vec2<N>> for Vec2<N>[src]

impl<N> StructuralEq for Vec2<N>[src]

impl<N> StructuralPartialEq for Vec2<N>[src]

impl<S: Sub<Output = S> + Copy> Sub<Vec2<S>> for Vec2<S>[src]

type Output = Self

The resulting type after applying the - operator.

impl<S: SubAssign<S> + Copy> SubAssign<Vec2<S>> for Vec2<S>[src]

impl<S: Zero + Eq + Copy> Zero for Vec2<S>[src]

Auto Trait Implementations

impl<N> RefUnwindSafe for Vec2<N> where
    N: RefUnwindSafe

impl<N> Send for Vec2<N> where
    N: Send

impl<N> Sync for Vec2<N> where
    N: Sync

impl<N> Unpin for Vec2<N> where
    N: Unpin

impl<N> UnwindSafe for Vec2<N> where
    N: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.