3

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?

\documentclass[12pt]{article}
\usepackage{amssymb,amsmath}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{pst-plot,pstricks-add,pst-solides3d,pst-3dplot}
\begin{document}
\psset{unit=1cm}
\begin{pspicture}[showgrid=false,solidmemory](-5,-5)(5,5)
\psset{algebraic=true}

\psset{lightsrc=10 -20 50,viewpoint=50 20 20 rtp2xyz,Decran=50}
\axesIIID(0,0,0)(4,4,6)

%Helix
\defFunction[algebraic]{helice}(t){t/3}{sin(t)}{cos(t)}
\psSolid[action=none,object=courbe,r=0,range=0 -10 Pi mul,linecolor=blue,linewidth=0.1,resolution=720,function=helice,name=A1]

%plane
\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]

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

\end{pspicture}
\end{document}
1
  • have a look at the package pst-magneticfield
    – user2478
    Commented Oct 9, 2016 at 20:14

1 Answer 1

2

To draw the helix I propose this code:

    \documentclass{article}
    \usepackage{pst-solides3d}
    \begin{document}
    \begin{pspicture}[showgrid=false,solidmemory](-5,-5)(5,5)
    \psset{algebraic=true}
    \psset{lightsrc=50 20 70 rtp2xyz,viewpoint=50 10 15 rtp2xyz,Decran=50}
    %Helix
    \defFunction[algebraic]{helice}(t){t/3}{sin(t)}{cos(t)}
    \psSolid[action=none,object=courbe,r=0.02,range=-10 Pi mul 0,function=helice,
            plansepare={[0 0 1 0]},name=solenoid]
    \psSolid[object=load,load=solenoid1,grid,fillcolor=red](0,0,0)
    \psSolid[object=plan,definition=equation,name=planhorizontal,opacity=0.7,filcolor=yellow!20,
             args={[0 0 1 0]},base=-11 1 -3 3,planmarks,showBase]
    \psset{plan=planhorizontal}
    \multido{\i=-1+-2,\I=-90+-180}{10}{%
    \psProjection[object=cercle,args=\i\space Pi 2 div mul 3 div \I\space sin 0.1,range=0 360]}%
    \psSolid[object=load,load=solenoid0,grid,fillcolor=red](0,0,0)
    \end{pspicture}
    \end{document} 

Solenoid

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

You must log in to answer this question.

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