Struct cavalier_contours::Vector2 [−][src]
Fields
x: T
y: T
Implementations
impl<T> Vector2<T> where
T: Real,
[src]
T: Real,
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.
fn add(self, rhs: &Vector2<T>) -> Self::Output
[src]
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.
fn add(self, _rhs: &'b Vector2<T>) -> Self::Output
[src]
impl<T: Real> Add<Vector2<T>> for Vector2<T>
[src]
type Output = Vector2<T>
The resulting type after applying the +
operator.
fn add(self, rhs: Vector2<T>) -> Self::Output
[src]
impl<T: Real> Add<Vector2<T>> for &Vector2<T>
[src]
type Output = Vector2<T>
The resulting type after applying the +
operator.
fn add(self, rhs: Vector2<T>) -> Self::Output
[src]
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.
fn neg(self) -> Self::Output
[src]
impl<T: Real> Neg for &Vector2<T>
[src]
type Output = Vector2<T>
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
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.
fn sub(self, rhs: &Vector2<T>) -> Self::Output
[src]
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.
fn sub(self, _rhs: &'b Vector2<T>) -> Self::Output
[src]
impl<T: Real> Sub<Vector2<T>> for Vector2<T>
[src]
type Output = Vector2<T>
The resulting type after applying the -
operator.
fn sub(self, rhs: Vector2<T>) -> Self::Output
[src]
impl<T: Real> Sub<Vector2<T>> for &Vector2<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Vector2<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Vector2<T> where
T: Send,
T: Send,
impl<T> Sync for Vector2<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Vector2<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Vector2<T> where
T: UnwindSafe,
T: 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> 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>,