pub trait PointOpsExt<F: Float>: PointLike<F> {
Show 20 methods // Provided methods fn add_f(self, scalar: F) -> Self { ... } fn sub_f(self, scalar: F) -> Self { ... } fn mul_f(self, scalar: F) -> Self { ... } fn abs(self) -> Self { ... } fn approx_eq(self, rhs: Self, epsilon: F) -> bool { ... } fn approx_eq_f(self, scalar: F, epsilon: F) -> bool { ... } fn round(self, n: usize) -> Self { ... } fn max(self, other: Self) -> Self { ... } fn min(self, other: Self) -> Self { ... } fn cross(self, rhs: Self) -> F { ... } fn dot(self, rhs: Self) -> F { ... } fn length(self) -> F { ... } fn distance(self, rhs: Self) -> F { ... } fn partial_cmp(&self, other: &F) -> Option<Ordering> { ... } fn lt(&self, other: &F) -> bool { ... } fn gt(self, other: &F) -> bool { ... } fn le(self, other: &F) -> bool { ... } fn ge(self, other: &F) -> bool { ... } fn eq(self, other: &F) -> bool { ... } fn ne(self, other: &F) -> bool { ... }
}

Provided Methods§

source

fn add_f(self, scalar: F) -> Self

Add a scalar to both components of a point.

source

fn sub_f(self, scalar: F) -> Self

Subtract a scalar from both components of a point.

source

fn mul_f(self, scalar: F) -> Self

Multiply a point by a scalar.

source

fn abs(self) -> Self

Construct a point from the absolute components of self.

source

fn approx_eq(self, rhs: Self, epsilon: F) -> bool

Compare all components in self with rhs for approximate equality.

source

fn approx_eq_f(self, scalar: F, epsilon: F) -> bool

Compare all components in a point with a scalar for approximate equality.

source

fn round(self, n: usize) -> Self

Round the components of a point to N decimal places.

source

fn max(self, other: Self) -> Self

Returns a point-like containing the maximum values for each element of self and rhs.

In other words this computes [self.x().max(rhs.x), self.y().max(rhs.y())].

source

fn min(self, other: Self) -> Self

Returns a point-like containing the minimum values for each element of self and rhs.

In other words this computes [self.x.min(rhs.x), self.y.min(rhs.y)].

source

fn cross(self, rhs: Self) -> F

Compute the cross product of two points.

source

fn dot(self, rhs: Self) -> F

Computes the dot of self and rhs.

a · b = (x₁ · x₂) + (y₁ · y₂)
source

fn length(self) -> F

Computes the length of self.

c = √(a² + b²)
source

fn distance(self, rhs: Self) -> F

Computes the Euclidean distance between two points in space.

This works by relocating one point to the origin, then computing the length of the resulting vector.

c = √((x₂ - x₁)² + (y₂ - y₁)²)
source

fn partial_cmp(&self, other: &F) -> Option<Ordering>

source

fn lt(&self, other: &F) -> bool

source

fn gt(self, other: &F) -> bool

source

fn le(self, other: &F) -> bool

source

fn ge(self, other: &F) -> bool

source

fn eq(self, other: &F) -> bool

source

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<F: Float, P: PointLike<F>> PointOpsExt<F> for P