Detecting frames in cuboid

WIP - not finished!