I would like to draw the following picture using pstricks:

Magnetic field of a coil

Therefore, I used a plane and a helix. But I want the part of the helix above the plane to be drawn darker than the part below the plane. I'm just getting this:

enter image description here

No difference between above and below the plane. It should look like this, drawn with GeoGebra:

enter image description here

Here's my code. Can somebody help?


\psset{lightsrc=10 -20 50,viewpoint=50 20 20 rtp2xyz,Decran=50}

\psSolid[action=none,object=courbe,r=0,range=0 -10 Pi mul,linecolor=blue,linewidth=0.1,resolution=720,function=helice,name=A1]

\psSolid[action=none,object=new,fillcolor=red,incolor=blue,sommets=-10 -2 0 -10 2 0  2 2 0  2 -2 0,faces={[0 3 2 1]},opacity=0.2,name=B1]

\psSolid[action=draw*,object=fusion,base=A1 B1,opacity=0.5]

  • have a look at the package pst-magneticfield – user2478 Oct 9 '16 at 20:14

To draw the helix I propose this code:

    \psset{lightsrc=50 20 70 rtp2xyz,viewpoint=50 10 15 rtp2xyz,Decran=50}
    \psSolid[action=none,object=courbe,r=0.02,range=-10 Pi mul 0,function=helice,
            plansepare={[0 0 1 0]},name=solenoid]
             args={[0 0 1 0]},base=-11 1 -3 3,planmarks,showBase]
    \psProjection[object=cercle,args=\i\space Pi 2 div mul 3 div \I\space sin 0.1,range=0 360]}%


For field lines of a solenoid, have a look at the package pst-magneticfield.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.