Struct ochre::Vec2 [−][src]
A 2-dimensional vector.
Fields
x: f32
y: f32
Implementations
impl Vec2
[src]
pub fn new(x: f32, y: f32) -> Vec2
[src]
Constructs a 2-dimensional vector.
pub fn dot(self, other: Vec2) -> f32
[src]
Computes the dot product between two vectors.
pub fn cross(self, other: Vec2) -> f32
[src]
Considering the two given vectors as 3-dimensional vectors lying in the XY-plane, finds the z-coordinate of their cross product.
pub fn distance(self, other: Vec2) -> f32
[src]
Computes the distance between two points.
pub fn length(self) -> f32
[src]
Computes the length of a vector.
pub fn normalized(self) -> Vec2
[src]
Finds the vector with the same direction and a length of 1.
pub fn lerp(t: f32, a: Vec2, b: Vec2) -> Vec2
[src]
Linearly interpolates between two vectors by the parameter t
.
pub fn min(self, other: Vec2) -> Vec2
[src]
Finds the componentwise minimum of two vectors.
pub fn max(self, other: Vec2) -> Vec2
[src]
Finds the componentwise maximum of two vectors.
Trait Implementations
impl Add<Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the +
operator.
fn add(self, rhs: Vec2) -> Vec2
[src]
impl AddAssign<Vec2> for Vec2
[src]
fn add_assign(&mut self, other: Vec2)
[src]
impl Clone for Vec2
[src]
impl Copy for Vec2
[src]
impl Debug for Vec2
[src]
impl Mul<Vec2> for Mat2x2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> Vec2
[src]
impl Mul<f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Vec2
[src]
impl PartialEq<Vec2> for Vec2
[src]
impl StructuralPartialEq for Vec2
[src]
impl Sub<Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the -
operator.
fn sub(self, rhs: Vec2) -> Vec2
[src]
impl SubAssign<Vec2> for Vec2
[src]
fn sub_assign(&mut self, other: Vec2)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Vec2
[src]
impl Send for Vec2
[src]
impl Sync for Vec2
[src]
impl Unpin for Vec2
[src]
impl UnwindSafe for Vec2
[src]
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>,