コード例 #1
0
 protected Point translate(Point p) {
   if (rotationAngle == 0) return p;
   double theta = Math.toRadians(rotationAngle);
   double x = Math.cos(theta) * p.getX() - Math.sin(theta) * p.getY();
   double y = Math.sin(theta) * p.getX() + Math.cos(theta) * p.getY();
   return new Point((int) x, (int) y);
 }
コード例 #2
0
  public PolygonalAperture(ArrayList<Point> points) {
    super();
    this.points = points;

    for (Point p : points) {
      maxX = Math.max(maxX, p.getX());
      minX = Math.min(minX, p.getX());
      maxY = Math.max(maxY, p.getY());
      minY = Math.min(minY, p.getY());
    }
  }
コード例 #3
0
 @Override
 public Aperture rotate(boolean clockwise) {
   ArrayList<Point> newPoints = new ArrayList<Point>();
   for (Point p : points) {
     Point point;
     if (clockwise) point = new Point(p.getY(), -p.getX());
     else point = new Point(-p.getY(), p.getX());
     newPoints.add(point);
   }
   points = newPoints;
   return this;
 }