%--------------------------------------------------------------------------
% EPS109, Fall 2009, UC Berkeley
% Author: Vu Chiem
% Description: Final Project, Sierpinski Carpet Movie
% Reference URL: http://en.wikipedia.org/wiki/Sierpinski_carpet
%--------------------------------------------------------------------------

%--------------------------------------------------------------------------
% APPROACH:
% - It's easier to declare the grid as a block of black pixels. Then, we
% need to color other pixels white as necessary.
% - In this example, we make white those pixels that we skip in the
% Sierpinski Carpet.
%--------------------------------------------------------------------------


% Variables + Constants
global grid nPoints;

nPoints = 3^7;
grid = ones(nPoints, nPoints, 'uint8');   % |nPoints|^2-pixel 2D grid

% Movie (by saving frames)
global m frames_per_image;
m = 1;
frames_per_image = 200;

sierpinski_movie(1, nPoints, 1, nPoints, nPoints);

fprintf('Written to %d images.\n', floor(m / frames_per_image));
