Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. String c = "";
  2. for (int n=0; n <4; n++){
  3.  
  4. for (int i=0; i < a.length(); i++){
  5.   char d = a.charAt(i);
  6.   if (d == 'X'){
  7.   c = c + "X+YF++YF-FX--FXFX-YF+";  
  8.   }
  9.   else if (d=='Y'){
  10.     c = c + "-FX+YFYF++YF+FX--FX-Y";
  11.   }
  12.   else c = c + d;
  13. }
  14. a=c;
  15. }
  16.  
  17. for (int i=0; i < c.length(); i++){
  18.   char b = c.charAt(i);
  19.   if (b == '+'){
  20.  
  21.   angle = angle + radians(60);
  22.   }
  23.   if(b == '-'){
  24.   angle = angle + radians(300);
  25.   }
  26.   if (b=='F'){
  27.    
  28.     px2=px1 + 5*cos(angle);
  29.     py2=py1 + 5*sin(angle);
  30.     line(px1,py1,px2,py2);
  31.     px1=px2;
  32.     py1=py2;
  33.    
  34.   }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement