[][src]Trait building_blocks::prelude::Point

pub trait Point: Ones + Bounded + PartialOrd<Self> + Copy + Add<Self, Output = Self> + Sub<Self, Output = Self> + Mul<Self::Scalar, Output = Self, Output = Self> + Mul<Self> + Div<Self::Scalar, Output = Self, Output = Self> + Div<Self> + Neg + Zero {
    type Scalar: Copy;
    fn basis() -> Vec<Self>;
fn abs(&self) -> Self;
fn at(&self, component_index: usize) -> Self::Scalar;
fn map_components(&self, f: impl Fn(Self::Scalar) -> Self::Scalar) -> Self; }

A trait that bundles op traits that all PointN<N> (and its components) should have.

Associated Types

type Scalar: Copy

Loading content...

Required methods

fn basis() -> Vec<Self>

fn abs(&self) -> Self

Returns a point where each component is the absolute value of the input component.

fn at(&self, component_index: usize) -> Self::Scalar

Returns the component specified by index. I.e. X = 0, Y = 1, Z = 2.

fn map_components(&self, f: impl Fn(Self::Scalar) -> Self::Scalar) -> Self

Returns the point after applying f component-wise.

Loading content...

Implementors

impl Point for PointN<[f32; 2]>[src]

type Scalar = f32

impl Point for PointN<[f32; 3]>[src]

type Scalar = f32

impl Point for PointN<[i32; 2]>[src]

type Scalar = i32

impl Point for PointN<[i32; 3]>[src]

type Scalar = i32

Loading content...