How to change foreach to omit a certain multiple
I hope the solution to my problem is not too complicated or tedious. I am drawing a diagram which has one nuisance in it:
Every time the sine curve touches the axis TiKz tries to draw a line of 0 length and therefore it produces the arrow tip at that location
How do I remove these arrow tips, while not listing out each individual line (i.e. using something like foeach x in ...
or similar. So essentially remove every arrow that is a multiple of 180
Here is the code for drawing the diagram:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach x in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach x in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach x in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
Sorry about the code being very messy, I have very bad habits when it comes to writing in LaTeX. I have annotated the 3 lines of code which produce the arrows that define the wave.
Me just thinking about the problem
I think maybe the use of a double foreach
stack could work. The first one where some variable a
in a list {45,225,405}
and then under that something like foreach x in {A,A+45,A+90}{...}
so it would look like this:
foreach a in {45,225,405} {
foreach x in {{a},{a +45},{a +90}}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
For the first set of helplines.
Unfortunately this attempt does not work for me
EDIT: It does work (see answer below), but is there a more efficient or neat way of solving this problem?
tikz-pgf tikz-3dplot
add a comment |
I hope the solution to my problem is not too complicated or tedious. I am drawing a diagram which has one nuisance in it:
Every time the sine curve touches the axis TiKz tries to draw a line of 0 length and therefore it produces the arrow tip at that location
How do I remove these arrow tips, while not listing out each individual line (i.e. using something like foeach x in ...
or similar. So essentially remove every arrow that is a multiple of 180
Here is the code for drawing the diagram:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach x in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach x in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach x in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
Sorry about the code being very messy, I have very bad habits when it comes to writing in LaTeX. I have annotated the 3 lines of code which produce the arrows that define the wave.
Me just thinking about the problem
I think maybe the use of a double foreach
stack could work. The first one where some variable a
in a list {45,225,405}
and then under that something like foreach x in {A,A+45,A+90}{...}
so it would look like this:
foreach a in {45,225,405} {
foreach x in {{a},{a +45},{a +90}}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
For the first set of helplines.
Unfortunately this attempt does not work for me
EDIT: It does work (see answer below), but is there a more efficient or neat way of solving this problem?
tikz-pgf tikz-3dplot
In your doubleforeach
putx
in parentheses(0,{(x)*(2*3)/360},0) -- (0,{(x)*(2*3/360)},{2*sin(x)})
. And you don't need curly brackets in{a,a+45,a+90}
.
– Kpym
1 hour ago
Yes I just found that out now instead you require parenthesis, I will post a solution very soon
– sab hoque
1 hour ago
1
you can trypgfmathparse{equal(mod(x,180),0)} ifnumpgfmathresult=0 draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)}); fi
– touhami
1 hour ago
add a comment |
I hope the solution to my problem is not too complicated or tedious. I am drawing a diagram which has one nuisance in it:
Every time the sine curve touches the axis TiKz tries to draw a line of 0 length and therefore it produces the arrow tip at that location
How do I remove these arrow tips, while not listing out each individual line (i.e. using something like foeach x in ...
or similar. So essentially remove every arrow that is a multiple of 180
Here is the code for drawing the diagram:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach x in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach x in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach x in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
Sorry about the code being very messy, I have very bad habits when it comes to writing in LaTeX. I have annotated the 3 lines of code which produce the arrows that define the wave.
Me just thinking about the problem
I think maybe the use of a double foreach
stack could work. The first one where some variable a
in a list {45,225,405}
and then under that something like foreach x in {A,A+45,A+90}{...}
so it would look like this:
foreach a in {45,225,405} {
foreach x in {{a},{a +45},{a +90}}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
For the first set of helplines.
Unfortunately this attempt does not work for me
EDIT: It does work (see answer below), but is there a more efficient or neat way of solving this problem?
tikz-pgf tikz-3dplot
I hope the solution to my problem is not too complicated or tedious. I am drawing a diagram which has one nuisance in it:
Every time the sine curve touches the axis TiKz tries to draw a line of 0 length and therefore it produces the arrow tip at that location
How do I remove these arrow tips, while not listing out each individual line (i.e. using something like foeach x in ...
or similar. So essentially remove every arrow that is a multiple of 180
Here is the code for drawing the diagram:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach x in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach x in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach x in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
Sorry about the code being very messy, I have very bad habits when it comes to writing in LaTeX. I have annotated the 3 lines of code which produce the arrows that define the wave.
Me just thinking about the problem
I think maybe the use of a double foreach
stack could work. The first one where some variable a
in a list {45,225,405}
and then under that something like foreach x in {A,A+45,A+90}{...}
so it would look like this:
foreach a in {45,225,405} {
foreach x in {{a},{a +45},{a +90}}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
For the first set of helplines.
Unfortunately this attempt does not work for me
EDIT: It does work (see answer below), but is there a more efficient or neat way of solving this problem?
tikz-pgf tikz-3dplot
tikz-pgf tikz-3dplot
edited 1 hour ago
sab hoque
asked 1 hour ago
sab hoquesab hoque
1,415318
1,415318
In your doubleforeach
putx
in parentheses(0,{(x)*(2*3)/360},0) -- (0,{(x)*(2*3/360)},{2*sin(x)})
. And you don't need curly brackets in{a,a+45,a+90}
.
– Kpym
1 hour ago
Yes I just found that out now instead you require parenthesis, I will post a solution very soon
– sab hoque
1 hour ago
1
you can trypgfmathparse{equal(mod(x,180),0)} ifnumpgfmathresult=0 draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)}); fi
– touhami
1 hour ago
add a comment |
In your doubleforeach
putx
in parentheses(0,{(x)*(2*3)/360},0) -- (0,{(x)*(2*3/360)},{2*sin(x)})
. And you don't need curly brackets in{a,a+45,a+90}
.
– Kpym
1 hour ago
Yes I just found that out now instead you require parenthesis, I will post a solution very soon
– sab hoque
1 hour ago
1
you can trypgfmathparse{equal(mod(x,180),0)} ifnumpgfmathresult=0 draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)}); fi
– touhami
1 hour ago
In your double
foreach
put x
in parentheses (0,{(x)*(2*3)/360},0) -- (0,{(x)*(2*3/360)},{2*sin(x)})
. And you don't need curly brackets in {a,a+45,a+90}
.– Kpym
1 hour ago
In your double
foreach
put x
in parentheses (0,{(x)*(2*3)/360},0) -- (0,{(x)*(2*3/360)},{2*sin(x)})
. And you don't need curly brackets in {a,a+45,a+90}
.– Kpym
1 hour ago
Yes I just found that out now instead you require parenthesis, I will post a solution very soon
– sab hoque
1 hour ago
Yes I just found that out now instead you require parenthesis, I will post a solution very soon
– sab hoque
1 hour ago
1
1
you can try
pgfmathparse{equal(mod(x,180),0)} ifnumpgfmathresult=0 draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)}); fi
– touhami
1 hour ago
you can try
pgfmathparse{equal(mod(x,180),0)} ifnumpgfmathresult=0 draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)}); fi
– touhami
1 hour ago
add a comment |
2 Answers
2
active
oldest
votes
Using the foreach
in a double stack works. Essentially like this:
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
So the final code looks like this:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach a in {45,225,405,585} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-2*sin(x)},{x*(2*3/360)},{2*sin(x)});
}
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach a in {765,945,1125,1305} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
And that fixes my problem:
Still wondering if there is something more tidy, neat or general than my solution?
add a comment |
Here is an alternative. Whether or not it is more tidy, I don't know. In principle, tips=on proper draw
from p. 187 of the pgfmanual, which Paul Gaborit pointed out here, should do the trick. But I couldn't make this work, so I implemented a length check by hand. This might be more useful in situations in which it is not so easy to seen when the zero-length paths occur analytically.
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach X in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
path let p1=($(0,{X*(2*3/360},0) -
(-{2*sin(X)},{X*(2*3/360)},{2*sin(X)})$),n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3/360},0) -- (-{2*sin(X)},{X*(2*3/360)},{2*sin(X)});
fi
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach X in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - (0,{X*(2*3/360)},{2*sin(X)})$),
n1={veclen(x1,y1)} in pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red,] (0,{X*(2*3)/360},0) -- (0,{X*(2*3/360)},{2*sin(X)});
fi}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach X in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)})$),
n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3)/360},0) -- ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)});
fi}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
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%2f469835%2fhow-to-change-foreach-to-omit-a-certain-multiple%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Using the foreach
in a double stack works. Essentially like this:
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
So the final code looks like this:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach a in {45,225,405,585} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-2*sin(x)},{x*(2*3/360)},{2*sin(x)});
}
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach a in {765,945,1125,1305} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
And that fixes my problem:
Still wondering if there is something more tidy, neat or general than my solution?
add a comment |
Using the foreach
in a double stack works. Essentially like this:
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
So the final code looks like this:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach a in {45,225,405,585} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-2*sin(x)},{x*(2*3/360)},{2*sin(x)});
}
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach a in {765,945,1125,1305} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
And that fixes my problem:
Still wondering if there is something more tidy, neat or general than my solution?
add a comment |
Using the foreach
in a double stack works. Essentially like this:
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
So the final code looks like this:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach a in {45,225,405,585} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-2*sin(x)},{x*(2*3/360)},{2*sin(x)});
}
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach a in {765,945,1125,1305} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
And that fixes my problem:
Still wondering if there is something more tidy, neat or general than my solution?
Using the foreach
in a double stack works. Essentially like this:
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
So the final code looks like this:
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach a in {45,225,405,585} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-2*sin(x)},{x*(2*3/360)},{2*sin(x)});
}
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach a in {765,945,1125,1305} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- (0,{x*(2*3/360)},{2*sin(x)});
}
}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach a in {1485,1665} {
foreach x in {{a},(a +45),(a +90)}{
draw[-latex,help lines,red] (0,{x*(2*3)/360},0) -- ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
}
}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
And that fixes my problem:
Still wondering if there is something more tidy, neat or general than my solution?
answered 1 hour ago
sab hoquesab hoque
1,415318
1,415318
add a comment |
add a comment |
Here is an alternative. Whether or not it is more tidy, I don't know. In principle, tips=on proper draw
from p. 187 of the pgfmanual, which Paul Gaborit pointed out here, should do the trick. But I couldn't make this work, so I implemented a length check by hand. This might be more useful in situations in which it is not so easy to seen when the zero-length paths occur analytically.
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach X in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
path let p1=($(0,{X*(2*3/360},0) -
(-{2*sin(X)},{X*(2*3/360)},{2*sin(X)})$),n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3/360},0) -- (-{2*sin(X)},{X*(2*3/360)},{2*sin(X)});
fi
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach X in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - (0,{X*(2*3/360)},{2*sin(X)})$),
n1={veclen(x1,y1)} in pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red,] (0,{X*(2*3)/360},0) -- (0,{X*(2*3/360)},{2*sin(X)});
fi}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach X in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)})$),
n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3)/360},0) -- ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)});
fi}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
add a comment |
Here is an alternative. Whether or not it is more tidy, I don't know. In principle, tips=on proper draw
from p. 187 of the pgfmanual, which Paul Gaborit pointed out here, should do the trick. But I couldn't make this work, so I implemented a length check by hand. This might be more useful in situations in which it is not so easy to seen when the zero-length paths occur analytically.
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach X in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
path let p1=($(0,{X*(2*3/360},0) -
(-{2*sin(X)},{X*(2*3/360)},{2*sin(X)})$),n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3/360},0) -- (-{2*sin(X)},{X*(2*3/360)},{2*sin(X)});
fi
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach X in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - (0,{X*(2*3/360)},{2*sin(X)})$),
n1={veclen(x1,y1)} in pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red,] (0,{X*(2*3)/360},0) -- (0,{X*(2*3/360)},{2*sin(X)});
fi}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach X in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)})$),
n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3)/360},0) -- ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)});
fi}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
add a comment |
Here is an alternative. Whether or not it is more tidy, I don't know. In principle, tips=on proper draw
from p. 187 of the pgfmanual, which Paul Gaborit pointed out here, should do the trick. But I couldn't make this work, so I implemented a length check by hand. This might be more useful in situations in which it is not so easy to seen when the zero-length paths occur analytically.
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach X in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
path let p1=($(0,{X*(2*3/360},0) -
(-{2*sin(X)},{X*(2*3/360)},{2*sin(X)})$),n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3/360},0) -- (-{2*sin(X)},{X*(2*3/360)},{2*sin(X)});
fi
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach X in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - (0,{X*(2*3/360)},{2*sin(X)})$),
n1={veclen(x1,y1)} in pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red,] (0,{X*(2*3)/360},0) -- (0,{X*(2*3/360)},{2*sin(X)});
fi}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach X in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)})$),
n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3)/360},0) -- ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)});
fi}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
Here is an alternative. Whether or not it is more tidy, I don't know. In principle, tips=on proper draw
from p. 187 of the pgfmanual, which Paul Gaborit pointed out here, should do the trick. But I couldn't make this work, so I implemented a length check by hand. This might be more useful in situations in which it is not so easy to seen when the zero-length paths occur analytically.
documentclass[10pt]{article}
usepackage{tikz}
usetikzlibrary{calc,patterns}
usepackage{tikz-3dplot}
usepackage[left=0.00cm, right=0.00cm]{geometry}
usepackage{physics}
usepackage{bm}
usepackage{rotating}
%Defining Diagonal Arrows:
newcommand{neswarrow}{%
begin{turn}{45}
raisebox{-1ex}{$leftrightarrow$}
end{turn}
}
newcommand{nwsearrow}{%
begin{turn}{45}
raisebox{0ex}{$updownarrow$}
end{turn}
}
begin{document}
tdplotsetmaincoords{75}{135}
begin{tikzpicture}[tdplot_main_coords,scale=0.5]
draw[red,very thick,-latex] plot[smooth,variable=x,domain=0:720,samples=360] (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)});
foreach X in {45,90,...,720} { %LOOK HERE FOR FIRST SET OF ARROWS
path let p1=($(0,{X*(2*3/360},0) -
(-{2*sin(X)},{X*(2*3/360)},{2*sin(X)})$),n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3/360},0) -- (-{2*sin(X)},{X*(2*3/360)},{2*sin(X)});
fi
}
draw[very thick,red,latex-latex,densely dashed] (-2,12,2) -- (2,12,-2);
begin{scope}[canvas is xz plane at y=12,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
node[anchor=south,transform shape,scale=1.5] at (0,3.5) {large Polariser};
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (-90:1.5) arc (-90:-135:1.5) -- cycle;
draw[blue] (-112.5:1.3) ..controls +(-112.5:0.7) and +(180:0.7).. (0.7,-1.7) node[right] {$alpha$};
end{scope}
draw[very thick] (0,12,-3) -- (0,12,3);
draw[red,very thick,-latex] plot[smooth,variable=x,domain=720:1440,samples=360] (0,{x*(2*3/360)},{2*sin(x)});
foreach X in {720,765,...,1440} {%LOOK HERE FOR SECOND SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - (0,{X*(2*3/360)},{2*sin(X)})$),
n1={veclen(x1,y1)} in pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red,] (0,{X*(2*3)/360},0) -- (0,{X*(2*3/360)},{2*sin(X)});
fi}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,densely dashed,latex-latex,red] (-90:2) -- (90:2);
end{scope}
begin{scope}[canvas is xz plane at y=24,xscale=-1]
draw[very thick,fill=white,fill opacity=0.6] (0,0) circle (3.5);
draw[blue,pattern=north west lines, pattern color=blue] (0,0) -- (90:1) arc (90:30:1) -- cycle;
node[blue] at (60:1.4) {$theta$};
draw[very thick] (-150:3) -- (30:3);
node[anchor=south,transform shape,scale=1.5] at (90:3.5) {large Analyser};
end{scope}
draw[red,very thick,-latex] plot[smooth,variable=x,domain=1440:1800,samples=360] ({-0.7071067812*sin(x)},{x*(2*3/360)},{0.5*sin(x)});
foreach X in {1440,1485,...,1800} { %LOOK HERE FOR THIRD SET OF ARROWS
path let p1=($(0,{X*(2*3)/360},0) - ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)})$),
n1={veclen(x1,y1)} in
pgfextra{xdefmylen{n1}};
ifdimmylen>1pt
draw[-latex,help lines,red] (0,{X*(2*3)/360},0) -- ({-0.7071067812*sin(X)},{X*(2*3/360)},{0.5*sin(X)});
fi}
draw[-latex] (0,0,0) -- (0,32,0);
draw[-latex] (0,0,-3) -- (0,0,3);
draw[-latex] (3,0,0) -- (-3,0,0);
begin{scope}[canvas is xz plane at y=1.5,xscale=-1]
draw[red] (2,2) .. controls +(45:0.5) and +(-120:0.5).. (3,2.7);
end{scope}
node[scale=0.75,red] at (-3,4,3.7) {$bm{E}=A_{neswarrow}cosleft(2pi f t+phi_{neswarrow}right)ket{neswarrow}+0ket{nwsearrow}$};
draw (0,12,-2.7) .. controls +(0:1) and +(-135:2).. (4,12,-3) node[below,scale=0.75] {Axis of Polarisation};
begin{scope}[canvas is xz plane at y=16.5,xscale=-1]
draw[red] (0,-2) .. controls +(-90:1) and +(0:0.5).. (-2,-4.4) node[left,scale=0.75] {$bm{E}=A_{neswarrow}cos(alpha)cosleft(2pi ft+phi_{neswarrow}right)ket{updownarrow} + 0ket{leftrightarrow}$};
end{scope}
end{tikzpicture}
tdplotsetmaincoords{0}{0}
begin{tikzpicture}[remember picture,overlay]
begin{scope}[xshift=-5.8cm,yshift=4cm]
draw (1,1) circle (1.1);
draw[red,thick,latex-latex] (0.5,0.5) -- (1.5,1.5);
draw[thick] (1,0.25) -- (1,1.75);
draw[red,densely dashed,thick] (1.5,1.5) -- (1,1.5) (1,0.5) -- (0.5,0.5);
node[left,scale=0.6,red,fill=white] at (1,1.5) {$A_{neswarrow}cos(alpha)$};
draw[blue,pattern=north west lines,pattern color=blue] (1,1) -- +(45:0.25) arc (45:90:0.25) -- cycle;
draw[blue] (1,1) +(67.5:0.2) ..controls +(45:0.3) and +(180:0.1).. (1.4,1) node[right] {$alpha$};
node[below,scale=0.75] at (1,-0.1) {Polariser};
end{scope}
begin{scope}[xshift=-0.8cm,yshift=4.1cm,rotate=-60]
draw (0,0) circle (1.1);
draw[red,thick,latex-latex] (150:0.7071067812) -- (-30:0.7071067812);
draw[thick] (0,-0.75) -- (0,0.75);
draw[red,densely dashed,thick] (150:0.7071067812) -- (0,0.3535533906) (0,-0.3535533906) -- (-30:0.7071067812);
draw[blue,pattern=north west lines,pattern color=blue] (0,0) -- (150:0.25) arc (150:90:0.25) -- cycle;
draw[blue] (120:0.2) ..controls +(120:0.3) and +(-90:0.1).. (-0.3,0.6) node[above right=-0.07cm] {$theta$};
node[below,scale=0.75] at (-30:1.1) {Analyser};
end{scope}
end{tikzpicture}
end{document}
answered 16 mins ago
marmotmarmot
90.8k4104195
90.8k4104195
add a comment |
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%2f469835%2fhow-to-change-foreach-to-omit-a-certain-multiple%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
In your double
foreach
putx
in parentheses(0,{(x)*(2*3)/360},0) -- (0,{(x)*(2*3/360)},{2*sin(x)})
. And you don't need curly brackets in{a,a+45,a+90}
.– Kpym
1 hour ago
Yes I just found that out now instead you require parenthesis, I will post a solution very soon
– sab hoque
1 hour ago
1
you can try
pgfmathparse{equal(mod(x,180),0)} ifnumpgfmathresult=0 draw[-latex,help lines,red] (0,{x*(2*3/360},0) -- (-{2*sin(x)},{x*(2*3/360)},{2*sin(x)}); fi
– touhami
1 hour ago