Key idea
ModeTwo Sources
This treats the points as sources of sine waves. For each point on the screen (right hand side of the diagram), the code finds the distances r₁ and r₂ from the two sources, works out the difference Δr = r₁ - r₂, then uses I = cos²(πΔr / λ) to get the relative intensity. (I do not know where this equation comes from - outsourced from wikipedia.) Bright and dark patches are then determined simply by assessing the value of the difference (positive integers end up being bright regions). I do not know how this works, but I know that it does work. I wanted to get this page done as fast as possible (been working on it for a week)