Wolfram Demonstrations: Source code
Representation of Diffraction by Vector Summation