Picking up on the long neglected rewrite of my graphics library, and I know I'd kind of left it in a very unfinished state, but I'd forgotten how much had been left out. Today I updated the ray tracing implementation. Next up are boolean operations
Got booleans working again and cranked up the rays. Looks like we're got a few escaping containment and a few missing from the emitters.
The cool part about everything being a vector is I can open it up and inspect all the layers and elements to see exactly what's going on
Something very strange is going on with my Angle type. While looking into the missing rays I changed the underlying value used for math on angles from degrees to radians, which caused my boolean operation to invert?

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.

Figured it out, sort of. When testing whether a ray intersects with a rectangle I'm checking the four edges, which is technically checking whether the ray intersects with a place defined by the line and I'm discarding it if the point isn't on the line. Seems like sometimes I get a false negative and the point is being rejected

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

One other weird thing, that probably isn't helping, is that while the distance function is correctly filtering rays, it always returns 0 or -0, rather than you know, an actual distance
@emorydunn following because obviously. What’re you writing this in?
@everyplace Haha, I'm here to entertain. I'm writing it all in Swift. My own little vector graphics library, originally for pen plotting