From 7aabd76a5961aed06ec6edd2a33e46246b48209d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 2 Nov 2014 21:52:04 +0000 Subject: pst-optexp (2nov14) git-svn-id: svn://tug.org/texlive/trunk@35486 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/dvips/pst-optexp/pst-optexp.pro | 166 ++++++++++++++++++++-- 1 file changed, 154 insertions(+), 12 deletions(-) (limited to 'Master/texmf-dist/dvips/pst-optexp') diff --git a/Master/texmf-dist/dvips/pst-optexp/pst-optexp.pro b/Master/texmf-dist/dvips/pst-optexp/pst-optexp.pro index d9e46618c82..e8bfcdb9054 100644 --- a/Master/texmf-dist/dvips/pst-optexp/pst-optexp.pro +++ b/Master/texmf-dist/dvips/pst-optexp/pst-optexp.pro @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: pst-optexp -%% Version: 4.10 (2014/06/04) +%% Version: 5.0 (2014/10/30) %% %% Copyright (C) 2007-2014 by Christoph Bersch %% @@ -245,6 +245,11 @@ tx@OptexpDict begin 3 1 roll mul 1.00001 mul /NAup ED mul 1.00001 mul /NAlow ED } bind def +/PathIfc { + pop pop /NAup 0 def /NAlow 0 def + 3 1 roll /Path ED + exec 3 -1 roll exec /Y ED /X ED +} bind def /NewCompIfc { /scl ED /next ED @@ -893,7 +898,7 @@ tx@OptexpDict begin PrevR type /realtype eq { /CurrCenter load /PrevCenter ED } if - IfcNum CompName isCurved { + IfcNum CompName isCurvedIfc { IfcNum CompName LoadIfc tx@Dict begin Pyth end /CurrR ED ToVec /CurrCenter ED @@ -905,7 +910,7 @@ tx@OptexpDict begin draw { /DrawnSegm DrawnSegm 1 add def PrevUp moveto CurrUp lineto - IfcNum CompName isCurved { + IfcNum CompName isCurvedIfc { CurrCenter CurrUp CurrLow 4 copy 3 -1 roll eq 3 1 roll eq and { 6 {pop} repeat @@ -1078,16 +1083,26 @@ tx@OptexpDict begin pop pop false } ifelse } bind def -/isCurved { +/isCurvedIfc { cvn load begin IfcName load /RX known end } bind def +/isPathIfc { + cvn load begin + IfcName load /Path known + end +} bind def /HandleInterface { (HandleInterface) DebugBegin /Yin ED /Xin ED /Y0 ED /X0 ED /n2 ED /mode ED - 2 copy 2 copy LoadIfc - 6 -2 roll isCurved { CurvedInterface }{ PlainInterface } ifelse + 2 copy 2 copy LoadIfc % IfcNum name IfcNum name path + dup type /arraytype eq { % is an path interface + 3 1 roll pop pop PathInterface % IfcNum name X0' Y0' Xout Yout status + } { + 6 -2 roll + isCurvedIfc { CurvedInterface }{ PlainInterface } ifelse + } ifelse dup missed eq not useNA connectifc not and and { 7 3 roll 2 copy 9 2 roll 4 2 roll 2 copy @@ -1095,7 +1110,7 @@ tx@OptexpDict begin cvn load begin IfcName load dup /NAlow get exch /NAup get end 2 copy lt { 4 2 roll 2 copy LoadIfc NormalizeVec - 6 -2 roll isCurved { + 6 -2 roll isCurvedIfc { neg exch } if %% ... X0' Y0' NAlow NAup X Y dXp dYp @@ -1118,10 +1133,14 @@ tx@OptexpDict begin (LoadIfc) DebugBegin cvn load begin IfcName load begin - X Y - CompMtrx transform CM itransform - currentdict /RX known { RX RY }{ DX DY } ifelse - CompMtrx dtransform CM idtransform + currentdict /Path known { + Path TransformPath + } { + X Y + CompMtrx transform CM itransform + currentdict /RX known { RX RY }{ DX DY } ifelse + CompMtrx dtransform CM idtransform + } ifelse end end DebugEnd @@ -1384,7 +1403,10 @@ tx@OptexpDict begin dup 4 -1 roll mul 3 1 roll mul } bind def /ToVec { - [ 3 1 roll ] cvx + ToPnt cvx +} bind def +/ToPnt { + [ 3 1 roll ] } bind def /AngToVec { dup cos exch sin ToVec @@ -1523,6 +1545,38 @@ tx@OptexpDict begin } ifelse DebugEnd } bind def +/PathInterface { + (PathInterface) DebugBegin + [ [X0 Y0] [X0 Xin add Y0 Yin add] ] exch + tx@IntersectDict begin IntersectLinePath end % [pathseg] t [isect] + dup length 0 eq { + pop pop pop 0 0 missed + } { + aload pop + Xin Yin Xin Yin + 8 -2 roll exch % I.x I.y Xin Yin Xin Yin t [pathseg] + dup length 2 eq { % a line + exch pop + aload pop aload pop 3 -1 roll aload pop VecSub % I.x I.y Xin Yin Xin Yin dXp dYp + } { + exch dup cvi sub DeriveCurve + } ifelse + % the following part is copied from /PlainInterface + NormalVec + mode trans eq { + n1 n2 RefractVec + 2 copy 0 eq exch 0 eq and { tir } { ok } ifelse + } { + ReflectVec ok + } ifelse + /n1 n2 def + 5 -2 roll 2 copy 7 2 roll X0 Y0 @ABVect Xin Yin DotProd 0 lt + PN 1 gt and { + pop missed + } if + } ifelse + DebugEnd +} bind def /TransformRefIndex { dup bgRefIndex eq { pop 1 } if } bind def @@ -1772,6 +1826,94 @@ tx@OptexpDict begin } for pop } def +/TransformPath { + mark [ 3 -1 roll aload pop + counttomark 1 add counttomark 1 add exch 1 roll + { + counttomark 1 eq { cleartomark exit } if + dup /curvetype eq { + 7 1 roll + 3 { CompMtrx transform CM itransform 7 2 roll } repeat + counttomark -1 roll dup counttomark 1 roll + 7 roll + } { + 3 1 roll CompMtrx transform CM itransform 3 -1 roll + counttomark -1 roll dup counttomark 1 roll + 3 roll + } ifelse + } loop + ] +} bind def +/DeriveCurve { + (DeriveCurve) DebugBegin + exch dup length 4 eq not { + pop pop 0 0 + } { + aload pop 5 -1 roll + dup 1 exch sub dup mul -3 mul exch % P0 P1 P2 P3 C0=(-3(1-t)^2) t + dup dup -4 mul 1 add exch dup mul 3 mul add 3 mul exch % P0 P1 P2 P3 C0 C1=(3(3t^2-4t+1)) t + dup dup 2 mul exch dup mul -3 mul add 3 mul exch % P0 P1 P2 P3 C0 C1 C2=(3(2t-3t^2)) t + dup mul 3 mul % P0 P1 P2 P3 C0 C1 C2 C3=3t^2 + 8 copy + 0 6 -1 3 { -1 roll 0 get 3 -1 roll mul add } for + 9 1 roll + 0 6 -1 3 { -1 roll 1 get 3 -1 roll mul add } for + } ifelse + DebugEnd +} bind def +/GetBezierDeriv { % t on stack + 10 dict begin % hold all local + /t ED + /t1 1 t sub def % t1=1-t + dup length /BezierOrder exch def + /Points exch def + /Coeff tx@FuncDict begin Pascal end BezierOrder get def % get the coefficients + 0 0 % initial values for x y + BezierOrder -1 0 { % BezierOrder,...,2,1,0 + /I ED % I=BezierOrder,...,2,1,0 + /J BezierOrder I sub def % J=0,1,2,...,BezierOrder + I 0 eq { + 0 + }{ + I t I 1 sub exp mul t1 J exp mul % i*t^{i-1}*(1-t)^{n-i} + } ifelse + J 0 eq { + 0 + } { + J t I exp mul t1 J 1 sub exp mul % -(n-i)t^i(1-t)^{n-i-1} + } ifelse + sub Coeff J get mul + Points I get aload pop 3 -1 roll VecScale VecAdd + } for % x y on stack + end +} bind def +tx@IntersectDict begin +/IntersectLinePath { + 3 dict begin + PreparePath + 2 copy ElongateLine exch 3 -1 roll pop + /isect [] def + /t -1 def + /n -1 def + { + /n n 1 add def + 2 copy IntersectBeziers + dup 5 1 roll LoadIntersectionPoints + dup length 0 gt { + /isect exch def + 0 get dup type /arraytype eq { + aload pop add 0.5 mul + } if n add /t exch def + exch pop + exit + } { + pop pop pop + } ifelse + } forall + t isect + end +} bind def +end /mymax { 2 copy lt { exch } if pop } bind def -- cgit v1.2.3