Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String c = "";
- for (int n=0; n <4; n++){
- for (int i=0; i < a.length(); i++){
- char d = a.charAt(i);
- if (d == 'X'){
- c = c + "X+YF++YF-FX--FXFX-YF+";
- }
- else if (d=='Y'){
- c = c + "-FX+YFYF++YF+FX--FX-Y";
- }
- else c = c + d;
- }
- a=c;
- }
- for (int i=0; i < c.length(); i++){
- char b = c.charAt(i);
- if (b == '+'){
- angle = angle + radians(60);
- }
- if(b == '-'){
- angle = angle + radians(300);
- }
- if (b=='F'){
- px2=px1 + 5*cos(angle);
- py2=py1 + 5*sin(angle);
- line(px1,py1,px2,py2);
- px1=px2;
- py1=py2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement