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
@jippoe The library is available on GitHub. All of these were made with the SwiftGraphics2 branch, though it’s a bit of a work in progress and I expect a lot to change. Happy to help you get it up and running
SwiftGraphics is a library for creative coding and generative art tailored towards rendering SVGs meant for pen plotting. - emorydunn/SwiftGraphics
@emorydunn have you watched Sebastian Lague’s amazingly well presented ray tracing videos?
https://youtube.com/playlist?list=PLFt_AvWsXl0dlgwe4JQ0oZuleqOTjmox3&si=M2jcw_f3WwcJAuA5