Trait spade::PointN[][src]

pub trait PointN where
    Self: Clone + Debug + PartialEq
{ type Scalar: SpadeNum; fn dimensions() -> usize;
fn from_value(value: Self::Scalar) -> Self;
fn nth(&self, index: usize) -> &Self::Scalar;
fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar; }

Abstraction over a point with a fixed number of dimensions.

Spade will work with any point type implementing this trait, at the moment points of the cgmath and nalgebra crates are supported. Also, the trait is implemented for fixed arrays of length 2, 3 and 4, allowing to use spade's datastructures with fixed size arrays as point coordinates. That means that the trait's methods are also implemented for these array types, thus be careful when importing PointN.

Implement this if you want spade to support your own point types. Also, an empty implementation TwoDimensional or ThreeDimensional should be given if appropriate.

Associated Types

The points's internal scalar type.

Required Methods

The (fixed) number of dimensions of this point type.

Creates a new point with all components set to a certain value.

Returns the nth element of this point.

Returns a mutable reference to the nth element of this point.

Implementations on Foreign Types

impl<S: SpadeNum + Copy> PointN for [S; 2]
[src]

impl<S: SpadeNum + Copy> PointN for [S; 3]
[src]

impl<S: SpadeNum + Copy> PointN for [S; 4]
[src]

impl<S: SpadeNum + BaseNum> PointN for Point2<S>
[src]

impl<S: SpadeNum + BaseNum> PointN for Point3<S>
[src]

impl<S: SpadeNum + Scalar> PointN for Point2<S>
[src]

impl<S: SpadeNum + Scalar> PointN for Point3<S>
[src]

impl<S: SpadeNum + Scalar + Scalar> PointN for Point4<S>
[src]

Implementors