[][src]Struct math2d::Point2f

#[repr(C)]
pub struct Point2f { pub x: f32, pub y: f32, }

Mathematical point on the 2D (x, y) plane.

Fields

x: f32

Horizontal component

y: f32

Vertical component

Methods

impl Point2f[src]

pub const ORIGIN: Point2f[src]

Mathematical origin point on the real number plane.

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

Construct a point from the components

pub fn to_i32(self) -> Point2i[src]

Casts the point to an integer point. Will truncate integers; if another behavior is desired it should be manually performed on the values before calling this function.

pub fn to_u32(self) -> Point2u[src]

Casts the point to an unsigned integer point. Will truncate integers; if another behavior is desired it should be manually performed on the values before calling this function. Beware this function will not produce reasonable values if the current value is negative.

pub fn to_vector(self) -> Vector2f[src]

pub fn rounded(self) -> Point2f[src]

Rounds the values in the point to the nearest integer, rounding away from zero in the half-way case.

See f32::round

pub fn is_approx_eq(self, other: impl Into<Point2f>, epsilon: f32) -> bool[src]

Determines if the components of two points are less than epsilon distance from each other. Be wary that this does not check the actual distance, but a component-wise distance check. If you desire a more precise distance check, consider subtracting one point from the other and comparing the length(_sq) of the resulting vector.

Trait Implementations

impl Copy for Point2f[src]

impl PartialEq<Point2f> for Point2f[src]

impl Default for Point2f[src]

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

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

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

impl From<Point2f> for D2D_POINT_2F[src]

impl From<D2D_POINT_2F> for Point2f[src]

impl From<Point2f> for Point2<f32>[src]

impl From<Point2<f32>> for Point2f[src]

impl From<Vec2> for Point2f[src]

impl Clone for Point2f[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Point2f[src]

impl<V> Add<V> for Point2f where
    V: Into<Vector2f>, 
[src]

type Output = Point2f

The resulting type after applying the + operator.

impl Sub<Point2f> for Point2f[src]

type Output = Vector2f

The resulting type after applying the - operator.

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

type Output = Vector2f

The resulting type after applying the - operator.

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

type Output = Vector2f

The resulting type after applying the - operator.

impl<V> Sub<V> for Point2f where
    V: Into<Vector2f>, 
[src]

type Output = Point2f

The resulting type after applying the - operator.

impl Mul<Matrix3x2f> for Point2f[src]

type Output = Point2f

The resulting type after applying the * operator.

impl Serialize for Point2f[src]

impl<'de> Deserialize<'de> for Point2f[src]

Auto Trait Implementations

impl Send for Point2f

impl Sync for Point2f

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

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

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]