From df2e480fb0e83b9160de826127a9200714b9f3f2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 17 Jan 2019 21:28:05 +0000 Subject: pst-magneticfield (17jan19) git-svn-id: svn://tug.org/texlive/trunk@49738 c570f23f-e606-0410-a88d-b1316a301751 --- .../pst-magneticfield/pst-magneticfield.tex | 80 ++++++++++++++++++---- 1 file changed, 67 insertions(+), 13 deletions(-) (limited to 'Master/texmf-dist/tex/generic/pst-magneticfield') diff --git a/Master/texmf-dist/tex/generic/pst-magneticfield/pst-magneticfield.tex b/Master/texmf-dist/tex/generic/pst-magneticfield/pst-magneticfield.tex index be716d75a51..cf548ae4367 100644 --- a/Master/texmf-dist/tex/generic/pst-magneticfield/pst-magneticfield.tex +++ b/Master/texmf-dist/tex/generic/pst-magneticfield/pst-magneticfield.tex @@ -17,11 +17,13 @@ % Requires some packages \ifx\PSTricksLoaded\endinput\else \input pstricks \fi \ifx\PSTthreeDLoaded\endinput\else\input pst-3d \fi +\ifx\PSTnodesLoaded\endinput\else \input pst-node \fi +\ifx\PSTarrowLoaded\endinput\else \input pst-arrow \fi \ifx\MultidoLoaded\endinput\else \input multido.tex\fi \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi % -\def\fileversion{1.13} -\def\filedate{2010/06/11} +\def\fileversion{1.15} +\def\filedate{2019/01/17} \message{`pst-magneticfield' v\fileversion, \filedate\space (ml,jg,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -55,10 +57,12 @@ \define@boolkey[psset]{pst-magneticfield}[Pst@]{AntiHelmholtz}[true]{} \define@boolkey[psset]{pst-magneticfield}[Pst@]{StreamDensityPlot}[true]{} \define@boolkey[psset]{pst-magneticfield}[Pst@]{setgray}[true]{} +\define@boolkey[psset]{pst-magneticfield}[Pst@]{changeNS}[true]{} % \psset[pst-magneticfield]{R=1,L=4,N=6,pointsB=500,pointsS=1000, PasB=0.02,PasS=0.00275,nS=1,nL=8,drawSelf,styleSpire=styleSpire, - styleCourant=sensCourant,AntiHelmholtz=false,StreamDensityPlot=false,setgray=false} + styleCourant=sensCourant,AntiHelmholtz=false,StreamDensityPlot=false,setgray=false, + changeNS=false} % \def\tx@MFieldDict{ tx@MFieldDict begin } % @@ -109,21 +113,34 @@ /StreamDensityPlot \ifPst@StreamDensityPlot true \else false \fi def /Setgray \ifPst@setgray true \else false \fi def }% - \addto@pscode{ \tx@MFieldDict MagneticField end }% + \addto@pscode{ \tx@MFieldDict %\pst@magnetrotate rotate + MagneticField end }% \ifPst@drawSelf \ifPst@AntiHelmholtz \psline[style=\psk@styleSpire](!Radius neg Radius 2 div)(!Radius Radius 2 div) - \psline[style=\psk@styleCourant]{<-}(!-0.2 Radius 2 div)(!0.2 Radius 2 div) \psline[style=\psk@styleSpire](!Radius neg Radius 2 div neg)(!Radius Radius 2 div neg) - \psline[style=\psk@styleCourant]{->}(!-0.2 Radius 2 div neg)(!0.2 Radius 2 div neg) + \ifPst@changeNS + \psline[style=\psk@styleCourant]{->}(!-0.2 Radius 2 div)(!0.2 Radius 2 div) + \psline[style=\psk@styleCourant]{<-}(!-0.2 Radius 2 div neg)(!0.2 Radius 2 div neg) + \else + \psline[style=\psk@styleCourant]{<-}(!-0.2 Radius 2 div)(!0.2 Radius 2 div) + \psline[style=\psk@styleCourant]{->}(!-0.2 Radius 2 div neg)(!0.2 Radius 2 div neg) + \fi \else - \multido{\i=1+1}{\psk@magneticfieldN}{% numero de la spire - \pst@Verb{ /Yspire yA \i\space 1 sub inter mul sub def } % position de la spire - \psline[style=\psk@styleSpire](! Radius neg Yspire)(! Radius Yspire) - \psline[style=\psk@styleCourant]{->}(! -0.2 Yspire)(! 0.2 Yspire)} - \fi% - \fi% - \end@SpecialObj% + \ifPst@changeNS + \multido{\i=1+1}{\psk@magneticfieldN}{% numero de la spire + \pst@Verb{ /Yspire yA \i\space 1 sub inter mul sub def } % position de la spire + \psline[style=\psk@styleSpire](! Radius neg Yspire)(! Radius Yspire) + \psline[style=\psk@styleCourant]{<-}(! -0.2 Yspire)(! 0.2 Yspire)}% + \else + \multido{\i=1+1}{\psk@magneticfieldN}{% numero de la spire + \pst@Verb{ /Yspire yA \i\space 1 sub inter mul sub def } % position de la spire + \psline[style=\psk@styleSpire](! Radius neg Yspire)(! Radius Yspire) + \psline[style=\psk@styleCourant]{->}(! -0.2 Yspire)(! 0.2 Yspire)}% + \fi + \fi + \fi + \end@SpecialObj \ignorespaces} % \newpsstyle{grille}{subgriddiv=0,gridcolor=lightgray,griddots=10} @@ -176,6 +193,43 @@ \fi \endgroup} % +\define@boolkey[psset]{pst-magneticfield}[Pst@]{showField}[true]{} +\define@boolkey[psset]{pst-magneticfield}[Pst@]{showPoleLabels}[true]{} +\define@key[psset]{pst-magneticfield}{fontstyle}[\large\bfseries\sffamily]{\def\psk@label@fontstyle{#1}} +\define@key[psset]{pst-magneticfield}{magnetScale}[1 1]{\pst@getscale{#1}\pst@magnetscale} +\psset[pst-magneticfield]{showPoleLabels,fontstyle=\large\bfseries\sffamily,showField=false, + magnetScale=1} + +\def\ps@Bar@Magnet{% + \psscalebox{\pst@magnetscale}{% + \psframe*[linecolor=Green](-0.5,-1.5)(0.5,0)% + \psframe*[linecolor=BrickRed](-0.5,0)(0.5,1.5)% + \ifPst@showPoleLabels + \rput{0}(0,1){\textcolor{white}{\psk@label@fontstyle N}}% + \rput{0}(0,-1){\textcolor{white}{\psk@label@fontstyle S}}% + \fi}% +}% + +\def\psBarMagnet{\pst@object{psBarMagnet}} +\def\psBarMagnet@i{\@ifnextchar(\psBarMagnet@ii{\psBarMagnet@ii(0,0)}}% +\def\psBarMagnet@ii(#1){% + \pst@killglue + \begingroup + \addbefore@par{R=0.8,L=3,N=4,pointsS=200,nL=9,nS=0,PasB=0.1,numSpires=0}% + \use@par + \ifPst@showField + \rput(#1){% + \psscalebox{0.4 0.7}{\psmagneticfield(-8,-10)(8,10)}% + \multido{\rA=0.3+0.3,\rB=0.8+0.1,\iA=-60+20,\iB=60+-20}{4}{% + \pccurve[ncurv=\rB,linewidth=0.1\pslinewidth,angleA=\iA,angleB=\iB,ArrowInside=->](0.5,\rA)(0.5,-\rA) + \psscalebox{-1 1}{\pccurve[ncurv=\rB,linewidth=0.1\pslinewidth,angleA=\iA,angleB=\iB,ArrowInside=->](0.5,\rA)(0.5,-\rA)}% + }}% + \fi + \rput(#1){\ps@Bar@Magnet}% + \endgroup + \ignorespaces +} +% \catcode`\@=\PstAtCode\relax % %% END -- cgit v1.2.3