src/main/java/chalmers/pimp/model/LayerRotation.java
public void update(int x, int y) {
    if (isFinished) {
      return;
    }
    double dx = x - rotationAnchorPoint.getX();
    double dy = y - rotationAnchorPoint.getY();

    currentDegree = (int) toDegrees(Math.atan(dy / dx));
    /**
     *     Since Math.atan isn't defined for angles in second and third quadrant and simply inverts
     *     the result a half rotation is added.
     *     Not a perfect solution but works for this prototype project.
     */
    if ((mouseStartDx > 0 && dx < 0) || (mouseStartDx < 0 && dx > 0)) {
      currentDegree += 180;
    }
    //Any rotation is based on the start position of the mouse.
    currentDegree = baseDegree + (currentDegree - mouseStartDegree);
  }
/**
   * Updates the state of the layer rotation. This method has no effect if the {@link
   * LayerMovement#stop()} method has been called on the layer rotation instance.
   *
   * @param x the current x-coordinate of the mouse.
   * @param y the current y-coordinate of the mouse.
   */
Updates the state of the layer rotation. This method has no effect if the {@link
LayerMovement#stop()} method has been called on the layer rotation instance.

@param x the current x-coordinate of the mouse.
@param y the current y-coordinate of the mouse.
Updates the state of the layer rotation . This method has no effect if the { @link LayerMovement#stop () } method has been called on the layer rotation instance . @param x the current x - coordinate of the mouse . @param y the current y - coordinate of the mouse .
public void update(int x, int y) {
    if (isFinished) {
      return;
    }
    double dx = x - rotationAnchorPoint.getX();
    double dy = y - rotationAnchorPoint.getY();
    currentDegree = (int) toDegrees(Math.atan(dy / dx));
    /**
     *     Since Math.atan isn't defined for angles in second and third quadrant and simply inverts
     *     the result a half rotation is added.
     *     Not a perfect solution but works for this prototype project.
     */
    if ((mouseStartDx > 0 && dx < 0) || (mouseStartDx < 0 && dx > 0)) {
      currentDegree += 180;
    }
    currentDegree = baseDegree + (currentDegree - mouseStartDegree);
  }
public void update ( int x , int y ) { if ( isFinished ) { return ; } double dx = x - rotationAnchorPoint . getX ( ) ; double dy = y - rotationAnchorPoint . getY ( ) ; currentDegree = ( int ) toDegrees ( Math . atan ( dy / dx ) ) ; /**
     *     Since Math.atan isn't defined for angles in second and third quadrant and simply inverts
     *     the result a half rotation is added.
     *     Not a perfect solution but works for this prototype project.
     */ if ( ( mouseStartDx > 0 && dx < 0 ) || ( mouseStartDx < 0 && dx > 0 ) ) { currentDegree += 180 ; } currentDegree = baseDegree + ( currentDegree - mouseStartDegree ) ; }
Updates the state of the layer rotation.
Updates the state of the layer rotation .
//Any rotation is based on the start position of the mouse.
