|      4 import Image |      4 import Image | 
|      5  |      5  | 
|      6 rt = Raytracer() |      6 rt = Raytracer() | 
|      7  |      7  | 
|      8 light1 = Light(position=(0.0, 5.0, -5.0), colour=(0.7, 0.3, 0.6)) |      8 light1 = Light(position=(0.0, 5.0, -5.0), colour=(0.7, 0.3, 0.6)) | 
|      9 rt.addlight(light1) |      9 rt.addLight(light1) | 
|     10  |     10  | 
|     11 light2 = Light(position=(-2.0, 10.0, -2.0), colour=(0.4, 0.6, 0.3)) |     11 light2 = Light(position=(-2.0, 10.0, -2.0), colour=(0.4, 0.6, 0.3)) | 
|     12 rt.addlight(light2) |     12 rt.addLight(light2) | 
|     13  |     13  | 
|     14 mat0 = Material(colour=(0.7, 0.7, 0.7)) |     14 mat0 = Material(colour=(0.7, 0.7, 0.7)) | 
|     15 mat0.setReflectivity(0.0) |     15 mat0.setReflectivity(0.0) | 
|     16 for x in range(8): |     16 for x in range(8): | 
|     17 	for y in range(8): |     17 	for y in range(8): | 
|     18 		for z in range(8): |     18 		for z in range(8): | 
|     19 			box = Box(L=(-4.3+x, -4.6+y, -8.6+z), H=(-3.7+x, -4.0+y, -8.0+z), material=mat0) |     19 			box = Box(L=(-4.3+x, -4.6+y, -8.6+z), H=(-3.7+x, -4.0+y, -8.0+z), material=mat0) | 
|     20 			rt.addshape(box) |     20 			rt.addShape(box) | 
|     21  |     21  | 
|     22 imagesize = (800, 600) |     22 imagesize = (800, 600) | 
|     23 data = rt.render(imagesize) |     23 data = rt.render(imagesize) | 
|     24 img = Image.fromstring("RGB", imagesize, data) |     24 img = Image.fromstring("RGB", imagesize, data) | 
|     25 img.save('boxes.png') |     25 img.save('boxes.png') |