Fields
array: [T; N]
Implementations
sourceimpl<T, const N: usize> Point<T, N>
impl<T, const N: usize> Point<T, N>
pub const fn new(array: [T; N]) -> Point<T, N>
sourcepub fn new_nn(array: [T; N]) -> Point<NotNan<T>, N> where
T: Float,
pub fn new_nn(array: [T; N]) -> Point<NotNan<T>, N> where
T: Float,
Panics
Panics if any of the inputs are NaN.
pub fn as_vec(&self) -> &Vector<T, N>
pub fn squared_euclidean_distance<F>(&self, rhs: &Point<T, N>) -> F where
T: Clone + Into<F>,
F: NumOps + Clone + Sum,
pub fn zero() -> Self where
T: Sum,
pub fn map<U, F>(&self, f: F) -> Point<U, N> where
T: Clone,
F: Fn(T) -> U,
pub fn cast<U>(&self) -> Point<U, N> where
T: Clone + Into<U>,
pub fn to_float(&self) -> Point<OrderedFloat<f64>, N> where
T: Clone + Into<f64>,
sourceimpl<T: PolygonScalar> Point<T, 2>
impl<T: PolygonScalar> Point<T, 2>
pub fn cmp_distance_to(&self, p: &Point<T, 2>, q: &Point<T, 2>) -> Ordering
sourcepub fn orient(
p1: &Point<T, 2>,
p2: &Point<T, 2>,
p3: &Point<T, 2>
) -> Orientation
pub fn orient(
p1: &Point<T, 2>,
p2: &Point<T, 2>,
p3: &Point<T, 2>
) -> Orientation
Determine the direction you have to turn if you walk from p1
to p2
to p3
.
For fixed-precision types (i8,i16,i32,i64,etc), this function is guaranteed to work for any input and never cause any arithmetic overflows.
Examples
let p1 = Point::new([ 0, 0 ]);
let p2 = Point::new([ 0, 1 ]); // One unit above p1.
// (0,0) -> (0,1) -> (0,2) == Orientation::CoLinear
assert!(Point::orient(&p1, &p2, &Point::new([ 0, 2 ])).is_colinear());
// (0,0) -> (0,1) -> (-1,2) == Orientation::CounterClockWise
assert!(Point::orient(&p1, &p2, &Point::new([ -1, 2 ])).is_ccw());
// (0,0) -> (0,1) -> (1,2) == Orientation::ClockWise
assert!(Point::orient(&p1, &p2, &Point::new([ 1, 2 ])).is_cw());
Runpub fn orient_along_direction(
p1: &Point<T, 2>,
direction: Direction<'_, T, 2>,
p2: &Point<T, 2>
) -> Orientation
pub fn orient_along_vector(
p1: &Point<T, 2>,
vector: &Vector<T, 2>,
p2: &Point<T, 2>
) -> Orientation
pub fn orient_along_perp_vector(
p1: &Point<T, 2>,
vector: &Vector<T, 2>,
p2: &Point<T, 2>
) -> Orientation
sourcepub fn ccw_cmp_around(&self, p: &Point<T, 2>, q: &Point<T, 2>) -> Ordering
pub fn ccw_cmp_around(&self, p: &Point<T, 2>, q: &Point<T, 2>) -> Ordering
Docs?
pub fn ccw_cmp_around_with(
&self,
z: &Vector<T, 2>,
p: &Point<T, 2>,
q: &Point<T, 2>
) -> Ordering
Trait Implementations
sourceimpl<T, const N: usize> Add<&'_ Vector<T, N>> for Point<T, N> where
for<'a> &'a T: Add<&'a T, Output = T>,
impl<T, const N: usize> Add<&'_ Vector<T, N>> for Point<T, N> where
for<'a> &'a T: Add<&'a T, Output = T>,
sourceimpl<'a, 'b, T, const N: usize> Add<&'a Vector<T, N>> for &'b Point<T, N> where
for<'c> &'c T: Add<&'c T, Output = T>,
impl<'a, 'b, T, const N: usize> Add<&'a Vector<T, N>> for &'b Point<T, N> where
for<'c> &'c T: Add<&'c T, Output = T>,
sourceimpl<T, const N: usize> Add<Vector<T, N>> for Point<T, N> where
for<'a> &'a T: Add<&'a T, Output = T>,
impl<T, const N: usize> Add<Vector<T, N>> for Point<T, N> where
for<'a> &'a T: Add<&'a T, Output = T>,
sourceimpl<T, const N: usize> AddAssign<&'_ Vector<T, N>> for Point<T, N> where
T: NumOps + Clone + AddAssign,
impl<T, const N: usize> AddAssign<&'_ Vector<T, N>> for Point<T, N> where
T: NumOps + Clone + AddAssign,
sourcefn add_assign(&mut self, other: &Vector<T, N>)
fn add_assign(&mut self, other: &Vector<T, N>)
Performs the +=
operation. Read more
sourceimpl<T, const N: usize> AddAssign<Vector<T, N>> for Point<T, N> where
T: NumOps + Clone + AddAssign,
impl<T, const N: usize> AddAssign<Vector<T, N>> for Point<T, N> where
T: NumOps + Clone + AddAssign,
sourcefn add_assign(&mut self, other: Vector<T, N>)
fn add_assign(&mut self, other: Vector<T, N>)
Performs the +=
operation. Read more
sourceimpl<T, const N: usize> Distribution<Point<T, N>> for Standard where
Standard: Distribution<T>,
impl<T, const N: usize> Distribution<Point<T, N>> for Standard where
Standard: Distribution<T>,
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Point<T, N>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Point<T, N>
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
sourceimpl<'a, T, const N: usize> From<&'a Point<T, N>> for VectorView<'a, T, N>
impl<'a, T, const N: usize> From<&'a Point<T, N>> for VectorView<'a, T, N>
sourcefn from(point: &Point<T, N>) -> VectorView<'_, T, N>
fn from(point: &Point<T, N>) -> VectorView<'_, T, N>
Converts to this type from the input type.
sourceimpl<'a, 'b, T, const N: usize> Mul<&'b Point<T, N>> for &'a Transform<T, N> where
T: TransformScalar,
impl<'a, 'b, T, const N: usize> Mul<&'b Point<T, N>> for &'a Transform<T, N> where
T: TransformScalar,
sourceimpl<'a, T, const N: usize> Mul<Point<T, N>> for &'a Transform<T, N> where
T: TransformScalar,
impl<'a, T, const N: usize> Mul<Point<T, N>> for &'a Transform<T, N> where
T: TransformScalar,
sourceimpl<T: Ord, const N: usize> Ord for Point<T, N>
impl<T: Ord, const N: usize> Ord for Point<T, N>
sourceimpl<T: PartialOrd, const N: usize> PartialOrd<Point<T, N>> for Point<T, N>
impl<T: PartialOrd, const N: usize> PartialOrd<Point<T, N>> for Point<T, N>
sourcefn partial_cmp(&self, other: &Point<T, N>) -> Option<Ordering>
fn partial_cmp(&self, other: &Point<T, N>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a, 'b, T, const N: usize> Sub<&'a Point<T, N>> for &'b Point<T, N> where
T: Sub<T, Output = T> + Clone,
impl<'a, 'b, T, const N: usize> Sub<&'a Point<T, N>> for &'b Point<T, N> where
T: Sub<T, Output = T> + Clone,
impl<T: Copy, const N: usize> Copy for Point<T, N>
impl<T: Eq, const N: usize> Eq for Point<T, N>
impl<T, const N: usize> StructuralEq for Point<T, N>
impl<T, const N: usize> StructuralPartialEq for Point<T, N>
Auto Trait Implementations
impl<T, const N: usize> RefUnwindSafe for Point<T, N> where
T: RefUnwindSafe,
impl<T, const N: usize> Send for Point<T, N> where
T: Send,
impl<T, const N: usize> Sync for Point<T, N> where
T: Sync,
impl<T, const N: usize> Unpin for Point<T, N> where
T: Unpin,
impl<T, const N: usize> UnwindSafe for Point<T, N> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more