Exemple #1
0
  /**
   * Given a working point and a reference point, rotate the working point by the given angle around
   * the reference point.
   *
   * @param p
   * @param angle
   * @param around
   * @return
   */
  private static BitPoint rotatePoint(BitPoint p, float angle, BitPoint around) {
    double s = Math.sin(angle);
    double c = Math.cos(angle);

    // translate point back to origin:
    p.x -= around.x;
    p.y -= around.y;

    // rotate point
    double xnew = p.x * c - p.y * s;
    double ynew = p.x * s + p.y * c;

    // translate point back:
    p.x = (float) (xnew + around.x);
    p.y = (float) (ynew + around.y);
    return p;
  }
Exemple #2
0
 @Override
 public BitPoint[] getProjectionPoints() {
   return new BitPoint[] {rightAngle, rightAngle.plus(width, 0), rightAngle.plus(0, height)};
 }