Use clock facings for relative directions.

This commit is contained in:
Nolan Darilek 2021-08-31 21:15:52 -05:00
parent fae8b559cf
commit 9a85544ad5

View File

@ -387,19 +387,19 @@ pub trait PointLike {
let bearing = self.bearing(other);
let relative = (bearing - yaw).degrees();
match relative {
v if v <= 15. => "ahead".into(),
v if v <= 45. => "ahead and left".into(),
v if v <= 75. => "left and ahead".into(),
v if v <= 105. => "left".into(),
v if v <= 135. => "left and behind".into(),
v if v <= 165. => "behind and left".into(),
v if v <= 195. => "behind".into(),
v if v <= 225. => "behind and right".into(),
v if v <= 255. => "right and behind".into(),
v if v <= 285. => "right".into(),
v if v <= 315. => "right and ahead".into(),
v if v <= 345. => "ahead and right".into(),
_ => "ahead".into(),
v if v <= 15. => "12:00".into(),
v if v <= 45. => "11:00".into(),
v if v <= 75. => "10:00".into(),
v if v <= 105. => "9:00".into(),
v if v <= 135. => "8:00".into(),
v if v <= 165. => "7:00".into(),
v if v <= 195. => "6:00".into(),
v if v <= 225. => "5:00".into(),
v if v <= 255. => "4:00".into(),
v if v <= 285. => "3:00".into(),
v if v <= 315. => "2:00".into(),
v if v <= 345. => "1:00".into(),
_ => "12:00".into(),
}
} else {
self.direction(other).into()