[−][src]Struct axgeom::Vec2
A 2D vector.
Fields
x: N
y: N
Implementations
impl<S: Copy + Neg<Output = S> + PartialOrd + Zero> Vec2<S>
[src]
#[must_use]pub fn abs(&self) -> Vec2<S>
[src]
#[must_use]pub fn rotate_90deg_right(&self) -> Vec2<S>
[src]
#[must_use]pub fn rotate_90deg_left(&self) -> Vec2<S>
[src]
#[must_use]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]
#[must_use]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]
#[must_use]pub fn scale(&self, other: Vec2<S>) -> Vec2<S>
[src]
#[must_use]pub fn inv_scale(&self, other: Vec2<S>) -> Vec2<S>
[src]
#[must_use]pub fn magnitude2(&self) -> S
[src]
#[must_use]pub fn dot(&self, other: Vec2<S>) -> S
[src]
impl<S: FloatCore> Vec2<S>
[src]
impl<T: Copy> Vec2<T>
[src]
#[must_use]pub fn inner_as<B: 'static + Copy>(&self) -> Vec2<B> where
T: AsPrimitive<B>,
[src]
T: AsPrimitive<B>,
impl<B> Vec2<B>
[src]
#[must_use]pub fn get_axis(&self, axis: impl Axis) -> &B
[src]
Get the range of one axis.
#[must_use]pub fn get_axis_mut(&mut self, axis: impl Axis) -> &mut B
[src]
Get the mutable range of one axis.
#[must_use]pub fn inner_into<A: From<B>>(self) -> Vec2<A>
[src]
#[must_use]pub fn inner_try_into<A>(self) -> Result<Vec2<A>, B::Error> where
B: TryInto<A>,
[src]
B: TryInto<A>,
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.
fn add(self, rhs: Self) -> Self
[src]
impl<S: AddAssign<S> + Copy> AddAssign<Vec2<S>> for Vec2<S>
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl<B> AsMut<[B; 2]> for Vec2<B>
[src]
impl<B> AsRef<[B; 2]> for Vec2<B>
[src]
impl<N: FloatCore> 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<'de, N> Deserialize<'de> for Vec2<N> where
N: Deserialize<'de>,
[src]
N: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<S: Div<Output = S> + Copy> Div<S> for Vec2<S>
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: S) -> Self
[src]
impl<S: DivAssign<S> + Copy> DivAssign<S> for Vec2<S>
[src]
fn div_assign(&mut self, scalar: 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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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.
fn mul(self, rhs: S) -> Self
[src]
impl<S: MulAssign<S> + Copy> MulAssign<S> for Vec2<S>
[src]
fn mul_assign(&mut self, scalar: S)
[src]
impl<S: Neg<Output = S>> Neg for Vec2<S>
[src]
impl<N: PartialEq> PartialEq<Vec2<N>> for Vec2<N>
[src]
impl<N> Serialize for Vec2<N> where
N: Serialize,
[src]
N: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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.
fn sub(self, rhs: Self) -> Self
[src]
impl<S: SubAssign<S> + Copy> SubAssign<Vec2<S>> for Vec2<S>
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl<S: Zero + Eq + Copy> Zero for Vec2<S>
[src]
Auto Trait Implementations
impl<N> RefUnwindSafe for Vec2<N> where
N: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for Vec2<N> where
N: Send,
N: Send,
impl<N> Sync for Vec2<N> where
N: Sync,
N: Sync,
impl<N> Unpin for Vec2<N> where
N: Unpin,
N: Unpin,
impl<N> UnwindSafe for Vec2<N> where
N: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut 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.
pub 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>,