Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. public void draw() {
  2.     double x0, x1, x2, x3, y0, y1, y2, y3;
  3.  
  4.     x0 = posX + size * Math.cos(angle);
  5.     x1 = posX + size * Math.cos(angle + Math.PI - 0.8);
  6.     x2 = posX - (size / 3) * Math.cos(angle);
  7.     x3 = posX + size * Math.cos(angle + Math.PI + 0.8);
  8.  
  9.     y0 = posY + size * Math.sin(angle);
  10.     y1 = posY + size * Math.sin(angle + Math.PI - 0.8);
  11.     y2 = posY - (size / 3) * Math.sin(angle);
  12.     y3 = posY + size * Math.sin(angle + Math.PI + 0.8);
  13.  
  14.     double[] shapeX = new double[] { x0, x1, x2, x3 };
  15.     double[] shapeY = new double[] { y0, y1, y2, y3 };
  16.  
  17.     StdDraw.setPenColor(StdDraw.BLUE);
  18.     StdDraw.filledCircle(posX, posY, size);
  19.    
  20.     StdDraw.setPenColor(StdDraw.WHITE);
  21.     StdDraw.filledPolygon(shapeX, shapeY);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement