4

What is the best way to draw 3D spherical mirrors like these on tikz? enter image description here

  • For things like that I just make a sketch in GeoGebra and export as TeX. – Rodrigo Apr 19 at 17:06
11

This may be a starting point.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{intersections}
\begin{document}
\tdplotsetmaincoords{90}{-30}
\begin{tikzpicture}[tdplot_main_coords,bullet/.style={circle,fill,inner sep=1pt}]
 % parameters
 \pgfmathsetmacro{\Radius}{2.5}
 \pgfmathsetmacro{\Angle}{120}
 % left
 \begin{scope}[shift={(-4,0,0)},local bounding box=L]
  \draw plot[variable=\x,domain=0:360,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \draw[top color=gray!20,bottom color=gray!30,middle color=white] 
  plot[variable=\x,domain=90:-90,smooth] (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)})
  -- plot[variable=\x,domain=-90:90,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)})
  --cycle ;
  \foreach \X in {90,140}
  {\draw plot[variable=\x,domain=90:-90,smooth]
  ({-0.1*\Radius*cos(\x)},{cos(\X)*\Radius*sin(\x)},{sin(\X)*\Radius*sin(\x)});}
  \draw plot[variable=\x,domain=0:60,smooth]
  ({-0.1*\Radius*cos(\x)},{cos(\Angle)*\Radius*sin(\x)},{sin(\Angle)*\Radius*sin(\x)})
  node[bullet] (P1){};
  \path ({-0.1*\Radius*cos(-40)},{cos(\Angle)*\Radius*sin(-40)},{sin(\Angle)*\Radius*sin(-40)})
  node[bullet] (P0){};
  \draw (0,0,-1.02*\Radius) -- (0,0,-1.2*\Radius) coordinate (l);
 \end{scope} 
 % left
 \begin{scope}[shift={(4,0,0)},local bounding box=R]
  \foreach \X in {90,140}
  {\draw[dashed] plot[variable=\x,domain=90:-90,smooth]
  ({-0.2+0.1*\Radius*cos(\x)},{cos(\X)*\Radius*sin(\x)},{sin(\X)*\Radius*sin(\x)});}
  \draw[dashed] plot[variable=\x,domain=90:270,smooth]
    (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \draw[top color=gray!20,bottom color=gray!30,middle color=white] 
  plot[variable=\x,domain=90:-90,smooth] (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)})
  -- plot[variable=\x,domain=-90:90,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)})
  --cycle ;
  \path[name path=left boundary]  plot[variable=\x,domain=90:-90,smooth]
  (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \path   ({-0.2+0.1*\Radius*cos(30)},{0},{\Radius*sin(30)}) 
  node[bullet,label=above:$P_2$] (P2){}
  ({-0.2+0.1*\Radius*cos(-30)},{0},{\Radius*sin(-30)}) node[bullet] (P3){};
  \path[name path=ray 1] (P1) -- (P2) coordinate[pos=0.5] (A);
  \path[name path=ray 2] (P2) -- (P0);
  \path[name path=ray 3] (P0) -- (P3);
  \path[name path=ray 4] (P3) -- (P1);
  \path[name intersections={of=left boundary and ray 1,by=i1},
    name intersections={of=left boundary and ray 2,by=i2},
    name intersections={of=left boundary and ray 3,by=i3},
    name intersections={of=left boundary and ray 4,by=i4}];
  \draw[thick,-stealth] (i2) -- (P0) -- (i3) (P1) -- (i1) (P1) -- (A);
  \draw[thick,-stealth,shorten >=1.5cm] (i4) -- (P1);
  \draw[dashed] (i1) -- (P2) -- (i2) (i3) -- (P3) -- (i4);
  \draw plot[variable=\x,domain=0:360,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \draw (0,0,-1.02*\Radius) -- (0,0,-1.2*\Radius) coordinate (r);
 \end{scope} 
 \draw[stealth-stealth] (l) -- (r) node[midway,fill=white]{$r+\varepsilon$};
\end{tikzpicture} 
\end{document} 

enter image description here

Or with a more realistic (?) curvature of the mirrors.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{intersections}
\begin{document}
\tdplotsetmaincoords{90}{-30}
\begin{tikzpicture}[tdplot_main_coords,bullet/.style={circle,fill,inner sep=1pt}]
 % parameters
 \pgfmathsetmacro{\Radius}{2.5}
 \pgfmathsetmacro{\Angle}{120}
 % left
 \begin{scope}[shift={(-4,0,0)},local bounding box=L]
  \draw[ball color=gray,fill opacity=0.1] plot[variable=\x,domain=0:360,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \draw[top color=gray!20,bottom color=gray!30,middle color=white] 
  plot[variable=\x,domain=90:-90,smooth] (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)})
  -- plot[variable=\x,domain=-90:90,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)})
  --cycle ;
  \foreach \X in {90,140}
  {\draw plot[variable=\x,domain=90:-90,smooth]
  ({-0.1*\Radius*cos(\x)},{cos(\X)*\Radius*sin(\x)},{sin(\X)*\Radius*sin(\x)});}
  \draw plot[variable=\x,domain=0:60,smooth]
  ({-0.1*\Radius*cos(\x)},{cos(\Angle)*\Radius*sin(\x)},{sin(\Angle)*\Radius*sin(\x)})
  node[bullet] (P1){};
  \path ({-0.1*\Radius*cos(-40)},{cos(\Angle)*\Radius*sin(-40)},{sin(\Angle)*\Radius*sin(-40)})
  node[bullet] (P0){};
  \draw (0,0,-1.02*\Radius) -- (0,0,-1.2*\Radius) coordinate (l);
 \end{scope} 
 % left
 \begin{scope}[shift={(4,0,0)},local bounding box=R]
  \foreach \X in {90,140}
  {\draw[dashed] plot[variable=\x,domain=30:-30,smooth]
  ({-0.2*(1+2*sqrt(3))+0.2*2*\Radius*cos(\x)},{cos(\X)*2*\Radius*sin(\x)},{sin(\X)*2*\Radius*sin(\x)});}
  \draw[dashed] plot[variable=\x,domain=90:270,smooth]
    (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \draw[top color=gray!20,bottom color=gray!30,middle color=white] 
  plot[variable=\x,domain=90:-90,smooth] (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)})
  -- plot[variable=\x,domain=-90:90,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)})
  --cycle ;
  \path[name path=left boundary]  plot[variable=\x,domain=90:-90,smooth]
  (-0.2,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \path   ({-0.2+0.1*\Radius*cos(30)},{0},{\Radius*sin(30)}) 
  node[bullet,label=above:$P_2$] (P2){}
  ({-0.2+0.1*\Radius*cos(-30)},{0},{\Radius*sin(-30)}) node[bullet] (P3){};
  \path[name path=ray 1] (P1) -- (P2) coordinate[pos=0.5] (A);
  \path[name path=ray 2] (P2) -- (P0);
  \path[name path=ray 3] (P0) -- (P3);
  \path[name path=ray 4] (P3) -- (P1);
  \path[name intersections={of=left boundary and ray 1,by=i1},
    name intersections={of=left boundary and ray 2,by=i2},
    name intersections={of=left boundary and ray 3,by=i3},
    name intersections={of=left boundary and ray 4,by=i4}];
  \draw[thick,-stealth] (i2) -- (P0) -- (i3) (P1) -- (i1) (P1) -- (A);
  \draw[thick,-stealth,shorten >=1.5cm] (i4) -- (P1);
  \draw[dashed] (i1) -- (P2) -- (i2) (i3) -- (P3) -- (i4);
  \draw[ball color=gray,fill opacity=0.1] plot[variable=\x,domain=0:360,smooth] (0,{\Radius*cos(\x)},{\Radius*sin(\x)});
  \draw (0,0,-1.02*\Radius) -- (0,0,-1.2*\Radius) coordinate (r);
 \end{scope} 
 \draw[stealth-stealth] (l) -- (r) node[midway,fill=white]{$r+\varepsilon$};
\end{tikzpicture} 
\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.