我正在尝试创建一个像图片中那样的透镜图案。我相信可以使用for 循环在 tikz 中,但我无法正确完成它。
感谢任何帮助循环。
编辑:这是更大图表的一部分,下面是代码。
\begin{document}
\begin{tikzpicture}[>={Stealth[inset=0pt,length=10pt,angle'=35,round]}]
\pgfmathsetmacro{\lensRadius}{6}
\pgfmathsetmacro{\lensHeight}{3}
\pgfmathsetmacro{\startAngle}{asin(\lensHeight/\lensRadius)}
\draw [] (0,\lensHeight)
arc[start angle=180-\startAngle,delta
angle=2*\startAngle,radius=\lensRadius]node [below, align=center] {\\
[1em]Main\\[-1ex]lens}
arc[start angle=-\startAngle,delta angle=2*\startAngle,radius=\lensRadius]
-- cycle;
\draw [line width=1mm ] (-1.5,3) -- (-1.5,-3) node [below, align=center] {\\
[1em]Weak\\[-1ex]diffuser};
\draw [] (6,\lensHeight)
arc[start angle=180-\startAngle,delta
angle=2*\startAngle,radius=\lensRadius]node [below, align=center] {\\
[1em]Field\\[-1ex]lens}
-- cycle;
\draw[] plot[only marks, mark=*,mark size=10pt,mark options={fill=Sepia}]
coordinates{(-6.5,0)} node[below, align=center]{\\[1em]Object};
\draw[] (-6,0) -- (0,3);
\draw[] (-6,0) -- (0,-3);
\draw[] (6.5,0) -- (0,3);
\draw[] (6.5,0) -- (0,-3);
%lenticular pattern
\pgfmathsetmacro{\lensRadius}{0.2}
\pgfmathsetmacro{\lensHeight}{0.2}
\pgfmathsetmacro{\startAngle}{asin(\lensHeight/\lensRadius)}
\draw [] (8,\lensHeight)
arc[start angle=180-\startAngle,delta
angle=2*\startAngle,radius=\lensRadius];
\draw [line width=0.25mm ] (8,3) -- (8,-3) -- (8.2,-3) -- (8.2,3) -- cycle;
\end{tikzpicture}
\end{document}
输出:
答案1
绘制类似的东西有很多种可能性,这是其中之一。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[pics/rr/.style={code={\draw (0.2,-0.2) |- ++(-0.4,0.4)
to[out=180,in=180] ++ (0,-0.4) -- cycle;}}]
\path foreach \X in {0,1,...,10}
{(0,0.4*\X) pic{rr}};
\draw (0.2,-0.2) rectangle (0.4,10*0.4+0.2);
\end{tikzpicture}
\end{document}