[][src]Struct youxi::prelude::Point2

#[repr(C)]
pub struct Point2<S> { pub x: S, pub y: S, }

A point in 2-dimensional space.

This type is marked as #[repr(C)].

Fields

x: Sy: S

Methods

impl<S> Point2<S>[src]

pub const fn new(x: S, y: S) -> Point2<S>[src]

Construct a new point, using the provided values.

pub fn map<U, F>(self, f: F) -> Point2<U> where
    F: FnMut(S) -> U, 
[src]

Perform the given operation on each field in the point, returning a new point constructed from the operations.

impl<S> Point2<S> where
    S: Copy + NumCast
[src]

pub fn cast<T>(&self) -> Option<Point2<T>> where
    T: NumCast
[src]

Component-wise casting to another type

Trait Implementations

impl<S> ElementWise<S> for Point2<S> where
    S: BaseNum
[src]

impl<S> ElementWise<Point2<S>> for Point2<S> where
    S: BaseNum
[src]

impl<S> PartialEq<Point2<S>> for Point2<S> where
    S: PartialEq<S>, 
[src]

impl<S> Bounded for Point2<S> where
    S: Bounded
[src]

impl<S> RemAssign<S> for Point2<S> where
    S: BaseNum + RemAssign<S>, 
[src]

impl<S> Mul<S> for Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the * operator.

impl<'a, S> Mul<S> for &'a Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the * operator.

impl<S> AbsDiffEq<Point2<S>> for Point2<S> where
    S: BaseFloat
[src]

type Epsilon = <S as AbsDiffEq<S>>::Epsilon

Used for specifying relative comparisons.

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of ApproxEq::abs_diff_eq.

impl<S> DivAssign<S> for Point2<S> where
    S: BaseNum + DivAssign<S>, 
[src]

impl<S> MetricSpace for Point2<S> where
    S: BaseFloat
[src]

type Metric = S

The metric to be returned by the distance function.

fn distance(self, other: Self) -> Self::Metric[src]

The distance between two values.

impl<S> Div<S> for Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the / operator.

impl<'a, S> Div<S> for &'a Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the / operator.

impl<S> AsMut<[S; 2]> for Point2<S>[src]

impl<S> AsMut<(S, S)> for Point2<S>[src]

impl<S> SubAssign<Vector2<S>> for Point2<S> where
    S: BaseNum + SubAssign<S>, 
[src]

impl<'a, S> Add<&'a Vector2<S>> for Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the + operator.

impl<'a, 'b, S> Add<&'a Vector2<S>> for &'b Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the + operator.

impl<S> Add<Vector2<S>> for Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the + operator.

impl<'a, S> Add<Vector2<S>> for &'a Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the + operator.

impl<S> Clone for Point2<S> where
    S: Clone
[src]

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

Performs copy-assignment from source. Read more

impl<S> From<[S; 2]> for Point2<S> where
    S: Clone
[src]

impl<'a, S> From<&'a (S, S)> for &'a Point2<S>[src]

impl<S> From<(S, S)> for Point2<S>[src]

impl<'a, S> From<&'a mut (S, S)> for &'a mut Point2<S>[src]

impl<'a, S> From<&'a mut [S; 2]> for &'a mut Point2<S>[src]

impl<'a, S> From<&'a [S; 2]> for &'a Point2<S>[src]

impl<S> Debug for Point2<S> where
    S: Debug
[src]

impl<S> Copy for Point2<S> where
    S: Copy
[src]

impl<S> Eq for Point2<S> where
    S: Eq
[src]

impl<'a, S> Sub<Vector2<S>> for &'a Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the - operator.

impl<'a, S> Sub<&'a Point2<S>> for Point2<S> where
    S: BaseNum
[src]

type Output = Vector2<S>

The resulting type after applying the - operator.

impl<S> Sub<Point2<S>> for Point2<S> where
    S: BaseNum
[src]

type Output = Vector2<S>

The resulting type after applying the - operator.

impl<S> Sub<Vector2<S>> for Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the - operator.

impl<'a, S> Sub<&'a Vector2<S>> for Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the - operator.

impl<'a, 'b, S> Sub<&'a Vector2<S>> for &'b Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the - operator.

impl<'a, 'b, S> Sub<&'a Point2<S>> for &'b Point2<S> where
    S: BaseNum
[src]

type Output = Vector2<S>

The resulting type after applying the - operator.

impl<'a, S> Sub<Point2<S>> for &'a Point2<S> where
    S: BaseNum
[src]

type Output = Vector2<S>

The resulting type after applying the - operator.

impl<S> Rem<S> for Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the % operator.

impl<'a, S> Rem<S> for &'a Point2<S> where
    S: BaseNum
[src]

type Output = Point2<S>

The resulting type after applying the % operator.

impl<S> AsRef<[S; 2]> for Point2<S>[src]

impl<S> AsRef<(S, S)> for Point2<S>[src]

impl<S> EuclideanSpace for Point2<S> where
    S: BaseNum
[src]

type Scalar = S

The associated scalar over which the space is defined. Read more

type Diff = Vector2<S>

The associated space of displacement vectors.

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

Returns the middle point between two other points. Read more

fn centroid(points: &[Self]) -> Self[src]

Returns the average position of all points in the slice. Read more

impl<S> Into<(S, S)> for Point2<S>[src]

impl<S> Into<[S; 2]> for Point2<S>[src]

impl<S> UlpsEq<Point2<S>> for Point2<S> where
    S: BaseFloat
[src]

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of ApproxEq::ulps_eq.

impl<S> AddAssign<Vector2<S>> for Point2<S> where
    S: BaseNum + AddAssign<S>, 
[src]

impl<S> Array for Point2<S> where
    S: BaseNum
[src]

type Element = S

fn as_ptr(&self) -> *const Self::Element[src]

Get the pointer to the first element of the array.

fn as_mut_ptr(&mut self) -> *mut Self::Element[src]

Get a mutable pointer to the first element of the array.

fn swap_elements(&mut self, i: usize, j: usize)[src]

Swap the elements at indices i and j in-place.

impl<S> MulAssign<S> for Point2<S> where
    S: BaseNum + MulAssign<S>, 
[src]

impl<S> RelativeEq<Point2<S>> for Point2<S> where
    S: BaseFloat
[src]

fn relative_ne(
    &self,
    other: &Rhs,
    epsilon: Self::Epsilon,
    max_relative: Self::Epsilon
) -> bool

The inverse of ApproxEq::relative_eq.

impl<S> Hash for Point2<S> where
    S: Hash
[src]

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

Feeds a slice of this type into the given [Hasher]. Read more

impl<S> Index<RangeTo<usize>> for Point2<S>[src]

type Output = [S]

The returned type after indexing.

impl<S> Index<Range<usize>> for Point2<S>[src]

type Output = [S]

The returned type after indexing.

impl<S> Index<RangeFrom<usize>> for Point2<S>[src]

type Output = [S]

The returned type after indexing.

impl<S> Index<RangeFull> for Point2<S>[src]

type Output = [S]

The returned type after indexing.

impl<S> Index<usize> for Point2<S>[src]

type Output = S

The returned type after indexing.

impl<S> IndexMut<Range<usize>> for Point2<S>[src]

impl<S> IndexMut<usize> for Point2<S>[src]

impl<S> IndexMut<RangeTo<usize>> for Point2<S>[src]

impl<S> IndexMut<RangeFrom<usize>> for Point2<S>[src]

impl<S> IndexMut<RangeFull> for Point2<S>[src]

Auto Trait Implementations

impl<S> Send for Point2<S> where
    S: Send

impl<S> Sync for Point2<S> where
    S: Sync

Blanket Implementations

impl<T> From for T[src]

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, 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> Any for T where
    T: 'static + ?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, Rhs, Output> NumOps for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]

impl<T, Rhs> NumAssignOps for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>, 
[src]