From 32c30cbb320650508dfd19eade9de84d3111d0d2 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 6 May 2011 18:08:17 -0400 Subject: [PATCH] Add a bunch of broken y-axis rotations (still using the x-axis code). --- src/Cardinal.hs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Cardinal.hs b/src/Cardinal.hs index c6f7e8f..c6d98db 100644 --- a/src/Cardinal.hs +++ b/src/Cardinal.hs @@ -89,3 +89,43 @@ ccwx (Quotient c0 c1) = Quotient (ccwx c0) (ccwx c1) -- | Rotate a cardinal direction clockwise about the x-axis. cwx :: Cardinal -> Cardinal cwx = ccwx . ccwx . ccwx + + +-- | Rotate a cardinal direction counter-clockwise about the x-axis. +ccwy :: Cardinal -> Cardinal +ccwy F = F +ccwy B = B +ccwy L = T +ccwy R = D +ccwy D = L +ccwy T = R +ccwy FL = FT +ccwy FR = FD +ccwy FD = FL +ccwy FT = FR +ccwy BL = BT +ccwy BR = BD +ccwy BD = BL +ccwy BT = BR +ccwy LD = LT +ccwy LT = RT +ccwy RD = LD +ccwy RT = RD +ccwy FLD = FLT +ccwy FLT = FRT +ccwy FRD = FLD +ccwy FRT = FRD +ccwy BLD = BLT +ccwy BLT = BRT +ccwy BRD = BLD +ccwy BRT = BRD +ccwy I = I +ccwy (Scalar s) = (Scalar s) +ccwy (Sum c0 c1) = Sum (ccwy c0) (ccwy c1) +ccwy (Difference c0 c1) = Difference (ccwy c0) (ccwy c1) +ccwy (Product c0 c1) = Product (ccwy c0) (ccwy c1) +ccwy (Quotient c0 c1) = Quotient (ccwy c0) (ccwy c1) + +-- | Rotate a cardinal direction clockwise about the x-axis. +cwy :: Cardinal -> Cardinal +cwy = ccwy . ccwy . ccwy -- 2.43.2