Correct edge case when org sensor on diagonal is closer to edge of world than to nearest edge of resource. Does not impact any results due to existing downstream code.
Cleanup in org sensor torus code (no impact on results).