Refer to ViewController::adjustVolumeSize for cuboid adjustments. What was the idea behind a rectangle instead of a cube? You could in theory adjust the z component of the cube to be zero, but I can't say what the results would be.
The cuboid volume defines clipping boundaries during scanning. The object being scanned might be smaller than the cube, so might not coincide with the cube volume. I think some developers here may have drawn annotations during scanning, you may find something in a search.
As mentioned above, the cube defines the clipping boundaries during a scan, not necessarily the scanned object boundaries. Your best bet may be to do a simple bounding box calculation after the completion of the scan.