From ffa45515c3a95981457361d8527cb9cc465451c3 Mon Sep 17 00:00:00 2001 From: Jonas Betzendahl Date: Fri, 16 May 2014 18:59:26 +0200 Subject: [PATCH] attempting to compensate once more --- src/Map/Map.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Map/Map.hs b/src/Map/Map.hs index 2880d87..2a3cb26 100644 --- a/src/Map/Map.hs +++ b/src/Map/Map.hs @@ -42,9 +42,11 @@ giveMapHeight :: PlayMap -> (Double, Double) -> Double giveMapHeight mop (x,z) - | outsideMap (x,z) = 0.0 - | otherwise = sum $ map (\(p,d) -> (hlu p) * (1 - (d / totald))) tups + | outsideMap (x,z') = 0.0 + | otherwise = sum $ map (\(p,d) -> (hlu p) * (1 - (d / totald))) tups where + z' = z * ((sqrt 3)/2) + outsideMap :: (Double, Double) -> Bool outsideMap (mx, mz) = let ((a,b),(c,d)) = bounds mop fr = fromIntegral @@ -56,13 +58,13 @@ giveMapHeight mop (x,z) -- reference Points refs :: [(Int, Int)] - refs = remdups $ map clmp $ map (tadd (floor x, floor z)) mods + refs = remdups $ map clmp $ map (tadd (floor x, floor z')) mods where mods = [(-1,-1),(-1,2),(0,0),(0,1),(1,0),(1,1),(2,-1),(2,2)] tadd (a,b) (c,d) = (a+b,c+d) -- tupels with reference point and distance - tups = map (\t -> (t, dist (x,z) t)) refs + tups = map (\t -> (t, dist (x,z') t)) refs -- total distance of all for reference point from the point in question totald = sum $ map (\(_,d) -> d) tups