DrawStar - % Set up the vertices tau = pi/5; for k=1:11...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function DrawStar(xc,yc,r,c) % Adds a 5-pointed star to the current window. % Assumes hold is on. % The star has radius r, center(xc,yc) and % color c where c is one of 'r', 'g', 'y', etc. % % The radius of the inner 5 vertices. . r2 = r/(2*(1+sin(pi/10)));
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Set up the vertices tau = pi/5; for k=1:11 theta = (2*k-1)*pi/10; if 2*floor(k/2)~=k x(k) = xc + r*cos(theta); y(k) = yc + r*sin(theta); else x(k) = xc + r2*cos(theta); y(k) = yc + r2*sin(theta); end end fill(x,y,c)...
View Full Document

Ask a homework question - tutors are online