Raindrop Rainbow

A JavaSim simulation demonstrating how light is refracted, reflected, and refracted again to form the optical phenomenon we call the rainbow. The simulation features sunlight hitting the ray horizontally. As the light changes mediums from air to water, the different colors that make up the sunlight are refracted at slightly different angles, then reflected off the opposite side, then refracted again as they leave. This dispersion causes the sunlight to split apart into sections of that are densely packed with the colors that make up the rainbow.