Struct rgx::math::algebra::Point2D

source ·
#[repr(C)]
pub struct Point2D<S = f32, U = ()> { pub x: S, pub y: S, /* private fields */ }
Expand description

2D point.

Fields§

§x: S§y: S

Implementations§

source§

impl<T: Zero + PartialEq> Point2D<T>

source

pub const ORIGIN: Self = Point2D::ZERO

source§

impl<S, U> Point2D<S, U>

source

pub const fn new(x: S, y: S) -> Self

source

pub fn map<F, T>(self, f: F) -> Point2D<T>where F: FnMut(S) -> T,

source§

impl Point2D<i32>

source

pub fn clamp(&mut self, rect: Rect<i32>)

Trait Implementations§

source§

impl<T: Add<Output = T>> Add<Size<T>> for Point2D<T>

§

type Output = Point2D<T, ()>

The resulting type after applying the + operator.
source§

fn add(self, other: Size<T>) -> Self

Performs the + operation. Read more
source§

impl<S, T, U> Add<T> for Point2D<S, U>where S: Add<Output = S> + Copy, T: Into<Vector2D<S, U>>,

§

type Output = Point2D<S, U>

The resulting type after applying the + operator.
source§

fn add(self, other: T) -> Self

Performs the + operation. Read more
source§

impl<S: Clone, U: Clone> Clone for Point2D<S, U>

source§

fn clone(&self) -> Point2D<S, U>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug, U: Debug> Debug for Point2D<S, U>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S: Default, U: Default> Default for Point2D<S, U>

source§

fn default() -> Point2D<S, U>

Returns the “default value” for a type. Read more
source§

impl<S, U> Display for Point2D<S, U>where S: Display,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S, U> Div<S> for Point2D<S, U>where S: Div<Output = S> + Copy,

§

type Output = Point2D<S, U>

The resulting type after applying the / operator.
source§

fn div(self, s: S) -> Self

Performs the / operation. Read more
source§

impl<T: Copy> From<[T; 2]> for Point2D<T>

source§

fn from(array: [T; 2]) -> Self

Converts to this type from the input type.
source§

impl<T: Copy> From<(T, T)> for Point2D<T>

source§

fn from((x, y): (T, T)) -> Self

Converts to this type from the input type.
source§

impl<S: One + Zero + Copy> From<Point2D<S, ()>> for Transform3D<S>

source§

fn from(other: Point2D<S>) -> Self

Converts to this type from the input type.
source§

impl<S, U: Copy> From<Point2D<S, U>> for Vector2D<S, U>

source§

fn from(p: Point2D<S, U>) -> Self

Converts to this type from the input type.
source§

impl From<Point2D<f32, ()>> for Point2D<i32>

source§

fn from(other: Point2D<f32>) -> Self

Converts to this type from the input type.
source§

impl From<Point2D<f32, ()>> for Vector4D<f32>

source§

fn from(other: Point2D<f32>) -> Self

Converts to this type from the input type.
source§

impl From<Point2D<f64, ()>> for Point2D<f32>

source§

fn from(other: Point2D<f64>) -> Self

Converts to this type from the input type.
source§

impl<S, U> From<Vector2D<S, U>> for Point2D<S, U>

source§

fn from(v: Vector2D<S, U>) -> Self

Converts to this type from the input type.
source§

impl Geometry for Point2D<f32>

source§

fn transform(self, t: impl Into<Transform>) -> Self

Return a transformed object.
source§

fn untransform(self, t: impl Into<Transform>) -> Self

Undos a transform.
source§

impl<S: Hash, U: Hash> Hash for Point2D<S, U>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Mul<Point2D<f32, ()>> for Transform2D

§

type Output = Point2D<f32, ()>

The resulting type after applying the * operator.
source§

fn mul(self, point: Point2D<f32>) -> Point2D<f32>

Performs the * operation. Read more
source§

impl Mul<Point2D<f32, ()>> for Transform3D<f32>

Transform a Point2D with a Transform3D.

use rgx::math::*;
let m = Transform3D::from_translation(Vector3D::new(8., 8., 0.));
let p = Point2D::new(1., 1.);

assert_eq!(m * p, Point2D::new(9., 9.));
§

type Output = Point2D<f32, ()>

The resulting type after applying the * operator.
source§

fn mul(self, p: Point2D<f32>) -> Point2D<f32>

Performs the * operation. Read more
source§

impl<S, U> Mul<S> for Point2D<S, U>where S: Mul<Output = S> + Copy,

§

type Output = Point2D<S, U>

The resulting type after applying the * operator.
source§

fn mul(self, s: S) -> Self

Performs the * operation. Read more
source§

impl<S: PartialEq, U: PartialEq> PartialEq<Point2D<S, U>> for Point2D<S, U>

source§

fn eq(&self, other: &Point2D<S, U>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<S, U> Sub<Point2D<S, U>> for Point2D<S, U>where S: Sub<Output = S> + Copy,

§

type Output = Vector2D<S, U>

The resulting type after applying the - operator.
source§

fn sub(self, other: Point2D<S, U>) -> Vector2D<S, U>

Performs the - operation. Read more
source§

impl<S, U> Sub<Vector2D<S, U>> for Point2D<S, U>where S: Sub<Output = S> + Copy,

§

type Output = Point2D<S, U>

The resulting type after applying the - operator.
source§

fn sub(self, other: Vector2D<S, U>) -> Self

Performs the - operation. Read more
source§

impl<T: Zero + PartialEq> Zero for Point2D<T>

source§

const ZERO: Self = _

source§

fn is_zero(&self) -> bool

source§

impl<S: Copy, U: Copy> Copy for Point2D<S, U>

source§

impl<S: Eq, U: Eq> Eq for Point2D<S, U>

source§

impl<S, U> StructuralEq for Point2D<S, U>

source§

impl<S, U> StructuralPartialEq for Point2D<S, U>

Auto Trait Implementations§

§

impl<S, U> RefUnwindSafe for Point2D<S, U>where S: RefUnwindSafe, U: RefUnwindSafe,

§

impl<S, U> Send for Point2D<S, U>where S: Send, U: Send,

§

impl<S, U> Sync for Point2D<S, U>where S: Sync, U: Sync,

§

impl<S, U> Unpin for Point2D<S, U>where S: Unpin, U: Unpin,

§

impl<S, U> UnwindSafe for Point2D<S, U>where S: UnwindSafe, U: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.