Math behind logical operators on 3D boxes / cuboids

have you checked the following threads