1

enter image description here

Using TikZ how can I draw this figure ?

Sorry, this time I didn't even tried to write a code, I'm really sorry :(, I know this is against the website's rules, but I really found it hard to draw.

Thanks in advance.

Edit : Here's my attempt, I found it hard to draw that line through I and I', they are the midpoints of the triangle's edges.

I tried to fix it with \begin{scope} but it wasn't helpful :

Here's the code :

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, shapes, positioning, calc, decorations.text, angles, quotes}
\begin{document}
\begin{tikzpicture}
\draw[smooth, dashed] (4,2.5)--(8,5.2);
\draw[smooth, dashed] (6.1,2.3)--(4.4,4);
\draw[smooth, black] (3,0)--(5,5)--(7,0)--(3,0);
\coordinate(O) at (5,5);
\coordinate(A) at (3,0);
\coordinate(B) at (7,0);
\pic[ draw,inner sep=1pt, circle,  draw,angle eccentricity=1.1, angle radius = 10mm] {angle = A--O--B};
\node[below] at (5,4.68) {$A$}; 
\draw[thick, gray] (1,0.45)--(4,2.5)--(6.1,2.3)--(8,0.1);

\end{tikzpicture}

\end{document}

enter image description here

  • 2
    Is it the Snell's law? However you can draw himself using a tool online. – Sebastiano Feb 05 '21 at 22:00
  • 2
    You may find an interesting starting point at: https://texample.net/tikz/examples/raindrop/ – Harald Lichtenstein Feb 05 '21 at 23:01
  • you can start by drawing the prism (it's a triangle) : \draw (a,b) --(c,d) The light rays correspond to segments that you can draw with \draw (a,b) -- (c,d) and \draw [dashed] To name the angles, you will need to draw arcs of a circle : \draw (a,b) arc (u,v,r) Look at the TikZ manual – Nicolas Feb 06 '21 at 07:14

1 Answers1

6

This is an adapted old drawing of mine. With a few changes you can have yours.

Instead of my macros for the angles, you can use angles+quotes tikz libraries (see this post: TikZ: Draw angle with label between lines).

My code:

\documentclass [border=2mm]{standalone}
\usepackage    {tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}

\newcommand{\cangle}[6] % A,B,C,radius,style,label (circle angle at point B) {% \pgfmathsetmacro\p{0.2+#4} % label position \begin{scope} \clip #1 -- #2 -- #3 -- cycle; \coordinate (AUX1) at ($#2!\p cm!#1$); \coordinate (AUX2) at ($#2!\p cm!#3$); \node[#5] at ($(AUX1)!0.5!(AUX2)$) {#6}; \draw[#5] #2 circle (#4); \end{scope} }

\newcommand{\sangle}[5] % A,B,C,distance,style (square angle at point B) {% \coordinate (AUX1) at ($#2!#4 cm!#1$); \coordinate (AUX3) at ($#2!#4 cm!#3$); \coordinate (AUX2) at ($(AUX1)+(AUX3)-#2$); \draw[#5] (AUX1) -- (AUX2) -- (AUX3); }

\begin{document} \begin{tikzpicture}[scale=2,line cap=round,line join=round] % styles \tikzstyle{ray} =[red,thick, decoration={markings, mark=at position 0.5 with {\arrow[>=stealth]{>}}}, postaction={decorate}] \tikzstyle{normal}=[blue,thin] % coordinates \coordinate (A) at (0,0); \coordinate (B) at (4,0); \coordinate (C) at (60:4); \coordinate (I1) at (-1,1); \coordinate (I4) at (5,3); \coordinate (I2) at (intersection of A--C and I1--I4); \coordinate (I3) at (intersection of B--C and I1--I4); \coordinate (R1) at (2,2.5); \coordinate (R3) at (5,0); \coordinate (R2) at (intersection of B--C and R1--R3); \coordinate (N1) at ($(I2)+(150:1)$); \coordinate (N2) at ($(I2)+(330:2)$); \coordinate (N3) at ($(R2)+(30:1)$); \coordinate (N4) at ($(R2)+(210:2)$); \coordinate (N5) at (intersection of N1--N2 and N3--N4); \coordinate (IR) at (intersection of I1--I4 and R1--R3); % prism \draw[thick, fill=blue!5] (A) -- (B) -- (C) -- cycle; % rays \draw[ray] (I1) -- (I2); \draw[ray] (I2) -- (R2); \draw[ray] (R2) -- (R3); \draw[dashed] (I2) -- (I4); \draw[dashed] (R1) -- (R2); % normal lines \draw[normal] (N2) -- (N1) node [left] {$N_1$}; \draw[normal] (N4) -- (N3) node [right] {$N_2$}; % angles
\sangle{(N1)}{(I2)}{(C)} {0.1}{normal}; \sangle{(N3)}{(R2)}{(C)} {0.1}{normal}; \cangle{(A)} {(C)} {(B)} {0.3}{} {$\hat\alpha$}; \cangle{(N1)}{(N5)}{(N4)}{0.3}{blue}{$\hat\alpha$}; \cangle{(N1)}{(I2)}{(I1)}{0.3}{red} {$\hat i_1$}; \cangle{(N2)}{(I2)}{(R2)}{0.3}{red} {$\hat r_1$}; \cangle{(I2)}{(R2)}{(N4)}{0.3}{red} {$\hat i_2$}; \cangle{(R3)}{(R2)}{(N3)}{0.3}{red} {$\hat r_2$}; \cangle{(I4)}{(I2)}{(R2)}{0.4}{} {$\hat\beta$}; \cangle{(R1)}{(R2)}{(I2)}{0.4}{} {$\hat\gamma$}; \cangle{(I1)}{(IR)}{(R1)}{0.3}{} {$\hat\delta$}; \end{tikzpicture} \end{document}

And, the prism: enter image description here

Juan Castaño
  • 28,426