Struct egui::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

pub const ZERO: Pos2

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

pub const fn zero() -> Pos2

👎 Deprecated:

Use Pos2::ZERO instead

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

pub fn to_vec2(self) -> Vec2

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

pub fn distance(self, other: Pos2) -> f32

pub fn distance_sq(self, other: Pos2) -> f32

pub fn floor(self) -> Pos2

pub fn round(self) -> Pos2

pub fn ceil(self) -> Pos2

pub fn is_finite(self) -> bool

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

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

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

Trait Implementations

impl Add<Vec2> for Pos2

type Output = Pos2

The resulting type after applying the + operator.

impl AddAssign<Vec2> for Pos2

impl Clone for Pos2

impl Copy for Pos2

impl Debug for Pos2

impl Default for Pos2

impl Eq for Pos2

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

impl<'_> From<&'_ (f32, f32)> for Pos2

impl From<[f32; 2]> for Pos2

impl From<(f32, f32)> for Pos2

impl Index<usize> for Pos2

type Output = f32

The returned type after indexing.

impl IndexMut<usize> for Pos2

impl NumExt for Pos2

impl PartialEq<Pos2> for Pos2

impl StructuralPartialEq for Pos2

impl Sub<Pos2> for Pos2

type Output = Vec2

The resulting type after applying the - operator.

impl Sub<Vec2> for Pos2

type Output = Pos2

The resulting type after applying the - operator.

impl SubAssign<Vec2> for Pos2

Auto Trait Implementations

impl RefUnwindSafe for Pos2

impl Send for Pos2

impl Sync for Pos2

impl Unpin for Pos2

impl UnwindSafe for Pos2

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.