This should help steer you on the right track: Room angle with bounding box, cuboid - #11 by jacob.small