Esempio n. 1
0
  /**
   * @param coord
   * @param width
   * @param center
   * @param height
   * @return true if inside the rectangle defined by values (inclusive)
   */
  public static boolean isInside(
      final PlanVector coord, final float width, final PlanVector center, final float height) {

    return coord.x() >= center.x() - width / 2
        && coord.y() >= center.y() - height / 2
        && coord.x() <= center.x() + width / 2
        && coord.y() <= center.y() + height / 2;
  }
Esempio n. 2
0
  /**
   * @param coord
   * @param leftTopCorner
   * @param width
   * @param height
   * @return true if inside the rectangle defined by values (inclusive)
   */
  public static boolean isInside(
      final PlanVector coord,
      final PlanVector leftTopCorner,
      final float width,
      final float height) {

    return coord.x() >= leftTopCorner.x()
        && coord.y() >= leftTopCorner.y()
        && coord.x() <= leftTopCorner.x() + width
        && coord.y() <= leftTopCorner.y() + height;
  }