From 2d704858c4c5259493db0e31c4ee1de7b16409ee Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 2 Dec 2013 23:09:07 +0100 Subject: reflection is always downward --- raytracer.hs | 6 +++--- 1 file 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) -- cgit v1.2.3