Code covered by the BSD License  

Highlights from
Pyramid built by UFO

image thumbnail

Pyramid built by UFO

by

Gustavo Orellana

 

Using matrix transformations and light to create ufo building pyramid.

drawBlocks(n,position)
%Gustavo Adalid Orellana
%May 9, 2009
%Draws n cubes at  the positions given by the nx3 matrix position
%Precondition: the number of rows in the matrix position must be
%same size as the number of cubes n to draw. This function does not
%check if they are the same.
%Return: num is a vector containing n values which are the parents
%of each cube.
function num = drawBlocks(n,position)
  num = [];
for i = 1:n
    j = myCube(); %Draw 3x3x3 block
    M = makehgtform('translate',position(i,:));
    set(j,'Matrix',M);%translate the block
    num = [num j];
end

Contact us