关于如何开始,有什么建议吗?我查看了 texamples 网站,但没有成功。
到目前为止,我有以下内容:
\begin{tikzpicture}
\draw (-0.05,-1.25) rectangle (0.25,1.5);
\draw (-3,0) ellipse (0.25cm and 1cm);
\draw (3,0) ellipse (0.25cm and 1cm);
\draw [rotate=45](-4.05,2.25) rectangle (-4.25,4.5);
%\draw [rotate=-30](-4.05,2.25) rectangle (-4.25,4.5);
\end{tikzpicture}{tikzpicture}
如您所见,我不是 TikZ 的熟练用户 :)。有没有更简单的方法来定义光栅的图形?我该如何表示红色和蓝色成分以及输入和输出光线?
答案1
shapes.geometric
节点可能更容易。这是一个开始,使用镜头库将路径切换为(大多数)节点。
\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}[inner sep=0pt, every node/.append style={draw}]
\node (m) [minimum width=3mm, minimum height=30mm, inner color=blue!50!black!50, outer color=blue!50!black] {};
\draw [line width=.5mm, gray] ([xshift=-65mm]m.west) coordinate (l1) -- ([yshift=-30mm,xshift=10mm]m.south east) coordinate [pos=.3] (l2) coordinate (l3);
\draw [line width=.5mm, gray] ([xshift=65mm]m.east) coordinate (r1) -- ([yshift=-30mm,xshift=-10mm]m.south west) coordinate [pos=.3] (r2) coordinate (r3);
\node (ll) [anchor=south, ellipse, minimum height=30mm, minimum width=5mm, fill=blue!25!gray, fill opacity=.025] at (l2) {};
\node (lr) [anchor=south, ellipse, minimum height=30mm, minimum width=5mm, fill=blue!25!gray, fill opacity=.025] at (r2) {};
\node [rotate=-45, anchor=north, minimum height=2mm, minimum width=20mm, fill=yellow!25] at (l1) {};
\node [rotate=45, anchor=north, minimum height=2mm, minimum width=20mm, fill=yellow!25] at (r1) {};
\foreach \i/\m in {l/west,r/east}
\foreach \j/\k in {75/blue,-75/red}
\draw [blend mode=overlay, fill=\k] (\i1) -- (l\i.{\j+5}) -- (m.\m |- l\i.\j) -- (l\i.{\j-5}) -- cycle;
\end{tikzpicture}
\end{document}
扩展、增强和纠缠留给读者作为练习。