function [mov] = make_movie(eyes, foc, asize, bsize) %This function makes a movie of the cereal %box as it's view from the multiple centers %of projection provided by eyes. The user %can also specify resolution and focal %length. cereal_box = [-5 -5 -5 -5 -5 -5 -5 -5 -5 3 3 3 3 3 3 11 11 11 11 11 11 11 11 11; -15 -15 -15 0 0 0 15 15 15 -15 -15 -15 15 15 15 -15 -15 -15 0 0 0 15 15 15; -20 0 20 -20 0 20 -20 0 20 -20 0 20 -20 0 20 -20 0 20 -20 0 20 -20 0 20]; set(gca,'nextplot','replacechildren'); aviobj = avifile('cool15.avi'); aviobj.Quality = 100; isize = size(eyes); I = zeros(bsize,asize); for j= 1:isize(2); ceye = eyes(1:3,j); %ceye(3) = -ceye(3); %I had to do this, until I started saving to %an avi file. I think it has to do with how %the avi object views the frame verses how %the figure plotter views it. [P,foc_v] = Pifw(ceye',foc,asize,bsize); for i = 1:24 curpent = cereal_box(1:3,i); curpent = curpent - ceye; if dot(curpent,foc_v) > 0 dotty(1:3,i) = curpent; end end dots = P*dotty; %I do kinda clipping. An easy fix is to %dot the potential point with the foc_v %from Pifw and only draw if the result is %positive. As per Roberts hidden-surface %algorithm, that mean the potential point %is on the same side of the plane through %cop as the vector normal to cop. I = Splat(I, dots); %max(max(I)) imagesc(I, [0 240]); colormap(gray); %As discussed in Splat: in order to prevent %the dimming of most dots when others %intersect on the screen, I have to clamp %the grayscale domain on the image, so that %matlab doesn't do its own scaling to fit %the grayscale values. (It's the [0 240] %above.) mov(j) = getframe; aviobj = addframe(aviobj,mov(j)); end aviobj = close(aviobj); movie(mov)