Python Raytracer in 50 Lines of Code

I've come to like the expressiveness of the Python language, though I dislike some of the other features. Here's a 50 line raytracer that renders scenes of colored spheres to a PNG file:

import math
from PIL import Image

def sub(v1, v2): return [x-y for x ...
more ...

Ray-Sphere Intersection

I'm writing a small raytracer to familiarize myself with Java. Obviously many of the main algorithms need to be as fast as possible in order to eventually get to real time speeds.

Here's my optimized version of a ray-sphere intersect check. It can probably be tweaked further: 9 ...

more ...