- resqpy.olio.box_utilities.overlapping_boxes(established_box, new_box, trim_box)¶
Checks for 3D overlap of two boxes; returns True and sets trim_box if there is overlap, otherwise False.
trim_box is modified in place.
established_box – numpy int array of shape (2, 3)
new_box – numpy int array of shape (2, 3) each is lower & upper indices in 3 dimensions defining a logical cuboid subset of a 3D cartesian grid protocol of indices for the two boxes must be the same
trim_box – numpy int array of shape (2, 3) set to lower & upper indices in 3 dimensions defining a logical cuboid subset of a 3D cartesian grid a subset of new_box such that if removed from new_box, a valid box would remain with no overlap with established_box indices protocol is the same as that used for established_box and new_box (if return value is True) if there is no overlap (return value False), all elements of trim_box are set to 0
when there is overlap between the boxes, there can be more than one way to trim the new_box, with trim_box fully covering either ij, jk or ik planes of new_box the function selects the trim_box containing the minimum number of cells (minimum ‘loss’ to trimming) this function does not actually apply the trimming, ie. new_box is not modified here
- returns: boolean
True if established_box and new_box overlap (implies trim_box valid), False otherwise (trim_box elements all 0)