我尝试过的事情:

我尝试过的事情:

如果这是另一个问题的重复,我深表歉意,但我想将此图左侧的节点 A 和 B 连接到右侧圆圈的顶部和底部:

在此处输入图片描述

像这样:

在此处输入图片描述

我尝试过的事情:

使用叠加并记住图片

当使用这些设置时,覆盖会将右侧图片移动到不想要的位置,并且单独使用记忆图片来连接节点不起作用。

将两个图像放在一个 tikzpicture 中并使用范围

不幸的是,当将右侧放置在左侧的 tikzpicture 环境中时,图表会将自身定位到 x,y 轴(实际上是图中的 x,t 平面),因此无法得到所需的输出。

我不确定如何绘制连接线。以下是制作图表时使用的代码:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tikz-3dplot}
\usepackage[left=0.00cm, right=0.00cm]{geometry}
\begin{document}
    \tdplotsetmaincoords{72}{170}
    \begin{tikzpicture}[tdplot_main_coords,scale=0.5,xscale=-1]
        \pgfmathsetmacro{\Length}{3}
        \pgfmathsetmacro{\Stretch}{2}
        % \draw[-latex] (0,0,0) -- (\Length,0,0) node[below]{$x$};
        % \draw[-latex] (0,0,0) -- (0,\Length,0) node[left]{$y$};
        % \draw[-latex] (0,0,0) -- (0,0,\Length) node[left]{$z$};
        \draw[black,very thick] plot[smooth,variable=\x,domain=0:720,samples=360] ({\Length*cos(\x)},
        {\x*(\Stretch*\Length/360)},{\Length*sin(\x)});
        \draw (-1.2*\Length,0,-1.2*\Length) coordinate (lbf) -- 
        (1.2*\Length,0,-1.2*\Length) coordinate (lbb) --
        (1.2*\Length,0,1.2*\Length) coordinate (ltb) -- 
        (-1.2*\Length,0,1.2*\Length) coordinate (ltf) -- cycle;
        \foreach \X in {bf,bb,tf}
        {\draw (l\X) -- ++ (0,2*\Stretch*\Length,0) coordinate (m\X);}
        \draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
        \foreach \X in {bf,bb,tf}
        {\draw[thick] (m\X) -- ++ (0,2*\Stretch*\Length,0) coordinate (r\X);}

        % middle
        \begin{scope}[canvas is zx plane at y=0]
            \node[transform shape,rotate=-90,scale=2,xscale=-1] at (1,0) {Circlular};
            \pgflowlevelsynccm    
            \draw[fill] (0,0) circle (0.2);
        \end{scope}
        \foreach \X in {1,...,5}
        {\ifnum\X=3
        \draw[thin] ($(mbf)!{\X/6}!(mbb)$) -- ++ (0,3*\Stretch*\Length,0);
            \draw[thin] ($(mbf)!{\X/6}!(mtf)$) -- ++ (0,3*\Stretch*\Length,0);
            \else
            \fi}
        \foreach \X [evaluate=\X as \Y using {int(mod(\X,5))}] in {1,...,18}
        {
            \ifnum\Y=0
            \draw[thin] ($(mbf)+(0,\X,0)$) -- ($(mbb)+(0,\X,0)$);
            \draw[thin] ($(mbf)+(0,\X,0)$) -- ($(mtf)+(0,\X,0)$);
            \else
            \fi
        }

        \draw[black,very thick,-latex] plot[smooth,variable=\x,domain=720:1460,samples=360] ({\Length*cos(\x)},
        {\x*(\Stretch*\Length/360)},{\Length*sin(\x)});
        \draw[black,densely dashed] plot[smooth,variable=\x,domain=720:1800,samples=360] 
        ({\Length*cos(\x)},{\x*(\Stretch*\Length/360)},-1.2*\Length);
        \draw[black,densely dashed] plot[smooth,variable=\x,domain=720:1800,samples=360] 
        (-1.2*\Length,{\x*(\Stretch*\Length/360)},{\Length*sin(\x)});
        % right
        \foreach \X in {bf,bb,tf}
            {\draw[very thick] (r\X) -- ++ (0,\Stretch*\Length,0);}
        \draw[very thick,fill=white,fill opacity=0.5] (rbf) -- (rbb) (rtf) -- (rbf);
        \draw[thick,densely dashed,-latex] plot[smooth,variable=\x,domain=0:-360] 
        ({\Length*cos(\x)},0,{-\Length*sin(\x)});

        \path (mbb) node[right=3pt,font=\Large\sffamily] {Cosine};
        \path (rtf) node[above left=3pt,font=\Large\sffamily] {Sine};
        \draw[-latex] (-3.6,0,-3.6) -- (-3.6,37,-3.6) node[left,font=\Large] {$t$};
        \draw[-latex] (3.6,0,-3.6)-- (5,0,-3.6) node [right,font=\Large] {$x$};
        \draw[-latex] (-3.6,0,3.6)-- (-3.6,0,5) node [above,font=\Large] {$y$};

        % NODES I WOULD LIKE TO CONNECT THE SECOND PICTURE TO:

        \node at (0,0,3) (A) {};
        \node at (0,0,-3) (B) {};
    \end{tikzpicture}
    \tdplotsetmaincoords{0}{0}
    \begin{tikzpicture}[remember picture]
        \draw[-latex] (-5,0) -- (5,0) node [right] {$x$};
        \draw[-latex] (0,-5) -- (0,5) node [above] {$y$};
        \draw[densely dashed] (0,0) circle (4);
        \draw[ultra thick,-latex] (0,0) -- (60:4) node[above right] {$E$};
        \draw[-latex,thick] (0,0) -- (2,0) node[below] {$x$};
        \draw[-latex,thick] (0,0) -- (0,3.46410615) node[left] {$y$};
        \draw[densely dashed] (2,0) -- (60:4) -- (0,3.46410615);
        \fill (0,0) circle (0.1);
        \draw[-latex] (60:4) -- (70:4);
    \end{tikzpicture}
\end{document}

答案1

这个问题有两个方面。

  1. 如何连接来自不同tikzpictures 的点。这是众所周知的:添加remember picture到键,然后使用单独的图片remember picture,overlay连接坐标。
  2. 那么,最好让这些线与圆相切。有些精确解是已知的。我使用分析公式在这里使用但需要手动添加一些细微的修正,因为左边的圆是圆的投影,因此不是一个精确的圆。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tikz-3dplot}
\usepackage[left=0.00cm, right=0.00cm]{geometry}
\begin{document}
    \tdplotsetmaincoords{72}{170}
    \begin{tikzpicture}[tdplot_main_coords,scale=0.5,xscale=-1,remember picture]
        \pgfmathsetmacro{\Length}{3}
        \pgfmathsetmacro{\Stretch}{2}
        % \draw[-latex] (0,0,0) -- (\Length,0,0) node[below]{$x$};
        % \draw[-latex] (0,0,0) -- (0,\Length,0) node[left]{$y$};
        % \draw[-latex] (0,0,0) -- (0,0,\Length) node[left]{$z$};
        \draw[black,very thick] plot[smooth,variable=\x,domain=0:720,samples=360] ({\Length*cos(\x)},
        {\x*(\Stretch*\Length/360)},{\Length*sin(\x)});
        \draw (-1.2*\Length,0,-1.2*\Length) coordinate (lbf) -- 
        (1.2*\Length,0,-1.2*\Length) coordinate (lbb) --
        (1.2*\Length,0,1.2*\Length) coordinate (ltb) -- 
        (-1.2*\Length,0,1.2*\Length) coordinate (ltf) -- cycle;
        \foreach \X in {bf,bb,tf}
        {\draw (l\X) -- ++ (0,2*\Stretch*\Length,0) coordinate (m\X);}
        \draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
        \foreach \X in {bf,bb,tf}
        {\draw[thick] (m\X) -- ++ (0,2*\Stretch*\Length,0) coordinate (r\X);}

        % middle
        \begin{scope}[canvas is zx plane at y=0]
            \node[transform shape,rotate=-90,scale=2,xscale=-1] at (1,0) {Circlular};
            \pgflowlevelsynccm    
            \draw[fill] (0,0) circle (0.2);
        \end{scope}
        \foreach \X in {1,...,5}
        {\ifnum\X=3
        \draw[thin] ($(mbf)!{\X/6}!(mbb)$) -- ++ (0,3*\Stretch*\Length,0);
            \draw[thin] ($(mbf)!{\X/6}!(mtf)$) -- ++ (0,3*\Stretch*\Length,0);
            \else
            \fi}
        \foreach \X [evaluate=\X as \Y using {int(mod(\X,5))}] in {1,...,18}
        {
            \ifnum\Y=0
            \draw[thin] ($(mbf)+(0,\X,0)$) -- ($(mbb)+(0,\X,0)$);
            \draw[thin] ($(mbf)+(0,\X,0)$) -- ($(mtf)+(0,\X,0)$);
            \else
            \fi
        }

        \draw[black,very thick,-latex] plot[smooth,variable=\x,domain=720:1460,samples=360] ({\Length*cos(\x)},
        {\x*(\Stretch*\Length/360)},{\Length*sin(\x)});
        \draw[black,densely dashed] plot[smooth,variable=\x,domain=720:1800,samples=360] 
        ({\Length*cos(\x)},{\x*(\Stretch*\Length/360)},-1.2*\Length);
        \draw[black,densely dashed] plot[smooth,variable=\x,domain=720:1800,samples=360] 
        (-1.2*\Length,{\x*(\Stretch*\Length/360)},{\Length*sin(\x)});
        % right
        \foreach \X in {bf,bb,tf}
            {\draw[very thick] (r\X) -- ++ (0,\Stretch*\Length,0);}
        \draw[very thick,fill=white,fill opacity=0.5] (rbf) -- (rbb) (rtf) -- (rbf);
        \draw[thick,densely dashed,-latex] 
        plot[smooth,variable=\x,domain=0:-360] 
        ({\Length*cos(\x)},0,{-\Length*sin(\x)});
        \path (0,0,0) coordinate (M) (\Length,0,0) coordinate (c0);
        \path (mbb) node[right=3pt,font=\Large\sffamily] {Cosine};
        \path (rtf) node[above left=3pt,font=\Large\sffamily] {Sine};
        \draw[-latex] (-3.6,0,-3.6) -- (-3.6,37,-3.6) node[left,font=\Large] {$t$};
        \draw[-latex] (3.6,0,-3.6)-- (5,0,-3.6) node [right,font=\Large] {$x$};
        \draw[-latex] (-3.6,0,3.6)-- (-3.6,0,5) node [above,font=\Large] {$y$};

        % NODES I WOULD LIKE TO CONNECT THE SECOND PICTURE TO:

        \node at (0,0,3) (A) {};
        \node at (0,0,-3) (B) {};
    \end{tikzpicture}
    \tdplotsetmaincoords{0}{0}
    \begin{tikzpicture}[remember picture]
        \draw[-latex] (-5,0) -- (5,0) node [right] {$x$};
        \draw[-latex] (0,-5) -- (0,5) node [above] {$y$};
        \draw[densely dashed] (0,0) coordinate (N) circle (4);
        \draw[ultra thick,-latex] (0,0) -- (60:4) node[above right] {$E$};
        \draw[-latex,thick] (0,0) -- (2,0) node[below] {$x$};
        \draw[-latex,thick] (0,0) -- (0,3.46410615) node[left] {$y$};
        \draw[densely dashed] (2,0) -- (60:4) -- (0,3.46410615);
        \fill (0,0) circle (0.1);
        \draw[-latex] (60:4) -- (70:4);
    \end{tikzpicture}
    \begin{tikzpicture}[overlay,remember picture]
        \draw let \p1=($(N)-(M)$),\p2=($(M)-(c0)$),
        \n1={atan2(\y1,\x1)},\n2={veclen(\y1,\x1)},
        \n3={veclen(\x2,\y2)},\n4={atan2(4cm-\n3,\n2)}
    in
        %\pgfextra{\typeout{\n1,\n4}}
        ($(M)+(-90-\n4+\n1:0.97*\n3)$) -- ($(N)+(-90-\n4+\n1:4cm)$)
        ($(M)+(90+\n4+\n1:0.98*\n3)$) -- ($(N)+(90+\n4+\n1:4cm)$);
\end{tikzpicture}
\end{document}

在此处输入图片描述

你让我解释代码,这很好。有一个错误,分析公式可以工作,只需要考虑左边的圆由于投影而有一点点扭曲的事实。

解释如下。整个过程都是calc语法,我们利用了切线斜率由连接中心的直线的斜率加上半径不同的事实得出的事实。一旦我们知道了斜率,这些点就被唯一地确定了。

 \draw let \p1=($(N)-(M)$), % \p1 is the vector from M to N, i.e. the difference
 % between the centers of the circles
 \p2=($(M)-(c0)$), % \p1 is the vector from M to c0
 \n1={atan2(\y1,\x1)}, % \n1 is the slope of the vector from M to N
 \n2={veclen(\y1,\x1)}, % \n2 is the distance of M and N
 \n3={veclen(\x2,\y2)}, % \n3 is the length of the vector from M to c0,
 % i.e. the radius of the left circle 
 \n4={atan2(4cm-\n3,\n2)} % \n4 is the additional slope the tangent has because
 % the radii are different
    in
        ($(M)+(-90-\n4+\n1:0.97*\n3)$) -- ($(N)+(-90-\n4+\n1:4cm)$)% point on the left circle in the form 
        % center + shift in polar coordinates (angle:radius)
        ($(M)+(90+\n4+\n1:0.98*\n3)$) -- ($(N)+(90+\n4+\n1:4cm)$);
        % same for the right point. 0.97 and 0.97 are needed to 
        % because the left circle is a projection, i.e. not an exact circle  

相关内容