Use clock facings for relative directions.
This commit is contained in:
parent
fae8b559cf
commit
9a85544ad5
26
src/core.rs
26
src/core.rs
|
@ -387,19 +387,19 @@ pub trait PointLike {
|
||||||
let bearing = self.bearing(other);
|
let bearing = self.bearing(other);
|
||||||
let relative = (bearing - yaw).degrees();
|
let relative = (bearing - yaw).degrees();
|
||||||
match relative {
|
match relative {
|
||||||
v if v <= 15. => "ahead".into(),
|
v if v <= 15. => "12:00".into(),
|
||||||
v if v <= 45. => "ahead and left".into(),
|
v if v <= 45. => "11:00".into(),
|
||||||
v if v <= 75. => "left and ahead".into(),
|
v if v <= 75. => "10:00".into(),
|
||||||
v if v <= 105. => "left".into(),
|
v if v <= 105. => "9:00".into(),
|
||||||
v if v <= 135. => "left and behind".into(),
|
v if v <= 135. => "8:00".into(),
|
||||||
v if v <= 165. => "behind and left".into(),
|
v if v <= 165. => "7:00".into(),
|
||||||
v if v <= 195. => "behind".into(),
|
v if v <= 195. => "6:00".into(),
|
||||||
v if v <= 225. => "behind and right".into(),
|
v if v <= 225. => "5:00".into(),
|
||||||
v if v <= 255. => "right and behind".into(),
|
v if v <= 255. => "4:00".into(),
|
||||||
v if v <= 285. => "right".into(),
|
v if v <= 285. => "3:00".into(),
|
||||||
v if v <= 315. => "right and ahead".into(),
|
v if v <= 315. => "2:00".into(),
|
||||||
v if v <= 345. => "ahead and right".into(),
|
v if v <= 345. => "1:00".into(),
|
||||||
_ => "ahead".into(),
|
_ => "12:00".into(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.direction(other).into()
|
self.direction(other).into()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user