การตกแต่ง "ขดลวด" ของ Tikz: จะเปลี่ยนทิศทางของขดลวดได้อย่างไร?
ฉันมีปัญหาในการใช้การcoil
ตกแต่งใน Tikz:
คุณอาจทราบว่าอนุภาคที่มีประจุหมุนรอบเส้นสนามแม่เหล็ก (เรียกว่าการเคลื่อนที่แบบไซโคลตรอน ) อย่างไรก็ตามใกล้พื้นผิวที่มีอคติการเคลื่อนที่ของศูนย์นำทาง (เช่นศูนย์กลางของลูป) จะหยุดการเคลื่อนที่เชิงเส้นตามเส้นสนามBและมีแนวโน้มที่จะเป็นไปตามทิศทางที่ตั้งฉากกับพื้นผิว นี่คือสิ่งที่ดูเหมือนใน Tikz:

ด้วยรหัสต่อไปนี้:
\documentclass[tikz]{standalone}
\usetikzlibrary{calc,decorations.pathreplacing,angles,quotes,decorations.pathmorphing}
\usepackage{newpxtext,newpxmath}
\usepackage[european,RPvoltages]{circuitikz}
\standaloneenv{circuitikz}
\begin{document}
\begin{tikzpicture}[thick,scale=1, every node/.style={scale=1}]
\def\ion#1#2{
%\draw node[circle,shading=ball,minimum width=1cm,color = white] at (#1,#2) {$\textbf{+}$};
\fill[white, ball color=blue!80!white] (#1, #2, 0) circle (0.5);
\draw (#1,#2) node[color = white] {\Huge $\textbf{+}$};
}
\def\electron#1#2{
%\draw node[circle,shading=ball,minimum width=1cm,color = white] at (#1,#2) {$\textbf{+}$};
\fill[line width=0.0mm, white, ball color=red] (#1, #2, 0) circle (0.30);
\draw (#1,#2) node[color = white] {\Large $\textbf{-}$};
}
% Electrodes
\shade [left color = gray , right color = gray!25] (10,0) -- (11,0) -- (11,7) -- (10,7) -- cycle;
\draw (10.5,3.5) node [rotate = -90] {Cathode, $V<0$ V};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% plasma
\shade [right color = blue!30 , left color = blue!10] (-0.5,0) -- (10,0) -- (10,7) -- (-0.5,7) -- cycle;
\draw [thick] (-0.5,0) -- (11,0);
\draw [thick] (-0.5,7) -- (11,7);
\draw [very thick] (10,0) -- (10,7);
\draw [ultra thick, ->,>=stealth] (0.5,5) -- (0.5,6.25);
\draw (0.5,6) node [above left] {$x$};
\draw [ultra thick, ->,>=stealth] (0.5,5) -- (1.75,5);
\draw (1.5,5) node [below left] {$z$};
\draw (0.5,5) node {$\bullet$};
\draw [very thick,->,>=stealth] (0.5,5) --++ (45:1.4);
\draw (0.5,5) ++ (45:1.4) node [above right] {$\vec{B}=B~\vec{b}$};
\draw [very thick] (0.5,5.5) arc(90:45:0.5);
\draw (0.5,5) ++ (70:0.75) node [] {$\psi$};
\draw [dashed, very thick, red!40!blue] (0,0) -- (3,3) to[out = 45, in = -170] (7,5) -- (10,5);
\draw [dashed, white!10!black, ultra thick](3,0) -- (3,7);
\draw [dashed, white!10!black, ultra thick](7,0) -- (7,7);
\draw (1.5,0) node [below, text width = 3cm,align = center] {Prégaine \\ collisionnelle $\sim\lambda_i$};
\draw (5,0) node [below, text width = 4cm,align = center] {Prégaine \\ magnétique $\sim\rho_\text{ci}$};
\draw (8.5,0) node [below, text width = 2.5cm,align = center] {Gaine de Debye $\sim\lambda_\text{De}$};
% THIS IS THE FRAGMENT TO DRAW THE BLUE COIL !!!!
\draw [very thick, blue!50!white,->,>=stealth,decorate,decoration={coil,amplitude=10mm,segment length=10mm,post length=1mm}]
(0,0) -- (3,3) to[out = 45, in = -170] (7,5) -- (10,5);
% THIS was THE FRAGMENT TO DRAW THE BLUE COIL !!!!
\draw [ultra thick,->,>=stealth,blue] (1,1) --++ (45:1);
\draw (1,1) ++ (45:1) node [above left,blue] {$\vec{v}_i$};
\ion{1}{1};
\draw [ultra thick,->,>=stealth,blue] (3,3) --++ (45:1.4);
\draw (3,3) ++ (45:1.4) node [below right,blue] {$\vec{v}_{i\parallel}=c_s~\vec{b}$};
\ion{3}{3};
\draw [ultra thick,->,>=stealth,blue] (7,5) --++ (0:1.4);
\draw (7,5) ++ (0:1.4) node [below,blue] {$\vec{v}_{iz}=c_s~\vec{e}_z$};
\ion{7}{5};
\draw [very thick, red!80!white,->,>=stealth,decorate,decoration={coil,amplitude=1.4mm,segment length=2mm,post length=1mm}]
(0,2.75) -- (4.25,7);
\electron{0}{2.75};
\draw [very thick, red!80!white,->,>=stealth,decorate,decoration={coil,amplitude=1.4mm,segment length=2mm,post length=1mm}]
(5,0.5) -- (8,3.5);
\draw [very thick , dotted , red!80!white] (8,3.5) -- ++(45:0.25);
\electron{5}{0.5};
\end{tikzpicture}
\end{document}
ปัญหาคือขดลวดจะต้องตั้งฉากกับทิศทางB ไม่ใช่ทางเดินตรงกลาง (รหัสที่สัมพันธ์กับการวาดขดลวดอยู่ระหว่างความคิดเห็นทั้งสอง% THIS IS THE FRAGMENT TO DRAW THE BLUE COIL !!!!
)
ดังนั้นคำถาม Tikz ของฉัน: มีวิธีบังคับขดลวดเพื่อให้มีความเอียงเท่ากันหรือไม่ (เช่นตั้งฉากกับ B) แต่จะทำตามเส้นประสีม่วงด้วยหรือไม่?
ฉันต้องการสิ่งนี้ (ขออภัยสำหรับคุณภาพที่ไม่ดี):

ขอบคุณล่วงหน้าสำหรับความช่วยเหลือของ!
คำตอบ
รุ่นแรกที่ใช้งานไม่ได้:
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\draw [very thick, orange] (0,0) -- (3,3) to[out = 45, in = -180] (7,5) -- (10,5);
\draw [very thick, blue!50, decorate, decoration={coil,amplitude=10mm,segment length=10mm, transform={shift only, rotate=45}}] (0,0) -- (3,3) to[out = 45, in = -180] (7,5) -- (10,5);
\end{tikzpicture}
\end{document}

transform={shift only, rotate=45}
ไม่ทำงานได้ดีกับ morphing เส้นทางขดลวด
ฉันสร้างเส้นทางพาราเมตริก - ฉันเลือกที่จะรวมส่วนตรงสองส่วนด้วยพาราโบลาและหวังว่ามันจะโอเค จากนั้นฉันวาดขดลวดพาราเมตริกที่เพิ่มเข้ามาในเส้นทางนี้:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw [very thick, green!50, domain={0:1}, smooth, variable=\t, samples=100] plot ({3*\t}, {3*\t});
\draw [very thick, green!50, domain={0:1}, smooth, variable=\t, samples=100] plot ({4*\t+3},{-2*(\t-1)^2+5});
\draw [very thick, green!50, domain={0:1}, smooth, variable=\t, samples=100] plot ({3*\t+7}, {5});
%
\draw[very thick, red!50, domain={0:10}, smooth, variable=\t, samples=100] plot ( {(0.3*\t+0.8*sin((\t*pi-pi/2) r)*cos(45)-cos((\t*pi-pi/2) r)*sin(45)}, {0.3*\t+cos((\t*pi-pi/2) r)} );
\draw[very thick, red!50, domain={0:10}, smooth, variable=\t, samples=100] plot ( {(0.4*\t+3+0.8*sin((\t*pi-pi/2) r)*cos(45)-cos((\t*pi-pi/2) r)*sin(45)}, {-2*(0.1*\t-1)^2+5+cos((\t*pi-pi/2) r)} );
\draw[very thick, red!50, domain={0:5}, smooth, variable=\t, samples=100] plot ( {(0.5*\t+7+0.8*sin((\t*pi-pi/2) r)*cos(45)-cos((\t*pi-pi/2) r)*sin(45)}, {5+cos((\t*pi-pi/2) r)} );
\end{tikzpicture}
\end{document}

สิ่งที่น่าจะดีกว่า:
- เนื่องจากวิธีที่ฉันเอียงขดลวดจึงไม่เริ่มต้นที่จุดเริ่มต้นของเส้นทาง
- ทั้งเส้นทางและขดลวดถูกวาดเป็นสามส่วน จะเป็นการดีกว่าหากกำหนดฟังก์ชันและวาดทั้งสองอย่างในครั้งเดียว ด้วยวิธีนี้จะไม่มีการเข้าร่วมและ
smooth
จะได้ผลตลอดเส้นทาง ฉันไม่รู้ว่าต้องทำอย่างไร - เนื่องจากสามส่วนฉันถูกบังคับให้เลือกจำนวนลูปจำนวนเต็มที่จะเพิ่มในแต่ละส่วน สิ่งนี้ทำให้ลูปดูมีระยะห่างมากขึ้นในระยะแรกของพาราโบลา อาจมีการปรับเปลี่ยนเส้นทางหากเส้นทางที่แน่นอนไม่สำคัญเพื่อให้ส่วนต่างๆมีความยาวอัตราส่วนจำนวนเต็ม
แก้ไข:
ฉันตระหนักดีว่าจุดเริ่มต้นนั้นไม่ได้เกิดจากการเอียง แต่เป็นเพราะฉันเริ่มลูปครึ่งรอบก่อน - นี่คือเวอร์ชันที่แก้ไข:
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\draw [very thick, green!50, domain={0:1}, smooth, variable=\t, samples=100] plot ({3*\t}, {3*\t});
\draw [very thick, green!50, domain={0:1}, smooth, variable=\t, samples=100] plot ({4*\t+3},{-2*(\t-1)^2+5});
\draw [very thick, green!50, domain={0:1}, smooth, variable=\t, samples=100] plot ({3*\t+7}, {5});
%
\draw[very thick, blue, domain={0:10}, smooth, variable=\t, samples=100] plot ( {(0.3*\t+sqrt(18)/7+0.8*sin((\t*pi-pi/2) r)*cos(45)-cos((\t*pi-pi/2) r)*sin(45)}, {0.3*\t+cos((\t*pi-pi/2) r)} );
\draw[very thick, blue, domain={0:10}, smooth, variable=\t, samples=100] plot ( {(0.4*\t+sqrt(18)/7+3+0.8*sin((\t*pi-pi/2) r)*cos(45)-cos((\t*pi-pi/2) r)*sin(45)}, {-2*(0.1*\t-1)^2+5+cos((\t*pi-pi/2) r)} );
\draw[very thick, blue, domain={0:3}, smooth, variable=\t, samples=100] plot ( {(0.6*\t+sqrt(18)/7+7+0.8*sin((\t*pi-pi/2) r)*cos(45)-cos((\t*pi-pi/2) r)*sin(45)}, {5+cos((\t*pi-pi/2) r)} );
\end{tikzpicture}
\end{document}
