1

I would like to draw the following picture using PSTricks.

enter image description here



Whats the best way to realize the solid and dashed lines looking like a coil? So far, I tried Herbert's link, but using pst-solides3d leads to this:

enter image description here

which isn't that useful. Therefore, I tried avoiding 3D. See the the following MWE:

\documentclass[12pt]{article}
\usepackage{amssymb,amsmath}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage{pst-all}
\begin{document}
\begin{pspicture}[showgrid=true](-5,-5)(5,5)
\psset{algebraic=true}
\psellipticarc[linestyle=dashed](0,0)(0.8,2.5){90}{-90}
\psellipticarc[linestyle=dashed](0.9,0)(0.8,2.5){90}{-90}
\psellipticarc[linestyle=dashed](1.8,0)(0.8,2.5){90}{-90}
\psellipticarc(0,0)(0.8,2.5){-90}{90}
\psellipticarc(0.9,0)(0.8,2.5){-90}{90}
\psellipticarc(1.8,0)(0.8,2.5){-90}{90}
\end{pspicture}
\end{document} 


Result:
enter image description here

Quite similar to the favorite picture on the top. But how can I connect the isolated windings?

3
  • Could you add some details of what you've tried?
    – Werner
    Commented Apr 2, 2017 at 18:20
  • see pstricks.blogspot.de and the year 2012
    – user2478
    Commented Apr 2, 2017 at 18:32
  • Please reopen ... necessary details added.
    – Gotti91
    Commented Apr 2, 2017 at 21:26

2 Answers 2

3
\documentclass{article}
\usepackage{pst-plot}
\begin{document}
\def\Lenz#1{
\pstVerb{%
% rayon de la bobine
/rS 1 def
% angle de projection
/Alpha #1 def
% reduction des fuyantes
/kf 0.5 def
% equation de la perspective //
% x=y-x*k*cos(alpha)
% y=z-x*k*sin'alpha)
/Equations {
% equation de l'helice
/xS rS t cos mul def
/zS rS t sin mul def
/yS t 180 div PI mul 0.1 mul def
% projection
yS xS Alpha cos mul kf mul sub
zS xS Alpha sin mul kf mul sub
} def}%
\def\UneSpire{%
% spire visible
\parametricplot[plotpoints=360,linecolor=red,linewidth=2\pslinewidth]{-90}{90}{Equations}
% spire invisible
\parametricplot[plotpoints=360,linecolor=red,linewidth=2\pslinewidth,linestyle=dotted]{90}{270}{Equations}}%
% 2*pi*0.1=0.628
% les spires de la bobine
\def\BobineA{% 5 spires
\multido{\r=0+0.628}{5}{\rput(\r,0){\UneSpire}}
\parametricplot[linecolor=red,linewidth=2\pslinewidth]{-90}{90}{Equations exch 3.14 add exch}}%
\BobineA\rput(6,0){\parametricplot[plotpoints=360,linecolor=red,linewidth=2\pslinewidth,linestyle=dotted]{90}{270}{Equations exch 0.628 sub exch}\BobineA}
% + 1/2 spire
\psline[linestyle=dashed,linecolor=red](3.14,1)(5.5,1)
\psline[linestyle=dashed,linecolor=red](3.14,-1)(5.5,-1)
\def\BobineB{ % 1/2 spire+ 2 spires + 1/2 spire
\multido{\r=0+0.314}{2}{\rput(\r,0){\psset{unit=0.5}\UneSpire}}
\parametricplot[linecolor=red,linewidth=2\pslinewidth,unit=0.5]{-90}{90}{Equations exch 0.628 2 mul add exch}
\parametricplot[linecolor=red,linewidth=2\pslinewidth,unit=0.5,linestyle=dotted]{90}{270}{Equations exch 0.314 1.25 mul sub exch}
}%
\psline[linecolor=red,linewidth=2\pslinewidth](!/t -90 def Equations)(!/t -90 def Equations pop -3)(4,-3)
\psline[linecolor=red,linewidth=2\pslinewidth](5,-3)(!/t -90 360 5.5 mul add def Equations pop 6.25 add -3)(!/t -90 360 5.5 mul add def Equations exch 6.25 add exch)(!/t -90 360 5.5 mul add def Equations exch 6 add exch)
\rput(4,0){\BobineB}
\psline(3.9,0.5)(3.9,2)(4,2)
\pscircle(4.3,2){0.3}\rput(4.3,2){V}
\psline(4.6,2)(4.7,2)(4.7,0.5)
\psdots(4.6,2)(4,2)(3.9,0.5)(4.7,0.5)
\rput(5,-3){\psline[linewidth=0.1](1.2;145)\psdots[dotstyle=o](0,0)(-1,0)}}%

\begin{pspicture}[showgrid](-1,-3)(10,3)
\Lenz0
\end{pspicture}

\begin{pspicture}[showgrid=false](-1,-3)(10,3)
\Lenz{30}
\end{pspicture}
\end{document} 

Alpha=0 Alpha=30

1
  • Excellent solution. Please help me understand: How exactly does the projection work? Is there any picture illustrating it?
    – Gotti91
    Commented Apr 4, 2017 at 12:47
1

perspective

Within the plane of projection $Oyz$ which gets the image area, if $\gamma$ is the angle of the vanishing line (the right angle is represented by $\gamma$), the coordinates of the point $M(x,y,z)$ will be $M(x_E,Y_E)$ :

formule-1

We set up a reduction/shortening coefficient $r$ to eventually shorten the vanishing lines, so that the graphic gets even more realistic. enter image description here

2
  • Okay, thank you very much. Whats means Equations exch 3.14 add exch?
    – Gotti91
    Commented Apr 4, 2017 at 19:44
  • The equations give the coordinates of the points x(t) y(t) on the stack. t Equations => x(t) y(t) exch exchanges the positions on the stack exch => y x add 3.14 => y x + 3.14% translation exch => x + 3.14 y% the coordinates are in the correct order on the stack
    – user73104
    Commented Apr 5, 2017 at 6:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .