summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-07-02 22:49:44 +0000
committerKarl Berry <karl@freefriends.org>2013-07-02 22:49:44 +0000
commit74eab85d64cec0e1252bb24e518e38287955a722 (patch)
treeadc2e3c7bf8e05af6cc19dc21849b80e7cb6eb00 /Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
parent1a6b61dfa1ffa5032428d260ce4b22db56698693 (diff)
c2l pst-optexp (2jul13)
git-svn-id: svn://tug.org/texlive/trunk@31072 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty')
-rw-r--r--Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty161
1 files changed, 95 insertions, 66 deletions
diff --git a/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty b/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
index 08aa3e52833..da236686fbd 100644
--- a/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
+++ b/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
@@ -9,7 +9,7 @@
%% This is a generated file.
%%
%% Project: pst-optexp
-%% Version: 4.2 (2013/06/07)
+%% Version: 4.3a (2013/07/02)
%%
%% Copyright (C) 2007-2013 by Christoph Bersch <usenet@bersch.net>
%%
@@ -31,7 +31,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{pst-optexp}
- [2013/06/07 v4.2 Optical experimental setups with PSTricks]
+ [2013/07/02 v4.3a Optical experimental setups with PSTricks]
\RequirePackage{ifthen}
\RequirePackage{pstricks}
\RequirePackage{pst-xkey}
@@ -431,7 +431,7 @@
labelstyle=,
labelalign=c,
labelref=relgrav,
- ref@angle=0
+ ref@angle=180
}%
\define@choicekey+[psset]{optexp}{extnodealign}%
[\val\nr]{rel,abs,relative,absolute}%
@@ -973,7 +973,14 @@
\define@key[psset]{optexp}{raprismsize}{%
\pst@checknum{#1}\POE@key@raprismsize
}
-\psset[optexp]{raprismsize=1.5}
+\define@choicekey+[psset]{optexp}{raprismalign}[\val\nr]%
+ {auto,center}%
+ {\def\POE@key@raprismalign{#1}}%
+ {\PackageError{pst-optexp}{Unknown value '\val' for raprismalign}}%
+\psset[optexp]{%
+ raprismsize=1.5,
+ raprismalign=auto
+}
\define@key[psset]{optexp}{prismsize}{%
\pst@checknum{#1}\POE@key@prismsize
}
@@ -2689,6 +2696,7 @@
\def\oenode@RefB#1{\oenode{@B}{#1}}%
\def\oenode@TrefA#1{\oenode{@TrefA}{#1}}%
\def\oenode@TrefB#1{\oenode{@TrefB}{#1}}%
+\def\oenode@Origin#1{\oenode{Origin}{#1}}%
\def\oenodeIfc#1#2{%
\ifnum9<1#1 %
\oenode{#1}{#2}%
@@ -2977,7 +2985,7 @@
}%
\expandafter\def\csname #2@ii\endcsname(##1)(##2)(##3)##4{%
\addbefore@par{#3}%
- \addafter@par{ref@angle=180,#1}%
+ \addafter@par{ref@angle=0,#1}%
\begin@OptexpTripole
\ifPOE@backlayer
\POE@calcNodes{##1}{##2}{##3}%
@@ -3177,7 +3185,7 @@
\fi
}%
\def\optcirculator@ii(#1)(#2)(#3)#4{%
- \addafter@par{ref@angle=180}%
+ \addafter@par{ref@angle=0}%
\begin@OptexpObj
\POE@calcCircRefNodes{#1}{#2}{#3}%
\POE@drawcomponent{optcirculator}{#4}
@@ -3301,7 +3309,37 @@
calcNodes
X@A Y@A}){\oenode@RefA{}}%
\pnode(! \POE@dict{X@B Y@B}){\oenode@RefB{}}%
+ \pnode(#2){\oenode@Origin{}}%
}\ignorespaces}%
+\def\POE@calcAngle{%
+ \POE@Verb{%
+ gsave
+ STV CP T
+ /N@\oenode@Origin{} @GetCenter 2 copy
+ /N@\oenodeRefA{} @GetCenter VecSub /ay ED /ax ED
+ /N@\oenodeRefB{} @GetCenter VecSub /by ED /bx ED
+ ax ay NormalizeVec bx by NormalizeVec VecAdd
+ 2 copy Pyth abs 1e-4 lt {
+ pop pop
+ ax ay 90 matrix rotate dtransform
+ } if
+ NormalizeVec 2 copy
+ ax ay bx by VecAdd
+ 2 copy Pyth abs 1e-4 lt {
+ pop pop ax ay
+ } if
+ NormalizeVec
+ 4 copy 4 copy
+ DotProd Acos 5 1 roll Chirality mul
+ /dOEangle exch def
+ ax ay Pyth bx by Pyth
+ 2 copy dup mul exch dup mul add
+ ax bx sub ay by sub Pyth dup mul exch sub
+ 3 1 roll -2 mul mul div Acos /OEangle exch def
+ neg exch ax ay \tx@UserCoor DotProd abs /@myht exch def
+ grestore
+ }%
+\ignorespaces}%
\def\POE@regNodes#1#2{%
\pnode(#1){\oenodeRefA{}}
\pnode(#2){\oenodeRefB{}}
@@ -3326,14 +3364,10 @@
\ignorespaces}%
\def\POE@pnode@shiftedrot(#1)#2#3#4{%
\pst@getcoor{#1}\POE@temp%
- \pnode(!%
- \POE@temp /YDiff ED /XDiff ED %
- \pst@nodedict /N@#2 load GetCenter end /YShifted ED /XShifted ED
- /rot@angle #4 \POE@key@labelrefangle\space add def
- /XDiff@Rot rot@angle cos XDiff mul rot@angle sin YDiff mul add def
- /YDiff@Rot rot@angle cos YDiff mul rot@angle sin XDiff mul sub def
- XShifted XDiff@Rot add YShifted YDiff@Rot add neg \tx@UserCoor
- ){#3}%
+ \pnode(! \POE@dict{
+ /N@#2 @GetCenter \POE@temp
+ #4 \POE@key@labelrefangle\space add matrix rotate dtransform
+ VecAdd \tx@UserCoor }){#3}%
\psset[optexp]{ref@angle=0}
}%
\def\POE@nlput{\pst@object{POE@nlput}}
@@ -3456,7 +3490,7 @@
\newOptexpDipole{doveprism}
\newOptexpDipole{glanthompson}
\newOptexpTripole{mirror}
-\newOptexpTripole[ref@angle=-135]{beamsplitter}
+\newOptexpTripole[ref@angle=45]{beamsplitter}
\newOptexpTripole{optgrating}
\def\optgrid{%
\PackageWarning{pst-optexp}{%
@@ -3464,9 +3498,9 @@
use \string\optgrating\space instead.}%
\optgrating%
}%
-\newOptexpTripole[ref@angle=-135]{pentaprism}
-\newOptexpTripole[ref@angle=-135]{rightangleprism}
-\newOptexpTripole[ref@angle=-135]{optprism}
+\newOptexpTripole[ref@angle=45]{pentaprism}
+\newOptexpTripole[ref@angle=45]{rightangleprism}
+\newOptexpTripole[ref@angle=45]{optprism}
\def\optdipole{\pst@object{optdipole}}
\def\optdipole@i(#1)(#2)#3{%
\@ifnextchar\bgroup%
@@ -3500,7 +3534,7 @@
{\opttripole@ii(#1)(#2)(#3){#4}{}}%
}%
\def\opttripole@ii(#1)(#2)(#3)#4#5{%
- \addafter@par{ref@angle=180}
+ \addafter@par{ref@angle=0}
\begin@OptexpTripole
\ifPOE@backlayer
\POE@calcNodes{#1}{#2}{#3}%
@@ -4395,11 +4429,9 @@
}%
}%
\def\optprism@ref{%
- \ifPOE@backlayer
- \POE@Verb{/OEangle\the\POE@cnt\space OEangle def }%
- \fi
- \ifPOE@frontlayer
- \POE@Verb{/OEangle OEangle\the\POE@cnt\space def }%
+ \POE@calcAngle
+ \ifx\POE@key@prismtype\POE@str@reflective
+ \edef\POE@key@labelrefangle{180}%
\fi
}%
\def\optprism@nodes{%
@@ -4417,20 +4449,18 @@
\fi
}%
\begingroup
- \ifx\POE@key@prismtype\POE@str@reflective
- \pst@def{ScreenCoor}< \pst@number\psyunit neg mul exch \pst@number\psxunit mul exch >
- \fi
- \pnode(! 0 \@hshift neg){\oenodeCenter{}}
+ \edef\POE@temp{\ifx\POE@key@prismtype\POE@str@reflective neg \fi}%
+ \pnode(! 0 \@hshift neg){\oenodeCenter{}}%
\newOptexpComp{%
{\@sz -0.6 mul \@ang tan mul \@hshift neg}
- {90 \@ang sub dup cos exch sin}
+ {90 \@ang sub dup cos exch sin \POE@temp}
\@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc}
{\@sz 0.6 mul \@ang tan mul \@hshift neg}
- {90 \@ang add dup cos exch sin}
+ {90 \@ang add dup cos exch sin \POE@temp}
\@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc}
\ifx\POE@key@prismtype\POE@str@reflective
12 6 roll
- {0 \@sz -0.4 mul \@hshift sub }
+ {0 \@sz 0.4 mul \@hshift sub }
{1 0} \@ang tan \@sz mul dup neg exch refl {PlainIfc}
12 6 roll
\fi
@@ -4452,52 +4482,51 @@
\fi
}%
\edef\POE@temp{\ifx\POE@key@prismtype\POE@str@reflective -1 mul \fi}%
- \pspolygon(! \@sz neg \@altan mul \@sz -0.4 mul \@hshift sub \POE@temp)
- (! \@sz \@altan mul \@sz -0.4 mul \@hshift sub \POE@temp)
- (! 0 \@sz 0.6 mul \@hshift sub \POE@temp)
+ \pspolygon(! \@sz neg \@altan mul \@sz -0.4 mul \POE@temp \@hshift sub)
+ (! \@sz \@altan mul \@sz -0.4 mul \POE@temp \@hshift sub)
+ (! 0 \@sz 0.6 mul \POE@temp \@hshift sub)
}%
\def\rightangleprism@ref{%
- \ifPOE@backlayer
- \POE@Verb{/OEangle\the\POE@cnt\space OEangle def }%
- \fi
- \ifPOE@frontlayer
- \POE@Verb{/OEangle OEangle\the\POE@cnt\space def }%
- \fi
- \POE@setref{%
- OEangle 0.5 mul
- { x sin modA mul }
- { OEangle x sub sin modB mul }
- tx@EcldDict begin
- 10 dict begin
- /ZeroEq { abs 5e-6 lt } bind def
- NewtonSolving pop
- end
- end
- /@htA exch def
- OEangle 0.5 mul exch sub /dOEangle exch def
+ \POE@calcAngle
+ \POE@Verb{%
+ /@htA @myht def
/@OEtrafo {dOEangle matrix rotate dtransform } bind def
}%
+ \let\POE@temp\POE@key@labelrefangle
+ \edef\POE@key@labelrefangle{\POE@temp \POE@dict{dOEangle add} }%
}%
\def\rightangleprism@nodes{%
- \edef\@sz{\POE@key@raprismsize\space}%
- \edef\@ht{\POE@dict{OEangle 0.5 mul sin modA mul} }%
+ \edef\@sz{\POE@key@raprismsize\space 0.5 mul }%
+ \POE@Verb{%
+ \ifx\POE@key@raprismalign\POE@str@auto
+ /@corrshift {} bind def
+ \else
+ /@corrshift {@htA sub \@sz 0.5 mul add } bind def%
+ \fi
+ }%
\newOptexpComp{%
- {@htA neg @htA \@sz 0.5 mul sub @OEtrafo} {1 0 @OEtrafo}
- @htA \@sz 0.5 mul sub @htA trans {PlainIfc}
- {@htA neg 0 @OEtrafo} {1 1 @OEtrafo}
- @htA 2 sqrt mul dup \@sz 2 sqrt div sub exch refl {PlainIfc}
- {@htA 0 @OEtrafo} {-1 1 @OEtrafo}
- @htA 2 sqrt mul dup \@sz 2 sqrt div sub exch refl {PlainIfc}
- {@htA dup \@sz 0.5 mul sub @OEtrafo} {1 0 @OEtrafo}
- @htA neg \@sz 0.5 mul @htA sub trans {PlainIfc}
+ {@htA neg @htA \@sz sub @corrshift @OEtrafo} {1 0 @OEtrafo}
+ @htA \@sz sub @htA trans {PlainIfc}
+ {@htA neg 0 @corrshift @OEtrafo} {1 1 @OEtrafo}
+ @htA 2 sqrt mul dup \@sz 0.5 sqrt div sub exch refl {PlainIfc}
+ {@htA 0 @corrshift @OEtrafo} {-1 1 @OEtrafo}
+ @htA 2 sqrt mul dup \@sz 0.5 sqrt div sub exch refl {PlainIfc}
+ {@htA dup \@sz sub @corrshift @OEtrafo} {1 0 @OEtrafo}
+ @htA neg \@sz @htA sub trans {PlainIfc}
\POE@key@n
}%
\ignorespaces}%
\def\rightangleprism@comp{%
\edef\@sz{\POE@key@raprismsize\space 0.5 mul }%
- \pspolygon(!\POE@dict{\@sz neg @htA \@sz sub @OEtrafo})
- (!\POE@dict{\@sz @htA \@sz sub @OEtrafo})
- (! 0 \POE@dict{@htA @OEtrafo})%
+ \ifx\POE@key@raprismalign\POE@str@auto
+ \pspolygon(!\POE@dict{\@sz neg @htA \@sz sub @OEtrafo})
+ (!\POE@dict{\@sz @htA \@sz sub @OEtrafo})
+ (! 0 \POE@dict{@htA @OEtrafo})%
+ \else
+ \pspolygon(!\POE@dict{\@sz \@sz -0.5 mul @OEtrafo})%
+ (!\POE@dict{\@sz neg \@sz -0.5 mul @OEtrafo})%
+ (!\POE@dict{0 \@sz 0.5 mul @OEtrafo})
+ \fi
\ignorespaces}%
\def\optfiber@ref{%
\POE@setref{%
@@ -5036,7 +5065,7 @@
{\elecmixer@ii(#1)(#2)(#3){}}%
}%
\def\elecmixer@ii(#1)(#2)(#3)#4{%
- \addafter@par{ref@angle=180}%
+ \addafter@par{ref@angle=0}%
\begin@OptexpObj
\POE@calcCircRefNodes{#1}{#2}{#3}%
\POE@drawcomponent{elecmixer}{#4}