testEquals3D static method

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

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

Implementation

static bool testEquals3D(
  Box box1,
  Box box2, {
  num? toleranceHoriz,
  num? toleranceVert,
}) {
  assertTolerance(toleranceVert);
  if (!Box.testEquals2D(box1, box2, toleranceHoriz: toleranceHoriz)) {
    return false;
  }
  if (!box1.is3D || !box1.is3D) {
    return false;
  }
  if (toleranceVert != null) {
    final minZ1 = box1.minZ;
    final maxZ1 = box1.maxZ;
    final minZ2 = box2.minZ;
    final maxZ2 = box2.maxZ;
    return minZ1 != null &&
        maxZ1 != null &&
        minZ2 != null &&
        maxZ2 != null &&
        (minZ1 - minZ2).abs() <= toleranceVert &&
        (maxZ1 - maxZ2).abs() <= toleranceVert;
  } else {
    return box1.minZ == box2.minZ && box1.maxZ == box2.maxZ;
  }
}