knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

RainbowLab is a tool to simulate the mechanisms behind the formation of rainbows. The approach is based on tracing rays of light through a drop of water and recording the differences between incident and exiting angle. The tool allows to 3D render the traced rays as well as evaluating the angular differences by means of a number of graphs. In its standard usage the parameters to be varied are the order of rainbows, the number of colors traced and the angular resolution/granulatriy of the the incident rays.

rainbowLab Ray Tracing Model

The ray tracing model of rainbowLab is based on tracing a number of rays through a water drop. For this, number of light rays (ray) over a range of incident angles are generated by a light source arcLight and traced through a drop defined by its radius R, its origin O and its refractive index refractiveIndex. A ray entering the drop will be expanded into a number of initially parallel rays differing in their assigned wavelength. The wavelenght assignment is made by the spectralize function. Rays are traced through the drop based on a geomteric optics model. Attenuation of the rays is modelled by fresnel coefficients.

Visualising tracing of light rays

To visualise ray tracing through a water drop, use the function traceOneRay() without any parameters. To alter the settings check the documentation ?traceOneRay.

Analysing the formation of rainbows

rainbowLab allows to analyse the formation of rainbows, notably The angels under which rainbows of different orders can be observed The effects of dispersion related to different wavelengths The relative intensities of the rainbows of different orders The width of rainbows of different orders

Data Types

rayData

rayData is a table (in data.table format) representing each ray traced amongst others in terms of rainbow number (rainbowNo), wavelength in nm (lambda), intensity (I) and angular deviation (difference between incident and exting angle in degrees (angDDeg). rayData is generated using rayData <- generateRainbows()

pdfData

pdfData is aggregated data over all rays traced. pdfData is organized as tidy-data table (in data.table format) with the categories rainbowNo, lambda and angular bins angD. For each category combination the intensity I is given. The intensity is obtained by summing up all intensities per category from rayData (using pdfData <- aggregateData(rayData).

Workflow

  1. Generate rayData
  2. Aggregate rayData to a probability density distribution/function (PDF)
  3. Plot results

When using the highlevel function generateRainbows() all these steps will be exectuted within the function call.



FredrikWartenberg/rainbowLab documentation built on April 5, 2021, 11:42 p.m.