diff options
| author | LLLL Colonq <llll@colonq> | 2024-07-09 03:14:53 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-07-09 03:14:53 -0400 |
| commit | 01ca857de7b61b491f54b462d3ddfe6f18868289 (patch) | |
| tree | 9c3e9de1a0762deafadb0c92178ace564d96e407 /src/utils.rs | |
| parent | 19dd50105290dcfde80bd1673064386e501f631c (diff) | |
Rotation of directions
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs index 9f2e0d2..af0d77d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -60,6 +60,15 @@ impl Cardinal { Self::East => 3.0 * std::f32::consts::PI / 2.0, } } + + pub fn turn_by(&self, o: &Self) -> Self { + match o { + Self::North => self.clone(), + Self::South => self.turn_cw().turn_cw(), + Self::West => self.turn_cw(), + Self::East => self.turn_ccw(), + } + } } pub fn lerp(a: f32, b: f32, t: f32) -> f32 { |
