testEquals2D static method

bool testEquals2D(
  1. Box box1,
  2. Box box2, {
  3. num? toleranceHoriz,
})

True if positions box1 and box2 equals by testing 2D coordinates only.

Implementation

static bool testEquals2D(
  Box box1,
  Box box2, {
  num? toleranceHoriz,
}) {
  assertTolerance(toleranceHoriz);
  return toleranceHoriz != null
      ? (box1.minX - box2.minX).abs() <= toleranceHoriz &&
          (box1.minY - box2.minY).abs() <= toleranceHoriz &&
          (box1.maxX - box2.maxX).abs() <= toleranceHoriz &&
          (box1.maxY - box2.maxY).abs() <= toleranceHoriz
      : box1.minX == box2.minX &&
          box1.minY == box2.minY &&
          box1.maxX == box2.maxX &&
          box1.maxY == box2.maxY;
}