It is done. Please check out  [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1434.0]Ray tracing (polygon: range from 3-10 faces)[/url]

You are welcomed to check out the following similar/related applets
[url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=415.0]Dispersion of light with prism[/url] ,
[url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=414.0]Prsim optics (slow motion of light entering a prism)[/url] ,
[url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=412.0]It is fun to play with prism. (light trace and intensity due to refraction)[/url]
or [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=121.0]Lens (thick lens) and Mirror[/url]