Trait stroke::point::Point

source ·
pub trait Point: Add<Self, Output = Self> + Sub<Self, Output = Self> + Mul<Self::Scalar, Output = Self> + Mul<f64, Output = Self> + Copy + PartialEq + Default + IntoIterator {
    type Scalar: Float + Default + PartialEq + From<f64> + Into<f64> + Add<f64, Output = Self::Scalar> + Sub<f64, Output = Self::Scalar> + Mul<f64, Output = Self::Scalar> + Div<f64, Output = Self::Scalar> + Sum<f64>;

    const DIM: usize;

    // Required methods
    fn axis(&self, index: usize) -> Self::Scalar;
    fn squared_length(&self) -> Self::Scalar;
}
Expand description

The Point trait is the only interface on which the library relies. The associated constant DIM is necessary so that the memory layout of its implementing type can be made known to the library, whenever new instances are returned.

Required Associated Types§

source

type Scalar: Float + Default + PartialEq + From<f64> + Into<f64> + Add<f64, Output = Self::Scalar> + Sub<f64, Output = Self::Scalar> + Mul<f64, Output = Self::Scalar> + Div<f64, Output = Self::Scalar> + Sum<f64>

Required Associated Constants§

Required Methods§

source

fn axis(&self, index: usize) -> Self::Scalar

Panics if index is greater than implementors dimension

source

fn squared_length(&self) -> Self::Scalar

Implementors§

source§

impl<T, const N: usize> Point for PointN<T, N>where T: Float + Copy + Default + Add<T, Output = T> + Add<f64, Output = T> + Sub<T, Output = T> + Sub<f64, Output = T> + Mul<T, Output = T> + Mul<f64, Output = T> + Sum<f64> + From<f64> + Into<f64>,

§

type Scalar = f64

source§

const DIM: usize = { N }