testEquals3D static method

bool testEquals3D(
  1. Box box1,
  2. Box box2, {
  3. double toleranceHoriz = defaultEpsilon,
  4. double toleranceVert = defaultEpsilon,
})

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

Implementation

static bool testEquals3D(
  Box box1,
  Box box2, {
  double toleranceHoriz = defaultEpsilon,
  double toleranceVert = defaultEpsilon,
}) {
  assertTolerance(toleranceVert);
  if (!Box.testEquals2D(box1, box2, toleranceHoriz: toleranceHoriz)) {
    return false;
  }
  if (!box1.is3D || !box1.is3D) {
    return false;
  }

  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;
}