Exemple #1
0
  private Polygon outline(int x, int y, double direction) {
    Polygon shape = new Polygon();

    shape.addPoint(x, y);
    addPointRelative(shape, x, y, getOuterRadius(), direction - getAngle());
    addPointRelative(shape, x, y, getInnerRadius(), direction);
    addPointRelative(shape, x, y, getOuterRadius(), direction + getAngle());
    shape.addPoint(x, y); // Closing the polygon (TEG 97-04-23)
    return shape;
  }
Exemple #2
0
 private void addPointRelative(Polygon shape, int x, int y, double radius, double angle) {
   shape.addPoint(x + (int) (radius * Math.cos(angle)), y + (int) (radius * Math.sin(angle)));
 }