[][src]Struct kas::geom::Vec2

#[repr(C)]pub struct Vec2(pub f32, pub f32);

2D vector

Usually used as either a coordinate or a difference of coordinates, but may have some other uses.

Vectors are partially ordered and support component-wise comparison via methods like lhs.lt(rhs). The PartialOrd trait is not implemented since it implements lhs ≤ rhs as lhs < rhs || lhs == rhs which is wrong for vectors (consider for lhs = (0, 1), rhs = (1, 0)).

Implementations

impl Vec2[src]

pub const ZERO: Vec2[src]

Zero

pub const INFINITY: Vec2[src]

Positive infinity

pub const fn splat(value: f32) -> Self[src]

Constructs a new instance with each element initialized to value.

pub fn min_comp(self) -> f32[src]

Take the minimum component

pub fn min(self, other: Self) -> Self[src]

Return the minimum, componentwise

pub fn max(self, other: Self) -> Self[src]

Return the maximum, componentwise

pub fn abs(self) -> Self[src]

Take the absolute value of each component

pub fn ceil(self) -> Self[src]

Take the ceiling of each component

pub fn sign(self) -> Self[src]

For each component, return ±1 with the same sign as self.

pub fn lt(self, rhs: Self) -> bool[src]

True when for all components, lhs < rhs

pub fn le(self, rhs: Self) -> bool[src]

True when for all components, lhs ≤ rhs

pub fn ge(self, rhs: Self) -> bool[src]

True when for all components, lhs ≥ rhs

pub fn gt(self, rhs: Self) -> bool[src]

True when for all components, lhs > rhs

pub fn complex_mul(self, rhs: Self) -> Self[src]

Multiply two vectors as if they are complex numbers

pub fn complex_div(self, rhs: Self) -> Self[src]

Divide by a second vector as if they are complex numbers

pub fn complex_inv(self) -> Self[src]

Take the complex reciprocal

pub fn sum(self) -> f32[src]

Return the sum of the terms

pub fn sum_square(self) -> f32[src]

Return the sum of the square of the terms

Trait Implementations

impl Add<Vec2> for Vec2[src]

type Output = Vec2

The resulting type after applying the + operator.

impl Add<f32> for Vec2[src]

type Output = Vec2

The resulting type after applying the + operator.

impl Clone for Vec2[src]

impl Copy for Vec2[src]

impl Debug for Vec2[src]

impl Default for Vec2[src]

impl Div<Vec2> for Vec2[src]

type Output = Vec2

The resulting type after applying the / operator.

impl Div<f32> for Vec2[src]

type Output = Vec2

The resulting type after applying the / operator.

impl From<(f32, f32)> for Vec2[src]

impl From<Coord> for Vec2[src]

impl From<Size> for Vec2[src]

impl From<Vec2> for (f32, f32)[src]

impl From<Vec2> for Coord[src]

impl From<Vec2> for Size[src]

impl From<Vec2> for Vec2[src]

impl From<Vec2> for Vec2[src]

impl Mul<Vec2> for Vec2[src]

type Output = Vec2

The resulting type after applying the * operator.

impl Mul<f32> for Vec2[src]

type Output = Vec2

The resulting type after applying the * operator.

impl Neg for Vec2[src]

type Output = Vec2

The resulting type after applying the - operator.

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.

impl Sub<f32> for Vec2[src]

type Output = Vec2

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Vec2

impl Send for Vec2

impl Sync for Vec2

impl Unpin for Vec2

impl UnwindSafe for Vec2

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.