coordinates/two_dimensional/
mod.rs

1use std::ops::{Add, Neg, Sub};
2
3use num_traits::Float;
4
5use crate::traits::Positional;
6
7mod polar;
8mod vector2;
9
10pub use polar::*;
11pub use vector2::*;
12
13/// Auto-trait for structs that implement consts and operators.
14pub trait FullTwoDimensional<U> {}
15
16impl<T, U: Float> FullTwoDimensional<U> for T where
17    T: Positional<U> + TwoDimensionalConsts<U> + Add + Sub + Neg + Sized
18{
19}
20
21/// Trait holding constants for unit vectors and the origin
22pub trait TwoDimensionalConsts<T: Float> {
23    /// Center of the coordinate space
24    const ORIGIN: Self;
25    /// Unit vector pointing in the positive y direction
26    const UP: Self;
27    /// Unit vector pointing in the negative y direction
28    const DOWN: Self;
29    /// Unit vector pointing in the positive x direction
30    const LEFT: Self;
31    /// Unit vector pointing in the negative x direction
32    const RIGHT: Self;
33}