[][src]Trait building_blocks_core::point::Point

pub trait Point: Add<Output = Self> + Bounded + Copy + Div<Self::Scalar, Output = Self> + Div<Self, Output = Self> + Mul<Self::Scalar, Output = Self> + Mul<Self, Output = Self> + Ones + PartialOrd + Sized + Sub<Output = 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 Point2f[src]

type Scalar = f32

impl Point for Point2i[src]

type Scalar = i32

impl Point for Point3f[src]

type Scalar = f32

impl Point for Point3i[src]

type Scalar = i32

Loading content...