I figured out the reason some rays are missing, and it's not related to the angles like I'd been thinking. A quirk of how I implemented the rays is they don't draw if they don't "project" onto an object, and it looks like the some raysfail to find an intersection with the bounding box.
This explains both the missing rays and the rays that project past the box onto the circle outside.
However I don't know why the intersection math fails sometimes.
Ok, we're getting there. Instead of checking if an intersection is on the line I'm running a distance check that returns nil if they don't intersect. The good news is I'm not getting false negatives anymore. The downside is I think I figured out why the check was failing. Sometimes the intersection function returns a point in the right direction, but thousands of pixels outside the rectangle.
The rectangle seems to work, but going through the fresnel is causing problems