Point

Trait 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 Constants§

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 Methods§

Source

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

Panics if index is greater than implementors dimension

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

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>,

Source§

const DIM: usize = { N }

Source§

type Scalar = f64