Circle.hs: only compute sqrt 2 once.

This commit is contained in:
joachim.fasting
2007-06-18 23:20:51 +00:00
parent 9715298a0e
commit 0f4d83c6ca

View File

@@ -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