Ripples: Executable or Text Version
Take any BMP, JPG or GIF, and view it as though it were under rippling water. Using various buttons and the mouse wheel, the amplitude of the ripples, the depth of the water, and the frequency of the ripples, can be changed "on the fly". This is no mean feat, taking a fraction of a second in ASM-assisted code as used here, but up to 15 seconds in pure BB4W.
The calculation needed is to get a pixel for the screen from somewhere else in the original picture according to the beam to the eye having been refracted at the water surface. Of course the water surface is undulating in both N/S and E/W directions, so some pretty horrible vector calculations are needed, requiring the following calculation in ASM, where n1 and n2 are the refractive indices of air and water respectively, and n is the vector normal to the water surface at the point concerned.