diff options
author | joachim.fasting <joachim.fasting@gmail.com> | 2007-06-19 01:20:51 +0200 |
---|---|---|
committer | joachim.fasting <joachim.fasting@gmail.com> | 2007-06-19 01:20:51 +0200 |
commit | 01a74bc7849aba9306f4c48b4bb0673aed5f6cd3 (patch) | |
tree | a878aad53e88c08dba6e1c957c4c1997fbc294df | |
parent | 1814ad0224ac36c8b3d3f335b7845f3d0b6ef572 (diff) | |
download | XMonadContrib-01a74bc7849aba9306f4c48b4bb0673aed5f6cd3.tar.gz XMonadContrib-01a74bc7849aba9306f4c48b4bb0673aed5f6cd3.tar.xz XMonadContrib-01a74bc7849aba9306f4c48b4bb0673aed5f6cd3.zip |
Circle.hs: only compute sqrt 2 once.
darcs-hash:20070618232051-ea16c-2d78b71c7164302c56e2dfd11fdac9f6f4830624.gz
-rw-r--r-- | Circle.hs | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -38,8 +38,9 @@ circleLayout r (w:ws) = return $ (w, center r) : (zip ws sats) center :: Rectangle -> Rectangle center (Rectangle sx sy sw sh) = Rectangle x y w h - where w = round ((fromIntegral sw / sqrt 2) :: Double) - h = round ((fromIntegral sh / sqrt 2) :: Double) + where s = sqrt 2 + w = round ((fromIntegral sw / s) :: Double) + h = round ((fromIntegral sh / s) :: Double) x = sx + fromIntegral (sw - w) `div` 2 y = sy + fromIntegral (sh - h) `div` 2 |