[−][src]Struct kas::geom::Vec2
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.
pub fn add(self, rhs: Vec2) -> Self::Output
[src]
impl Add<f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the +
operator.
pub fn add(self, rhs: f32) -> Self::Output
[src]
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.
pub fn div(self, rhs: Vec2) -> Self::Output
[src]
impl Div<f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
pub fn div(self, rhs: f32) -> Self::Output
[src]
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.
pub fn mul(self, rhs: Vec2) -> Self::Output
[src]
impl Mul<f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
pub fn mul(self, rhs: f32) -> Self::Output
[src]
impl Neg for Vec2
[src]
type Output = Vec2
The resulting type after applying the -
operator.
pub fn neg(self) -> Self::Output
[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.
pub fn sub(self, rhs: Vec2) -> Self::Output
[src]
impl Sub<f32> for Vec2
[src]
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]
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>,