# Graphical Raytracing using CarMetal

In optics, the law of refraction by Snellius is widely known.

$n_1 \cdot sin(\alpha_1) = n_2 \cdot sin(\alpha_2)$

The calculation of  $sin(\alpha_2)$ can actually be done using geometry exclusively.

mere geometric calculation of the refraction of a ray

I have created this nice image using CarMetal, a geometry program. You can download the CarMetal-file brechung_regulaerundtotal.zir and play around with the angles yourself. While you change $\alpha_1$, f0r example, CarMetal maintains the introduced relationships like „… being parallel to …“ or „… goes through the intersection of … and … „. The green ray shows near total reflection which appears as soon as there’s no intersection of the vertical line with the inner circle.