equals2DWithTolerance method

bool equals2DWithTolerance(
  1. Coordinate c,
  2. double tolerance
)

Tests if another Coordinate has the same values for the X and Y ordinates, within a specified tolerance value. The Z ordinate is ignored.

@param c a Coordinate with which to do the 2D comparison. @param tolerance the tolerance value to use @return true if other is a Coordinate with the same values for X and Y.

Implementation

bool equals2DWithTolerance(Coordinate c, double tolerance) {
  if (!NumberUtils.equalsWithTolerance(this.x, c.x, tolerance)) {
    return false;
  }
  if (!NumberUtils.equalsWithTolerance(this.y, c.y, tolerance)) {
    return false;
  }
  return true;
}