Skip to content

rowdyrotifer/RaindropRainbow

Repository files navigation

Table of Contents

  1. Overview
  2. Example
  3. Install
  4. Download

Raindrop Rainbow

A JavaSim simulation demonstrating how light is refracted and reflected by raindrops to form the optical phenomenon we all know and love: the rainbow.


Overview

When sunlight passes through raindrops, the total angle change after refracting, reflecting, and dispersing stops at a certain limit dependent on the wavelength of light.

For each ray of sunlight, it strikes the raindrop with an angle of incidence, i.

According to Snell's law, when changing mediums from air to water or water to air, an angle of refraction r can be calculated:

Snell's Law

where Refractive Index is the refractive index, the ratio of the speed of light to the phase velocity of light in the medium.

Solving the geometry of the problem, we can see that the total deflection angle, Theta Total, can be represented as a function of i and r:

Equation 1

or, solving for r, simply as a function of i:

Equation 2

For a certain refractive index r (about 1.3 in this case), the graph from angles 0° to 90° looks like so:

Graph 1

This angle where Theta = 0 varies slightly as Refractive Index changes (see this empirical data), causing bundles of certain wavelengths to group up at certain angles, generating the rainbow as a result of dispersion.

Example

The current output of the simulation:

Example

A zoomed in version of the bottom 6.5% of the outputted rays is visible in the bottom right.

Install

RaindropRainbow is a JavaSim simulation. After installing JavaSim, place RaindropRainbow.jar into the JavaSim folder (located in your Documents folder by default).

Download

About

JavaSim Simulation demonstrating the rainbow phenomenon.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages