Code covered by the BSD License  

Highlights from
Pyramid built by UFO

image thumbnail

Pyramid built by UFO

by

 

Using matrix transformations and light to create ufo building pyramid.

antenna(zpos,height,rad)
%Gustavo Adalid Orellana
%May 7, 2009
%This draws an antenna starting at positon zpos
%parameter: h is height, r is radius, zpos is the starting
%z position.
%Return: a handle to the parent
function h = antenna(zpos,height,rad)
hold on
h = hgtransform;
i = hgtransform;
set(i,'Parent',h);
[x,y,z] = cylinder([(rad+0.05) rad],10);
z = (z.*height) + zpos; %elongate, then translate.
f = surf(x,y,z);%cylinder
set(f,'Parent',h,'FaceColor',[.7 .7 .8],'EdgeAlpha',0);
g = sphereA(10,rad*2);
set(g,'Parent',i,'FaceColor',[.4 .6 .1]);
spherePos = z(end,1) + rad*2; %var to set base of sph. at top of antenna
set(i,'Matrix',makehgtform('translate',[0 0 spherePos]));
hold off

Contact us