summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex63
1 files changed, 57 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex b/Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex
index cd15fa05373..0aff59732c5 100644
--- a/Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex
+++ b/Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex
@@ -1,4 +1,4 @@
-%% $Id: pst-coil.tex 578 2011-09-18 17:18:46Z herbert $
+%% $Id: pst-coil.tex 930 2024-08-13 18:19:44Z herbert $
%% BEGIN pst-coil.tex
%%
%% Coils and zigzags with PSTricks
@@ -7,7 +7,7 @@
%%
%%
%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt, tvz@nwu.edu.
-%% 2006-2015 Herbert Voss, hvoss@tug.org
+%% 2006-2024 Herbert Voss, hvoss@tug.org
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
@@ -21,8 +21,8 @@
\ifx\PSTnodeLoaded\endinput \else\input pst-node.tex\fi
\ifx\PSTXKeyLoaded\endinput \else\input pst-xkey \fi
%
-\def\fileversion{1.07}
-\def\filedate{2015/05/13}
+\def\fileversion{1.08}
+\def\filedate{2024/08/13}
%
\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11
@@ -48,7 +48,15 @@
\let\psk@coilarmB\psk@coilarmA}
\define@key[psset]{pst-coil}{coilaspect}[45]{\pst@getangle{#1}\psk@coilaspect}
\define@key[psset]{pst-coil}{coilinc}[10]{\pst@getangle{#1}\psk@coilinc}
-%
+%%%%%% alternative macro
+\define@key[psset]{pst-coil}{N}[10]{\def\psk@NoOfSpirals{#1 }}
+\define@key[psset]{pst-coil}{R}[1]{\def\psk@InitialWidth{#1 }}% in cm
+\define@key[psset]{pst-coil}{l0}[10]{\def\psk@InitialLength{#1 }}
+\define@key[psset]{pst-coil}{alpha}[15]{\def\psk@coil@Alpha{#1 }}
+\define@key[psset]{pst-coil}{arm}[0]{\def\psk@coil@arm{#1 }}
+\define@key[psset]{pst-coil}{nS}[25]{\def\psk@coil@NoOfPointsPerCoil{#1 }}
+\psset[pst-coil]{N=10,R=0.5,alpha=15,arm=0,l0=5,nS=25}
+
\psset[pst-coil]{coilaspect=45,coilarm=.5cm,coilheight=1,coilwidth=1cm,coilinc=10}
%
\def\pscoil{\def\pst@par{}\pst@object{pscoil}}
@@ -198,7 +206,7 @@
{ \psk@function }
\tx@Sin
}%
- \showpointsfalse%
+ \showpointsfalse
\end@OpenObj}
%
\def\ncsin{\pst@object{ncsin}}
@@ -220,6 +228,49 @@
\def\pcsin{\def\pst@par{}\pst@object{pcsin}}
\def\pcsin@i{\pc@object\ncsin@ii}
%
+\def\psAltCoil{\def\pst@par{}\pst@object{psAltCoil}}
+\def\psAltCoil@i{\pst@getarrows\psAltCoil@ii}
+\def\psAltCoil@ii(#1){\@ifnextchar({\psAltCoil@iii{1}(#1)}{\psAltCoil@iii{\z@}(0,0)(#1)}}
+\def\psAltCoil@iii#1(#2)(#3){%
+ \begin@OpenObj
+ \pst@getcoor{#2}\pst@tempa
+ \pst@getcoor{#3}\pst@tempb
+ \addto@pscode{%
+ \pst@tempa \pst@tempb
+ /y1 ED /x1 ED /y0 ED /x0 ED
+ x0 y0 translate
+ y1 y0 sub x1 x0 sub 2 copy Pyth
+ /Longueur ED
+ Atan rotate
+ /NoOfSpirals \psk@NoOfSpirals def % nombre de spires
+ /Alpha \psk@coil@Alpha def
+ /R_0 \psk@InitialWidth \pst@number\psunit mul def
+ /arm \psk@coil@arm \pst@number\psunit mul def
+ /l_0 \psk@InitialLength \pst@number\psunit mul def
+ /nS \psk@coil@NoOfPointsPerCoil def
+ /Pas_0 l_0 NoOfSpirals div def
+ /Pas Longueur 2 arm mul sub NoOfSpirals div def
+ % longueur de l'hélice sur un tour
+ % = sqrt(4*pi^2*R^2+p^2)
+ /Longueur_Helice_pas 39.47842 R_0 dup mul mul Pas_0 dup mul add sqrt def
+ % R=1/(2*pi)*sqrt(L^2-p^2)
+ /Radius 0.1591549 Longueur_Helice_pas dup mul Pas dup mul sub sqrt mul def
+ /xH {Radius 360 t mul cos mul Radius sub} def
+ /yH {Radius 360 t mul sin mul} def
+ /zH {Pas t mul arm add} def
+ /Inc 1 NoOfSpirals nS mul div def % nS(50) points par spires
+ 1 setlinejoin
+ 1 0 0 0 ArrowA arm 0 lineto
+ 0 Inc NoOfSpirals {
+ /t ED
+ zH xH Alpha tan mul sub
+ yH
+ lineto
+ } for
+ Longueur 0
+ ArrowB lineto
+ }%
+ \end@OpenObj}
%
\catcode`\@=\TheAtCode\relax
\endinput