Struct crayon::prelude::math::Point2
[−]
[src]
#[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: S
y: S
Methods
impl<S> Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> Point2<S> where
S: Copy + NumCast,
[src]
S: Copy + NumCast,
Trait Implementations
impl<S> Copy for Point2<S> where
S: Copy,
[src]
S: Copy,
impl<S> Hash for Point2<S> where
S: Hash,
[src]
S: Hash,
fn hash<__HS>(&self, __arg_0: &mut __HS) where
__HS: Hasher,
[src]
__HS: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<S> EuclideanSpace for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
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 origin() -> Point2<S>
[src]
The point at the origin of the Euclidean space.
fn from_vec(v: Vector2<S>) -> Point2<S>
[src]
Convert a displacement vector to a point. Read more
fn to_vec(self) -> Vector2<S>
[src]
Convert a point to a displacement vector. Read more
fn dot(self, v: Vector2<S>) -> S
[src]
This is a weird one, but its useful for plane calculations.
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> Clone for Point2<S> where
S: Clone,
[src]
S: Clone,
fn clone(&self) -> Point2<S>
[src]
Returns a copy of the value. Read more
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]
S: Clone,
impl<'a, S> From<&'a mut [S; 2]> for &'a mut Point2<S>
[src]
impl<'a, S> From<&'a (S, S)> for &'a Point2<S>
[src]
impl<'a, S> From<&'a [S; 2]> 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<S> PartialEq<Point2<S>> for Point2<S> where
S: PartialEq<S>,
[src]
S: PartialEq<S>,
fn eq(&self, __arg_0: &Point2<S>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Point2<S>) -> bool
[src]
This method tests for !=
.
impl<S> ApproxEq for Point2<S> where
S: BaseFloat,
[src]
S: BaseFloat,
type Epsilon = <S as ApproxEq>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> <S as ApproxEq>::Epsilon
[src]
The default tolerance to use when testing values that are close together. Read more
fn default_max_relative() -> <S as ApproxEq>::Epsilon
[src]
The default relative tolerance for testing values that are far-apart. Read more
fn default_max_ulps() -> u32
[src]
The default ULPs to tolerate when testing values that are far-apart. Read more
fn relative_eq(
&self,
other: &Point2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_relative: <S as ApproxEq>::Epsilon
) -> bool
[src]
&self,
other: &Point2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_relative: <S as ApproxEq>::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
fn ulps_eq(
&self,
other: &Point2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
[src]
&self,
other: &Point2<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
A test for equality that uses units in the last place (ULP) if the values are far apart.
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of ApproxEq::relative_eq
.
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
The inverse of ApproxEq::ulps_eq
.
impl<'a, S> Add<Vector2<S>> for &'a Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> Add<Vector2<S>> for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, 'b, S> Add<&'a Vector2<S>> for &'b Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, S> Add<&'a Vector2<S>> for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> Debug for Point2<S> where
S: Debug,
[src]
S: Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl<S> AddAssign<Vector2<S>> for Point2<S> where
S: BaseNum + AddAssign<S>,
[src]
S: BaseNum + AddAssign<S>,
fn add_assign(&mut self, vector: Vector2<S>)
[src]
impl<'a, S> Rem<S> for &'a Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> Rem<S> for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> RemAssign<S> for Point2<S> where
S: BaseNum + RemAssign<S>,
[src]
S: BaseNum + RemAssign<S>,
fn rem_assign(&mut self, scalar: S)
[src]
impl<S> Into<(S, S)> for Point2<S>
[src]
impl<S> Into<[S; 2]> for Point2<S>
[src]
impl<S> Index<RangeFull> for Point2<S>
[src]
impl<S> Index<usize> for Point2<S>
[src]
impl<S> Index<Range<usize>> for Point2<S>
[src]
impl<S> Index<RangeFrom<usize>> for Point2<S>
[src]
impl<S> Index<RangeTo<usize>> for Point2<S>
[src]
impl<S> Div<S> for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, S> Div<S> for &'a Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> Array for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
type Element = S
fn from_value(scalar: S) -> Point2<S>
[src]
Construct a vector from a single value, replicating it. Read more
fn sum(self) -> S where
S: Add<S, Output = S>,
[src]
S: Add<S, Output = S>,
The sum of the elements of the array.
fn product(self) -> S where
S: Mul<S, Output = S>,
[src]
S: Mul<S, Output = S>,
The product of the elements of the array.
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> Eq for Point2<S> where
S: Eq,
[src]
S: Eq,
impl<S> AsRef<[S; 2]> for Point2<S>
[src]
impl<S> AsRef<(S, S)> for Point2<S>
[src]
impl<S> AsMut<[S; 2]> for Point2<S>
[src]
impl<S> AsMut<(S, S)> for Point2<S>
[src]
impl<S> DivAssign<S> for Point2<S> where
S: BaseNum + DivAssign<S>,
[src]
S: BaseNum + DivAssign<S>,
fn div_assign(&mut self, scalar: S)
[src]
impl<S> MulAssign<S> for Point2<S> where
S: BaseNum + MulAssign<S>,
[src]
S: BaseNum + MulAssign<S>,
fn mul_assign(&mut self, scalar: S)
[src]
impl<S> MetricSpace for Point2<S> where
S: BaseFloat,
[src]
S: BaseFloat,
type Metric = S
The metric to be returned by the distance
function.
fn distance2(self, other: Point2<S>) -> S
[src]
Returns the squared distance. Read more
fn distance(self, other: Self) -> Self::Metric
[src]
The distance between two values.
impl<S> Mul<S> for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, S> Mul<S> for &'a Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<S> IndexMut<RangeTo<usize>> for Point2<S>
[src]
fn index_mut(&'a mut self, i: RangeTo<usize>) -> &'a mut [S]
[src]
impl<S> IndexMut<RangeFull> for Point2<S>
[src]
fn index_mut(&'a mut self, i: RangeFull) -> &'a mut [S]
[src]
impl<S> IndexMut<RangeFrom<usize>> for Point2<S>
[src]
fn index_mut(&'a mut self, i: RangeFrom<usize>) -> &'a mut [S]
[src]
impl<S> IndexMut<usize> for Point2<S>
[src]
impl<S> IndexMut<Range<usize>> for Point2<S>
[src]
fn index_mut(&'a mut self, i: Range<usize>) -> &'a mut [S]
[src]
impl<S> Sub<Point2<S>> for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, S> Sub<&'a Point2<S>> for Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, 'b, S> Sub<&'a Point2<S>> for &'b Point2<S> where
S: BaseNum,
[src]
S: BaseNum,
impl<'a, S> Sub<Point2<S>> for &'a Point2<S> where
S: BaseNum,
[src]
S: BaseNum,