[][src]Struct emath::Pos2

pub struct Pos2 {
    pub x: f32,
    pub y: f32,
}

A position on screen.

Normally given in points (logical pixels).

Mathematically this is known as a "point", but the term position was chosen so not to conflict with the unit (one point = X physical pixels).

Fields

x: f32y: f32

Implementations

impl Pos2[src]

pub const fn zero() -> Self[src]

The zero position, the origin. The top left corner in a GUI. Same as Pos2::default().

pub const fn new(x: f32, y: f32) -> Self[src]

pub fn to_vec2(self) -> Vec2[src]

The vector from origin to this position. p.to_vec2() is equivalent to p - Pos2::default().

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

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

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

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

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

pub fn is_finite(self) -> bool[src]

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

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

#[must_use]pub fn clamp(self, range: RangeInclusive<Self>) -> Self[src]

Trait Implementations

impl Add<Vec2> for Pos2[src]

type Output = Pos2

The resulting type after applying the + operator.

impl AddAssign<Vec2> for Pos2[src]

impl Clone for Pos2[src]

impl Copy for Pos2[src]

impl Debug for Pos2[src]

impl Default for Pos2[src]

impl Eq for Pos2[src]

impl From<&'_ [f32; 2]> for Pos2[src]

impl From<[f32; 2]> for Pos2[src]

impl NumExt for Pos2[src]

impl PartialEq<Pos2> for Pos2[src]

impl Sub<Pos2> for Pos2[src]

type Output = Vec2

The resulting type after applying the - operator.

impl Sub<Vec2> for Pos2[src]

type Output = Pos2

The resulting type after applying the - operator.

impl SubAssign<Vec2> for Pos2[src]

Auto Trait Implementations

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.