[−][src]Struct rgx::math::algebra::Vector2
2D vector.
Fields
x: S
y: S
Methods
impl<S: Sized> Vector2<S>
[src]
pub const fn new(x: S, y: S) -> Self
[src]
pub fn normalize(self) -> Self where
S: One + Float + Div + Mul,
[src]
S: One + Float + Div + Mul,
Returns a vector with the same direction and a given magnitude.
pub fn magnitude(self) -> S where
S: Float,
[src]
S: Float,
The distance from the tail to the tip of the vector.
pub fn dot(a: Self, b: Self) -> <S as Add>::Output where
S: Mul<Output = S> + Add,
[src]
S: Mul<Output = S> + Add,
Dot product of two vectors.
use rgx::math::*; let v1 = Vector4::new(1, 3, -5, 4); let v2 = Vector4::new(4, -2, -1, 3); assert_eq!(v1 * v2, 15);
pub fn distance(self, other: Self) -> S where
S: Float,
[src]
S: Float,
Distance between two vectors.
pub fn extend(self, z: S) -> Vector3<S>
[src]
Extend vector to three dimensions.
pub fn map<F, T>(self, f: F) -> Vector2<T> where
F: FnMut(S) -> T,
[src]
F: FnMut(S) -> T,
Trait Implementations
impl<S> Add<Vector2<S>> for Vector2<S> where
S: Add<Output = S> + Copy,
[src]
S: Add<Output = S> + Copy,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Vector2<S>) -> Self
[src]
impl<S> Add<Vector2<S>> for Point2<S> where
S: Add<Output = S> + Copy,
[src]
S: Add<Output = S> + Copy,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Vector2<S>) -> Self
[src]
impl<T> Add<Vector2<T>> for Rect<T> where
T: Add<Output = T> + Copy,
[src]
T: Add<Output = T> + Copy,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, vec: Vector2<T>) -> Self
[src]
impl Add<Vector2<f32>> for Line
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, vec: Vector2<f32>) -> Self
[src]
impl<T> AddAssign<Vector2<T>> for Rect<T> where
T: AddAssign<T> + Copy,
[src]
T: AddAssign<T> + Copy,
fn add_assign(&mut self, vec: Vector2<T>)
[src]
impl<S: Clone> Clone for Vector2<S>
[src]
impl<S: Copy> Copy for Vector2<S>
[src]
impl<S: Debug> Debug for Vector2<S>
[src]
impl<S: Eq> Eq for Vector2<S>
[src]
impl<T: Copy> From<[T; 2]> for Vector2<T>
[src]
impl<S> From<Point2<S>> for Vector2<S>
[src]
impl<S> From<Vector2<S>> for Point2<S>
[src]
impl<S: Hash> Hash for Vector2<S>
[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<S> Mul<S> for Vector2<S> where
S: Mul<Output = S> + Copy,
[src]
S: Mul<Output = S> + Copy,
impl<S: PartialEq> PartialEq<Vector2<S>> for Vector2<S>
[src]
impl<S> StructuralEq for Vector2<S>
[src]
impl<S> StructuralPartialEq for Vector2<S>
[src]
impl<S> Sub<Vector2<S>> for Vector2<S> where
S: Sub<Output = S> + Copy,
[src]
S: Sub<Output = S> + Copy,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Vector2<S>) -> Self
[src]
impl<S> Sub<Vector2<S>> for Point2<S> where
S: Sub<Output = S> + Copy,
[src]
S: Sub<Output = S> + Copy,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Vector2<S>) -> Self
[src]
impl<T> Sub<Vector2<T>> for Rect<T> where
T: Sub<Output = T> + Copy,
[src]
T: Sub<Output = T> + Copy,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, vec: Vector2<T>) -> Self
[src]
impl<T> SubAssign<Vector2<T>> for Rect<T> where
T: SubAssign<T> + Copy,
[src]
T: SubAssign<T> + Copy,
fn sub_assign(&mut self, vec: Vector2<T>)
[src]
impl<S: Zero + Copy + PartialEq> Zero for Vector2<S>
[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for Vector2<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for Vector2<S> where
S: Send,
S: Send,
impl<S> Sync for Vector2<S> where
S: Sync,
S: Sync,
impl<S> Unpin for Vector2<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for Vector2<S> where
S: UnwindSafe,
S: 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,
fn borrow_mut(&mut self) -> &mut T
[src]
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.
fn to_owned(&self) -> T
[src]
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.
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>,