Returns the direction opposite this one, or Center if it's Center.
(&self)
| 97 | |
| 98 | /// Returns the direction opposite this one, or Center if it's Center. |
| 99 | pub fn opposite(&self) -> Direction { |
| 100 | if *self == Center { |
| 101 | return Center; |
| 102 | } |
| 103 | let new_dir = ((*self as u8) + 4) % 8; |
| 104 | Direction::num_to_direction(new_dir) |
| 105 | } |
| 106 | |
| 107 | /// Returns the direction 45 degrees to the left (counter-clockwise) of |
| 108 | /// this one, or Center if it's Center. |
no outgoing calls