...
This is a representative calculation of the distance measurement while facing front. This is fairly standard pythagorean geometry.
Update: To accommodate the mistake here, I just subtracted 45° from the yaw-angle output to the distance calculations. I could have let it be and just called the outputs differently, but I wanted to keep the current outputs.