Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void draw() {
- double x0, x1, x2, x3, y0, y1, y2, y3;
- x0 = posX + size * Math.cos(angle);
- x1 = posX + size * Math.cos(angle + Math.PI - 0.8);
- x2 = posX - (size / 3) * Math.cos(angle);
- x3 = posX + size * Math.cos(angle + Math.PI + 0.8);
- y0 = posY + size * Math.sin(angle);
- y1 = posY + size * Math.sin(angle + Math.PI - 0.8);
- y2 = posY - (size / 3) * Math.sin(angle);
- y3 = posY + size * Math.sin(angle + Math.PI + 0.8);
- double[] shapeX = new double[] { x0, x1, x2, x3 };
- double[] shapeY = new double[] { y0, y1, y2, y3 };
- StdDraw.setPenColor(StdDraw.BLUE);
- StdDraw.filledCircle(posX, posY, size);
- StdDraw.setPenColor(StdDraw.WHITE);
- StdDraw.filledPolygon(shapeX, shapeY);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement