How to connect a node between two 3d tikzpictures
I apologize if this is a repeat of another question, but I would like to connect the nodes A and B from the left hand side of this picture to the top and bottom of the circle in the right hand side:
So something like this:
Things I have tried:
Using overlay and remember picture
When using these settings, overlay moves the right hand picture to an undesired location and using remember picture by itself to connect the nodes does not work.
Placing both images inside one tikzpicture and using scopes
Unfortunately when placing the right hand side inside the left hand side's tikzpicture environment, the diagram orients itself to the x,y axis (which is actually the x,t plane in the diagram) and hence does not get me the desired output.
I am unsure of how to draw the connecting lines. Here is the code used in the making of the diagram:
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
tikz-pgf tikz-3dplot
add a comment |
I apologize if this is a repeat of another question, but I would like to connect the nodes A and B from the left hand side of this picture to the top and bottom of the circle in the right hand side:
So something like this:
Things I have tried:
Using overlay and remember picture
When using these settings, overlay moves the right hand picture to an undesired location and using remember picture by itself to connect the nodes does not work.
Placing both images inside one tikzpicture and using scopes
Unfortunately when placing the right hand side inside the left hand side's tikzpicture environment, the diagram orients itself to the x,y axis (which is actually the x,t plane in the diagram) and hence does not get me the desired output.
I am unsure of how to draw the connecting lines. Here is the code used in the making of the diagram:
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
tikz-pgf tikz-3dplot
add a comment |
I apologize if this is a repeat of another question, but I would like to connect the nodes A and B from the left hand side of this picture to the top and bottom of the circle in the right hand side:
So something like this:
Things I have tried:
Using overlay and remember picture
When using these settings, overlay moves the right hand picture to an undesired location and using remember picture by itself to connect the nodes does not work.
Placing both images inside one tikzpicture and using scopes
Unfortunately when placing the right hand side inside the left hand side's tikzpicture environment, the diagram orients itself to the x,y axis (which is actually the x,t plane in the diagram) and hence does not get me the desired output.
I am unsure of how to draw the connecting lines. Here is the code used in the making of the diagram:
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
tikz-pgf tikz-3dplot
I apologize if this is a repeat of another question, but I would like to connect the nodes A and B from the left hand side of this picture to the top and bottom of the circle in the right hand side:
So something like this:
Things I have tried:
Using overlay and remember picture
When using these settings, overlay moves the right hand picture to an undesired location and using remember picture by itself to connect the nodes does not work.
Placing both images inside one tikzpicture and using scopes
Unfortunately when placing the right hand side inside the left hand side's tikzpicture environment, the diagram orients itself to the x,y axis (which is actually the x,t plane in the diagram) and hence does not get me the desired output.
I am unsure of how to draw the connecting lines. Here is the code used in the making of the diagram:
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
tikz-pgf tikz-3dplot
tikz-pgf tikz-3dplot
asked Jan 10 at 1:11
sab hoquesab hoque
1,502318
1,502318
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There are two aspects in this question.
- How to connect points from different
tikzpicture
s. This is well-known: addremember picture
to the keys and then use a separate picture withremember picture,overlay
to connect coordinates. - Then it is probably desirable to have the lines being tangents to the circles. Some exact solutions are known. I use an analytical formula used here but add slight corrections by hand because the left circle is a projection of a circle and thus not an exact circle.
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
It is good that you made me explain the code. There was a bug and the analytic formula works, one only has to account for the fact that the left circle is a tiny bit distorted because of the projection.
Here come the explanations. The whole thing is calc
syntax and we make use of the fact that the slope of the tangents are given by the slope of the line connecting the centers plus something coming from the fact that the radii are different. Once we know the slope, the points are uniquely determined.
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
Could you please let me know what everything inside the last tikzpicture section means or at least where they are in the manual, I do not know what they mean
– sab hoque
Jan 10 at 8:49
1
@sabhoque Done. Thanks! This helped me to fix a bug and now the analytical determination works very well, no more adjustments by hand. (There was a conversion factor in the old example because there the radii were specified without units but was not needed here, and spoiled tie formula.)
– marmot
Jan 10 at 15:23
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f469469%2fhow-to-connect-a-node-between-two-3d-tikzpictures%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are two aspects in this question.
- How to connect points from different
tikzpicture
s. This is well-known: addremember picture
to the keys and then use a separate picture withremember picture,overlay
to connect coordinates. - Then it is probably desirable to have the lines being tangents to the circles. Some exact solutions are known. I use an analytical formula used here but add slight corrections by hand because the left circle is a projection of a circle and thus not an exact circle.
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
It is good that you made me explain the code. There was a bug and the analytic formula works, one only has to account for the fact that the left circle is a tiny bit distorted because of the projection.
Here come the explanations. The whole thing is calc
syntax and we make use of the fact that the slope of the tangents are given by the slope of the line connecting the centers plus something coming from the fact that the radii are different. Once we know the slope, the points are uniquely determined.
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
Could you please let me know what everything inside the last tikzpicture section means or at least where they are in the manual, I do not know what they mean
– sab hoque
Jan 10 at 8:49
1
@sabhoque Done. Thanks! This helped me to fix a bug and now the analytical determination works very well, no more adjustments by hand. (There was a conversion factor in the old example because there the radii were specified without units but was not needed here, and spoiled tie formula.)
– marmot
Jan 10 at 15:23
add a comment |
There are two aspects in this question.
- How to connect points from different
tikzpicture
s. This is well-known: addremember picture
to the keys and then use a separate picture withremember picture,overlay
to connect coordinates. - Then it is probably desirable to have the lines being tangents to the circles. Some exact solutions are known. I use an analytical formula used here but add slight corrections by hand because the left circle is a projection of a circle and thus not an exact circle.
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
It is good that you made me explain the code. There was a bug and the analytic formula works, one only has to account for the fact that the left circle is a tiny bit distorted because of the projection.
Here come the explanations. The whole thing is calc
syntax and we make use of the fact that the slope of the tangents are given by the slope of the line connecting the centers plus something coming from the fact that the radii are different. Once we know the slope, the points are uniquely determined.
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
Could you please let me know what everything inside the last tikzpicture section means or at least where they are in the manual, I do not know what they mean
– sab hoque
Jan 10 at 8:49
1
@sabhoque Done. Thanks! This helped me to fix a bug and now the analytical determination works very well, no more adjustments by hand. (There was a conversion factor in the old example because there the radii were specified without units but was not needed here, and spoiled tie formula.)
– marmot
Jan 10 at 15:23
add a comment |
There are two aspects in this question.
- How to connect points from different
tikzpicture
s. This is well-known: addremember picture
to the keys and then use a separate picture withremember picture,overlay
to connect coordinates. - Then it is probably desirable to have the lines being tangents to the circles. Some exact solutions are known. I use an analytical formula used here but add slight corrections by hand because the left circle is a projection of a circle and thus not an exact circle.
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
It is good that you made me explain the code. There was a bug and the analytic formula works, one only has to account for the fact that the left circle is a tiny bit distorted because of the projection.
Here come the explanations. The whole thing is calc
syntax and we make use of the fact that the slope of the tangents are given by the slope of the line connecting the centers plus something coming from the fact that the radii are different. Once we know the slope, the points are uniquely determined.
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
There are two aspects in this question.
- How to connect points from different
tikzpicture
s. This is well-known: addremember picture
to the keys and then use a separate picture withremember picture,overlay
to connect coordinates. - Then it is probably desirable to have the lines being tangents to the circles. Some exact solutions are known. I use an analytical formula used here but add slight corrections by hand because the left circle is a projection of a circle and thus not an exact circle.
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 (lX) -- ++ (0,2*Stretch*Length,0) coordinate (mX);}
draw[thick] (mbf) -- (mbb) (mtf) -- (mbf);
foreach X in {bf,bb,tf}
{draw[thick] (mX) -- ++ (0,2*Stretch*Length,0) coordinate (rX);}
% 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}
{ifnumX=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}
{
ifnumY=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] (rX) -- ++ (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=Largesffamily] {Cosine};
path (rtf) node[above left=3pt,font=Largesffamily] {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}
It is good that you made me explain the code. There was a bug and the analytic formula works, one only has to account for the fact that the left circle is a tiny bit distorted because of the projection.
Here come the explanations. The whole thing is calc
syntax and we make use of the fact that the slope of the tangents are given by the slope of the line connecting the centers plus something coming from the fact that the radii are different. Once we know the slope, the points are uniquely determined.
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
edited Jan 10 at 15:21
answered Jan 10 at 4:10
marmotmarmot
92.1k4108201
92.1k4108201
Could you please let me know what everything inside the last tikzpicture section means or at least where they are in the manual, I do not know what they mean
– sab hoque
Jan 10 at 8:49
1
@sabhoque Done. Thanks! This helped me to fix a bug and now the analytical determination works very well, no more adjustments by hand. (There was a conversion factor in the old example because there the radii were specified without units but was not needed here, and spoiled tie formula.)
– marmot
Jan 10 at 15:23
add a comment |
Could you please let me know what everything inside the last tikzpicture section means or at least where they are in the manual, I do not know what they mean
– sab hoque
Jan 10 at 8:49
1
@sabhoque Done. Thanks! This helped me to fix a bug and now the analytical determination works very well, no more adjustments by hand. (There was a conversion factor in the old example because there the radii were specified without units but was not needed here, and spoiled tie formula.)
– marmot
Jan 10 at 15:23
Could you please let me know what everything inside the last tikzpicture section means or at least where they are in the manual, I do not know what they mean
– sab hoque
Jan 10 at 8:49
Could you please let me know what everything inside the last tikzpicture section means or at least where they are in the manual, I do not know what they mean
– sab hoque
Jan 10 at 8:49
1
1
@sabhoque Done. Thanks! This helped me to fix a bug and now the analytical determination works very well, no more adjustments by hand. (There was a conversion factor in the old example because there the radii were specified without units but was not needed here, and spoiled tie formula.)
– marmot
Jan 10 at 15:23
@sabhoque Done. Thanks! This helped me to fix a bug and now the analytical determination works very well, no more adjustments by hand. (There was a conversion factor in the old example because there the radii were specified without units but was not needed here, and spoiled tie formula.)
– marmot
Jan 10 at 15:23
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f469469%2fhow-to-connect-a-node-between-two-3d-tikzpictures%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown