To toggle between reflection and refraction, change the variable "refraction?". REFLECTION Inputs: - Change "theta-i" to change the angle of incidence. Outputs: - "theta-r" represents the angle of reflection. REFRACTION Inputs: - Change "roundAngles?" to toggle on and off angles being rounded. - Change "n1" to change the refractive index of the medium in which light enters from. - Change "n2" to change the refractive index of the medium in which light enters into. - Change "theta-i" to change the angle of incidence. Outputs: - "v1" represents the speed of light (m/s) travelling through the first medium. - "v2" represents the speed of light (m/s) travelling through the second medium. - "theta-r" represents the angle of reflection. - "theta-R" represents angle of refraction. - If n1 is greater than n2, "theta-c" represents the critical angle.
A program that simulates the reflection and refraction of light on a surface or through two mediums using the Law of Reflection and Snell's Law as well as total internal reflection. ~ NOTICE ~ The negative numbers on this diagram should not be negative when calculated, they just are because of theta-i changing direction on both sides (making the angle positive or negative). Also, the intensity of the reflected beam during refraction is not entirely accurate (it's as close as I could get it) until total internal reflection occurs. Refractive Index Cheat Sheet: Vacuum or Air -- n = 1 Water -- n = 1.3 Glass -- n = 1.5 Oil -- n = 1.5 Diamond -- n = 2.4