Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function draw_roses(n)
- color = ['r' 'b' 'm'];
- T = 360/n;
- t = 0; i = 0;
- while t<360
- t=t+T;
- i=i+1; if (i > 3) i=1; end
- rose(1, color(i), t);
- pause(0.2);
- end
- end
- function rose(a, color, degree)
- t=0;
- p=Pero(a, 0);
- p.set('lineColor', color);
- while (t < 2*pi)
- t=t+pi/60;
- x=a*cos(t)*cos(3*t);
- y=a*sin(t)*cos(3*t);
- p.punct(x, y);
- end
- p.transform(@rotation, degree);
- p.draw;
- end
- function [x2, y2]=rotation(x1, y1, degree)
- t=degree*pi/180;
- x2 = x1*cos(t) - y1*sin(t);
- y2 = x1*sin(t) + y1*cos(t);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement