summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-11-16 19:58:17 +0000
committerKarl Berry <karl@freefriends.org>2009-11-16 19:58:17 +0000
commitee7b4a2078b6b24ffa5e1053b545eb87ae368726 (patch)
tree7dcd1fa54a6ae2878541febd382c5d1df42e32f1 /Master/texmf-dist/tex/generic
parent494bd0475fd9f4b8ad307a7fb97b96d1f8093936 (diff)
pst-optexp 2.1 (6nov09)
git-svn-id: svn://tug.org/texlive/trunk@16037 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex470
1 files changed, 366 insertions, 104 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex b/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex
index 2231aa412ad..03b23973d64 100644
--- a/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex
+++ b/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex
@@ -26,8 +26,8 @@
\let\PSToptexpLoaded\endinput
%
%
-\def\fileversion{2.0}
-\def\filedate{2008/07/27}
+\def\fileversion{2.1}
+\def\filedate{2009/11/05}
\message{`pst-optexp' v\fileversion, \filedate\space (CB)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -36,12 +36,6 @@
\def\pst@optexpdict{tx@OptexpDict begin }
\SpecialCoor
%
-% We need pstricks-add >= 2.87 for the \psrotate macro version that
-% can handle Postscript code in the nodes
-\ifdim\pstricksaddfileversion pt<2.87pt
-\PackageError{pst-optexp}{^^JWe need a pstricks-add version >= 2.87, you have v\pstricksaddfileversion, please update!^^J}
-\fi
-%
%
% IF's
%
@@ -55,6 +49,10 @@
\newif\ifPOE@endbox
\newif\ifPOE@thicklens
\newif\ifPOE@usefiberstyle
+\newif\ifPOE@connjoin
+\newif\ifPOE@fiber@
+%
+\newdimen\optboxwidth
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -98,6 +96,8 @@
\edef\POS@optexp@extnode@postfix{ExtNode}
\edef\POS@detector@round{round}
\edef\POS@detector@diode{diode}
+\edef\POS@bs@cube{cube}
+\edef\POS@bs@plate{plate}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% psstyles
@@ -108,7 +108,9 @@
hatchsep=1.4\POK@mirror@linewidth,%
fillstyle=hlines}%
\newpsstyle{PiezoMirror}{fillstyle=solid,fillcolor=black!30}%
-\newpsstyle{Beam}{linecolor=green!90!black}%
+\newpsstyle{Beam}{linecolor=green!90!black,linewidth=\pslinewidth}%
+\define@key[psset]{optexp}{newBeam}{\newpsstyle{Beam}{#1}}
+\define@key[psset]{optexp}{addtoBeam}{\addtopsstyle{Beam}{#1}}
%
\newpsstyle{Fiber}{}%
\define@key[psset]{optexp}{newFiber}{\newpsstyle{Fiber}{#1}}
@@ -138,6 +140,10 @@
\define@key[psset]{optexp}{newFiberOut2}{\newpsstyle{FiberOut2}{#1}}
\define@key[psset]{optexp}{addtoFiberOut2}{\addtopsstyle{FiberOut2}{#1}}
%
+\newpsstyle{OptComp}{}%
+\define@key[psset]{optexp}{newOptComp}{\newpsstyle{OptComp}{#1}}
+\define@key[psset]{optexp}{addtoOptComp}{\addtopsstyle{OptComp}{#1}}
+%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -156,6 +162,38 @@
\define@key[psset]{optexp}{labelstyle}{\def\POK@label@style{#1}}
\define@key[psset]{optexp}{labelalign}{\def\POK@label@align{#1}}
\define@key[psset]{optexp}{labelref}{\edef\POK@label@ref{#1}}
+\define@key[psset]{optexp}{label}{%
+ \pst@expandafter\psset@@label{#1} {} {} {} {} {}\@nil
+}%
+% offset angle align ref
+\def\psset@@label#1 #2 #3 #4 #5\@nil{%
+ \edef\@empty@dot{.}%
+ \edef\pst@temp{#4}%
+ \ifx\pst@temp\@empty\else
+ \ifx\pst@temp\@empty@dot\else
+ \psset{labelref=#4}
+ \fi
+ \fi
+ \edef\pst@temp{#3}
+ \ifx\pst@temp\@empty\else
+ \ifx\pst@temp\@empty@dot\else
+ \psset{labelalign=#3}
+ \fi
+ \fi
+ \edef\pst@temp{#2}%
+ \ifx\pst@temp\@empty\else
+ \ifx\pst@temp\@empty@dot\else
+ \psset{labelangle=#2}%
+ \fi
+ \fi
+ \edef\pst@temp{#1}%
+ \ifx\pst@temp\@empty\else
+ \ifx\pst@temp\@empty@dot\else
+ \psset{labeloffset=#1}
+ \fi
+ \fi
+}%
+\define@boolkey[psset]{optexp}[POE@label@]{innerlabel}[true]{}
% for internal use only
\define@key[psset]{optexp}{ref@angle}{\edef\POK@label@refangle{#1}}
% labelrelative is obsolete
@@ -243,6 +281,7 @@
%
% Beamsplitter
\define@key[psset]{optexp}{bssize}{\edef\POK@bssize{#1}}
+\define@key[psset]{optexp}{bsstyle}{\edef\POK@bsstyle{#1}}
\define@key[psset]{optexp}{bswidth}{%
\edef\POK@bssize{#1}%
\PackageWarning{pst-optexp}{bswidth is obsolete, use bssize instead}%
@@ -280,7 +319,10 @@
\define@boolkey[psset]{optexp}[POE@]{reverse}[true]{}
%
% Box
-\define@key[psset]{optexp}{optboxwidth}{\edef\POK@optbox@width{#1}}
+\define@key[psset]{optexp}{optboxwidth}{%
+ \pssetlength\optboxwidth{#1}%
+ \edef\POK@optbox@width{#1}%
+}
\define@key[psset]{optexp}{optboxheight}{\edef\POK@optbox@height{#1}}
\define@boolkey[psset]{optexp}[POE@]{endbox}[true]{}
\define@key[psset]{optexp}{refractiveindex}{\edef\POK@optbox@n{#1}}
@@ -357,6 +399,9 @@
% Isolator
\define@key[psset]{optexp}{isolatorsize}{\edef\POK@isolator@size{#1}}
%
+% Fiber polarizer
+\define@key[psset]{optexp}{fiberpolsize}{\edef\POK@fiberpol@size{#1}}
+%
% Optical switch
\define@key[psset]{optexp}{switchsize}{\edef\POK@switch@size{#1}}
\define@choicekey+[psset]{optexp}{switchstyle}[\val\nr]{opened,closed}%
@@ -377,6 +422,9 @@
{\PackageError{pst-optexp}{Unknown value '\val' for key couplertype}}
\define@key[psset]{optexp}{align}{\edef\POK@align{#1}}
%
+%
+\define@key[psset]{optexp}{compshift}{\edef\POK@comp@shift{#1}}
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Code for the extnode parameter (additional input node)
@@ -466,6 +514,17 @@
\fi
\fi
}%
+\define@key[psset]{optexp}{connjoin}{%
+ \edef\pst@temp{#1}%
+ \ifnum\pst@temp<0
+ \POE@connjoinfalse
+ \else\ifnum\pst@temp>2
+ \POE@connjoinfalse
+ \else
+ \POE@connjointrue
+ \edef\POK@connjoin{\pst@temp}
+ \fi\fi
+}%
\define@key[psset]{optexp}{conn}{%
\edef\pst@tempg{#1}%
\expandafter\psset@@conn\pst@tempg\@empty-\@empty\@nil
@@ -488,6 +547,7 @@
\def\psk@connOut{}%
% this is the conntable for the direct drawing of the connections
\def\pst@optexp@conntable{,o-o,i-i,f-f}%
+%
\def\psoe@cs@out@{}%
\def\psoe@cs@in@{}%
\def\psoe@cs@in@o{\psline[style=Beam](\POS@optexp@basicname@default A)(\optexp@nodeA)}%
@@ -537,6 +597,9 @@
\def\drawbeam@i#1#2{%
\def\pst@tempA{\pst@optexp@getfirstchar#1\@nil}%
\def\pst@tempB{\pst@optexp@getfirstchar#2\@nil}%
+ \ifPOE@connjoin
+ \psset{linejoin=\POK@connjoin}%
+ \fi
\begin@OpenObj%
\if(\pst@tempB
% second parameter is a node
@@ -592,8 +655,12 @@
\psset{conn=i-o}%
}
\define@choicekey[psset]{optexp}{fiber}[\val\nr]{}[]{%
- \psset{conn=f-f}%
+ \psset{conn=f-f, fiber@=true}%
}
+%
+% The fiber@ parameter is for internal use only to allow using \pscustom and connjoin
+% when drawing internal beams.
+\define@boolkey[psset]{optexp}[POE@]{fiber@}[true]{}
\def\optexp@nodeA{\POK@basicname 1}%
\def\optexp@nodeB{\POK@basicname N}%
\def\optexp@node#1{\POK@basicname #1}%
@@ -609,11 +676,6 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% Command analog to addbefore@par which is defined in pstricks.tex
-% addafter@par inserts new options at the _end_ of the current token register.
-% This can be useful to preset options that are not allowed to be changed by the
-% user.
-%
\def\pst@OptexpVerb#1{\pst@Verb{\pst@optexpdict #1 end }}%
\def\begin@OptexpObj{%
\define@key[psset]{optexp}{compname}{\psset{@compname=##1}}
@@ -621,12 +683,30 @@
\begingroup
\pst@OptexpVerb{InitOptexpComp}%
\use@par
+ % Usually the shift refers to the y-direction, shifting in x-direction
+ % is done by 'abspos' or 'position'
+ \let\POK@comp@Yshift\POK@comp@shift%
+ \def\POK@comp@Xshift{0}%
+}%
+\def\begin@OptexpMultipole{%
+ \begin@OptexpObj
+ % for multipoles the default shifting is in x-direction
+ \let\POK@comp@Xshift\POK@comp@shift%
+ \def\POK@comp@Yshift{0}%
}%
\def\end@OptexpObj{%
\pst@OptexpVerb{(\POS@optexp@basicname@default) (\POK@basicname) CloseOptexpComp}%
\endgroup
\ignorespaces%
}%
+\let\end@OptexpDipole\end@OptexpObj
+\let\end@OptexpMultipole\end@OptexpObj
+%
+% Command analog to addbefore@par which is defined in pstricks.tex
+% addafter@par inserts new options at the _end_ of the current token register.
+% This can be useful to preset options that are not allowed to be changed by the
+% user.
+%
\def\addafter@par#1{%
\ifx\pst@par\@empty
\def\pst@par{#1}%
@@ -664,6 +744,47 @@
\new@optexpdipole[fiber,#1]{#2}{#3}%
}%
%
+\def\draw@InternalConnections{%
+ \ifPOE@endbox
+ \@nameuse{\psk@connIn}
+ \else
+ \ifPOE@fiber@
+ \@nameuse{\psk@connIn}
+ \@nameuse{\psk@connOut}
+ \else
+ \ifPOE@connjoin
+ \def\tmp@A{psoe@cs@in@i}%
+ \ifx\tmp@A\psk@connIn
+ \def\tmp@B{psoe@cs@out@o}
+ \ifx\tmp@B\psk@connOut
+ \pscustom[style=Beam, linejoin=\POK@connjoin]{\@nameuse{\psk@connIn}\@nameuse{\psk@connOut}}%
+ \else\ifx\@empty\psk@connOut
+ \pscustom[style=Beam, linejoin=\POK@connjoin]{\@nameuse{\psk@connIn}\@nameuse{\psk@connOut}}%
+ \else
+ \@nameuse{\psk@connIn}\@nameuse{\psk@connOut}%
+ \fi\fi
+ \else
+ \def\tmp@A{psoe@cs@out@i}%
+ \ifx\tmp@A\psk@connOut
+ \def\tmp@B{psoe@cs@in@o}
+ \ifx\tmp@B\psk@connIn
+ \pscustom[style=Beam, linejoin=\POK@connjoin]{\@nameuse{\psk@connIn}\@nameuse{\psk@connOut}}%
+ \else\ifx\@empty\psk@connIn
+ \pscustom[style=Beam, linejoin=\POK@connjoin]{\@nameuse{\psk@connIn}\@nameuse{\psk@connOut}}%
+ \else
+ \@nameuse{\psk@connIn}\@nameuse{\psk@connOut}%
+ \fi\fi
+ \else
+ \@nameuse{\psk@connIn}\@nameuse{\psk@connOut}%
+ \fi
+ \fi
+ \else
+ \@nameuse{\psk@connIn}\@nameuse{\psk@connOut}%
+ \fi
+ \fi
+ \fi
+}%
+%
% Creates new macros ...@i and ...@ii which provide most code for the arrangement
% of the objects. A tempNode@Label is predefined as well as two internal nodes if compname is
% defined.
@@ -674,14 +795,12 @@
\expandafter\def\csname #2@i\endcsname(##1)(##2)##3{%
\addbefore@par{#3}%
\addafter@par{#1}%
+ \pst@regNodes{##1}{##2}
\begin@OptexpObj
- \pst@regNodes{##1}{##2}
+ \pst@adjustTempNodes
\pst@draw@component{##3}{\@nameuse{#2@ii}}
% connect
- \@nameuse{\psk@connIn}
- \ifPOE@endbox\else
- \@nameuse{\psk@connOut}
- \fi
+ \draw@InternalConnections
\end@OptexpObj
}%
\@namedef{#2@ii}{%
@@ -701,12 +820,12 @@
\expandafter\def\csname #2@i\endcsname(##1)(##2){%
\addbefore@par{#3}%
\addafter@par{#1}%
+ \pst@regNodes{##1}{##2}
\begin@OptexpObj
- \pst@regNodes{##1}{##2}
+ \pst@adjustTempNodes
\pst@draw@component{}{\@nameuse{#2@ii}}
- %
- \@nameuse{\psk@connIn}
- \@nameuse{\psk@connOut}
+ % connect
+ \draw@InternalConnections
\end@OptexpObj
}%
\@namedef{#2@ii}{%
@@ -726,8 +845,8 @@
\expandafter\def\csname #2@i\endcsname(##1)(##2)(##3)##4{%
\addbefore@par{#3}%
\addafter@par{ref@angle=180,#1}%
- \begin@OptexpObj
- \pst@calcNodes{##1}{##2}{##3}
+ \pst@calcNodes{##1}{##2}{##3}
+ \begin@OptexpMultipole
\pst@draw@component{##4}{\@nameuse{#2@ii}}
% adjust tempNode@A and tempNode@B for the connections
% \pnode(##1){tempNode@A}
@@ -745,9 +864,8 @@
10 {InitPnode } NewNode
end end
}%
- \@nameuse{\psk@connIn}%
- \@nameuse{\psk@connOut}%
- \end@OptexpObj
+ \draw@InternalConnections
+ \end@OptexpMultipole
}%
\@namedef{#2@ii}{%
\pnode(0,0){tempNode@Label}%
@@ -766,6 +884,7 @@
\expandafter\def\csname #2@i\endcsname(##1)(##2)(##3)(##4)##5{%
\addbefore@par{#3}%
\addafter@par{#1}%
+ %
\begin@OptexpObj
%
\ifx\POK@align\POS@optexp@top
@@ -812,7 +931,6 @@
\def\wdmsplitter{\pst@object{wdmsplitter}}%
\def\wdmsplitter@i(#1)(#2)(#3)#4{%
\begin@OptexpObj
- %
\pnode(#1){tempNode@A}
\ifx\POK@align\POS@optexp@top
\pnode(#2){tempNode@B}
@@ -825,12 +943,14 @@
\pst@tempB\pst@number\psyunit div exch \pst@number\psxunit div exch
\pst@optexpdict mwNode end){tempNode@B}
\fi\fi
- %
+ %
\pst@draw@component{#4}\wdmsplitter@ii
- %
- % connect the fibers
+ %
+ % default connection angles
\psset{angleA=! \pst@optexpdict FiberAngleA end,
angleB=! \pst@optexpdict FiberAngleB end}
+ %
+ % connect the fibers
\pccurve[style=FiberIn](#1)(tempNode@A@)
\pccurve[style=FiberOut1](tempNode@B@1)(#2)
\pccurve[style=FiberOut2](tempNode@B@2)(#3)
@@ -841,7 +961,6 @@
\def\wdmcoupler{\pst@object{wdmcoupler}}%
\def\wdmcoupler@i(#1)(#2)(#3)#4{%
\begin@OptexpObj
- %
\pnode(#3){tempNode@B}
\ifx\POK@align\POS@optexp@top
\pnode(#1){tempNode@A}
@@ -854,12 +973,14 @@
\pst@tempB\pst@number\psyunit div exch \pst@number\psxunit div exch
\pst@optexpdict mwNode end){tempNode@A}
\fi\fi
- %
+ %
\pst@draw@component{#4}\wdmcoupler@ii
- %
- % connect the fibers
+ %
+ % default connection angles
\psset{angleA=! \pst@optexpdict FiberAngleA end,
angleB=! \pst@optexpdict FiberAngleB end}
+ %
+ % connect the fibers
\pccurve[style=FiberOut](tempNode@B@)(#3)
\pccurve[style=FiberIn1](#1)(tempNode@A@1)
\pccurve[style=FiberIn2](#2)(tempNode@A@2)
@@ -890,6 +1011,8 @@
\pst@tempc \pst@number\psyunit div exch \pst@number\psxunit div exch
\pst@tempb \pst@number\psyunit div exch \pst@number\psxunit div exch
calcNodes
+ /ExchCoorSwitch
+ Y@A X@A neg Y@B X@B neg ExchCoor def
X@A Y@A end){tempNode@A}%
\pnode(! \pst@optexpdict X@B Y@B end){tempNode@B}%
}\ignorespaces}%
@@ -902,10 +1025,15 @@
\def\pst@regNodes#1#2{%
\pnode(#1){tempNode@A}
\pnode(#2){tempNode@B}
- \pst@Verb{tx@NodeDict begin N@tempNode@A GetCenter pop N@tempNode@B GetCenter pop end
- gt {/@xref \POK@xref\space neg def /@yref \POK@yref\space neg def}
- {/@xref \POK@xref\space def /@yref \POK@yref\space def} ifelse
- tx@OptexpDict /chirality known not {tx@OptexpDict begin /chirality 1 def end } if
+\ignorespaces}%
+\def\pst@adjustTempNodes{%
+ \pst@Verb{tx@NodeDict begin N@tempNode@A GetCenter N@tempNode@B GetCenter end
+ \pst@optexpdict ExchCoor dup end
+ {/@xref \POK@xref\space neg def /@yref \POK@yref\space neg def}
+ {/@xref \POK@xref\space def /@yref \POK@yref\space def} ifelse
+ \pst@optexpdict /ExchCoorSwitch ED end
+ tx@OptexpDict /chirality known not {\pst@optexpdict /chirality 1 def
+ end } if
}%
\ignorespaces}%
%
@@ -949,11 +1077,13 @@
% Place the component in argument #1 and define a new node 'tempNode@LabelShifted'
% for positioning of the label
\def\put@Comp#1{%
- #1%
- \pst@defShiftedRotLabelNode(0,\POK@label@offset)%
- {tempNode@Label}%
- {tempNode@LabelShifted}%
- {\POK@label@angle}%
+ \rput(\POK@comp@Xshift,\POK@comp@Yshift){%
+ #1%
+ \pst@defShiftedRotLabelNode(0,\POK@label@offset)%
+ {tempNode@Label}%
+ {tempNode@LabelShifted}%
+ {\POK@label@angle}%
+ }%
}%
%
% Positioning of the label depending on the reference coordinates.
@@ -1060,37 +1190,123 @@
%
\def\optdipole{\pst@object{optdipole}}
\def\optdipole@i(#1)(#2)#3#4{%
- \pst@killglue
- \begingroup
- \use@par
- \pst@regNodes{#1}{#2}
+ \pst@regNodes{#1}{#2}
+ \begin@OptexpObj
+ \pst@adjustTempNodes
\pst@draw@component{#4}{%
\pnode(0,0){tempNode@Label}%
\pnode(0,0){\optexp@nodeA}%
\pnode(0,0){\optexp@nodeB}%
#3
}%
- \@nameuse{\psk@connIn}
- \ifPOE@endbox\else
- \@nameuse{\psk@connOut}
- \fi
- \endgroup
+ \draw@InternalConnections
+ \end@OptexpObj
}%
\def\opttripole{\pst@object{opttripole}}
\def\opttripole@i(#1)(#2)(#3)#4#5{%
- \pst@killglue
- \begingroup
- \use@par
- \pst@calcNodes{#1}{#2}{#3}
+ \pst@calcNodes{#1}{#2}{#3}
+ \begin@OptexpMultipole
\pst@draw@component{#5}{%
\pnode(0,0){tempNode@Label}%
\pnode(0,0){\optexp@nodeA}%
\pnode(0,0){\optexp@nodeB}%
#4
}%
- \endgroup
+ % adjust tempNode@A and tempNode@B for the connections
+ % \pnode(##1){tempNode@A}
+ % \pnode(##3){tempNode@B}
+ % check if node must be switched, therefore we implement this
+ % directly as PS code
+ \pst@getcoor{#1}\pst@tempA%
+ \pst@getcoor{#3}\pst@tempB%
+ \pst@Verb{%
+ \pst@optexpdict
+ tx@NodeDict begin
+ {\pst@tempA } false chirality 0 le { /N@tempNode@B }{ /N@tempNode@A } ifelse
+ 10 {InitPnode } NewNode
+ {\pst@tempB } false chirality 0 le { /N@tempNode@A }{ /N@tempNode@B } ifelse
+ 10 {InitPnode } NewNode
+ end end
+ }%
+ \draw@InternalConnections
+ \end@OptexpMultipole
+}%
+\def\fibercollimator{\pst@object{fibercollimator}}
+\def\fibercollimator@i(#1)(#2){%
+ \addbefore@par{conn=o-f}
+ \def\pst@tempA{#1}%
+ \def\pst@tempB{#2}%
+ \def\pst@tempC{}%
+ \def\pst@tempD{}%
+ \pst@regNodes{\pst@tempA}{\pst@tempB}
+ \pst@adjustTempNodes
+ \@ifnextchar({\fibercollimator@ii}{\fibercollimator@iv}%
+}%
+%
+\def\fibercollimator@ii(#1){%
+ \def\pst@tempC{#1}%
+ \@ifnextchar({\fibercollimator@iii}{\fibercollimator@iv}%
}%
%
+\def\fibercollimator@iii(#1)#2{%
+ \def\pst@tempD{#1}%
+ \fibercollimator@iv{#2}%
+}
+\def\fibercollimator@iv#1{%
+ \begin@OptexpObj
+ \pst@draw@component{#1}{%
+ \pnode(0,0){tempNode@Label}%
+ \pnode(0,0){\optexp@nodeA}%
+ \pnode(0,0){\optexp@nodeB}%
+ \fibercollimator@v%
+ }%
+ \@nameuse{\psk@connIn}%
+ \ifx\@empty\pst@tempC
+ \@nameuse{\psk@connOut}%
+ \else\ifx\@empty\pst@tempD
+ \psbezier[style=FiberOut](\pst@tempC)(\pst@tempB)(\pst@tempB)(\optexp@nodeB)%
+ \else
+ \psbezier[style=FiberOut](\pst@tempD)(\pst@tempC)(\pst@tempB)(\optexp@nodeB)%
+ \fi\fi
+ \end@OptexpObj
+}%
+% \def\fibercollimator@i(#1)(#2){%
+% \addbefore@par{conn=o-f}
+% \def\pst@tempA{#1}%
+% \def\pst@tempB{#2}%
+% \@ifnextchar({\fibercollimator@ii}{\fibercollimator@iii}%
+% }%
+% %
+% \def\fibercollimator@ii(#1)#2{%
+% \pst@regNodes{\pst@tempA}{\pst@tempB}
+% \pst@adjustTempNodes
+% \begin@OptexpObj
+% \pst@draw@component{#2}{%
+% \pnode(0,0){tempNode@Label}%
+% \pnode(0,0){\optexp@nodeA}%
+% \pnode(0,0){\optexp@nodeB}%
+% \fibercollimator@iv%
+% }%
+% \@nameuse{\psk@connIn}%
+% \psbezier[style=FiberOut](#1)(\pst@tempB)(\pst@tempB)(\optexp@nodeB)%
+% \end@OptexpObj
+% }%
+% %
+% \def\fibercollimator@iii#1{%
+% \pst@regNodes{\pst@tempA}{\pst@tempB}
+% \begin@OptexpObj
+% \pst@adjustTempNodes
+% \pst@draw@component{#1}{%
+% \pnode(0,0){tempNode@Label}%
+% \pnode(0,0){\optexp@nodeA}%
+% \pnode(0,0){\optexp@nodeB}%
+% \fibercollimator@iv%
+% }%
+% \@nameuse{\psk@connIn}%
+% \@nameuse{\psk@connOut}%
+% \end@OptexpObj
+% }%
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -1101,14 +1317,11 @@
\newOptexpFiberDipole{optfilter}{}
\newOptexpFiberDipole{polcontrol}{}
\newOptexpFiberDipole{optisolator}{}
+\newOptexpFiberDipole{optfiberpolarizer}{}
\newOptexpFiberDipole{optswitch}{}
\newOptexpFiberDipole{fiberdelayline}{}
\newOptexpFiberQuadrupole{optcoupler}{}
%
-% HYBRID COMPONENTS
-\newOptexpDipole{fibercollimator}{conn=o-f}
-%
-%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% default settings
@@ -1134,6 +1347,7 @@
,innerheight=0.1
% beamsplitter
,bssize=0.8
+% ,bsstyle=cube
% crystal
,crystalwidth=1.4
,crystalheight=0.6
@@ -1203,6 +1417,7 @@
,filtertype=bandpass
,polcontrolsize=0.15
,isolatorsize=0.6
+ ,fiberpolsize=0.6
,couplersize=0.2
,couplersep=0.05
,couplertype=elliptic
@@ -1212,6 +1427,9 @@
,fibercolsize=0.3
,conn=-
,usefiberstyle=false
+ ,bsstyle=cube
+ ,compshift=0
+ ,connjoin=1
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -1241,10 +1459,12 @@
% Positioning of the component
%
\begingroup
+ %
+ \psset{style=OptComp}
%
% linestyle to use, if component should be marked as optional
\ifPOE@component@optional
- \psset{style=OptionalStyle}
+ \psset{style=OptionalStyle}%
\fi
% if parameter 'position' is given, use it for 'npos'
\ifx\POK@position\@empty
@@ -1261,7 +1481,16 @@
\endgroup
%
% Now put the label
- \put@Label{#1}%
+ \ifPOE@label@innerlabel
+ \ifdim\optboxwidth>0pt
+ \psset{labeloffset=0, labelref=relative}
+ \put@Label{\parbox{\optboxwidth}{#1}}%
+ \else
+ \put@Label{#1}%
+ \fi
+ \else
+ \put@Label{#1}%
+ \fi
%
% Show some special dots for debugging
\ifPOE@debug@showoptdots
@@ -1337,7 +1566,7 @@
\psarc[linewidth=0.8\pslinewidth,arrowinset=0,arrowscale=0.8]{<->}
(! \@m@wd 0.4 sub neg 0){0.6}{160}{200}
\fi
- \psline[linewidth=\POK@mirror@linewidth](! \@m@wd neg 0)(! \@m@wd 0)
+ \psline[linewidth=\POK@mirror@linewidth](! \@m@wd neg \getCLWH)(! \@m@wd \getCLWH)
%
% mirrortype
\ifx\POK@mirror@type\POS@mirror@type@piezo%
@@ -1372,19 +1601,34 @@
\ifx\POK@lens@type\@empty
% NEW CODE!
\begin@ClosedObj
+ \edef\@lens@newwd{0\space}%
\edef\@lens@wd{\POK@lens@width\space\pst@number\psxunit mul 2 div }%
- \edef\@lens@ht{\POK@lens@height\space\pst@number\psyunit mul 2 div }%
- \edef\@lens@rL{\POK@lens@radiusLeft\space\pst@number\psxunit mul }%
- \edef\@lens@rR{\POK@lens@radiusRight\space\pst@number\psxunit mul }%
- \edef\@lens@th{}%
- \addto@pscode{\pst@optexpdict}%
+ \edef\@lens@th{0}%
+ \addto@pscode{%
+ \pst@optexpdict
+ /@wd \POK@lens@width\space\pst@number\psxunit mul 2 div def
+ /@ht \POK@lens@height\space\pst@number\psyunit mul 2 div def
+ /@rL \POK@lens@radiusLeft\space\pst@number\psxunit mul def
+ /@rR \POK@lens@radiusRight\space\pst@number\psxunit mul def
+ /@th 0 def
+ }%
%
% distinguish between all the different lens-combination possibilities
%
\ifdim\POK@lens@radiusLeft pt=0pt\else
- \edef\@lens@th{\ifPOE@thicklens \@lens@wd\else a1 \fi}%
+ % this takes the /a1 definition from the leftC* procedures
+ % the macro is necessary for the outer nodes
+ \edef\@lens@newwd{%
+ \POK@lens@radiusLeft\space\POK@lens@height\space 2 div segLen
+ \ifdim\POK@lens@radiusLeft pt<0pt
+ 0.5 mul
+ \fi\space
+ }%
+ %
+ \edef\@lens@th{\ifPOE@thicklens \POK@lens@width\space 2 div \else \POK@lens@radiusLeft\space\POK@lens@height\space 2 div segLen \fi}%
\addto@pscode{%
- \@lens@ht \@lens@rL
+ /@th \ifPOE@thicklens @wd \else @rL @ht segLen \fi def
+ @ht @rL
\ifdim\POK@lens@radiusLeft pt<0pt
leftConcave
\else
@@ -1393,9 +1637,12 @@
}%
\fi
\ifdim\POK@lens@radiusRight pt=0pt\else
- \edef\@lens@th{\@lens@th\space\ifPOE@thicklens \@lens@wd\else a2 \fi}%
+ % this takes the /a1 definition from the rightC* procedures
+ % the macro is necessary for the outer nodes
+ \edef\@lens@th{\@lens@th\space\ifPOE@thicklens \POK@lens@width\space 2 div\else \POK@lens@radiusRight\space\POK@lens@height\space 2 div segLen \fi\space add}%
\addto@pscode{%
- \@lens@ht \@lens@rR
+ /@th @th \ifPOE@thicklens @wd \else @rR @ht segLen \fi add def
+ @ht @rR
\ifdim\POK@lens@radiusRight pt<0pt
rightConcave
\else
@@ -1410,14 +1657,11 @@
% \- right convex
\ifdim\POK@lens@radiusLeft pt=0pt
\ifdim\POK@lens@radiusRight pt=0pt\else
- \addto@pscode{\@lens@th 2 div sub neg 5 1 roll }%
- \ifdim\POK@lens@radiusRight pt<0pt
- \addto@pscode{%
- \@lens@th 2 div neg \@lens@ht neg moveto ArcR
- \@lens@th 2 div neg \@lens@ht lineto}%
- \else
- \addto@pscode{ArcR}%
- \fi
+ \addto@pscode{%
+ @th 2 div sub neg 5 1 roll
+ @th 2 div neg @ht neg moveto ArcR
+ @th 2 div neg @ht lineto
+ }%
\fi
\fi
%
@@ -1426,13 +1670,11 @@
% \- left convex
\ifdim\POK@lens@radiusRight pt=0pt
\ifdim\POK@lens@radiusLeft pt=0pt\else
- \addto@pscode{\@lens@th 2 div sub 5 1 roll }%
- \ifdim\POK@lens@radiusLeft pt<0pt
- \addto@pscode{\@lens@th 2 div \@lens@ht moveto ArcL
- \@lens@th 2 div \@lens@ht neg lineto }%
- \else
- \addto@pscode{ArcL }%
- \fi
+ \addto@pscode{%
+ @th 2 div sub 5 1 roll
+ @th 2 div @ht moveto ArcL
+ @th 2 div @ht neg lineto
+ }%
\fi
\fi
%
@@ -1440,14 +1682,17 @@
\ifdim\POK@lens@radiusRight pt=0pt\else
\ifdim\POK@lens@radiusLeft pt=0pt\else
\addto@pscode{%
- \@lens@th\space add 2 div dup
- 7 1 roll sub neg 5 1 roll
- ArcR sub 5 1 roll ArcL }%
+ @th 2 div dup
+ 7 1 roll sub neg 5 1 roll
+ ArcR sub 5 1 roll ArcL
+ }%
\fi
\fi
%
% now complete the object
\addto@pscode{closepath 1 setlinejoin end }%
+ \pnode(! \pst@optexpdict\space\@lens@th\space -2 div 0 end){\optexp@nodeA}
+ \pnode(! \pst@optexpdict\space\@lens@th\space 2 div 0 end){\optexp@nodeB}
\end@ClosedObj
%
% OLD CODE (compatibility)
@@ -1561,8 +1806,12 @@
%
\def\beamsplitter@iii{%
\edef\@bs@wd{\POK@bssize\space 2.0 div\space}%
- \psline{cc-cc}(! \@bs@wd neg 2 sqrt mul 0)(! \@bs@wd 2 sqrt mul 0)
- \rput[c]{45}(0,0){\psframe(! \@bs@wd neg \@bs@wd neg)(! \@bs@wd \@bs@wd)}
+ \ifx\POK@bsstyle\POS@bs@cube
+ \psline{cc-cc}(! \@bs@wd neg 2 sqrt mul 0)(! \@bs@wd 2 sqrt mul 0)
+ \rput[c]{45}(0,0){\psframe(! \@bs@wd neg \@bs@wd neg)(! \@bs@wd \@bs@wd)}
+ \else\ifx\POK@bsstyle\POS@bs@plate
+ \psline(! \@bs@wd neg 2 sqrt mul 0)(! \@bs@wd 2 sqrt mul 0)
+ \fi\fi
\ignorespaces}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1685,7 +1934,7 @@
\edef\@g@step{\POK@optgrid@width\space\@g@cnt div\space}%
\ifx\POK@optgrid@type\POS@optgrid@type@blazed
\ifPOE@reverse%
- \pscustom[linewidth=\POK@optgrid@linewidth]{%
+ \pscustom[linewidth=\POK@optgrid@linewidth, linejoin=1]{%
\psline[liftpen=1](! \@g@wd \@g@dp)(! \@g@wd \@g@ht)%
(! \@g@wd neg \@g@ht)(! \@g@wd neg \@g@dp)
\multido{\i=0+1}{\POK@optgrid@count}{%
@@ -1696,7 +1945,7 @@
\closepath
}%
\else%
- \pscustom[linewidth=\POK@optgrid@linewidth]{%
+ \pscustom[linewidth=\POK@optgrid@linewidth, linejoin=1]{%
\psline[liftpen=1](! \@g@wd \@g@dp)(! \@g@wd \@g@ht)%
(! \@g@wd neg \@g@ht)(! \@g@wd neg \@g@dp)
\multido{\i=0+1}{\POK@optgrid@count}{%
@@ -1760,8 +2009,8 @@
%
\def\optplate@iii{%
\psline[linewidth=\POK@plate@linewidth]%
- (! 0 \POK@plate@height\space 2 div neg)%
- (! 0 \POK@plate@height\space 2 div)
+ (! \POK@plate@height\space 2 div \POK@angle\space 2 copy sin mul 3 1 roll cos mul neg)%
+ (! \POK@plate@height\space 2 div \POK@angle\space 2 copy sin mul neg 3 1 roll cos mul )%
\ignorespaces}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2033,6 +2282,19 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% FIBER POLARIZER
+%
+\def\optfiberpolarizer@iii{%
+ \edef\@ht{\POK@fiberpol@size\space 2 div\space}%
+ \edef\@wd{\POK@fiberpol@size\space 0.8 mul\space}%
+ \psframe[dimen=outer](! \@wd neg \@ht neg)(! \@wd \@ht)
+ \psline(! \@wd neg 0.2 mul \@ht neg)(!\@wd 0.2 mul \@ht)
+ \pnode(! \@wd neg 0){\optexp@nodeA}
+ \pnode(! \@wd 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
% SWITCH
%
\def\optswitch@iii{%
@@ -2049,8 +2311,8 @@
\ifPOE@usefiberstyle
\psset{style=Fiber}
\fi
- \psline(! @@x neg 0)(! @@x -0.6 mul @lw sub 0)%
- \psline(! @@x 0.6 mul 0)(! @@x 0)%
+ \psline[arrows=-](! @@x neg 0)(! @@x -0.6 mul @lw sub 0)%
+ \psline[arrows=-](! @@x 0.6 mul 0)(! @@x 0)%
\egroup
% different styles
\ifx\POK@switch@style\POS@optexp@closed%
@@ -2181,7 +2443,7 @@
%
% FIBER COLLIMATOR
%
-\def\fibercollimator@iii{%
+\def\fibercollimator@v{%
\def\@sz{\POK@fibercol@size\space 0.5 mul\space}%
\pspolygon(! \@sz neg \getCLWH add \@sz neg)(!\@sz 0)(!\@sz neg \getCLWH add \@sz)
\pnode(!\@sz neg 0){\optexp@nodeA}