Skip to content
Advertisement

Snell’s Law not functioning

I am writing a program to calculate light refraction using snell’s law, however, when I run the program it prints -0.7076118148 rather than the correct value of 22

JavaScript

Advertisement

Answer

You’re using degrees instead of radians.
You’ll have to convert, e.g like this:

JavaScript

=> 22.082413194472252

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement