[Shootout-list] Ray tracer

Jon Harrop jon@ffconsultancy.com
Wed, 27 Apr 2005 18:20:31 +0100


I've knocked up a little ray tracer to see if it is feasible to get one in the 
shootout. I think it'll take quite a bit of work to cut it down to be small 
enough. My current attempt (222 LOC in OCaml but with lots of dandy features) 
is on-line here:

  http://www.ffconsultancy.com/free/ray_tracer/

I must say that I'm stunned at how effective this little OCaml program is! :-)

Anyway, I think an interesting quirk to be to allow the scene to be lazily 
evaluated in a functional language. With 7 levels of spheres, giving about 
600,000 objects, a lot of time is spent generating (and probably traversing) 
a huge data structure. This is silly though, because there's no need to 
explicitly calculate anything.

I'd like to hear people's comments.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists