Struct cavalier_contours::Vector2[][src]

pub struct Vector2<T = f64> {
    pub x: T,
    pub y: T,
}

Fields

x: Ty: T

Implementations

impl<T> Vector2<T> where
    T: Real
[src]

pub fn new(x: T, y: T) -> Self[src]

Create a new vector with x and y components.

pub fn zero() -> Self[src]

Create a zero vector (x = 0, y = 0).

pub fn scale(&self, scale_factor: T) -> Self[src]

Uniformly scale the vector by scale_factor.

pub fn dot(&self, other: Self) -> T[src]

Dot product.

pub fn perp_dot(&self, other: Self) -> T[src]

Compute the perpendicular dot product (self.x * other.y - self.y * other.x).

pub fn length_squared(&self) -> T[src]

Squared length of the vector.

pub fn length(&self) -> T[src]

Length of the vector.

pub fn normalize(&self) -> Self[src]

Normalize the vector (length = 1).

pub fn fuzzy_eq_eps(&self, other: Self, fuzzy_epsilon: T) -> bool[src]

Fuzzy equal comparison with another vector using fuzzy_epsilon given.

pub fn fuzzy_eq(&self, other: Self) -> bool[src]

Fuzzy equal comparison with another vector using T::fuzzy_epsilon().

pub fn perp(&self) -> Self[src]

Create perpendicular vector.

pub fn unit_perp(&self) -> Self[src]

Create perpendicular unit vector (length = 1).

pub fn rotate_about(&self, origin: Self, angle: T) -> Self[src]

Rotate this point around an origin point by some angle in radians.

Trait Implementations

impl<T: Real> Add<&'_ Vector2<T>> for Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the + operator.

impl<'a, 'b, T: Real> Add<&'b Vector2<T>> for &'a Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the + operator.

impl<T: Real> Add<Vector2<T>> for Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the + operator.

impl<T: Real> Add<Vector2<T>> for &Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the + operator.

impl<T: Clone> Clone for Vector2<T>[src]

impl<T: Copy> Copy for Vector2<T>[src]

impl<T: Debug> Debug for Vector2<T>[src]

impl<T: Real> Neg for Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the - operator.

impl<T: Real> Neg for &Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the - operator.

impl<T: PartialEq> PartialEq<Vector2<T>> for Vector2<T>[src]

impl<T> StructuralPartialEq for Vector2<T>[src]

impl<T: Real> Sub<&'_ Vector2<T>> for Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the - operator.

impl<'a, 'b, T: Real> Sub<&'b Vector2<T>> for &'a Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the - operator.

impl<T: Real> Sub<Vector2<T>> for Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the - operator.

impl<T: Real> Sub<Vector2<T>> for &Vector2<T>[src]

type Output = Vector2<T>

The resulting type after applying the - operator.

Auto Trait Implementations

impl<T> RefUnwindSafe for Vector2<T> where
    T: RefUnwindSafe

impl<T> Send for Vector2<T> where
    T: Send

impl<T> Sync for Vector2<T> where
    T: Sync

impl<T> Unpin for Vector2<T> where
    T: Unpin

impl<T> UnwindSafe for Vector2<T> where
    T: 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.