function [mov] = make_ray_movie_2(spheres, planes, lights) %This function makes a movie of the ray traced %spheres, as the spheres move. The user %also specifies resolution. I = zeros(100,100,3); [m,n] = size(I); figure('Units','pixels','Position',[100 100 n m]) image(I); set(gca,'Position',[0 0 1 1]) set(gca,'nextplot','replacechildren'); aviobj = avifile('ray9.avi'); aviobj.Quality = 100; t = 0:.005:1; t = 4*pi*t; q = size(t); t = t'; centers = [.5 + .3*cos(t), .5 + .3*sin(t), (t-.2)/(4*pi) + .5*(cos(t)).^2]; for j= 1:q(2); spheres(5,1:3) = centers(j,1:3); I = raytrace_with_planes(spheres,planes,lights,[1.7 1.7 1.7], [-2 -2 -2], 200,200); %max(max(I)) imagesc(I); mov(j) = getframe; aviobj = addframe(aviobj,mov(j)); end aviobj = close(aviobj); movie(mov)