summaryrefslogtreecommitdiffstats
path: root/raytracer.hs
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2013-11-23 11:22:14 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2013-11-23 11:22:14 +0100
commit6d592918ef72a956abcbaf2736a3f04f372ee175 (patch)
tree270caf8fab006417e3b682beca4c9c96e252f102 /raytracer.hs
parent92d525aa9a908bdc1417455ed27839e96cc4aa5d (diff)
downloadhaskell-6d592918ef72a956abcbaf2736a3f04f372ee175.tar.gz
haskell-6d592918ef72a956abcbaf2736a3f04f372ee175.tar.bz2
haskell-6d592918ef72a956abcbaf2736a3f04f372ee175.zip
fix
Diffstat (limited to 'raytracer.hs')
-rw-r--r--raytracer.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/raytracer.hs b/raytracer.hs
index 899b922..f33a87f 100644
--- a/raytracer.hs
+++ b/raytracer.hs
@@ -21,8 +21,8 @@ oversampling = 2 -- each pixel is 2x2 rays
ov_alphaoffset = ((alpha2 - alpha1) / (w-1)) / oversampling
ov_betaoffset = ((beta2 - beta1) / (h-1)) / oversampling
-ov_alphaoffsets = take oversampling [0,ov_alphaoffset..]
-ov_betaoffsets = take oversampling [0,ov_betaoffset..]
+ov_alphaoffsets = take (round oversampling) [0,ov_alphaoffset..]
+ov_betaoffsets = take (round oversampling) [0,ov_betaoffset..]
imgheader = "P3 " ++ (show w) ++ " " ++ (show h) ++ " 255\n"
@@ -68,8 +68,8 @@ pixel_to_ppm (r,g,b) = show r ++ " " ++ show g ++ " " ++ show b ++ "\n"
-- from one pixel alpha beta, get a list of oversampled pixels
--oversample (a,b) = (cartProd ov_alphaoffsets ov_betaoffsets)
--- allpixels = map (uncurry pixel_color) (cartProdTranspose betas alphas)
+allpixels = map (uncurry pixel_color) (cartProdTranspose betas alphas)
---image = imgheader ++ (foldr (++) "" (map pixel_to_ppm allpixels))
+image = imgheader ++ (foldr (++) "" (map pixel_to_ppm allpixels))
---main = writeFile "foo.ppm" image
+main = writeFile "foo.ppm" image