Trait point_like::PointOpsExt
source · 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§
sourcefn approx_eq(self, rhs: Self, epsilon: F) -> bool
fn approx_eq(self, rhs: Self, epsilon: F) -> bool
Compare all components in self with rhs for approximate equality.
sourcefn approx_eq_f(self, scalar: F, epsilon: F) -> bool
fn approx_eq_f(self, scalar: F, epsilon: F) -> bool
Compare all components in a point with a scalar for approximate equality.
sourcefn max(self, other: Self) -> Self
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())].
sourcefn min(self, other: Self) -> Self
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)].
sourcefn distance(self, rhs: Self) -> F
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₁)²)
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
Object Safety§
This trait is not object safe.