The Coffeecup Caustic

You are drinking from a cylindrical cup in the sunshine. Sometimes, when the sun shines into the cup, you can see a crescent of light as the sunshine reflects from the inside of the cup onto the surface of the drink. Here is a picture of a real cup to jog your memory.

Here's why. Click many times in different places in the yellow area. Each time you click a ray of light shoots into the circle of the cup and is reflected from the inside surface of the cup. The incident ray is gray, the reflected ray is yellow. You will see the characteristic shape emerge: it is called a caustic curve.

Clicking in the red area clears the drawing space.


Here is the Java Source Code.

Brought to you by BallAndClaw.com.