创建光分路器节点

创建光分路器节点

您能帮我创建一个光分路器节点吗?该节点有两个输入端口和两个输出端口?形状如下:

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{shapes,arrows,positioning,calc}
\usepackage{circuitikz}

\begin{document}

\begin{tikzpicture}[auto, node distance=2cm,>=latex']

% Draw lines
\draw (-2,1)  to [out=0,in=180] (0,0);
\draw (-2,-1) to [out=0,in=180] (0,0);
\draw (0,0)   to [out=0,in=180] (2,1);
\draw (0,0)   to [out=0,in=180] (2,-1);

% Draw center ellipse
\filldraw (0,0) ellipse (0.2 and 0.1);

\end{tikzpicture}
\end{document}

答案1

您可以创建一个pic。恕我直言,在这种情况下,apic比 a 更合适node(毕竟,您会在分隔符的中心写什么?)

\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}[optical splitter/.pic = {
  \draw[pic actions] (-2,1) coordinate (#1-in-1) to [out=0,in=180] (0,0)
    (-2,-1) coordinate (#1-in-2) to [out=0,in=180] (0,0)
    (0,0)   to [out=0,in=180] (2,1) coordinate (#1-out-1)
    (0,0)   to [out=0,in=180] (2,-1) coordinate (#1-out-2);
  \filldraw[pic actions] (0,0) ellipse (0.2 and 0.1);
}]
  \pic[red] at (0,0) {optical splitter=X};
  \draw[blue] (-3,-2) |- (X-in-1);
  \draw[purple] (X-in-2) -- ++ (0,-1);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容