%  sierp3(N) displays the N'th step in the generation of the fractal
%  known as the Sierpinski arrowhead.  sierp3(0) displays a tetrahedron;
%  sierp3(1) displays four smaller tetrahedra left when you remove the
%  "middle" of a larger one; etc.
%
%  sierp3 uses four fixed colors for the sides of the tetrahedra.
%
%  See also sierp3c.



% "sierp3.m" written by Albert Dvornik <bert@mit.edu>
% Redistribute freely, but it would be nice to let me know if you use it.


function [] = sierp3(n)

%%% calculate coordinates of the vertices
x = [0, 1, 1/2,       1/2      ];
y = [0, 0, sqrt(3)/2, sqrt(3)/6];
z = [0, 0, 0,         sqrt(2/3)];

%%% set window parameters
clf;
view(viewmtx(45,-7,35));
set(gca,'Visible','off');

%%% call the "helper" procedure and select the color map
sierpiter(x,y,z,n,[.3 .3 .5; .85 .85 .85; 0 0 0; 1 1 .9]);
