Building an interactive raytracing lab from scratch: intersection math, the law of reflection, and why my mirrors kept spawning ghost beams.