Firstly let me just apologise for the terrible drawings below. Very briefly what I am trying to figure out is a very robust way of counting how many boxes are touching the blue box. I have tried to create the rules for this but keep on spinning myself in circles and have resigned myself to the fact that I am not clever enough to solve it :P These boxes are in 3d dimensional space and the coordinates for the bottom left and upper right corners are known.
In this first example all the boxes are the same shape and orientation and we should be able to show that 5 boxes are touching the blue box.
However in this second example the boxes are different shapes and orientations but we would still want to show that there are now 3 boxes touching the blue box.
Below are the mock coordinates of the bottom left (BL) and upper right (UR) corners for the second example (starting from left to right with the back red box being the last coordinate set). Can anyone show me the light and help to code up this in Python or even point me in the direction of a mathematical approach I can use?
BOX 1: BL - (0,0,0) UR - (200,50,150)
BOX 2: BL - (200,0,0) UR - (400,100,150)
BOX 3: BL - (400,0,0) UR - (450,50,300)
BOX 4: BL - (450,0,0) UR - (500,50,300)
BOX 5: BL - (200,0,150) UR - (400,100,300)
Thanks in advance!