summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/dvips/pst-coil
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-14 23:07:19 +0000
committerKarl Berry <karl@freefriends.org>2011-08-14 23:07:19 +0000
commita6f1bf5e02c8819c63809f345c5a803cb274c9d5 (patch)
tree4822d0d50c334c78c73d0edcf71b94a913879a68 /Master/texmf-dist/dvips/pst-coil
parent135d4e294c8799bf72c97ae9ae12f679d57a2450 (diff)
pst-coil
git-svn-id: svn://tug.org/texlive/trunk@23558 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips/pst-coil')
-rw-r--r--Master/texmf-dist/dvips/pst-coil/pst-coil.pro38
1 files changed, 36 insertions, 2 deletions
diff --git a/Master/texmf-dist/dvips/pst-coil/pst-coil.pro b/Master/texmf-dist/dvips/pst-coil/pst-coil.pro
index 518703e43f9..026f662e779 100644
--- a/Master/texmf-dist/dvips/pst-coil/pst-coil.pro
+++ b/Master/texmf-dist/dvips/pst-coil/pst-coil.pro
@@ -1,6 +1,6 @@
%!ps
% PostScript prologue for pst-coil.tex.
-% Version 1.03, 2010/02/01
+% Version 1.05, 2011/07/12
% For distribution, see pstricks.tex.
%
/tx@CoilDict 40 dict def tx@CoilDict begin
@@ -49,7 +49,8 @@
/mtrx CM def
relativePeriod
{}
- { SinLength Periods div roundValue { cvi } if
+ { SinLength Periods div
+ roundValue dup 0 eq { pop cvi } { 1 eq { round } if } ifelse
/Periods ED } ifelse
/dxStep SinLength 360 div def % the default step for x pos
/xStep 360 PointsPerPeriod div def % the step for the for loop
@@ -87,5 +88,38 @@
n { x w /w w neg def /x x h add def } repeat
TotalLength ArmA sub 0 TotalLength 0 } def
%
+ /ZigZagCirc { % x0 y0 x1 y1 bow h w ArmA ArmB on stack
+ /bow ED
+ /ArmB ED /ArmA ED
+ 2 div /w ED
+ w mul /h ED /y1 ED /x1 ED /y0 ED /x0 ED
+ x1 y1 translate %
+ y0 y1 sub x0 x1 sub 2 copy Pyth 2 div
+ /HalfLength ED
+ Atan /ang ED %angle of A relative to B
+ %rotate % so end B is origin and BA is horizontal, A to right
+ /theta bow abs HalfLength Atan 2 mul def %halfangular sector for arc
+ /theta2 theta 2 mul def % full arc
+ %/psi ang 90 sub theta sub def % angle of B from center if bow>0
+ /rho HalfLength theta sin div def % radius of circle
+ bow 0 gt { /direc 1 def /thetaB ang 90 sub theta sub def } % travel B to A in pos drn
+ { /direc -1 def /thetaB ang 90 add theta add def } ifelse % travel B to A in neg drn
+ %thetaB=angle from center to B
+ rho thetaB 180 add PtoC translate % origin now at center
+ /h h rho div RadtoDeg def
+ /ArmA ArmA rho div RadtoDeg def /ArmB ArmB rho div RadtoDeg def
+ theta2 ArmA sub ArmB sub dup h div cvi /n ED n h mul
+ %HalfLength 2 mul ArmA sub ArmB sub dup h div cvi /n ED n h mul
+ sub 2 div dup ArmA add
+ /ArmA ED ArmB add /ArmB ED
+ /h h direc mul def % h is now angle increment for half-period
+ /rhoo rho w add def /rhoi rho w sub def % outer and inner radii
+ /arg thetaB ArmB direc mul add def % argument for 2nd point
+% thetaB = direc = bow = HalfLength = theta = rho = arg = h = n =
+ mark rho thetaB PtoC rho arg PtoC /arg arg h 2 div add def
+ n { w 0 gt { rhoo }{ rhoi } ifelse arg PtoC /w w neg def /arg arg h add def } repeat
+ rho thetaB theta2 ArmA sub direc mul add PtoC rho thetaB theta2 direc mul add PtoC
+ } def
+%
end
% END pst-coil.pro