绘制球面镜

绘制球面镜

在 tikz 上绘制这样的 3D 球面镜的最佳方法是什么?在此处输入图片描述

答案1

这或许是一个起点。

\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} 

在此处输入图片描述

或者具有更现实的(?)镜子曲率。

\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} 

在此处输入图片描述

相关内容