summaryrefslogtreecommitdiffstats
path: root/raytracer.hs
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-02 23:09:07 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-02 23:09:07 +0100
commit2d704858c4c5259493db0e31c4ee1de7b16409ee (patch)
tree0bf451cdbd62ac30adb7f9d9d103121941a51852 /raytracer.hs
parent2b722cf3bdd267c999f25c4f1c2ebb4cc4d27cb4 (diff)
downloadhaskell-2d704858c4c5259493db0e31c4ee1de7b16409ee.tar.gz
haskell-2d704858c4c5259493db0e31c4ee1de7b16409ee.tar.bz2
haskell-2d704858c4c5259493db0e31c4ee1de7b16409ee.zip
reflection is always downward
Diffstat (limited to 'raytracer.hs')
-rw-r--r--raytracer.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/raytracer.hs b/raytracer.hs
index a49e5cd..fe873e0 100644
--- a/raytracer.hs
+++ b/raytracer.hs
@@ -38,7 +38,7 @@ spheres num = [ trace ("Sphere at " ++
show (round (80 * sin(num * degrees))) ++ "," ++
show (round (80 * cos(num * degrees))) ++ ",5" )
Sphere (80 * sin(num * degrees), 80 * cos(num * degrees), 5) 10 (255,60,0),
- sphere1]
+ sphere1, sphere2]
writenum :: Double -> IO ()
writenum num = trace ("Rendering " ++ show (filename $ round num))
@@ -85,7 +85,7 @@ attenuate_color factor (r,g,b) = ( round $ fromIntegral r * factor,
spherical_proj :: Coord -> Angle -> Angle -> Double -> Coord
spherical_proj (x,y,z) alpha beta dist = (x + dist*(sin beta * cos alpha),
y + dist*(sin beta * sin alpha),
- z + dist*cos beta)
+ z + dist*cos beta - 0.1)
-- intersect sphere
@@ -120,7 +120,7 @@ intersect_sphere source spheres (alpha, beta) (Sphere centre radius color)
aa = sin beta * cos alpha
bb = sin beta * sin alpha
cc = cos beta
- reflection_angle = (0, -beta)
+ reflection_angle = (-alpha, 180)
intersect_point_floor :: Coord -> ScreenCoord -> (Coord, Double)