Refraction of incident light, the explanation with wavelets from the Huygens-Fresnel principle, internal reflection, polarization by reflection.
For more related figures, please see the Optics category.
Edit and compile if you like:
% Author: Izaak Neutelings (May 2020)% Inspiration: https://tex.stackexchange.com/questions/285578/how-to-draw-parallelepiped-and-cube-with-latex/288101#288101\documentclass[border=3pt,tikz]{standalone}\usetikzlibrary{arrows,arrows.meta}\usetikzlibrary{calc}\usetikzlibrary{decorations.markings}\usetikzlibrary{angles,quotes} % for pic (angle labels)%\usepackage{tkz-euclide} % for \tkzMarkRightAngle%\usetkzobj{all}\tikzset{>=latex} % for LaTeX arrow head\colorlet{myblue}{blue!80!black}\colorlet{mydarkblue}{blue!35!black}\colorlet{myred}{black!50!red}\colorlet{glasscol}{blue!10}\colorlet{Ecol}{orange!90!black}\tikzstyle{myarr}=[-{Latex[length=3,width=2]}]\tikzstyle{Evec}=[Ecol,{Latex[length=2.8,width=2.5]}-{Latex[length=2.8,width=2.5]},line width=0.6]\tikzstyle{glass}=[top color=glasscol!88!black,bottom color=glasscol,shading angle=0]%\tikzstyle{glass}=[top color=glasscol!88!black,bottom color=glasscol,middle color=glasscol!98!black,shading angle=0]\tikzset{light beam/.style={thick,myblue,decoration={markings,mark=at position #1 with {\arrow{latex}}},postaction={decorate}},light beam/.default=0.5}\newcommand\rightAngle[4]{\pgfmathanglebetweenpoints{\pgfpointanchor{#2}{center}}{\pgfpointanchor{#3}{center}}\coordinate (tmpRA) at ($(#2)+(\pgfmathresult+45:#4)$);\draw[white,line width=0.6] ($(#2)!(tmpRA)!(#1)$) -- (tmpRA) -- ($(#2)!(tmpRA)!(#3)$);\draw[blue!40!black] ($(#2)!(tmpRA)!(#1)$) -- (tmpRA) -- ($(#2)!(tmpRA)!(#3)$);}% WAVEFRONT\def\p{0.03}\def\r{0.25}\tikzset{wavefront/.pic={\tikzset{/wavefront/.cd,#1}\fill (0,0) circle (\p);\draw (\wang:\r) arc(\wang:-\wang:\r);
Click to download: optics_refractions.tex • optics_refractions.pdf
Open in Overleaf: optics_refractions.tex
Hello!
I modified a code I found here to show how an image is formed in a convex lens (see code below). I was wondering if there would be a way to further modify it, so that by changing the position of the object (at 2f, between 2f and f, at f and within f, it would automatically change the rays and image. My skills are not that great yet! hehehe
Thank you,
Wagner.
\documentclass[border=2pt]{standalone}
%Drawing
\usepackage{tikz}
\tikzset{>=latex}
\usetikzlibrary{calc, decorations.markings}
%Styles
%%Arrow in the Middle
\tikzset{arrow inside/.style = {postaction=decorate,decoration={markings,mark=at position 0.52 with \arrow{stealth}}}}
%Newcommand
%%Midline Label
\newcommand{\midlinelabel}[3]{
\node (midlabel) at ($ (#1)!.5!(#2) $) {#3};
\draw[] (midlabel) — (#2);
}
% Define Color
\definecolor{glass}{cmyk}{0.2,0,0,0}
\begin{document}
\begin{tikzpicture}[scale=1.8]
% Grid
% \draw[help lines] (-3,-3) grid (6,6);
% Lens
\path[fill=glass, draw=black, line width = 0.6] (1,-2) .. controls (0.8,0) .. (1,2) .. controls (1.2,0) .. (1,-2);
% Axis
\draw[dashed, black!60] (1,-2) — +(0,4);
\draw[black!60] (-4,0) — (6,0) node[below]{\small Principal Axis};
% Points
\draw[fill=red] (-2,0) circle (0.5pt) node[below] {$2f$};
\draw[fill=red] (-0.5,0) circle (0.5pt) node[below] {$f$};
\draw[fill=magenta] (1,0) circle (0.5pt) node[below] {$C$};
\draw[fill=red] (2.5,0) circle (0.5pt) node[below] {$f$};
\draw[fill=red] (4,0) circle (0.5pt) node[below] {$2f$};
%Rays
%%1
\draw[red, line width = 0.6, arrow inside] (-3.,1.2) — (1,0);
%\draw[red, line width = 0.6] (0.88,0.7) — (1.12,0.67);
\draw[red, line width = 0.6, arrow inside] (1,0) — (5,-1.2);
%%2
\draw[red, line width = 0.6, arrow inside] (-3.,1.2) — (0.92,1.2);
\draw[red, line width = 0.6] (0.92,1.2) — (1.09,1.13);
\draw[red, line width = 0.6, arrow inside] (1.09,1.13) — (4.5,-1.6);
%%3
\draw[red, line width = 0.6, arrow inside] (-3.,1.2) — (0.875,-0.658);
\draw[red, line width = 0.6] (0.875,-0.658) — (1.11,-0.72);
\draw[red, line width = 0.6, arrow inside] (1.11,-0.72) — (4.5,-0.72);
% Distances
%\midlinelabel{-2,-0.75}{1,-0.75}{$\alpha$}
\midlinelabel{1,0.1}{2.5,0.1}{$F$}
%\midlinelabel{1,0}{1,1.18}{\small$h$}
%\midlinelabel{1,1.18}{2,1.18}{\small$\beta(h)$}
% Dashed
%\draw[dashed] (2,0) — (2,1.18);
%Object and Image
\draw[->, thick, blue] (-3,0) node[below]{\small $Object$} –++ (0,1.2);
\draw[->, thick, cyan] (3.4,0) node[above]{\small $Image$} –++ (0,-0.72);
\end{tikzpicture}
\end{document}