Trait GridPoint

Source
pub trait GridPoint:
    Eq
    + PartialEq
    + Clone {
    // Required methods
    fn up(&self) -> Self;
    fn down(&self) -> Self;
    fn left(&self) -> Self;
    fn right(&self) -> Self;
    fn position(&self, scale: f64) -> (f64, f64, f64);
}
Expand description

A point on a surface grid.

A type implementing this trait should ensure that the following conditions are met:

  • Two points are equal if they point to the same physical location on the grid.

A point on the grid must also be associated with some direction. For surfaces that loop this should work such that moving in the same direction will eventually result in reaching the point at which you started moving.

Required Methods§

Source

fn up(&self) -> Self

Gets the point that is immediately above this grid point.

Source

fn down(&self) -> Self

Gets the point that is immediately below this grid point.

Source

fn left(&self) -> Self

Gets the point that is immediately to the left of this grid point.

Source

fn right(&self) -> Self

Gets the point that is immediately to the right of this grid point.

Source

fn position(&self, scale: f64) -> (f64, f64, f64)

Gets the position of the point in 3D space.

  • scale - The scale of the 3D object.

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<const S: usize> GridPoint for CubeSpherePoint<S>

Source§

impl<const W: usize, const H: usize> GridPoint for RectangleSpherePoint<W, H>