Struct xmath::Vector2

source ·
pub struct Vector2 {
    pub x: f32,
    pub y: f32,
    /* private fields */
}

Fields§

§x: f32§y: f32

Implementations§

source§

impl Vector2

source

pub fn new(x: f32, y: f32) -> Self

Trait Implementations§

source§

impl Add<Vector2> for Vector2

§

type Output = Vector2

The resulting type after applying the + operator.
source§

fn add(self, rhs: Vector2) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<Vector2> for Vector2

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl Clone for Vector2

source§

fn clone(&self) -> Vector2

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Vector2

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<Vector2> for Vector2

§

type Output = Vector2

The resulting type after applying the / operator.
source§

fn div(self, rhs: Vector2) -> Self::Output

Performs the / operation. Read more
source§

impl Div<f32> for Vector2

§

type Output = Vector2

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<Vector2> for Vector2

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl DivAssign<f32> for Vector2

source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
source§

impl From<[f32; 4]> for Vector2

source§

fn from(row: [f32; 4]) -> Self

Converts to this type from the input type.
source§

impl Index<usize> for Vector2

§

type Output = f32

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Mul<Vector2> for Vector2

§

type Output = Vector2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Vector2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Vector2> for f32

§

type Output = Vector2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Vector2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f32> for Vector2

§

type Output = Vector2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<Vector2> for Vector2

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl MulAssign<f32> for Vector2

source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
source§

impl Neg for Vector2

§

type Output = Vector2

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq<Vector2> for Vector2

source§

fn eq(&self, other: &Vector2) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<Vector2> for Vector2

§

type Output = Vector2

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Vector2) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<Vector2> for Vector2

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl Vector for Vector2

source§

fn zero() -> Self

source§

fn one() -> Self

source§

fn infinity() -> Self

source§

fn nan() -> Self

source§

fn epsilon() -> Self

source§

fn replicate(value: f32) -> Self

source§

fn is_nan(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn dot(&self, other: &Self) -> f32

source§

fn swizzle(&self, e0: usize, e1: usize, _e2: usize, _e3: usize) -> Self

source§

fn permute( &self, other: &Self, permute_x: usize, permute_y: usize, _permute_z: usize, _permute_w: usize ) -> Self

source§

fn transform(&self, matrix: &Matrix) -> Self

source§

fn min(&self, other: &Self) -> Self

source§

fn max(&self, other: &Self) -> Self

source§

fn round(&self) -> Self

source§

fn trunc(&self) -> Self

source§

fn floor(&self) -> Self

source§

fn ceil(&self) -> Self

source§

fn clamp(&self, min: &Self, max: &Self) -> Self

source§

fn multiply_add(&self, mul: &Self, add: &Self) -> Self

source§

fn splat_x(&self) -> Self

source§

fn splat_y(&self) -> Self

source§

fn splat_z(&self) -> Self

source§

fn splat_w(&self) -> Self

source§

fn is_finite(&self) -> bool

source§

fn length_sq(&self) -> f32

source§

fn length(&self) -> f32

source§

fn normalize(self) -> Self

source§

impl Copy for Vector2

source§

impl StructuralPartialEq for Vector2

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.