[]Struct druid::Point

pub struct Point {
    pub x: f64,
    pub y: f64,
}

A 2d point.

Fields

x: f64

The x coordinate.

y: f64

The y coordinate.

Methods

impl Point

pub const ZERO: Point

The point (0, 0).

pub const ORIGIN: Point

The point at the origin; (0, 0).

pub const fn new(x: f64, y: f64) -> Point

Create a new Point with the provided x and y coordinates.

pub const fn to_vec2(self) -> Vec2

Convert this point into a Vec2.

pub fn lerp(self, other: Point, t: f64) -> Point

Linearly interpolate between two points.

pub fn midpoint(self, other: Point) -> Point

Determine the midpoint of two points.

pub fn distance(self, other: Point) -> f64

Euclidean distance.

pub fn round(self) -> Point

A new Point, with each of x and y rounded to the nearest integer value.

Trait Implementations

impl Add<Vec2> for Point

type Output = Point

The resulting type after applying the + operator.

impl AddAssign<Vec2> for Point

impl Clone for Point

impl Copy for Point

impl Data for Point[src]

impl Debug for Point

impl Default for Point

impl Display for Point

impl From<(f64, f64)> for Point

impl Into<Value> for Point[src]

impl Mul<Point> for Affine

type Output = Point

The resulting type after applying the * operator.

impl PartialEq<Point> for Point

impl StructuralPartialEq for Point

impl Sub<Point> for Point

type Output = Vec2

The resulting type after applying the - operator.

impl Sub<Vec2> for Point

type Output = Point

The resulting type after applying the - operator.

impl SubAssign<Vec2> for Point

Auto Trait Implementations

impl RefUnwindSafe for Point

impl Send for Point

impl Sync for Point

impl Unpin for Point

impl UnwindSafe for Point

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> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.