Edit and compile if you like:
\documentclass[borders=2pt]{standalone}% Drawing\usepackage{tikz}% Define Color\definecolor{g1}{rgb}{0.0, 1.0, 0.0}% Tikz Library\usetikzlibrary{angles, quotes, calc, decorations.markings, decorations.pathmorphing, intersections}% Styles\tikzset{every node/.style={align=center}}\tikzset{arrow inside/.style = {postaction=decorate,decoration={markings,mark=at position .52 with \arrow{stealth}}}}\tikzset{ray/.style={very thick, red}}\tikzset{line/.style={thick, black}}\tikzset{lined/.style={thick, black, dashed}}\begin{document}\begin{tikzpicture}% % Grid% \draw[dotted, black!30] (0,0) grid (10,10);% \foreach \i in {0,...,10}% {% \node at (-2ex,\i) {\i};% \node at (\i,-2ex) {\i};% }% Coordinates%% Rays\coordinate (A') at (5,9);\coordinate (A'') at (5,1);\coordinate (B) at (4.6,4);\coordinate (B') at (4.6,1);%% Rectangles\coordinate (a) at (2,6);\coordinate (b) at (8,4);%% Comptutated\coordinate (A) at ($(a)+(3,0)$);
Click to download: refractive-index.tex
Open in Overleaf: refractive-index.tex
This file is available on GitHub.
See more on the author page of Alexandros Tsagkaropolulos.