[][src]Struct footile::Pt

pub struct Pt(pub f32, pub f32);

2-dimensional vector / point.

Implementations

impl Pt[src]

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

Get the X value

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

Get the Y value

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

Get the magnitude of a vector

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

Create a copy normalized to unit length

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

Calculate the distance squared between two points

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

Calculate the distance between two points

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

Get the midpoint of two points

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

Create a left-hand perpendicular vector

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

Create a right-hand perpendicular vector

pub fn lerp(self, rhs: Self, t: f32) -> Self[src]

Calculate linear interpolation of two points.

  • t Interpolation amount, from 0 to 1

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

Calculate the relative angle to another vector / point.

The result will be between -PI and +PI.

Trait Implementations

impl Add<Pt> for Pt[src]

type Output = Self

The resulting type after applying the + operator.

impl Clone for Pt[src]

impl Copy for Pt[src]

impl Debug for Pt[src]

impl Default for Pt[src]

impl Div<f32> for Pt[src]

type Output = Self

The resulting type after applying the / operator.

impl Mul<Pt> for Pt[src]

type Output = f32

The resulting type after applying the * operator.

fn mul(self, rhs: Self) -> f32[src]

Calculate the cross product of two vectors

impl Mul<Pt> for Transform[src]

type Output = Pt

The resulting type after applying the * operator.

impl Mul<f32> for Pt[src]

type Output = Self

The resulting type after applying the * operator.

impl Neg for Pt[src]

type Output = Self

The resulting type after applying the - operator.

impl PartialEq<Pt> for Pt[src]

impl StructuralPartialEq for Pt[src]

impl Sub<Pt> for Pt[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Pt

impl Send for Pt

impl Sync for Pt

impl Unpin for Pt

impl UnwindSafe for Pt

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.