TikZ 光圈问题

TikZ 光圈问题

我尝试生成 TikZ 图形来可视化光圈问题。我正在寻找的是如下图所示的内容:

光圈问题

我尝试搜索类似的东西,但没有找到合适的。我可以请求您的帮助吗?

答案1

下次,请尝试提供您迄今为止尝试过的代码。如果您能发布最小工作示例(MWE)

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{patterns,arrows.meta}
\begin{document}
\begin{tikzpicture}
  \begin{scope}
    \node[font=\bfseries\sffamily] at (1,5.5) {A};
       \node[draw,fill,pattern = north east lines,minimum width=2cm,minimum
       height=4cm,rotate=45] (a) at (1,2) {};
     \draw[fill=white,even odd rule] (-0.2,0.8) rectangle (2.2,3.2) (1,2) circle (0.8cm);
     \draw[double distance=4pt,  -{Latex[length=0pt 3 0,open]}] ([shift={(-2mm,2mm)}]a.north) -- +(-0.75,0.75);
  \end{scope}
  \begin{scope}[xshift=5cm]
    \node[font=\bfseries\sffamily] at (1,5.5) {B};
    \node[draw,fill,pattern = north east lines,minimum width=2cm,minimum
       height=4cm] (a) at (1,2) {};
    \draw[fill=white,even odd rule] (-0.2,0.8) rectangle (2.2,3.2) (1,2) circle (0.8cm);
    \draw[double distance=4pt,  -{Latex[length=0pt 3 0,open]}] ([yshift=2mm]a.north) -- +(0,1);
  \end{scope}
    \begin{scope}[xshift=10cm]
  \node[font=\bfseries\sffamily] at (1,5.5) {C};
  \node[draw,fill,pattern = north east lines,minimum width=2cm,minimum
       height=4cm,rotate=90] (a) at (1,2) {};
  \draw[fill=white,even odd rule] (-0.2,0.8) rectangle (2.2,3.2) (1,2) circle (0.8cm);
  \draw[double distance=4pt,  -{Latex[length=0pt 3 0,open]}] ([xshift=-2mm]a.north) -- +(-1,0);
  \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

除了使用 s 之外,几乎与 Harish Kumar 的答案完全相同pic

\documentclass[tikz, border=5]{standalone}
\usetikzlibrary{patterns}
\tikzset{%
  aperture/.pic={
   \path [draw=black, rotate=#1-90, pattern=north east lines]
     (-3/4,-3/2) rectangle (3/4,3/2);
   \path [draw=black, rotate=#1-90, scale=1/8]
     (0,14) -- ++(-1,0) -- ++(0,2) -- ++(-1,0) -- ++(2,2)
     -- ++(2,-2) -- ++(-1,0) -- ++(0,-2) -- cycle;
   \path [fill=white, draw=black, even odd rule] 
     circle [radius=2/3] (-1,-1) rectangle (1,1);
  }
}
\begin{document}   
\begin{tikzpicture}
\path (0,3) node {A} (0,0) pic {aperture={135}};
\path (4,3) node {B} (4,0) pic {aperture={90}};
\path (8,3) node {C} (8,0) pic {aperture={180}};
\end{tikzpicture}   
\end{document}

在此处输入图片描述

相关内容