// Called when the user releases the mouse button after drawing a wall
  // If the mouse is on a wall then the wall that was drawn will resize automatically
  public boolean completeWall(float x, float y) {
    WallModel wall = isOnWall(x, y);

    // Check if the mouse was on a wall when released
    if (wall != null) {
      // If the user drew a horizontal wall and mouse was released on a vertical wall adjust the
      // starting X position and width
      if (wall.getWidth() > wall.getHeight() && currentWall.getHeight() > currentWall.getWidth()) {
        if (wall.getStartPositionX() <= currentWall.getStartPositionX()
            && wall.getStartPositionX() + wall.getWidth()
                > currentWall.getStartPositionX() + currentWall.getWidth()) {
          if (wall.getStartPositionY() > currentWall.getStartPositionY()) {
            currentWall.setHeight(
                wall.getStartPositionY() + wall.getHeight() - currentWall.getStartPositionY());
          } else {
            currentWall.setHeight(
                (currentWall.getStartPositionY() + currentWall.getHeight())
                    - wall.getStartPositionY());
            currentWall.setStartPositionY(wall.getStartPositionY());
          }
        }
      } else { // else if the the user drew a vertical wall and released it on a horizontal wall
               // adjust the starting Y position and height
        if (wall.getStartPositionY() <= currentWall.getStartPositionY()
            && wall.getStartPositionY() + wall.getHeight()
                > currentWall.getStartPositionY() + currentWall.getHeight()) {
          if (wall.getStartPositionX() > currentWall.getStartPositionX()) {
            currentWall.setWidth(
                wall.getStartPositionX() + wall.getWidth() - currentWall.getStartPositionX());
          } else {
            currentWall.setWidth(
                (currentWall.getStartPositionX() + currentWall.getWidth())
                    - wall.getStartPositionX());
            currentWall.setStartPositionX(wall.getStartPositionX());
          }
        }
      }

      // return true so that the geometry model can be updated in the WireFrameDisplay class
      return true;
    }

    currentWall = null;
    tempWall = null;

    return false;
  }
  // Manipulate the width and height of the wall
  public void drawWall(float px, float py, float cx, float cy) {
    float halfThickness = externalWallThickness / 2f;
    float startX, startY, width, height;

    startX = startY = width = height = 0;

    float x = cx - px;
    float y = cy - py;

    if (currentWall != null) {
      // This if else structure determines which direction the wall will extrude based on the mouse
      // position
      if (x > Math.abs(y) && x > 0) {
        // Adjust Width (Right)
        currentWall.setStartPositionY(tempWall.getStartPositionY());
        width = (cx - px + halfThickness);
        height = externalWallThickness;
      } else if (y < x && y < 0) {
        // Adjust Starting Y (Up)
        currentWall.setStartPositionX(tempWall.getStartPositionX());
        startY = (tempWall.getStartPositionY() - py + cy + halfThickness);
        currentWall.setStartPositionY(startY);
        height = (halfThickness + py - cy);
        width = externalWallThickness;
      } else if (y > Math.abs(x) && y > 0) {
        // Adjust Height (Down)
        currentWall.setStartPositionX(tempWall.getStartPositionX());
        height = (cy - py + halfThickness);
        width = externalWallThickness;
      } else {
        // Adjust Starting X (Left)
        currentWall.setStartPositionY(tempWall.getStartPositionY());
        startX = (tempWall.getStartPositionX() - px + cx + halfThickness);
        currentWall.setStartPositionX(startX);
        width = (halfThickness + px - cx);
        height = externalWallThickness;
      }

      currentWall.setWidth(width);
      currentWall.setHeight(height);
    }
  }