Rotates a Direction for 180 Degrees.
Up
|> mirror
--> Down
Left
|> mirror
--> RightRotates a Direction clockwise
Up
|> rotateLeftwise
--> LeftRotates a Direction counter-clockwise
Up
|> rotateRightwise
--> RightConvert coordinates into a direction by comparing the sign
{ x = 0, y = 1 }
|> fromCoord
--> Just Down
{ x = 0, y = -1 }
|> fromCoord
--> Just Up
{ x = 1, y = 0 }
|> fromCoord
--> Just Right
{ x = -1, y = 0 }
|> fromCoord
--> Just Left
{ x = 1, y = 1 }
|> fromCoord
--> NothingConvert a direction into an angle.
Right
|> toAngle
--> 0
Up
|> toAngle
--> pi / 2
Left
|> toAngle
--> pi
Down
|> toAngle
--> 3 * pi / 2
A abstract concept of a direction on a grid.