contains method

bool contains(
  1. AABB aabb
)

Returns true if the given AABB is fully contained in this AABB.

Implementation

bool contains(AABB aabb) {
  final l1 = lowerBound;
  final u1 = upperBound;
  final l2 = aabb.lowerBound;
  final u2 = aabb.upperBound;

  //      l2        u2
  //      |---------|
  // |---------------|
  // l1              u1

  return (
    (l1.x <= l2.x && u1.x >= u2.x) &&
    (l1.y <= l2.y && u1.y >= u2.y) &&
    (l1.z <= l2.z && u1.z >= u2.z)
  );
}