29 lines
792 B
Text
29 lines
792 B
Text
[
|
|
// Snell's Law
|
|
{
|
|
"name": "Snell's Law",
|
|
"description": r"""
|
|
Law describing refraction of light at interface between media.
|
|
|
|
$$n_1\sin(\theta_1) = n_2\sin(\theta_2)$$
|
|
|
|
Where:
|
|
- $n_1, n_2$: Refractive indices of the two media
|
|
- $\theta_1$: Angle of incidence
|
|
- $\theta_2$: Angle of refraction
|
|
|
|
This law explains how light bends when passing between materials.""",
|
|
"input": [
|
|
{"name": "n1", "unit": "scalar"},
|
|
{"name": "n2", "unit": "scalar"},
|
|
{"name": "theta1", "unit": "degree"}
|
|
],
|
|
"output": {"name": "theta2", "unit": "degree"},
|
|
"d4rtCode": """
|
|
var theta1Rad = theta1 * (pi / 180);
|
|
var sinTheta2 = (n1 * sin(theta1Rad)) / n2;
|
|
theta2 = asin(sinTheta2) * (180 / pi);
|
|
""",
|
|
"tags": ["physics", "optics", "light"]
|
|
}
|
|
]
|