fixed the vector method of the kartesiandirection

Dieser Commit ist enthalten in:
Sebastian Tobie 2024-12-06 16:55:36 +01:00
Ursprung 855772e976
Commit 2bbf7c86f6

Datei anzeigen

@ -58,21 +58,21 @@ enum KartesianDirection {
} }
impl KartesianDirection { impl KartesianDirection {
fn vector<T: Signed + Integer + Zero + From<i8>>(self) -> Kartesian<T> { pub fn vector<T: Signed + Integer + Zero + From<i8>>(self) -> Kartesian<T> {
const BELOW: i8 = -1; const BELOW: i8 = -1;
const ON: i8 = 0; const ON: i8 = 0;
const UPPER: i8 = 1; const UPPER: i8 = 1;
Kartesian::<T> { Kartesian::<T> {
x: match self { x: match self {
Self::TopLeft | Self::Left | Self::BottomLeft => BELOW.into(),
Self::Top | Self::None | Self::Bottom => ON.into(),
Self::TopRight | Self::Right | Self::BottomRight => UPPER.into(),
},
y: match self {
Self::TopLeft | Self::Top | Self::TopRight => BELOW.into(), Self::TopLeft | Self::Top | Self::TopRight => BELOW.into(),
Self::Left | Self::None | Self::Right => ON.into(), Self::Left | Self::None | Self::Right => ON.into(),
Self::BottomLeft | Self::Bottom | Self::BottomRight => UPPER.into(), Self::BottomLeft | Self::Bottom | Self::BottomRight => UPPER.into(),
}, },
y: match self {
Self::TopLeft | Self::Left | Self::BottomLeft => BELOW.into(),
Self::Top | Self::None | Self::Bottom => ON.into(),
Self::TopRight | Self::Right | Self::BottomRight => UPPER.into(),
},
} }
} }
} }