From 50c635a862c38a0ca07b2e77068d6f2a58bbb487 Mon Sep 17 00:00:00 2001 From: Kai Grossjohann Date: Sat, 21 Jul 2007 22:40:26 +0200 Subject: 3col rounding darcs-hash:20070721204026-07ca0-176eb30577633174db0f20f827923aff32ecad19.gz --- ThreeColumns.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ThreeColumns.hs') diff --git a/ThreeColumns.hs b/ThreeColumns.hs index c8edc5f..0abaac2 100644 --- a/ThreeColumns.hs +++ b/ThreeColumns.hs @@ -59,7 +59,7 @@ tile3 f r nmaster n where (r1, r2, r3) = split3HorizontallyBy f r (s1, s2) = splitHorizontallyBy f r nslave = (n - nmaster) - nmid = floor (nslave % 2) + nmid = ceiling (nslave % 2) nright = (n - nmaster - nmid) split3HorizontallyBy :: Rational -> Rectangle -> (Rectangle, Rectangle, Rectangle) @@ -67,6 +67,6 @@ split3HorizontallyBy f (Rectangle sx sy sw sh) = ( Rectangle sx sy leftw sh , Rectangle (sx + fromIntegral leftw) sy midw sh , Rectangle (sx + fromIntegral leftw + fromIntegral midw) sy rightw sh ) - where leftw = floor $ fromIntegral sw * (2/3) * f - midw = floor ( (sw - leftw) % 2 ) + where leftw = ceiling $ fromIntegral sw * (2/3) * f + midw = ceiling ( (sw - leftw) % 2 ) rightw = sw - leftw - midw -- cgit v1.2.3