function [I] = random_raytrace(n_spheres, n_lights, given_spheres, planes) %This calls raytrace to create an image of n_spheres randomly %places spheres with n_lights randomly placed lights. spheres = rand(n_spheres, 14); spheres(:, 4) = .01 + .08*spheres(:,4); spheres(:,5:7) = .1 + .1*spheres(:,5:7); spheres(:,8:10) = .2 + .2*spheres(:,8:10); spheres(:,11:13) = .3 + .3*spheres(:,11:13); for i = 1:n_spheres if spheres(i,4) < .1 spheres(i,14) = 128; else spheres(i,14) = 64; end end q = size(given_spheres); q = q(1); if q >0 spheres(n_spheres+1:n_spheres+q,1:14) = given_spheres; end lights = rand(n_lights, 12); lights(:, 4:12) = .6 + .4*lights(:,4:12); I = raytrace_with_planes(spheres,planes,lights, [1.5 1.5 1.5],[-1.5 -1.5 -1.4],200, 200);