Trait krakel::PointTrait

source ·
pub trait PointTrait: Clone + PartialEq{
    type PScalar;

    const DIMENSION: u8;

    // Required methods
    fn x(&self) -> Self::PScalar;
    fn y(&self) -> Self::PScalar;
    fn set_x(&mut self, x: Self::PScalar);
    fn set_y(&mut self, y: Self::PScalar);
    fn at(&self, index: u8) -> Self::PScalar;
    fn at_mut(&mut self, index: u8) -> &mut Self::PScalar;

    // Provided method
    fn dist_sq<Q: PointTrait<PScalar = Self::PScalar>>(
        a: &Self,
        b: &Q
    ) -> Self::PScalar { ... }
}

Required Associated Types§

Required Associated Constants§

Required Methods§

source

fn x(&self) -> Self::PScalar

source

fn y(&self) -> Self::PScalar

source

fn set_x(&mut self, x: Self::PScalar)

source

fn set_y(&mut self, y: Self::PScalar)

source

fn at(&self, index: u8) -> Self::PScalar

source

fn at_mut(&mut self, index: u8) -> &mut Self::PScalar

Provided Methods§

source

fn dist_sq<Q: PointTrait<PScalar = Self::PScalar>>( a: &Self, b: &Q ) -> Self::PScalar

Returns the squared distance between this point and another point that is using the same scalar type.

Object Safety§

This trait is not object safe.

Implementors§