[][src]Struct pointy::Pt32

pub struct Pt32(pub f32, pub f32);

2-dimensional point / vector with f32 values.

use pointy::Pt32;

let pt = Pt32(10.0, 15.0);

Implementations

impl Pt32[src]

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

Get the X value

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

Get the Y value

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

Get the magnitude (length) of a vector

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

Normalize to unit length vector

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

Get distance squared between two points

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

Get distance between two points

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

Get the midpoint of two points

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

Calculate linear interpolation of two points.

  • t Interpolation amount, from 0 to 1

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

Get left-hand perpendicular vector

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

Get right-hand perpendicular vector

pub fn dot<P: Into<Self>>(self, rhs: P) -> f32[src]

Get dot product with another vector

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

Get vector angle in radians

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

Get relative angle to another vector.

The result will be between -PI and +PI.

Trait Implementations

impl Add<(f32, f32)> for Pt32[src]

type Output = Self

The resulting type after applying the + operator.

impl Add<Pt32> for Pt32[src]

type Output = Self

The resulting type after applying the + operator.

impl Clone for Pt32[src]

impl Copy for Pt32[src]

impl Debug for Pt32[src]

impl Default for Pt32[src]

impl Div<f32> for Pt32[src]

type Output = Self

The resulting type after applying the / operator.

impl From<(f32, f32)> for Pt32[src]

impl Mul<(f32, f32)> for Pt32[src]

type Output = f32

The resulting type after applying the * operator.

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

Get cross product with another vector.

Returns the signed magnitude of the 3D cross product.

impl Mul<Pt32> for Pt32[src]

type Output = f32

The resulting type after applying the * operator.

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

Get cross product with another vector.

Returns the signed magnitude of the 3D cross product.

impl Mul<Pt32> for Transform32[src]

type Output = Pt32

The resulting type after applying the * operator.

impl Mul<Transform32> for Pt32[src]

type Output = Pt32

The resulting type after applying the * operator.

impl Mul<f32> for Pt32[src]

type Output = Self

The resulting type after applying the * operator.

impl Neg for Pt32[src]

type Output = Self

The resulting type after applying the - operator.

impl PartialEq<Pt32> for Pt32[src]

impl StructuralPartialEq for Pt32[src]

impl Sub<(f32, f32)> for Pt32[src]

type Output = Self

The resulting type after applying the - operator.

impl Sub<Pt32> for Pt32[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Pt32

impl Send for Pt32

impl Sync for Pt32

impl Unpin for Pt32

impl UnwindSafe for Pt32

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.