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:


enter image description here

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

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

2 Answers 2

% 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}%
% spire visible
% spire invisible
% 2*pi*0.1=0.628
% les spires de la bobine
\def\BobineA{% 5 spires
\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
\def\BobineB{ % 1/2 spire+ 2 spires + 1/2 spire
\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)



Alpha=0 Alpha=30

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


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)$ :


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

  • Okay, thank you very much. Whats means Equations exch 3.14 add exch?
    – Gotti91
    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
    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 .