summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-07-28 22:53:54 +0000
committerKarl Berry <karl@freefriends.org>2008-07-28 22:53:54 +0000
commitf6b1250ed24d6489698126ab69a0528101a24ff6 (patch)
treed64893b665a30c44f4208b32b71c9a75422ef36a /Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex
parented6efd6b2b5e4e45a8e0f8a27074443bdc93db9c (diff)
pst-optexp update (28jul08)
git-svn-id: svn://tug.org/texlive/trunk@9853 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex1651
1 files changed, 1340 insertions, 311 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 6d7b5fe5bcc..2231aa412ad 100644
--- a/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex
+++ b/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex
@@ -16,12 +16,18 @@
%%
%% HISTORY -> see file Changes
%%
+%% Naming conventions:
+%% macros starting with
+%% \POS are _P_STricks _O_ptexp _S_trings
+%% \POK are _P_STricks _O_ptexp _K_eys
+%% \ifPOE are _P_STricks _O_pt_e_xp ifs
+%%
\csname PSToptexpLoaded\endcsname
\let\PSToptexpLoaded\endinput
%
%
-\def\fileversion{1.2}
-\def\filedate{2008/06/17}
+\def\fileversion{2.0}
+\def\filedate{2008/07/27}
\message{`pst-optexp' v\fileversion, \filedate\space (CB)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -30,82 +36,107 @@
\def\pst@optexpdict{tx@OptexpDict begin }
\SpecialCoor
%
-% In some versions of pstricks-add previous to 2.81 the macro
-% \nlput is buggy. In these cases it is redefined here.
-\ifdim\pstricksaddfileversion pt<2.81pt
-\typeout{}
-\typeout{pst-optexp: please update pstricks-add to version >= 2.81}
-\typeout{}
-\def\psLDNode(#1)(#2)#3#4{%
-% #1: node A #2: node B #3: dimen measured from A #4: node name
- \pst@getcoor{#1}\pst@tempA%
- \pst@getcoor{#2}\pst@tempB%
- \pssetlength\pst@dimp{#3}%
- \pnode(!%
- \pst@tempA /YA exch \pst@number\psyunit div def
- /XA exch \pst@number\psxunit div def
- \pst@tempB /YB exch \pst@number\psyunit div def
- /XB exch \pst@number\psxunit div def
- /dx XB XA sub def
- /dy YB YA sub def
- /angle dy dx Atan def
- /linelength \pst@number\pst@dimp \pst@number\psunit div def
- XA linelength angle cos mul add YA linelength angle sin mul add ){#4}%
-}%
-\def\nlput{\pst@object{nlput}}
-\def\nlput@i(#1)(#2)#3#4{%
- \begin@SpecialObj
- \psLDNode(#1)(#2){#3}{temp@lnput}
- \pcline[linestyle=none](#1)(temp@lnput)%
- \ncput[npos=1]{#4}%
- \end@SpecialObj
-}%
+% 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
%
-\newif\ifPst@optexp@variable
-\newif\ifPst@optexp@crystal@voltage
-\newif\ifPst@optexp@crystal@caxisinv
-\newif\ifPst@optexp@reverse
-\newif\ifPst@optexp@crystal@lamp
-\newif\ifPst@optexp@component@optional
-\newif\ifPst@optexp@debug@showoptdots
-\newif\ifPst@optexp@endbox
-\newif\ifPst@optexp@thicklens
+\newif\ifPOE@variable
+\newif\ifPOE@crystal@voltage
+\newif\ifPOE@crystal@caxisinv
+\newif\ifPOE@reverse
+\newif\ifPOE@crystal@lamp
+\newif\ifPOE@component@optional
+\newif\ifPOE@debug@showoptdots
+\newif\ifPOE@endbox
+\newif\ifPOE@thicklens
+\newif\ifPOE@usefiberstyle
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Strings
-\def\pst@string@pol@polperp{perp}
-\def\pst@string@pol@polparallel{parallel}
-\def\pst@string@pol@polmisc{misc}
-\def\pst@string@pol@polrcirc{rcirc}
-\def\pst@string@pol@pollcirc{lcirc}
-\def\pst@string@mirror@type@piezo{piezo}
-\def\pst@string@mirror@type@plain{plain}
-\def\pst@string@mirror@type@extended{extended}
-\def\pst@string@optgrid@type@blazed{blazed}
-\def\pst@string@optgrid@type@binary{binary}
-%
-\def\pst@string@lens@type@plainconvex{plainconvex}
-\def\pst@string@lens@type@convexplain{convexplain}
-\def\pst@string@lens@type@biconvex{biconvex}
-\def\pst@string@lens@type@plainconcave{plainconcave}
-\def\pst@string@lens@type@concaveplain{concaveplain}
-\def\pst@string@lens@type@biconcave{biconcave}
-%
-\def\pst@string@labelref@relative{relative}
-\def\pst@string@labelref@relgrav{relgrav}
-\def\pst@string@labelref@global{global}
%
+\def\POS@pol@polperp{perp}
+\def\POS@pol@polparallel{parallel}
+\def\POS@pol@polmisc{misc}
+\def\POS@pol@polrcirc{rcirc}
+\def\POS@pol@pollcirc{lcirc}
+\def\POS@mirror@type@piezo{piezo}
+\def\POS@mirror@type@plain{plain}
+\def\POS@mirror@type@extended{extended}
+\def\POS@optgrid@type@blazed{blazed}
+\def\POS@optgrid@type@binary{binary}
+%
+\def\POS@lens@type@plainconvex{plainconvex}
+\def\POS@lens@type@convexplain{convexplain}
+\def\POS@lens@type@biconvex{biconvex}
+\def\POS@lens@type@plainconcave{plainconcave}
+\def\POS@lens@type@concaveplain{concaveplain}
+\def\POS@lens@type@biconcave{biconcave}
+%
+\def\POS@labelref@relative{relative}
+\def\POS@labelref@relgrav{relgrav}
+\def\POS@labelref@global{global}
+%
+\edef\POS@filter@type@bandpass{bandpass}
+\edef\POS@filter@type@bandstop{bandstop}
+%
+\edef\POS@coupler@type@none{none}
+\edef\POS@coupler@type@elliptic{elliptic}
+%
+\edef\POS@optexp@top{top}
+\edef\POS@optexp@bottom{bottom}
+\edef\POS@optexp@center{center}
+\edef\POS@optexp@closed{closed}
+\edef\POS@optexp@opened{opened}
+\edef\POS@optexp@basicname@default{tempNode@}
+\edef\POS@optexp@basicname@postfix{Intern}
+\edef\POS@optexp@extnode@postfix{ExtNode}
+\edef\POS@detector@round{round}
+\edef\POS@detector@diode{diode}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% psstyles
%
\newpsstyle{OptionalStyle}{linestyle=dashed,dash=1.5pt 1pt}%
\newpsstyle{ExtendedMirror}{linestyle=none,%
- hatchwidth=0.5\psk@optexp@mirror@linewidth,%0.6pt,%
- hatchsep=1.4\psk@optexp@mirror@linewidth,%
+ hatchwidth=0.5\POK@mirror@linewidth,
+ hatchsep=1.4\POK@mirror@linewidth,%
fillstyle=hlines}%
\newpsstyle{PiezoMirror}{fillstyle=solid,fillcolor=black!30}%
-\newpsstyle{OptBeam}{linecolor=green!90!black}%
+\newpsstyle{Beam}{linecolor=green!90!black}%
+%
+\newpsstyle{Fiber}{}%
+\define@key[psset]{optexp}{newFiber}{\newpsstyle{Fiber}{#1}}
+\define@key[psset]{optexp}{addtoFiber}{\addtopsstyle{Fiber}{#1}}
+%
+\newpsstyle{FiberIn}{style=Fiber}%
+\define@key[psset]{optexp}{newFiberIn}{\newpsstyle{FiberIn}{#1}}
+\define@key[psset]{optexp}{addtoFiberIn}{\addtopsstyle{FiberIn}{#1}}
+%
+\newpsstyle{FiberOut}{style=Fiber}%
+\define@key[psset]{optexp}{newFiberOut}{\newpsstyle{FiberOut}{#1}}
+\define@key[psset]{optexp}{addtoFiberOut}{\addtopsstyle{FiberOut}{#1}}
+%
+\newpsstyle{FiberIn1}{style=FiberIn}%
+\define@key[psset]{optexp}{newFiberIn1}{\newpsstyle{FiberIn1}{#1}}
+\define@key[psset]{optexp}{addtoFiberIn1}{\addtopsstyle{FiberIn1}{#1}}
+%
+\newpsstyle{FiberIn2}{style=FiberIn}%
+\define@key[psset]{optexp}{newFiberIn2}{\newpsstyle{FiberIn2}{#1}}
+\define@key[psset]{optexp}{addtoFiberIn2}{\addtopsstyle{FiberIn2}{#1}}
+%
+\newpsstyle{FiberOut1}{style=FiberOut}%
+\define@key[psset]{optexp}{newFiberOut1}{\newpsstyle{FiberOut1}{#1}}
+\define@key[psset]{optexp}{addtoFiberOut1}{\addtopsstyle{FiberOut1}{#1}}
+%
+\newpsstyle{FiberOut2}{style=FiberOut}%
+\define@key[psset]{optexp}{newFiberOut2}{\newpsstyle{FiberOut2}{#1}}
+\define@key[psset]{optexp}{addtoFiberOut2}{\addtopsstyle{FiberOut2}{#1}}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -113,21 +144,49 @@
% Parameterdefinitions
%
% General
-\define@boolkey[psset]{optexp}[Pst@optexp@component@]{optional}[true]{}
-\define@key[psset]{optexp}{position}{\edef\psk@optexp@position{#1}}
-\define@key[psset]{optexp}{abspos}{\edef\psk@optexp@abspos{#1}}
-\define@key[psset]{optexp}{angle}{\edef\psk@optexp@angle{#1}}
+\define@boolkey[psset]{optexp}[POE@component@]{optional}[true]{}
+\define@key[psset]{optexp}{position}{\edef\POK@position{#1}}
+\define@key[psset]{optexp}{abspos}{\edef\POK@abspos{#1}}
+\define@key[psset]{optexp}{angle}{\edef\POK@angle{#1}}
+\define@boolkey[psset]{optexp}[POE@]{usefiberstyle}[true]{}
+%
+% Label
+\define@key[psset]{optexp}{labelangle}{\edef\POK@label@angle{#1}}
+\define@key[psset]{optexp}{labeloffset}{\edef\POK@label@offset{#1}}
+\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}}
+% for internal use only
+\define@key[psset]{optexp}{ref@angle}{\edef\POK@label@refangle{#1}}
+% labelrelative is obsolete
+\define@choicekey[psset]{optexp}{labelrelative}[\val\nr]{true,false}[true]{%
+ \ifcase\nr\relax
+ \psset{labelref=relative}
+ \or
+ \psset{labelref=global}
+ \fi
+ \PackageWarning{pst-optexp}{labelrelative is obsolete, please use labelref=relative instead}
+}
+%
+% Debug
+\define@boolkey[psset]{optexp}[POE@debug@]{showoptdots}[true]{}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Parameters for free-ray components
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Lens
-\define@key[psset]{optexp}{lensheight}{\edef\psk@optexp@lens@height{#1}}
-\define@key[psset]{optexp}{lenswidth}{\edef\psk@optexp@lens@width{#1}}
-\define@key[psset]{optexp}{lensradiusleft}{\edef\psk@optexp@lens@radiusLeft{#1}}
-\define@key[psset]{optexp}{lensradiusright}{\edef\psk@optexp@lens@radiusRight{#1}}
-\define@boolkey[psset]{optexp}[Pst@optexp@]{thicklens}[true]{}
+\define@key[psset]{optexp}{lensheight}{\edef\POK@lens@height{#1}}
+\define@key[psset]{optexp}{lenswidth}{\edef\POK@lens@width{#1}}
+\define@key[psset]{optexp}{lensradiusleft}{\edef\POK@lens@radiusLeft{#1}}
+\define@key[psset]{optexp}{lensradiusright}{\edef\POK@lens@radiusRight{#1}}
+\define@boolkey[psset]{optexp}[POE@]{thicklens}[true]{}
\define@key[psset]{optexp}{lensradius}{%
\psset{lensradiusleft=#1,%
lensradiusright=#1}%
- \edef\psk@optexp@lens@radius{#1}%
+ \edef\POK@lens@radius{#1}%
}%
% Lens Type (only for backward compatibility)
% 0 -> plainconvex
@@ -139,13 +198,13 @@
%
\define@key[psset]{optexp}{lenstype}{%
\def\pst@tempA{#1}
- \edef\psk@optexp@lens@type{%
- \ifx\pst@string@lens@type@plainconvex\pst@tempA 0\else
- \ifx\pst@string@lens@type@convexplain\pst@tempA 1\else
- \ifx\pst@string@lens@type@biconvex\pst@tempA 2\else
- \ifx\pst@string@lens@type@plainconcave\pst@tempA 3\else
- \ifx\pst@string@lens@type@concaveplain\pst@tempA 4\else
- \ifx\pst@string@lens@type@biconcave\pst@tempA 5%
+ \edef\POK@lens@type{%
+ \ifx\POS@lens@type@plainconvex\pst@tempA 0\else
+ \ifx\POS@lens@type@convexplain\pst@tempA 1\else
+ \ifx\POS@lens@type@biconvex\pst@tempA 2\else
+ \ifx\POS@lens@type@plainconcave\pst@tempA 3\else
+ \ifx\POS@lens@type@concaveplain\pst@tempA 4\else
+ \ifx\POS@lens@type@biconcave\pst@tempA 5%
\fi\fi\fi\fi\fi\fi%
}}
\define@key[psset]{optexp}{lens}{%
@@ -170,99 +229,378 @@
}%
%
% Pinhole
-\define@key[psset]{optexp}{innerheight}{\edef\psk@optexp@pinhole@iheight{#1}}
+\define@key[psset]{optexp}{innerheight}{\edef\POK@pinhole@iheight{#1}}
\define@key[psset]{optexp}{iwidth}{%
- \edef\psk@optexp@pinhole@iheight{#1}%
+ \edef\POK@pinhole@iheight{#1}%
\PackageWarning{pst-optexp}{iwidth is obsolete, use innerheight instead}
}
-\define@key[psset]{optexp}{outerheight}{\edef\psk@optexp@pinhole@oheight{#1}}
+\define@key[psset]{optexp}{outerheight}{\edef\POK@pinhole@oheight{#1}}
\define@key[psset]{optexp}{owidth}{%
- \edef\psk@optexp@pinhole@oheight{#1}%
+ \edef\POK@pinhole@oheight{#1}%
\PackageWarning{pst-optexp}{owidth is obsolete, use outerheight instead}
}
-\define@key[psset]{optexp}{phlinewidth}{\edef\psk@optexp@pinhole@linewidth{#1}}
+\define@key[psset]{optexp}{phlinewidth}{\edef\POK@pinhole@linewidth{#1}}
%
% Beamsplitter
-\define@key[psset]{optexp}{bssize}{\edef\psk@optexp@bssize{#1}}
+\define@key[psset]{optexp}{bssize}{\edef\POK@bssize{#1}}
\define@key[psset]{optexp}{bswidth}{%
- \edef\psk@optexp@bssize{#1}%
+ \edef\POK@bssize{#1}%
\PackageWarning{pst-optexp}{bswidth is obsolete, use bssize instead}%
}
%
% Crystal
-\define@key[psset]{optexp}{crystalwidth}{\edef\psk@optexp@crystal@width{#1}}
-\define@key[psset]{optexp}{crystalheight}{\edef\psk@optexp@crystal@height{#1}}
-\define@key[psset]{optexp}{caxislength}{\edef\psk@optexp@crystal@caxislength{#1}}
-\define@boolkey[psset]{optexp}[Pst@optexp@crystal@]{voltage}[true]{}
-\define@boolkey[psset]{optexp}[Pst@optexp@crystal@]{caxisinv}[true]{}
-\define@boolkey[psset]{optexp}[Pst@optexp@crystal@]{lamp}[true]{}
-\define@key[psset]{optexp}{lampscale}{\def\psk@optexp@lamp@scale{#1}}
+\define@key[psset]{optexp}{crystalwidth}{\edef\POK@crystal@width{#1}}
+\define@key[psset]{optexp}{crystalheight}{\edef\POK@crystal@height{#1}}
+\define@key[psset]{optexp}{caxislength}{\edef\POK@crystal@caxislength{#1}}
+\define@boolkey[psset]{optexp}[POE@crystal@]{voltage}[true]{}
+\define@boolkey[psset]{optexp}[POE@crystal@]{caxisinv}[true]{}
+\define@boolkey[psset]{optexp}[POE@crystal@]{lamp}[true]{}
+\define@key[psset]{optexp}{lampscale}{\def\POK@lamp@scale{#1}}
%
% Mirror
-\define@key[psset]{optexp}{mirrorwidth}{\edef\psk@optexp@mirror@width{#1}}
-\define@key[psset]{optexp}{mirrorlinewidth}{\edef\psk@optexp@mirror@linewidth{#1}}
-\define@key[psset]{optexp}{mirrortype}{\edef\psk@optexp@mirror@type{#1}}% piezo, extended, plain
-\define@key[psset]{optexp}{mirrordepth}{\edef\psk@optexp@mirror@depth{#1}}
-\define@key[psset]{optexp}{mirrorradius}{\edef\psk@optexp@mirror@radius{#1}}
-\define@boolkey[psset]{optexp}[Pst@optexp@]{variable}[true]{}
+\define@key[psset]{optexp}{mirrorwidth}{\edef\POK@mirror@width{#1}}
+\define@key[psset]{optexp}{mirrorlinewidth}{\edef\POK@mirror@linewidth{#1}}
+%\define@key[psset]{optexp}{mirrortype}{\edef\POK@mirror@type{#1}}% piezo, extended, plain
+\define@choicekey+[psset]{optexp}{mirrortype}[\val\nr]{piezo,extended,plain}%
+ {\edef\POK@mirror@type{#1}}%
+ {\PackageError{pst-optexp}{Unknown value '\val' for mirrortype}}
+\define@key[psset]{optexp}{mirrordepth}{\edef\POK@mirror@depth{#1}}
+\define@key[psset]{optexp}{mirrorradius}{\edef\POK@mirror@radius{#1}}
+\define@boolkey[psset]{optexp}[POE@]{variable}[true]{}
%
% Grid
-\define@key[psset]{optexp}{optgridcount}{\edef\psk@optexp@optgrid@count{#1}}
-\define@key[psset]{optexp}{optgridwidth}{\edef\psk@optexp@optgrid@width{#1}}
-\define@key[psset]{optexp}{optgridheight}{\edef\psk@optexp@optgrid@height{#1}}
-\define@key[psset]{optexp}{optgridtype}{\edef\psk@optexp@optgrid@type{#1}}
-\define@key[psset]{optexp}{optgriddepth}{\edef\psk@optexp@optgrid@depth{#1}}
-\define@key[psset]{optexp}{optgridlinewidth}{\edef\psk@optexp@optgrid@linewidth{#1}}
-\define@boolkey[psset]{optexp}[Pst@optexp@]{reverse}[true]{}
+\define@key[psset]{optexp}{optgridcount}{\edef\POK@optgrid@count{#1}}
+\define@key[psset]{optexp}{optgridwidth}{\edef\POK@optgrid@width{#1}}
+\define@key[psset]{optexp}{optgridheight}{\edef\POK@optgrid@height{#1}}
+\define@choicekey+[psset]{optexp}{optgridtype}[\val\nr]{binary,blazed}%
+ {\edef\POK@optgrid@type{#1}}
+ {\PackageError{pst-optexp}{Unknown value '\val' for optgridtype}}
+\define@key[psset]{optexp}{optgriddepth}{\edef\POK@optgrid@depth{#1}}
+\define@key[psset]{optexp}{optgridlinewidth}{\edef\POK@optgrid@linewidth{#1}}
+\define@boolkey[psset]{optexp}[POE@]{reverse}[true]{}
%
% Box
-\define@key[psset]{optexp}{optboxwidth}{\edef\psk@optexp@optbox@width{#1}}
-\define@key[psset]{optexp}{optboxheight}{\edef\psk@optexp@optbox@height{#1}}
-\define@boolkey[psset]{optexp}[Pst@optexp@]{endbox}[true]{}
+\define@key[psset]{optexp}{optboxwidth}{\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}}
%
% Plate
-\define@key[psset]{optexp}{platelinewidth}{\edef\psk@optexp@plate@linewidth{#1}}
-\define@key[psset]{optexp}{plateheight}{\edef\psk@optexp@plate@height{#1}}
+\define@key[psset]{optexp}{platelinewidth}{\edef\POK@plate@linewidth{#1}}
+\define@key[psset]{optexp}{plateheight}{\edef\POK@plate@height{#1}}
%
% Optical Retardation Plate
-\define@key[psset]{optexp}{platewidth}{\edef\psk@optexp@plate@width{#1}}
+\define@key[psset]{optexp}{platewidth}{\edef\POK@plate@width{#1}}
%
% Detector
-\define@key[psset]{optexp}{detsize}{\edef\psk@optexp@detector@size{#1}}
+\define@key[psset]{optexp}{detsize}{\edef\POK@detector@size{#1}}
+\define@choicekey+[psset]{optexp}{dettype}[\val\nr]{round,diode}%
+ {\edef\POK@detector@type{\val}}
+ {\PackageError{pst-optexp}{Unknown value '\val' for key dettype}}
%
% Polarization
\define@key[psset]{optexp}{polwidth}{%
- \edef\psk@optexp@polarization@size{#1}%
+ \edef\POK@polarization@size{#1}%
\PackageWarning{pst-optexp}{polwidth is obsolete, use polsize instead}%
}
-\define@key[psset]{optexp}{polsize}{\edef\psk@optexp@polarization@size{#1}}
-\define@key[psset]{optexp}{pollinewidth}{\edef\psk@optexp@polarization@linewidth{#1}}
-\define@key[psset]{optexp}{poltype}{\edef\psk@optexp@pol@type{#1}}
+\define@key[psset]{optexp}{polsize}{\edef\POK@polarization@size{#1}}
+\define@key[psset]{optexp}{pollinewidth}{\edef\POK@polarization@linewidth{#1}}
+\define@choicekey+[psset]{optexp}{poltype}[\val\nr]{parallel,misc,perp,rcirc,lcirc}%
+ {\edef\POK@pol@type{#1}}
+ {\PackageError{pst-optexp}{Unknown value '\val' for key poltype}}
\define@key[psset]{optexp}{pol}{%
- \edef\psk@optexp@poltype{#1}%
+ \edef\POK@poltype{#1}%
\PackageWarning{pst-optexp}{pol is obsolete, use poltype instead}%
}
%
-% Label
-\define@key[psset]{optexp}{labelangle}{\edef\psk@optexp@label@angle{#1}}
-\define@key[psset]{optexp}{labeloffset}{\edef\psk@optexp@label@offset{#1}}
-\define@key[psset]{optexp}{labelstyle}{\def\psk@optexp@label@style{#1}}
-\define@key[psset]{optexp}{labelalign}{\def\psk@optexp@label@align{#1}}
-\define@key[psset]{optexp}{labelref}{\edef\psk@optexp@label@ref{#1}}
-% for internal use only
-\define@key[psset]{optexp}{ref@angle}{\edef\psk@optexp@label@refangle{#1}}
-% labelrelative is obsolete
-\define@choicekey*[psset]{optexp}{labelrelative}[\val\nr]{true,false}[true]{%
- \ifcase\nr\relax
- \psset{labelref=relative}
- \or
- \psset{labelref=global}
- \fi
- \PackageWarning{pst-optexp}{labelrelative is obsolete, please use labelref=relative instead}
+% Optical Diode
+\define@key[psset]{optexp}{optdiodesize}{\edef\POK@diode@size{#1}}
+%
+% Penta Prism
+\define@key[psset]{optexp}{pentaprismsize}{\edef\POK@pentaprism@size{#1}}
+%
+% Right-Angle Prism
+\define@key[psset]{optexp}{raprismsize}{\edef\POK@raprism@size{#1}}
+%
+% Prism
+\define@key[psset]{optexp}{prismsize}{\edef\POK@prism@size{#1}}
+\define@key[psset]{optexp}{prismangle}{\edef\POK@prism@angle{#1}}
+%
+% Dove Prism
+\define@key[psset]{optexp}{doveprismsize}{\edef\POK@doveprism@size{#1}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Parameters for fiber-optical components
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Fiber
+\define@key[psset]{optexp}{fiberloops}{\edef\POK@fiber@count{#1}}
+\define@key[psset]{optexp}{fiberloopradius}{\edef\POK@fiber@radius{#1}}
+\define@key[psset]{optexp}{fiberloopsep}{\edef\POK@fiber@sep{#1}}
+%
+% Filter
+\define@key[psset]{optexp}{filtersize}{\edef\POK@filter@size{#1}}
+\define@choicekey+[psset]{optexp}{filtertype}[\val\nr]{bandstop,bandpass}%
+ {\edef\POK@filter@type{#1}}%
+ {\PackageError{pst-optexp}{Unknown value '\val' for key filtertype}}
+%
+% Polarization controller
+\define@key[psset]{optexp}{polcontrolsize}{\edef\POK@polcontrol@size{#1}}
+%
+% Optical amplifier
+\define@key[psset]{optexp}{optampsize}{\edef\POK@optamp@size{#1}}
+%
+% Mach-Zehnder-Modulator
+\define@key[psset]{optexp}{optmzmsize}{\edef\POK@optmzm@size{#1}}
+%
+% Isolator
+\define@key[psset]{optexp}{isolatorsize}{\edef\POK@isolator@size{#1}}
+%
+% Optical switch
+\define@key[psset]{optexp}{switchsize}{\edef\POK@switch@size{#1}}
+\define@choicekey+[psset]{optexp}{switchstyle}[\val\nr]{opened,closed}%
+ {\edef\POK@switch@style{#1}}%
+ {\PackageError{pst-optexp}{Unknown value '\val' for key switchstyle}}
+%
+% Fiber delay line
+\define@key[psset]{optexp}{fdlsize}{\edef\POK@fdl@size{#1}}
+%
+% Fiber collimator
+\define@key[psset]{optexp}{fibercolsize}{\edef\POK@fibercol@size{#1}}
+%
+% Coupler
+\define@key[psset]{optexp}{couplersize}{\edef\POK@coupler@size{#1}}
+\define@key[psset]{optexp}{couplersep}{\edef\POK@coupler@sep{#1}}
+\define@choicekey+[psset]{optexp}{couplertype}[\val\nr]{none,elliptic}%
+ {\edef\POK@coupler@type{#1}}%
+ {\PackageError{pst-optexp}{Unknown value '\val' for key couplertype}}
+\define@key[psset]{optexp}{align}{\edef\POK@align{#1}}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Code for the extnode parameter (additional input node)
+%
+\define@key[psset]{optexp}{extnoden@me}{\edef\POK@extnode@name{#1}}
+%
+% (this part was copied and adapted from \psset@@ref from pstricks.tex)
+\define@key[psset]{optexp}{extnode}{%
+ \edef\POK@extnode{#1}%
+ \ifx\@empty\POK@extnode\else
+ \pst@expandafter\psset@@extnode{#1}\@empty,,\@nil
+ \fi
+}%
+\def\POK@xref{0}%
+\def\POK@yref{0}%
+\def\psset@@extnode#1#2,#3,#4\@nil{%
+ \def\POK@xref{0}%
+ \def\POK@yref{0}%
+ \ifx\@empty#3\@empty
+ \@nameuse{getref@optexp@#1}%
+ \@nameuse{getref@optexp@#2}%
+ \else
+ \pst@checknum{#1#2}\POK@xref%
+ \pst@checknum{#3}\POK@yref%
+ \fi}%
+\def\getref@optexp@c{}%
+\def\getref@optexp@t{\def\POK@yref{1}}%
+\def\getref@optexp@b{\def\POK@yref{-1}}%
+\def\getref@optexp@l{\def\POK@xref{-1}}%
+\def\getref@optexp@r{\def\POK@xref{1}}%
+%
+%
+\define@key[psset]{optexp}{rotateref}{%
+ \def\pst@temp{#1}%
+ \ifx\@empty\pst@temp\else
+ \pst@expandafter\psset@@rotateref{#1}\@empty,,\@nil
+ \fi
+}%
+\def\POK@rotate@xref{0}%
+\def\POK@rotate@yref{0}%
+\def\psset@@rotateref#1#2,#3,#4\@nil{%
+ \def\POK@rotate@xref{0}%
+ \def\POK@rotate@yref{0}%
+ \ifx\@empty#3\@empty
+ \@nameuse{getref@optexp@rotate@#1}%
+ \@nameuse{getref@optexp@rotate@#2}%
+ \else
+ \pst@checknum{#1#2}\POK@rotate@xref%
+ \pst@checknum{#3}\POK@rotate@yref%
+ \fi}%
+\def\getref@optexp@rotate@c{}%
+\def\getref@optexp@rotate@t{\def\POK@rotate@yref{1}}%
+\def\getref@optexp@rotate@b{\def\POK@rotate@yref{-1}}%
+\def\getref@optexp@rotate@l{\def\POK@rotate@xref{-1}}%
+\def\getref@optexp@rotate@r{\def\POK@rotate@xref{1}}%
+%
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% THIS IS THE COMPLETE AND NEW CODE FOR ALL CONNECTIONS %%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+\define@key[psset]{optexp}{b@sicname}{%
+ \edef\pst@temp{#1}%
+ \ifx\pst@temp\@empty%
+ \edef\POK@basicname{\POS@optexp@basicname@default}%
+ \else%
+ \edef\POK@basicname{#1\POS@optexp@basicname@postfix}%
+ \fi%
+}%
+\def\POE@complist{}%
+\g@addto@macro{\endpspicture}{\gdef\POE@complist{}}%
+\define@key[psset]{optexp}{@compname}{%
+ \edef\POK@compname{#1}%
+ \psset{b@sicname=#1}%
+ \psset{extnoden@me=#1\POS@optexp@extnode@postfix}%
+ % check if compname was already defined
+ \ifx\POK@compname\@empty\else
+ \@expandtwoargs\in@{,#1,}{,\POE@complist,}%
+ \ifin@
+ \PackageWarning{pst-optexp}%
+ {^^Jcompname '#1' already used. Previously defined nodes will be overwritten!^^J}%
+ \else
+ % Use definition of \XKV@addtolist@x with an \xdef instead of \edef in order
+ % to keep the bookkeeping global
+ \xdef\POE@complist{\POE@complist\ifx\POE@complist\@empty\else,\fi#1}%
+ \fi
+ \fi
+}%
+\define@key[psset]{optexp}{conn}{%
+ \edef\pst@tempg{#1}%
+ \expandafter\psset@@conn\pst@tempg\@empty-\@empty\@nil
+ \if@pst\else
+ \pstrickserr{Bad connection specification: #1}\@ehpa
+ \fi
+}%
+\def\psset@@conn#1-#2\@empty#3\@nil{%
+ \@psttrue
+ \def\next##1,#1-##2,##3\@nil{\def\pst@tempg{##2}}%
+ \expandafter\next\pst@optexp@conntable,#1-#1,\@nil
+ \@ifundefined{psoe@cs@in@\pst@tempg}%
+ {\@pstfalse\def\psk@connIn{}}%
+ {\edef\psk@connIn{psoe@cs@in@\pst@tempg}}%
+ \@ifundefined{psoe@cs@out@#2}%
+ {\@pstfalse\def\psk@connOut{}}%
+ {\def\psk@connOut{psoe@cs@out@#2}}%
+}%
+\def\psk@connIn{}%
+\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)}%
+\def\psoe@cs@out@o{\psline[style=Beam](\optexp@nodeB)(\POS@optexp@basicname@default B)}%
+\def\psoe@cs@in@f{%
+ \pccurve[angleA=!\pst@optexpdict FiberAngleA end,
+ angleB=!\pst@optexpdict FiberAngleB end,
+ style=FiberIn](\POS@optexp@basicname@default A)(\optexp@nodeA)%
+}%
+\def\psoe@cs@out@f{%
+ \pccurve[angleA=!\pst@optexpdict FiberAngleA end,
+ angleB=!\pst@optexpdict FiberAngleB end,
+ style=FiberOut](\optexp@nodeB)(\POS@optexp@basicname@default B)%
+}%
+\def\psoe@cs@in@i{%
+ \def\pst@par{style=Beam}
+ \begin@OpenObj
+ \addto@pscode{%
+ [
+ \pst@optexpdict
+ (\POK@basicname) false GetInternalBeamNodes
+ /N@\POS@optexp@basicname@default A tx@NodeDict begin load GetCenter end
+ end
+ }%
+ \psline@ii
+}%
+\def\psoe@cs@out@i{%
+ \def\pst@par{style=Beam}
+ \begin@OpenObj
+ \addto@pscode{%
+ [
+ \pst@optexpdict
+ /N@\POS@optexp@basicname@default B tx@NodeDict begin load GetCenter end
+ (\POK@basicname) false GetInternalBeamNodes
+ end
+ }%
+ \psline@ii
+}%
+%
+%
+\def\drawbeam{%
+ \def\conntable{,a-a,b-b,A-A,B-B}%
+ \begingroup
+ \psset{style=Beam}%
+ \pst@object{drawbeam}
+}%
+\def\drawbeam@i#1#2{%
+ \def\pst@tempA{\pst@optexp@getfirstchar#1\@nil}%
+ \def\pst@tempB{\pst@optexp@getfirstchar#2\@nil}%
+ \begin@OpenObj%
+ \if(\pst@tempB
+ % second parameter is a node
+ \pst@optexp@@getcoor#2
+ \def\psk@connOut{pst@coor}%
+ \else
+ \pst@optexp@check@compname{#2}%
+ \edef\POK@basicnameB{#2\POS@optexp@basicname@postfix}%
+ \fi
+ \if(\pst@tempA
+ % % first parameter is a node
+ \pst@optexp@@getcoor#1%
+ \def\psk@connIn{pst@coor}%
+ \else
+ \pst@optexp@check@compname{#1}%
+ \edef\POK@basicnameA{#1\POS@optexp@basicname@postfix}%
+ \fi
+ \let\POK@basicname\POK@basicnameB
+ \addto@pscode{[ \@nameuse{\psk@connOut}}%
+ \let\POK@basicname\POK@basicnameA
+ \addto@pscode{\@nameuse{\psk@connIn}}%
+ \psline@ii
+ \endgroup
+\ignorespaces}%
+%
+\def\pst@optexp@check@compname#1{%
+ % check if 'compname' is defined
+ \@expandtwoargs\in@{,#1,}{,\POE@complist,}%
+ \ifin@\else
+ \PackageError{pst-optexp}{^^Jcompname '#1' undefined!^^J}
+ \fi
+}%
+\def\pst@optexp@getfirstchar#1#2\@nil{#1}%
+\def\pst@optexp@@getcoor(#1){%
+ \pst@@getcoor{#1}%
+\ignorespaces}%
+%
+% IN
+\def\psoe@cs@in@a{tx@NodeDict begin /N@\POK@basicname 1 load GetCenter end }%
+\def\psoe@cs@in@A{\pst@optexpdict (\POK@basicname) true GetInternalBeamNodes end }%
+\def\psoe@cs@in@b{tx@NodeDict begin /N@\POK@basicname N load GetCenter end }%
+\def\psoe@cs@in@B{\pst@optexpdict (\POK@basicname) false GetInternalBeamNodes end }%
+%
+% OUT
+%
+\def\psoe@cs@out@a{tx@NodeDict begin N@\POK@basicname 1 GetCenter end }%
+\def\psoe@cs@out@A{\pst@optexpdict (\POK@basicname) false GetInternalBeamNodes end }%
+\def\psoe@cs@out@b{tx@NodeDict begin N@\POK@basicname N GetCenter end }%
+\def\psoe@cs@out@B{\pst@optexpdict (\POK@basicname) true GetInternalBeamNodes end }%
+%
+%
+\define@choicekey[psset]{optexp}{beam}[\val\nr]{}[]{%
+ \psset{conn=i-o}%
}
+\define@choicekey[psset]{optexp}{fiber}[\val\nr]{}[]{%
+ \psset{conn=f-f}%
+}
+\def\optexp@nodeA{\POK@basicname 1}%
+\def\optexp@nodeB{\POK@basicname N}%
+\def\optexp@node#1{\POK@basicname #1}%
%
-% Debug
-\define@boolkey[psset]{optexp}[Pst@optexp@debug@]{showoptdots}[true]{}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -276,6 +614,19 @@
% 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}}
+ \pst@killglue
+ \begingroup
+ \pst@OptexpVerb{InitOptexpComp}%
+ \use@par
+}%
+\def\end@OptexpObj{%
+ \pst@OptexpVerb{(\POS@optexp@basicname@default) (\POK@basicname) CloseOptexpComp}%
+ \endgroup
+ \ignorespaces%
+}%
\def\addafter@par#1{%
\ifx\pst@par\@empty
\def\pst@par{#1}%
@@ -284,7 +635,19 @@
\pst@toks\expandafter{\pst@par}%
\edef\pst@par{\the\pst@toks,\the\toks@}%
\fi%
-}
+}%
+\def\getCLWH{CLW \pst@number\psxunit 2 mul div\space}%
+\def\getCLW{CLW \pst@number\psxunit div\space}%
+% Define new node '#3' which is shifted by (#1) relative to an existing
+% node '#2'
+\def\defShiftedNode(#1)(#2)#3{%
+ \pst@getcoor{#1}\pst@tempOrig%
+ \pst@getcoor{#2}\pst@tempDiff%
+ \pnode(!%
+ \pst@tempDiff \pst@tempOrig
+ 3 -1 roll add \pst@number\psyunit div
+ 3 1 roll add \pst@number\psxunit div exch){#3}%
+}%
%
% New high-level macros
% 1) Allow a compressed notation of all provided elements, as most of the organizing code
@@ -295,6 +658,11 @@
\def\newOptexpDipole{\@ifnextchar[{\new@optexpdipole}{\new@optexpdipole[]}}
\def\newOptexpDipoleNolabel{\@ifnextchar[{\new@optexpdipolenolabel}{\new@optexpdipolenolabel[]}}
\def\newOptexpTripole{\@ifnextchar[{\new@optexptripole}{\new@optexptripole[]}}
+\def\newOptexpFiberDipole{\@ifnextchar[{\new@optexpfiberdipole}{\new@optexpfiberdipole[]}}
+\def\newOptexpFiberQuadrupole{\@ifnextchar[{\new@optexpfiberquadrupole}{\new@optexpfiberquadrupole[]}}
+\def\new@optexpfiberdipole[#1]#2#3{%
+ \new@optexpdipole[fiber,#1]{#2}{#3}%
+}%
%
% 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
@@ -304,17 +672,22 @@
\@ifundefined{#2@i}{%
\@namedef{#2}{\pst@object{#2}}%
\expandafter\def\csname #2@i\endcsname(##1)(##2)##3{%
- \pst@killglue
\addbefore@par{#3}%
\addafter@par{#1}%
- \begingroup
- \use@par
+ \begin@OptexpObj
\pst@regNodes{##1}{##2}
\pst@draw@component{##3}{\@nameuse{#2@ii}}
- \endgroup
+ % connect
+ \@nameuse{\psk@connIn}
+ \ifPOE@endbox\else
+ \@nameuse{\psk@connOut}
+ \fi
+ \end@OptexpObj
}%
\@namedef{#2@ii}{%
\pnode(0,0){tempNode@Label}%
+ \pnode(0,0){\optexp@nodeA}%
+ \pnode(0,0){\optexp@nodeB}%
\@nameuse{#2@iii}%
}%
}{%
@@ -326,17 +699,20 @@
\@ifundefined{#2@i}{%
\@namedef{#2}{\pst@object{#2}}%
\expandafter\def\csname #2@i\endcsname(##1)(##2){%
- \pst@killglue
\addbefore@par{#3}%
\addafter@par{#1}%
- \begingroup
- \use@par
+ \begin@OptexpObj
\pst@regNodes{##1}{##2}
\pst@draw@component{}{\@nameuse{#2@ii}}
- \endgroup
+ %
+ \@nameuse{\psk@connIn}
+ \@nameuse{\psk@connOut}
+ \end@OptexpObj
}%
\@namedef{#2@ii}{%
\pnode(0,0){tempNode@Label}%
+ \pnode(0,0){\optexp@nodeA}%
+ \pnode(0,0){\optexp@nodeB}%
\@nameuse{#2@iii}%
}%
}{%
@@ -348,22 +724,147 @@
\@ifundefined{#2@i}{%
\@namedef{#2}{\pst@object{#2}}%
\expandafter\def\csname #2@i\endcsname(##1)(##2)(##3)##4{%
- \pst@killglue
\addbefore@par{#3}%
\addafter@par{ref@angle=180,#1}%
- \begingroup
- \use@par
+ \begin@OptexpObj
\pst@calcNodes{##1}{##2}{##3}
\pst@draw@component{##4}{\@nameuse{#2@ii}}
- \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
+ }%
+ \@nameuse{\psk@connIn}%
+ \@nameuse{\psk@connOut}%
+ \end@OptexpObj
}%
\@namedef{#2@ii}{%
\pnode(0,0){tempNode@Label}%
+ \pnode(0,0){\optexp@nodeA}%
+ \pnode(0,0){\optexp@nodeB}%
\@nameuse{#2@iii}%
}%
}{%
\@pstrickserr{OptExp tripole object `#2' already defined}\@eha}%
\ignorespaces}%
+%
+%
+\def\new@optexpfiberquadrupole[#1]#2#3{%
+ \@ifundefined{#2@i}{%
+ \@namedef{#2}{\pst@object{#2}}%
+ \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
+ \pnode(##1){tempNode@A}
+ \pnode(##3){tempNode@B}
+ \else\ifx\POK@align\POS@optexp@bottom
+ \pnode(##2){tempNode@A}
+ \pnode(##4){tempNode@B}
+ \else
+ \pst@getcoor{##1}\pst@tempA%
+ \pst@getcoor{##2}\pst@tempB%
+ \pnode(!\pst@tempA\pst@number\psyunit div exch \pst@number\psxunit div exch
+ \pst@tempB\pst@number\psyunit div exch \pst@number\psxunit div exch
+ \pst@optexpdict mwNode end){tempNode@A}
+ \pst@getcoor{##3}\pst@tempA%
+ \pst@getcoor{##4}\pst@tempB%
+ \pnode(!\pst@tempA\pst@number\psyunit div exch \pst@number\psxunit div exch
+ \pst@tempB\pst@number\psyunit div exch \pst@number\psxunit div exch
+ \pst@optexpdict mwNode end){tempNode@B}
+ \fi\fi
+ %
+ \pst@draw@component{##5}{\@nameuse{#2@ii}}
+ %
+ % connect the fibers
+ \psset{angleA=! \pst@optexpdict FiberAngleA end,
+ angleB=! \pst@optexpdict FiberAngleB end}
+ \pccurve[style=FiberIn1](##1)(tempNode@A@1)
+ \pccurve[style=FiberIn2](##2)(tempNode@A@2)
+ \pccurve[style=FiberOut1](tempNode@B@1)(##3)
+ \pccurve[style=FiberOut2](tempNode@B@2)(##4)
+ \end@OptexpObj
+ }%
+ \@namedef{#2@ii}{%
+ \pnode(0,0){tempNode@Label}%
+ \@nameuse{#2@iii}%
+ }%
+ }{%
+ \@pstrickserr{OptExp fiber quadrupole object `#2' already defined}\@eha}%
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Fiber tripole macros
+%
+\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}
+ \else\ifx\POK@align\POS@optexp@bottom
+ \pnode(#3){tempNode@B}
+ \else
+ \pst@getcoor{#2}\pst@tempA%
+ \pst@getcoor{#3}\pst@tempB%
+ \pnode(!\pst@tempA\pst@number\psyunit div exch \pst@number\psxunit div exch
+ \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
+ \psset{angleA=! \pst@optexpdict FiberAngleA end,
+ angleB=! \pst@optexpdict FiberAngleB end}
+ \pccurve[style=FiberIn](#1)(tempNode@A@)
+ \pccurve[style=FiberOut1](tempNode@B@1)(#2)
+ \pccurve[style=FiberOut2](tempNode@B@2)(#3)
+ \end@OptexpObj
+}%
+%
+%
+\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}
+ \else\ifx\POK@align\POS@optexp@bottom
+ \pnode(#2){tempNode@A}
+ \else
+ \pst@getcoor{#1}\pst@tempA%
+ \pst@getcoor{#2}\pst@tempB%
+ \pnode(!\pst@tempA\pst@number\psyunit div exch \pst@number\psxunit div exch
+ \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
+ \psset{angleA=! \pst@optexpdict FiberAngleA end,
+ angleB=! \pst@optexpdict FiberAngleB end}
+ \pccurve[style=FiberOut](tempNode@B@)(#3)
+ \pccurve[style=FiberIn1](#1)(tempNode@A@1)
+ \pccurve[style=FiberIn2](#2)(tempNode@A@2)
+ \end@OptexpObj
+}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Some of the components need three points to be positioned.
@@ -401,6 +902,11 @@
\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}%
%
%
@@ -416,7 +922,7 @@
\pnode(!%
\pst@tempDiff /YDiff ED /XDiff ED %
/N@#2 load GetCenter /YShifted ED /XShifted ED
- /rot@angle #4 \psk@optexp@label@refangle\space add def
+ /rot@angle #4 \POK@label@refangle\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 \pst@number\psxunit div
@@ -435,19 +941,19 @@
% Used to put the label for labelref=relative
%
\def\put@RelLabel#1{%
- \nput[labelsep=0]{\psk@optexp@label@angle}%
+ \nput[labelsep=0]{\POK@label@angle}%
{tempNode@LabelShifted}%
- {\rput[\psk@optexp@label@align](0,0){\psk@optexp@label@style #1}}%
+ {\rput[\POK@label@align](0,0){\POK@label@style #1}}%
}%
%
% 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,\psk@optexp@label@offset)%
+ \pst@defShiftedRotLabelNode(0,\POK@label@offset)%
{tempNode@Label}%
{tempNode@LabelShifted}%
- {\psk@optexp@label@angle}%
+ {\POK@label@angle}%
}%
%
% Positioning of the label depending on the reference coordinates.
@@ -464,20 +970,22 @@
% relative => as relgrav but text is rotated together with object.
%
\def\put@Label#1{%
- \ifx\psk@optexp@label@ref\pst@string@labelref@global
+ \def\pst@temp{#1}%
+ \ifx\pst@temp\@empty\else
+ \ifx\POK@label@ref\POS@labelref@global
%
% global
- \nput[labelsep=\psk@optexp@label@offset]%
- {\psk@optexp@label@angle}%
+ \nput[labelsep=\POK@label@offset]%
+ {\POK@label@angle}%
{tempNode@Label}%
- {\rput[\psk@optexp@label@align](0,0){\psk@optexp@label@style #1}}%
+ {\rput[\POK@label@align](0,0){\POK@label@style #1}}%
%
- \else\ifx\psk@optexp@label@ref\pst@string@labelref@relgrav
+ \else\ifx\POK@label@ref\POS@labelref@relgrav
%
% relgrav
- \rput[\psk@optexp@label@align](tempNode@LabelShifted){\psk@optexp@label@style #1}%
+ \rput[\POK@label@align](tempNode@LabelShifted){\POK@label@style #1}%
%
- \else\ifx\psk@optexp@label@ref\pst@string@labelref@relative
+ \else\ifx\POK@label@ref\POS@labelref@relative
%
% relative
\begingroup
@@ -493,26 +1001,31 @@
tx@NodeDict a known tx@NodeDict b known and dup {
/NodeA a load def /NodeB b load def
NodeA GetCenter NodeB GetCenter % xA yA xB yB
- 4 copy pop exch pop le % xA xB
- { /yB ED /xB ED /yA ED /xA ED }
- { /yA ED /xA ED /yB ED /xB ED } ifelse
+ 4 copy exch 4 -1 roll 2 copy gt % yA yB xB xA
+% 4 copy pop exch pop le % xA xB
+ { pop pop pop pop /yB ED /xB ED /yA ED /xA ED }
+ { eq 3 1 roll lt and
+ { /yB ED /xB ED /yA ED /xA ED}
+ { /yA ED /xA ED /yB ED /xB ED} ifelse
+ } ifelse
} if >%
%
\ncline[linestyle=none,fillstyle=none,npos=]{tempNode@A}{tempNode@B}%
%
%
- \ifx\psk@optexp@position\@empty
- \ifx\psk@optexp@abspos\@empty
+ \ifx\POK@position\@empty
+ \ifx\POK@abspos\@empty
\ncput[nrot=:U,npos=]{\put@RelLabel{#1}}
\else
- \nlput[nrot=:U](tempNode@A)(tempNode@B){\psk@optexp@abspos}{\put@RelLabel{#1}}
+ \nlput[nrot=:U](tempNode@A)(tempNode@B){\POK@abspos}{\put@RelLabel{#1}}
\fi
\else
- \ncput[nrot=:U,npos=\psk@optexp@position]{\put@RelLabel{#1}}
+ \ncput[nrot=:U,npos=\POK@position]{\put@RelLabel{#1}}
\fi
%
\endgroup
\fi\fi\fi
+ \fi
}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -529,14 +1042,19 @@
\newOptexpDipole{optbox}{}%
\newOptexpDipole{optplate}{}%
\newOptexpDipole{optretplate}{}%
-\newOptexpDipole[endbox]{detector}{}%
-\newOptexpDipole{optdipole}{}%
+\newOptexpDipole[endbox]{optdetector}{}%
+\@ifundefined{PSTcircLoaded}{\newpsobject{detector}{optdetector}}{}{}%
+\newOptexpDipole{optdiode}{}%
+\newOptexpDipole{doveprism}{}%
%
% TRIPOLES
%
\newOptexpTripole{mirror}{}%
\newOptexpTripole[ref@angle=-135]{beamsplitter}{}%
\newOptexpTripole{optgrid}{}%
+\newOptexpTripole[ref@angle=-135]{pentaprism}{}%
+\newOptexpTripole[ref@angle=-135]{rightangleprism}{}%
+\newOptexpTripole[ref@angle=-135]{optprism}{}%
%
% SPECIAL OBJECTS
%
@@ -547,9 +1065,15 @@
\use@par
\pst@regNodes{#1}{#2}
\pst@draw@component{#4}{%
- \pnode(0,0){tempNode@Label}%
+ \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
}%
\def\opttripole{\pst@object{opttripole}}
@@ -560,11 +1084,30 @@
\pst@calcNodes{#1}{#2}{#3}
\pst@draw@component{#5}{%
\pnode(0,0){tempNode@Label}%
+ \pnode(0,0){\optexp@nodeA}%
+ \pnode(0,0){\optexp@nodeB}%
#4
}%
\endgroup
}%
%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FIBER COMPONENTS
+\newOptexpFiberDipole{optfiber}{}
+\newOptexpFiberDipole{optamp}{}
+\newOptexpFiberDipole{optmzm}{}
+\newOptexpFiberDipole{optfilter}{}
+\newOptexpFiberDipole{polcontrol}{}
+\newOptexpFiberDipole{optisolator}{}
+\newOptexpFiberDipole{optswitch}{}
+\newOptexpFiberDipole{fiberdelayline}{}
+\newOptexpFiberQuadrupole{optcoupler}{}
+%
+% HYBRID COMPONENTS
+\newOptexpDipole{fibercollimator}{conn=o-f}
+%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -576,6 +1119,7 @@
position=\@empty
,abspos=\@empty
,angle=0
+ ,rotateref=c
% lens
,lenswidth=0.2
,lensheight=1
@@ -583,6 +1127,7 @@
,lensradius=\@empty
,lensradiusleft=1
,lensradiusright=1
+ ,thicklens=false
% pinhole
,phlinewidth=2\pslinewidth
,outerheight=1
@@ -590,37 +1135,54 @@
% beamsplitter
,bssize=0.8
% crystal
- ,crystalwidth=2
- ,crystalheight=0.8
+ ,crystalwidth=1.4
+ ,crystalheight=0.6
,caxislength=0.6
,lampscale=0.3
% mirror
,mirrorwidth=1
- ,mirrordepth=0.08
+ ,mirrordepth=0.1
,mirrorradius=0
- ,mirrortype=\pst@string@mirror@type@plain
+ % can't use the \POS@mirror@type@plain macro as \define@choicekey
+ % does not expand the list containing the alternatives
+ ,mirrortype=plain
,mirrorlinewidth=2\pslinewidth
+ ,variable=false
% optgrid
,optgridcount=10
,optgridwidth=1
- ,optgridheight=0.1
- ,optgriddepth=0.05
- ,optgridtype=\pst@string@optgrid@type@blazed
+ ,optgridheight=0.15
+ ,optgriddepth=0.075
+ ,optgridtype=blazed
,optgridlinewidth=0.7\pslinewidth
+ ,reverse=false
% optbox
- ,optboxwidth=1
- ,optboxheight=0.5
+ ,optboxwidth=1.4
+ ,optboxheight=0.8
+ ,refractiveindex=\@empty
% optplate
,plateheight=1
,platelinewidth=2\pslinewidth
% optretplate
,platewidth=0.1
% detector
- ,detsize=0.5
+ ,detsize=0.8
+ ,dettype=round
% polarization
- ,poltype=\pst@string@pol@polparallel
+ ,poltype=parallel
,polsize=0.6
,pollinewidth=0.7\pslinewidth
+% optdiode
+ ,optdiodesize=0.8
+% pentaprism
+ ,pentaprismsize=0.7
+% rightangleprism
+ ,raprismsize=1.5
+% optprism
+ ,prismsize=1
+ ,prismangle=60
+% doveprism
+ ,doveprismsize=0.6
% label
,labeloffset=0.8
,labelangle=0
@@ -628,6 +1190,28 @@
,labelalign=c
,labelref=relgrav
,ref@angle=0
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% fiber optics
+ ,@compname=\@empty
+ ,extnode=\@empty
+ ,fiberloops=3
+ ,fiberloopradius=0.4
+ ,fiberloopsep=0.3
+ ,optmzmsize=0.8
+ ,optampsize=0.8
+ ,filtersize=0.8
+ ,filtertype=bandpass
+ ,polcontrolsize=0.15
+ ,isolatorsize=0.6
+ ,couplersize=0.2
+ ,couplersep=0.05
+ ,couplertype=elliptic
+ ,switchsize=0.8
+ ,switchstyle=opened
+ ,fdlsize=0.6
+ ,fibercolsize=0.3
+ ,conn=-
+ ,usefiberstyle=false
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -636,47 +1220,57 @@
% This macro is called by every unit
%
\def\pst@draw@component#1#2{%
- %
- \ifPst@optexp@endbox%
- \ifx\psk@optexp@label@offset\@empty
+ %
+ \def\@@comp{%
+ #2
+ \ifx\POK@extnode\@empty\else
+ \pnode(! \pst@optexpdict ExtNode end){\POK@extnode@name}
+ \fi
+ }%
+ \ifPOE@endbox%
+ \ifx\POK@label@offset\@empty
\psset{labeloffset=0}
\fi
\psset{position=1}%
\fi%
%
- % linestyle to use, if component should be marked as optional
- \ifPst@optexp@component@optional
- \psset{style=OptionalStyle}
- \fi
\ncline[linestyle=none,fillstyle=none,npos=]{tempNode@A}{tempNode@B}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Positioning of the component
%
+ \begingroup
+ %
+ % linestyle to use, if component should be marked as optional
+ \ifPOE@component@optional
+ \psset{style=OptionalStyle}
+ \fi
% if parameter 'position' is given, use it for 'npos'
- \ifx\psk@optexp@position\@empty
+ \ifx\POK@position\@empty
%
% then check if absolute positioning is wanted
- \ifx\psk@optexp@abspos\@empty
- \ncput[nrot=:U,npos=]{\put@Comp{#2}}
+ \ifx\POK@abspos\@empty
+ \ncput[nrot=:U,npos=]{\put@Comp{\@@comp}}
\else
- \nlput[nrot=:U](tempNode@A)(tempNode@B){\psk@optexp@abspos}{\put@Comp{#2}}
+ \nlput[nrot=:U](tempNode@A)(tempNode@B){\POK@abspos}{\put@Comp{\@@comp}}
\fi
\else
- \ncput[nrot=:U,npos=\psk@optexp@position]{\put@Comp{#2}}
+ \ncput[nrot=:U,npos=\POK@position]{\put@Comp{\@@comp}}
\fi
+ \endgroup
%
% Now put the label
\put@Label{#1}%
%
% Show some special dots for debugging
- \ifPst@optexp@debug@showoptdots
+ \ifPOE@debug@showoptdots
\psdot[linecolor=red](tempNode@Label)
\psdot[linecolor=red](tempNode@LabelShifted)
\psdot[linecolor=black](tempNode@A)
\psdot[linecolor=black](tempNode@B)
\fi
+ %
\ignorespaces}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -689,21 +1283,21 @@
% MIRROR
%
\def\mirror@iii{%
- \edef\@mirror@ht{\psk@optexp@mirror@width\space\pst@number\psyunit mul 2 div }%
- \edef\@mirror@dp{\psk@optexp@mirror@depth\space\pst@number\psxunit mul }%
- \edef\@mirror@r{\psk@optexp@mirror@radius\space\pst@number\psxunit mul }%
+ \edef\@mirror@ht{\POK@mirror@width\space\pst@number\psyunit mul 2 div }%
+ \edef\@mirror@dp{\POK@mirror@depth\space\pst@number\psxunit mul }%
+ \edef\@mirror@r{\POK@mirror@radius\space\pst@number\psxunit mul }%
\edef\@mirror@postcode{neg 5 -1 roll exch 5 2 roll 90 add exch 90 add exch ArcR }%
\edef\@mirror@extpostcode{neg \@mirror@dp add 5 -1 roll exch 5 2 roll 90 add exch 90 add }%
%
%
% concave mirrors
%
- \ifdim\psk@optexp@mirror@radius pt<0pt
+ \ifdim\POK@mirror@radius pt<0pt
% always draw the input plane
\begin@OpenObj
\addto@pscode{\pst@optexpdict \@mirror@ht \@mirror@r rightConcave \@mirror@postcode end}%
\end@OpenObj
- \ifx\psk@optexp@mirror@type\pst@string@mirror@type@extended
+ \ifx\POK@mirror@type\POS@mirror@type@extended
%
% extended concave mirror
\psset{style=ExtendedMirror}
@@ -717,12 +1311,12 @@
%
% convex mirrors
%
- \else\ifdim\psk@optexp@mirror@radius pt>0pt
+ \else\ifdim\POK@mirror@radius pt>0pt
% always draw the input plane
\begin@OpenObj
\addto@pscode{\pst@optexpdict \@mirror@ht \@mirror@r rightConvex \@mirror@postcode end}%
\end@OpenObj
- \ifx\psk@optexp@mirror@type\pst@string@mirror@type@extended
+ \ifx\POK@mirror@type\POS@mirror@type@extended
%
% extended convex mirror
\psset{style=ExtendedMirror}
@@ -736,29 +1330,33 @@
%
% plain mirror
%
- \edef\@m@wd{\psk@optexp@mirror@width\space 2 div }
- \ifPst@optexp@variable
+ \edef\@m@wd{\POK@mirror@width\space 2 div }
+ \ifPOE@variable
\psarc[linewidth=0.8\pslinewidth,arrowinset=0,arrowscale=0.8]{<->}
(! \@m@wd 0.4 sub 0){0.6}{-20}{20}
\psarc[linewidth=0.8\pslinewidth,arrowinset=0,arrowscale=0.8]{<->}
(! \@m@wd 0.4 sub neg 0){0.6}{160}{200}
\fi
- \psline[linewidth=\psk@optexp@mirror@linewidth](! \@m@wd neg 0)(! \@m@wd 0)
+ \psline[linewidth=\POK@mirror@linewidth](! \@m@wd neg 0)(! \@m@wd 0)
%
% mirrortype
- \ifx\psk@optexp@mirror@type\pst@string@mirror@type@piezo%
+ \ifx\POK@mirror@type\POS@mirror@type@piezo%
%
% piezo
- \psframe[style=PiezoMirror](! \@m@wd 4 div 0)(! \@m@wd -4 div \@m@wd 2.5 div)
- \psbezier(! 0 \@m@wd 2.5 div)%
- (! 0 \@m@wd 1.5 div)%
- (! \@m@wd 2 div \@m@wd 2 div)%
- (! \@m@wd 4 div \@m@wd)%
- \else\ifx\psk@optexp@mirror@type\pst@string@mirror@type@extended%
+ \psframe[style=PiezoMirror,dimen=outer](! \@m@wd 4 div 0)(! \@m@wd -4 div \@m@wd 2.5 div)
+ \ifx\POK@extnode\@empty
+ \psbezier(! 0 \@m@wd 2.5 div)%
+ (! 0 \@m@wd 1.5 div)%
+ (! \@m@wd 2 div \@m@wd 2 div)%
+ (! \@m@wd 4 div \@m@wd)%
+ \else
+ \pst@Verb{/@@y0 \@m@wd 2.5 div def }%
+ \fi
+ \else\ifx\POK@mirror@type\POS@mirror@type@extended%
%
% extended
\psframe[style=ExtendedMirror]%
- (! \@m@wd neg \psk@optexp@mirror@depth\space )%
+ (! \@m@wd neg \POK@mirror@depth\space )%
(! \@m@wd 0)%
\fi\fi
\fi\fi
@@ -771,34 +1369,34 @@
\def\lens@iii{%
%
% use old lens code to maintain backward compatibility
- \ifx\psk@optexp@lens@type\@empty
+ \ifx\POK@lens@type\@empty
% NEW CODE!
\begin@ClosedObj
- \edef\@lens@wd{\psk@optexp@lens@width\space\pst@number\psxunit mul 2 div }%
- \edef\@lens@ht{\psk@optexp@lens@height\space\pst@number\psyunit mul 2 div }%
- \edef\@lens@rL{\psk@optexp@lens@radiusLeft\space\pst@number\psxunit mul }%
- \edef\@lens@rR{\psk@optexp@lens@radiusRight\space\pst@number\psxunit mul }%
+ \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}%
%
% distinguish between all the different lens-combination possibilities
%
- \ifdim\psk@optexp@lens@radiusLeft pt=0pt\else
- \edef\@lens@th{\ifPst@optexp@thicklens \@lens@wd\else a1 \fi}%
+ \ifdim\POK@lens@radiusLeft pt=0pt\else
+ \edef\@lens@th{\ifPOE@thicklens \@lens@wd\else a1 \fi}%
\addto@pscode{%
\@lens@ht \@lens@rL
- \ifdim\psk@optexp@lens@radiusLeft pt<0pt
+ \ifdim\POK@lens@radiusLeft pt<0pt
leftConcave
\else
leftConvex
\fi
}%
\fi
- \ifdim\psk@optexp@lens@radiusRight pt=0pt\else
- \edef\@lens@th{\@lens@th\space\ifPst@optexp@thicklens \@lens@wd\else a2 \fi}%
+ \ifdim\POK@lens@radiusRight pt=0pt\else
+ \edef\@lens@th{\@lens@th\space\ifPOE@thicklens \@lens@wd\else a2 \fi}%
\addto@pscode{%
\@lens@ht \@lens@rR
- \ifdim\psk@optexp@lens@radiusRight pt<0pt
+ \ifdim\POK@lens@radiusRight pt<0pt
rightConcave
\else
rightConvex
@@ -810,10 +1408,10 @@
%
% 1) Left is plain - right concave
% \- right convex
- \ifdim\psk@optexp@lens@radiusLeft pt=0pt
- \ifdim\psk@optexp@lens@radiusRight pt=0pt\else
+ \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\psk@optexp@lens@radiusRight pt<0pt
+ \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}%
@@ -826,10 +1424,10 @@
%
% 2) Right is plain - left concave
% \- left convex
- \ifdim\psk@optexp@lens@radiusRight pt=0pt
- \ifdim\psk@optexp@lens@radiusLeft pt=0pt\else
+ \ifdim\POK@lens@radiusRight pt=0pt
+ \ifdim\POK@lens@radiusLeft pt=0pt\else
\addto@pscode{\@lens@th 2 div sub 5 1 roll }%
- \ifdim\psk@optexp@lens@radiusLeft pt<0pt
+ \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
@@ -839,8 +1437,8 @@
\fi
%
% 3) right and left are both curved
- \ifdim\psk@optexp@lens@radiusRight pt=0pt\else
- \ifdim\psk@optexp@lens@radiusLeft pt=0pt\else
+ \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
@@ -866,15 +1464,15 @@
%
\def\pst@draw@lens{%
%
- \edef\@l@h{\psk@optexp@lens@height\space 2 div\space}%
- \edef\@l@a{\psk@optexp@lens@width\space 2 div\space}%
+ \edef\@l@h{\POK@lens@height\space 2 div\space}%
+ \edef\@l@a{\POK@lens@width\space 2 div\space}%
%
- \ifnum\psk@optexp@lens@type<3
+ \ifnum\POK@lens@type<3
% CONVEX
- \ifx\psk@optexp@lens@radius\@empty
+ \ifx\POK@lens@radius\@empty
\edef\@l@r{\@l@a 2 div \@l@h dup mul 2 \@l@a mul div add\space}%
\else
- \edef\@l@r{\psk@optexp@lens@radius\space}%
+ \edef\@l@r{\POK@lens@radius\space}%
\edef\@l@a{\@l@r dup dup mul \@l@h dup mul sub sqrt sub\space}%
\fi
%
@@ -884,10 +1482,10 @@
\edef\@l@y{\@l@d\space}%
\else
% CONCAVE
- \ifx\psk@optexp@lens@radius\@empty
+ \ifx\POK@lens@radius\@empty
\edef\@l@r{\@l@h 1.5 mul\space}%
\else
- \edef\@l@r{\psk@optexp@lens@radius\space}%
+ \edef\@l@r{\POK@lens@radius\space}%
\fi%
%
% define some parameters only for concave lenses
@@ -908,7 +1506,7 @@
%
%
\pscustom{%
- \ifcase\psk@optexp@lens@type
+ \ifcase\POK@lens@type
% plainconvex
\temp@RightPlot%
\closepath%
@@ -949,12 +1547,12 @@
% PINHOLE
%
\def\pinhole@iii{%
- \psline[linewidth=\psk@optexp@pinhole@linewidth]%
- (! 0 \psk@optexp@pinhole@oheight\space 2 div)%
- (! 0 \psk@optexp@pinhole@iheight\space 2 div)%
- \psline[linewidth=\psk@optexp@pinhole@linewidth]%
- (! 0 \psk@optexp@pinhole@oheight\space -2 div)%
- (! 0 \psk@optexp@pinhole@iheight\space -2 div)%
+ \psline[linewidth=\POK@pinhole@linewidth]%
+ (! 0 \POK@pinhole@oheight\space 2 div)%
+ (! 0 \POK@pinhole@iheight\space 2 div)%
+ \psline[linewidth=\POK@pinhole@linewidth]%
+ (! 0 \POK@pinhole@oheight\space -2 div)%
+ (! 0 \POK@pinhole@iheight\space -2 div)%
\ignorespaces}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -962,7 +1560,7 @@
% BEAMSPLITTER
%
\def\beamsplitter@iii{%
- \edef\@bs@wd{\psk@optexp@bssize\space 2.0 div\space}%
+ \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)}
\ignorespaces}%
@@ -972,51 +1570,63 @@
% CRYSTAL
%
\def\crystal@iii{%
- \edef\@c@wd{\psk@optexp@crystal@width\space 2 div\space}%
- \edef\@c@ht{\psk@optexp@crystal@height\space 2 div\space}%
- \rput[c]{\psk@optexp@angle}(0,0){%
- \psframe(! \@c@wd neg \@c@ht neg)(! \@c@wd \@c@ht)
- \ifPst@optexp@crystal@voltage%
- \psline(! \@c@wd 4 div 3 mul neg \@c@ht)%
- (! \@c@wd 4 div 3 mul neg \@c@ht 0.2 add)
+ \pst@Verb{%
+ /@@x \POK@crystal@width\space 0.5 mul def
+ /@@y \POK@crystal@height\space 0.5 mul def
+ }%
+ \psrotate(! @@x \POK@rotate@xref\space mul @@y \POK@rotate@yref\space mul)
+ {\POK@angle}{%
+ \psframe(! @@x neg @@y neg)(! @@x @@y)
+ \ifPOE@crystal@voltage%
+ \psline(! @@x 4 div 3 mul neg @@y)%
+ (! @@x 4 div 3 mul neg @@y 0.2 add)
\pscircle[fillstyle=solid,%
- fillcolor=white](! \@c@wd 4 div 3 mul neg \@c@ht 0.2 add){0.04}
- \psline(! \@c@wd 4 div 3 mul neg \@c@ht neg)%
- (! \@c@wd 4 div 3 mul neg \@c@ht neg 0.2 sub)%
- \psline(! \@c@wd 4 div 3 mul neg 0.15 sub \@c@ht neg 0.2 sub)%
- (! \@c@wd 4 div 3 mul neg 0.15 add \@c@ht neg 0.2 sub)%
+ fillcolor=white](! @@x 4 div 3 mul neg @@y 0.2 add){0.04}
+ \psline(! @@x 4 div 3 mul neg @@y neg)%
+ (! @@x 4 div 3 mul neg @@y neg 0.2 sub)%
+ \psline(! @@x 4 div 3 mul neg 0.15 sub @@y neg 0.2 sub)%
+ (! @@x 4 div 3 mul neg 0.15 add @@y neg 0.2 sub)%
\fi
%
- \ifPst@optexp@crystal@lamp
- \rput{180}(! \@c@wd \@c@ht 1.4 \psk@optexp@lamp@scale\space mul add){\lamp}%
+ \ifPOE@crystal@lamp
+ \rput{180}(! @@x @@y 1.4 \POK@lamp@scale\space mul add){\crystal@lamp}%
\fi
% plot c-axis only, if caxislength > 0
- \ifdim\psk@optexp@crystal@caxislength pt>0pt
- \edef\@c@caxisL{\psk@optexp@crystal@caxislength\space 2 div\space}%
- \ifPst@optexp@crystal@caxisinv
+ \ifdim\POK@crystal@caxislength pt>0pt
+ \edef\@c@caxisL{\POK@crystal@caxislength\space 2 div\space}%
+ \ifPOE@crystal@caxisinv
%
% invert the c-axis
\psline[linestyle=dashed,%
dash=2pt 2pt,%
linewidth=0.7\pslinewidth,%
arrowinset=0]{->}%
- (! 0 \@c@ht neg)(! 0 \@c@ht \@c@caxisL add)%
+ (! 0 @@y neg)(! 0 @@y \@c@caxisL add)%
\else
\psline[linestyle=dashed,%
dash=2pt 2pt,%
linewidth=0.7\pslinewidth,%
arrowinset=0]{->}%
- (! 0 \@c@ht)(! 0 \@c@ht neg \@c@caxisL sub)%
+ (! 0 @@y)(! 0 @@y neg \@c@caxisL sub)%
\fi
\fi
+ \pnode(0,0){tempNode@Label}
+ \pnode(! @@x neg 0){\optexp@nodeA}
+ \pnode(! @@x
+ \ifx\POK@optbox@n\@empty 0 \else
+ \POK@angle\space sin neg dup dup mul neg \POK@optbox@n\space dup mul add sqrt div 2 @@x mul mul
+ \fi
+ ){\optexp@nodeB}
+ %\pnode(! \@c@wd neg 0){\optexp@nodeA}
+ %\pnode(! \@c@wd 0){\optexp@nodeB}
}%
\ignorespaces}%
%
% LAMP FOR THE CRYSTAL
%
-\def\lamp{%
+\def\crystal@lamp{%
\psset{linewidth=0.6\pslinewidth}
- \edef\@l@s{\psk@optexp@lamp@scale\space}%
+ \edef\@l@s{\POK@lamp@scale\space}%
%
\pscurve[fillstyle=none](! -0.05 \@l@s mul 0)%
(! -0.1 \@l@s mul 0.15 \@l@s mul)%
@@ -1038,27 +1648,27 @@
%
\def\polarization@iii{%
%
- \edef\@pol@size{\psk@optexp@polarization@size\space 2 div\space}%
- \ifx\psk@optexp@pol@type\pst@string@pol@polparallel
- \psline[linestyle=solid,linewidth=\psk@optexp@polarization@linewidth,arrowscale=0.8]{<->}%
+ \edef\@pol@size{\POK@polarization@size\space 2 div\space}%
+ \ifx\POK@pol@type\POS@pol@polparallel
+ \psline[linestyle=solid,linewidth=\POK@polarization@linewidth,arrowscale=0.8]{<->}%
(! 0 \@pol@size neg)(! 0 \@pol@size)%
\fi
- \ifx\psk@optexp@pol@type\pst@string@pol@polperp
+ \ifx\POK@pol@type\POS@pol@polperp
\psdot[dotsize=0.05](0,0)%
- \pscircle[fillstyle=none,linestyle=solid,linewidth=\psk@optexp@polarization@linewidth](0,0){0.12}%
+ \pscircle[fillstyle=none,linestyle=solid,linewidth=\POK@polarization@linewidth](0,0){0.12}%
\fi
- \ifx\psk@optexp@pol@type\pst@string@pol@polmisc
- \psline[linestyle=solid,linewidth=\psk@optexp@polarization@linewidth,arrowscale=0.8]{<->}%
+ \ifx\POK@pol@type\POS@pol@polmisc
+ \psline[linestyle=solid,linewidth=\POK@polarization@linewidth,arrowscale=0.8]{<->}%
(! 0 \@pol@size neg)(! 0 \@pol@size)%
\psdot[dotsize=0.05](0,0)%
\pscircle[fillstyle=none,linestyle=solid,linewidth=0.7\pslinewidth](0,0){0.12}%
\fi
- \ifx\psk@optexp@pol@type\pst@string@pol@polrcirc
- \psellipticarc[linewidth=\psk@optexp@polarization@linewidth]{->}%
+ \ifx\POK@pol@type\POS@pol@polrcirc
+ \psellipticarc[linewidth=\POK@polarization@linewidth]{->}%
(0,0)(! \@pol@size 2 div \@pol@size){20}{-20}%
\fi
- \ifx\psk@optexp@pol@type\pst@string@pol@pollcirc
- \psellipticarc[linewidth=\psk@optexp@polarization@linewidth]{<-}%
+ \ifx\POK@pol@type\POS@pol@pollcirc
+ \psellipticarc[linewidth=\POK@polarization@linewidth]{<-}%
(0,0)(! \@pol@size 2 div \@pol@size){20}{-20}
\fi
\ignorespaces}%
@@ -1068,17 +1678,17 @@
% OPTICAL GRID
%
\def\optgrid@iii{%
- \edef\@g@cnt{\psk@optexp@optgrid@count\space}%
- \edef\@g@wd{\psk@optexp@optgrid@width\space 2 div\space}%
- \edef\@g@ht{\psk@optexp@optgrid@height\space}%
- \edef\@g@dp{\psk@optexp@optgrid@depth\space}%
- \edef\@g@step{\psk@optexp@optgrid@width\space\@g@cnt div\space}%
- \ifx\psk@optexp@optgrid@type\pst@string@optgrid@type@blazed
- \ifPst@optexp@reverse%
- \pscustom[linewidth=\psk@optexp@optgrid@linewidth]{%
+ \edef\@g@cnt{\POK@optgrid@count\space}%
+ \edef\@g@wd{\POK@optgrid@width\space 2 div\space}%
+ \edef\@g@ht{\POK@optgrid@height\space}%
+ \edef\@g@dp{\POK@optgrid@depth\space}%
+ \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]{%
\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}{\psk@optexp@optgrid@count}{%
+ \multido{\i=0+1}{\POK@optgrid@count}{%
\psline[liftpen=1](! \@g@wd neg \i\space \@g@step mul add \@g@dp)%
(! \@g@wd neg \i\space \@g@step mul add 0)%
(! \@g@wd neg \i\space 1 add \@g@step mul add \@g@dp)%
@@ -1086,10 +1696,10 @@
\closepath
}%
\else%
- \pscustom[linewidth=\psk@optexp@optgrid@linewidth]{%
+ \pscustom[linewidth=\POK@optgrid@linewidth]{%
\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}{\psk@optexp@optgrid@count}{%
+ \multido{\i=0+1}{\POK@optgrid@count}{%
\psline[liftpen=1](! \@g@wd neg \i\space \@g@step mul add \@g@dp)%
(! \@g@wd neg \i\space 1 add \@g@step mul add 0)%
(! \@g@wd neg \i\space 1 add \@g@step mul add \@g@dp)%
@@ -1097,11 +1707,11 @@
\closepath
}%
\fi%
- \else\ifx\psk@optexp@optgrid@type\pst@string@optgrid@type@binary
- \pscustom[linewidth=\psk@optexp@optgrid@linewidth]{%
+ \else\ifx\POK@optgrid@type\POS@optgrid@type@binary
+ \pscustom[linewidth=\POK@optgrid@linewidth]{%
\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}{\psk@optexp@optgrid@count}{%
+ \multido{\i=0+1}{\POK@optgrid@count}{%
\psline[liftpen=1](! \@g@wd neg \i\space \@g@step mul add \@g@dp)%
(! \@g@wd neg \i\space \@g@step mul add 0)%
(! \@g@wd neg \i\space 0.5 add \@g@step mul add 0)%
@@ -1117,14 +1727,29 @@
% OPTBOX
%
\def\optbox@iii{%
- \edef\@b@wd{\psk@optexp@optbox@width\space 2 div\space}%
- \edef\@b@ht{\psk@optexp@optbox@height\space 2 div\space}%
- \ifPst@optexp@endbox
- \pnode(! \@b@wd 0){tempNode@Label}%
- \psframe(! 0 \@b@ht neg)(! \@b@wd 2 mul \@b@ht)%
+ \pst@Verb{%
+ /@@x \POK@optbox@width\space 0.5 mul def
+ /@@y \POK@optbox@height\space 0.5 mul def
+ }%
+ \ifPOE@endbox
+ \pst@Verb{/@@x0 @@x def}%
+ \psrotate(! @@x0 @@x \POK@rotate@xref\space mul add
+ @@y0 @@y \POK@rotate@yref\space mul add){\POK@angle}{%
+ \pnode(! @@x 0){tempNode@Label}%
+ \psframe[dimen=outer](! 0 @@y neg)(! @@x 2 mul @@y)
+ \pnode(tempNode@B){\optexp@nodeA}
+ }%
\else
- \rput{\psk@optexp@angle}(0,0){%
- \psframe(! \@b@wd neg \@b@ht neg)(! \@b@wd \@b@ht)%
+ \psrotate(! @@x0 @@x \POK@rotate@xref\space mul add
+ @@y0 @@y \POK@rotate@yref\space mul add){\POK@angle}{%
+ \pnode(! @@x neg 0){\optexp@nodeA}
+ \pnode(! @@x
+ \ifx\POK@optbox@n\@empty 0 \else
+ \POK@angle\space sin neg dup dup mul neg \POK@optbox@n\space dup mul add sqrt div 2 @@x mul mul
+ \fi
+ ){\optexp@nodeB}
+ \pnode(0,0){tempNode@Label}
+ \psframe[dimen=outer](! @@x neg @@y neg)(! @@x @@y)
}%
\fi
\ignorespaces}%
@@ -1134,18 +1759,40 @@
% OPTPLATE
%
\def\optplate@iii{%
- \psline[linewidth=\psk@optexp@plate@linewidth]%
- (! 0 \psk@optexp@plate@height\space 2 div neg)%
- (! 0 \psk@optexp@plate@height\space 2 div)
+ \psline[linewidth=\POK@plate@linewidth]%
+ (! 0 \POK@plate@height\space 2 div neg)%
+ (! 0 \POK@plate@height\space 2 div)
\ignorespaces}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DETECTOR
%
-\def\detector@iii{%
- \pnode(! \psk@optexp@detector@size\space 3 div 0){tempNode@Label}%
- \pswedge(0,0){\psk@optexp@detector@size}{-90}{90}
+\def\optdetector@iii{%
+ \pnode(tempNode@B){\optexp@nodeA}
+ \ifx\POK@detector@type\POS@detector@round
+ \pnode(! \POK@detector@size\space .2 mul 0){tempNode@Label}%
+ \begin@ClosedObj
+ % I could have use pswedge but then a correction of the component size
+ % depending on the current linewidth is not possible
+ \addto@pscode{CLW 0.5 mul 0 \POK@detector@size\space\pst@number\psrunit mul 0.5 mul
+ CLW sub -90 90 arc closepath }%
+ \end@ClosedObj
+ \pst@Verb{/@@x0 \POK@detector@size\space 0.5 mul def}%
+ \else\ifx\POK@detector@type\POS@detector@diode
+ \edef\@sz{\POK@detector@size\space 0.5 mul\space}%
+ \psframe[dimen=outer](! 0 \@sz neg)(!\@sz 2 mul \@sz)
+ \pspolygon(! \@sz 0.8 mul \@sz -0.4 mul)%
+ (! \@sz 1.6 mul \@sz -0.4 mul)%
+ (! \@sz 1.2 mul \@sz 0.4 mul)%
+ \psline(! \@sz 0.8 mul \@sz 0.4 mul \getCLWH add)(! \@sz 1.6 mul \@sz 0.4 mul \getCLWH add)
+ \psset{arrows=->, arrowinset=0, arrowscale=0.8}
+ \psline(! \@sz 0.2 mul \@sz 0.6 mul)(! \@sz 0.7 mul \@sz 0.3 mul)
+ \psline(! \@sz 0.2 mul \@sz 0.3 mul)(! \@sz 0.7 mul 0)
+ \psline(! \@sz 0.2 mul 0)(! \@sz 0.7 mul \@sz -0.3 mul)
+ \pst@Verb{/@@x0 \@sz def /@@x \@sz def /@@y \@sz def}%
+ \pnode(! \@sz 0){tempNode@Label}
+ \fi\fi
\ignorespaces}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1153,12 +1800,394 @@
% OPTRETPLATE
%
\def\optretplate@iii{%
- \edef\@p@ht{\psk@optexp@plate@height\space 2 div\space}%
- \edef\@p@wd{\psk@optexp@plate@width\space 2 div\space}%
+ \edef\@p@ht{\POK@plate@height\space 2 div\space}%
+ \edef\@p@wd{\POK@plate@width\space 2 div\space}%
\psframe(! \@p@wd neg \@p@ht neg)(! \@p@wd \@p@ht)
\psline{cc-cc}(! \@p@wd neg \@p@ht)(! \@p@wd \@p@ht neg)
\ignorespaces}%
%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% OPTDIODE
+%
+\def\optdiode@iii{%
+ \edef\@sz{\POK@diode@size\space}%
+ \psframe[dimen=outer](! \@sz -0.5 mul dup)(!\@sz 0.5 mul dup)
+ \pspolygon(! \@sz -0.2 mul \@sz -0.2 mul)
+ (! \@sz -0.2 mul \@sz 0.2 mul)
+ (! \@sz 0.2 mul 0)
+ \psline(! \@sz 0.2 mul \getCLWH add \@sz 0.2 mul)(! \@sz 0.2 mul \getCLWH add \@sz -0.2 mul)
+ \pnode(! \@sz -0.5 mul 0){\optexp@nodeA}
+ \pnode(! \@sz 0.5 mul 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DOVE PRISM
+%
+\def\doveprism@iii{%
+ \edef\@ht{\POK@doveprism@size\space 0.5 mul\space}%
+ \edef\@wd{\POK@doveprism@size\space 1.5 mul\space}%
+ \pspolygon(! \@wd neg \@ht neg)%
+ (! \@wd \@ht neg)%
+ (! \@ht dup)%
+ (! \@ht neg \@ht)%
+ \pnode(!\@wd \@ht add -0.5 mul 0){\optexp@nodeA}
+ \pnode(! 0 \@ht neg){\optexp@node{2}}
+ \pnode(!\@wd \@ht add 0.5 mul 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% PENTA PRISM
+%
+\def\pentaprism@iii{%
+ \edef\@pp@size{\POK@pentaprism@size\space}%
+ \pscustom{%
+ \psline(! \@pp@size 2 sqrt div 0)%
+ (! \@pp@size 2 sqrt div 67.5 cos \@pp@size mul 67.5 sin div sub \@pp@size)%
+ (! 67.5 cos \@pp@size mul 67.5 sin div \@pp@size 2 sqrt div sub \@pp@size)%
+ (! \@pp@size 2 sqrt div neg 0)%
+ (! 0 \@pp@size 2 sqrt div neg)%
+ \closepath
+ }%
+ \pnode(! \@pp@size 2 sqrt div 67.5 cos \@pp@size mul 67.5 sin 2 mul div sub \@pp@size 2 div){\optexp@nodeA}%
+ \pnode(! 67.5 cos \@pp@size mul 67.5 sin 2 mul div \@pp@size 2 sqrt div sub \@pp@size 2 div){\optexp@nodeB}%
+}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% PRISM
+%
+\def\optprism@iii{%
+ %
+% \pst@Verb{%
+% /@sz \POK@prism@size\space def
+% /@alpha \POK@prism@angle\space 0.5 mul def
+% /@hshift @sz 0.5 mul @alpha tan mul \pst@optexpdict OEangle end 0.5 mul tan div def
+% }%
+% \pspolygon(! @sz neg @alpha tan mul @sz -0.5 mul @hshift sub)
+% (! @sz @alpha tan mul @sz -0.5 mul @hshift sub)
+% (! 0 @sz 0.5 mul @hshift sub)
+% \pnode(! @sz -0.5 mul @alpha tan mul @hshift neg){\optexp@nodeA}
+% \pnode(! @sz 0.5 mul @alpha tan mul @hshift neg){\optexp@nodeB}
+ \pst@Verb{%
+ /@sz \POK@prism@size\space def
+ /@alpha \POK@prism@angle\space 0.5 mul def
+ /@hshift @sz 0.6 mul @alpha tan mul \pst@optexpdict OEangle end 0.5 mul tan div def
+ }%
+ \pspolygon(! @sz neg @alpha tan mul @sz -0.4 mul @hshift sub)
+ (! @sz @alpha tan mul @sz -0.4 mul @hshift sub)
+ (! 0 @sz 0.6 mul @hshift sub)
+ \pnode(! @sz -0.6 mul @alpha tan mul @hshift neg){\optexp@nodeA}
+ \pnode(! @sz 0.6 mul @alpha tan mul @hshift neg){\optexp@nodeB}
+}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% RIGHT-ANGLE PRISM
+%
+\def\rightangleprism@iii{%
+ %
+ \pst@Verb{%
+ /prism@size \POK@raprism@size\space 0.5 mul def
+ /h \pst@optexpdict OEangle 0.5 mul sin modA mul end def
+ }%
+ \pspolygon(! prism@size neg h \getCLW add prism@size sub)
+ (! prism@size h \getCLW add prism@size sub)
+ (! 0 h \getCLW 2 sqrt mul add)%
+ \pnode(! h neg 0){\optexp@nodeA}
+ \pnode(! h 0){\optexp@nodeB}
+}%
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FIBER OPTICS
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FIBER
+%
+\def\optfiber@iii{%
+ \edef\@f@cnt{\POK@fiber@count\space}%
+ \edef\@f@r{\POK@fiber@radius\space}%
+ \edef\@f@sep{\POK@fiber@sep\space}%
+ \parametricplot[plotpoints=200,style=Fiber]{0}{1}{%
+ t 360 mul \@f@cnt mul sin \@f@r mul \@f@sep \@f@cnt 1 sub mul t 0.5 sub mul add
+ 1 t 360 mul \@f@cnt mul cos sub \@f@r mul
+ }%
+ \pnode(!\@f@sep \@f@cnt 1 sub mul \@f@r mul 0.5 mul neg 0){\optexp@nodeA}
+ \pnode(!\@f@sep \@f@cnt 1 sub mul \@f@r mul 0.5 mul 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% OPTMZM
+%
+\def\optmzm@iii{%
+ \pst@Verb{%
+ /@@x \POK@optmzm@size\space 0.8 mul def
+ /@@y \POK@optmzm@size\space 0.5 mul def
+ }%
+ \bgroup
+ \ifPOE@usefiberstyle
+ \psset{style=Fiber}
+ \fi
+ \psline(! @@x neg 0)(! @@x -0.7 mul 0)(! @@x -0.4 mul @@y 0.6 mul)%
+ (! @@x 0.4 mul @@y 0.6 mul)(! @@x 0.7 mul 0)(! @@x 0)%
+ (! @@x 0.7 mul 0)(! @@x 0.4 mul @@y -0.6 mul)%
+ (! @@x -0.4 mul @@y -0.6 mul)(! @@x -0.7 mul 0)%
+ \egroup
+ \psframe[dimen=outer](! @@x neg @@y neg)(! @@x @@y)
+ %
+ \pnode(! @@x neg 0){\optexp@nodeA}
+ \pnode(! @@x 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% OPTICAL FILTER
+%
+\def\optfilter@iii{%
+ \pst@Verb{%
+ /@@x \POK@filter@size\space 0.5 mul def
+ /@@y @@x def
+ }%
+ \def\filter@curve{%
+ \parametricplot[plotstyle=curve,arrows=c-c]{-1}{1}{%
+ t @@x mul 0.7 mul t Pi mul RadtoDeg 90 add cos 0.2 @@x mul mul}%
+ }%
+ \psframe[dimen=outer](! @@x neg dup)(! @@x dup)
+ \multips(! 0 -0.5 @@y mul)(! 0 0.5 @@y mul){3}{\filter@curve}
+ \ifx\POK@filter@type\POS@filter@type@bandpass
+ \psline(! -0.3 @@x mul -0.65 @@y mul)%
+ (! 0.3 @@x mul -0.35 @@y mul)%
+ \psline(! -0.3 @@x mul 0.35 @@y mul)%
+ (! 0.3 @@x mul 0.65 @@y mul)%
+ \rput(! 0 -0.5 @@y mul){\filter@curve}
+ \rput(0, 0){%
+ \ifPOE@usefiberstyle
+ \psset{style=Fiber}
+ \fi
+ \filter@curve}
+ \rput(! 0 0.5 @@y mul){\filter@curve}
+ \else\ifx\POK@filter@type\POS@filter@type@bandstop
+ \psline(! -0.3 @@x mul -0.15 @@y mul)%
+ (! 0.3 @@x mul 0.15 @@y mul)%
+ \rput(! 0 -0.5 @@y mul){%
+ \ifPOE@usefiberstyle
+ \psset{style=Fiber}
+ \fi
+ \filter@curve}
+ \rput(0, 0){\filter@curve}
+ \rput(! 0 0.5 @@y mul){%
+ \ifPOE@usefiberstyle
+ \psset{style=Fiber}
+ \fi
+ \filter@curve}
+ \fi\fi
+ %
+ \pnode(! @@x neg 0){\optexp@nodeA}
+ \pnode(! @@x 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% OPTICAL AMPLIFIER
+%
+\def\optamp@iii{%
+ \edef\@sz{\POK@optamp@size\space 0.5 mul\space}%
+ \edef\@xl{0.75 sqrt \@sz mul\space}%
+ \pspolygon(! \@xl 0)(! \getCLWH \@xl sub \@sz)(! \getCLWH \@xl sub \@sz neg)
+ \pnode(!\@xl neg 0){\optexp@nodeA}
+ \pnode(!\@xl 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% POLARIZATION CONTROLLER
+%
+\def\polcontrol@iii{%
+ \edef\@sz{\POK@polcontrol@size\space}%
+ \ifPOE@usefiberstyle
+ \psset{style=Fiber}
+ \fi
+ \multips(! -2.5 \@sz mul \@sz)(! 2.5 \@sz mul 0){3}{\pscircle(0,0){\POK@polcontrol@size}}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ISOLATOR
+%
+\def\optisolator@iii{%
+ \edef\@ht{\POK@isolator@size\space 2 div\space}%
+ \edef\@wd{\POK@isolator@size\space 0.8 mul\space}%
+ \psframe[dimen=outer](! \@wd neg \@ht neg)(! \@wd \@ht)
+ \psline[linewidth=2\pslinewidth,arrowinset=0]{->}(! \@wd neg 0.6 mul 0)(!\@wd 0.6 mul 0)
+ \pnode(! \@wd neg 0){\optexp@nodeA}
+ \pnode(! \@wd 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% SWITCH
+%
+\def\optswitch@iii{%
+ \pst@Verb{%
+ /@@x \POK@switch@size\space 0.5 mul def
+ /@@y @@x def
+ }%
+ \pnode(! @@x neg 0){\optexp@nodeA}%
+ \pnode(! @@x 0){\optexp@nodeB}%
+ % storing the linewidth of the object allows for some aesthetic fine tuning
+ \pstVerb{tx@Dict begin /@lw \getCLW def end}%
+ % the fiber parts
+ \bgroup
+ \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)%
+ \egroup
+ % different styles
+ \ifx\POK@switch@style\POS@optexp@closed%
+ %
+ \bgroup
+ \ifPOE@usefiberstyle
+ \psset{style=Fiber}
+ \fi
+ \psdot[dotsize=3\pslinewidth](! @@x 0.6 mul 0)%
+ \psdot[dotsize=3\pslinewidth](! @@x -0.6 mul 0)%
+ \psline[arrows=-, linewidth=1.5\pslinewidth](! @@x -0.6 mul @lw)(! @@x 0.6 mul @lw)%
+ \egroup
+ \else
+ \psline[arrows=-, linewidth=1.5\pslinewidth](! @@x -0.6 mul @lw add @lw)(! @@x 0.6 mul dup)%
+ \pscircle(! @@x -0.6 mul 0){\pslinewidth}%
+ \psdot[dotsize=3\pslinewidth](! @@x 0.6 mul 0)%
+ \fi
+ \psframe[dimen=outer](! @@x neg dup)(! @@x dup)%
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FIBER DELAY LINE
+%
+\def\fiberdelayline@iii{%
+ \pst@Verb{%
+ /@@x \POK@fdl@size\space 0.8 mul def
+ /@@y \POK@fdl@size\space 0.5 mul def
+ }%
+ \psframe[dimen=outer](! @@x neg @@y neg)(! @@x @@y)
+ \psline{->}(! @@x -0.3 mul @@y -1.5 mul)(! @@x 0.3 mul @@y 1.7 mul)
+ \pnode(! @@x neg 0){\optexp@nodeA}
+ \pnode(! @@x 0){\optexp@nodeB}
+\ignorespaces}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% COUPLER
+%
+\def\optcoupler@iii{%
+ \edef\@sz{\POK@coupler@size\space}%
+ \edef\@sep{\POK@coupler@sep\space 0.5 mul\space}%
+ \ifx\POK@align\POS@optexp@top
+ \pst@Verb{/@yshift \@sep neg def}%
+ \else\ifx\POK@align\POS@optexp@bottom
+ \pst@Verb{/@yshift \@sep def}%
+ \else
+ \pst@Verb{/@yshift 0 def}%
+ \fi\fi
+ \ifx\POK@coupler@type\POS@coupler@type@elliptic
+ \psellipse[dimen=outer](!0 @yshift)(! \@sz \@sz 0.4 mul)
+ \ifPOE@variable
+ \psline[arrowinset=0]{->}(!\@sz -0.5 mul \@sz neg @yshift add)(!\@sz 0.5 mul \@sz @yshift add)
+ \fi
+ \pnode(! \@sz neg \getCLW 0.3 mul add @yshift \@sep add){tempNode@A@1}
+ \pnode(! \@sz neg \getCLW 0.3 mul add @yshift \@sep sub){tempNode@A@2}
+ \pnode(! \@sz \getCLW 0.3 mul sub @yshift \@sep add){tempNode@B@1}
+ \pnode(! \@sz \getCLW 0.3 mul sub @yshift \@sep sub){tempNode@B@2}
+ \pnode(! 0 @yshift){tempNode@Label}
+ \else\ifx\POK@coupler@type\POS@coupler@type@none
+ \pnode(! \@sz -0.5 mul @yshift \@sep add){tempNode@A@1}
+ \pnode(! \@sz -0.5 mul @yshift \@sep sub){tempNode@A@2}
+ \pnode(! \@sz 0.5 mul @yshift \@sep add){tempNode@B@1}
+ \pnode(! \@sz 0.5 mul @yshift \@sep sub){tempNode@B@2}
+ \psline[style=Fiber](tempNode@A@1)(tempNode@B@1)
+ \psline[style=Fiber](tempNode@A@2)(tempNode@B@2)
+ \fi\fi
+}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% WDM COUPLER
+%
+\def\wdmcoupler@ii{%
+ \edef\@sz{\POK@coupler@size\space}%
+ \edef\@sep{\POK@coupler@sep\space 0.5 mul\space}%
+ \ifx\POK@align\POS@optexp@top
+ \pst@Verb{/@yshift \@sep neg def}%
+ \else\ifx\POK@align\POS@optexp@bottom
+ \pst@Verb{/@yshift \@sep def}%
+ \else
+ \pst@Verb{/@yshift 0 def}%
+ \fi\fi
+ \ifx\POK@coupler@type\POS@coupler@type@elliptic
+ \psellipse[dimen=outer](!0 @yshift)(! \@sz \@sz 0.4 mul)
+ \pnode(! \@sz neg \getCLW 0.3 mul add @yshift \@sep add){tempNode@A@1}
+ \pnode(! \@sz neg \getCLW 0.3 mul add @yshift \@sep sub){tempNode@A@2}
+ \pnode(!0 @yshift){tempNode@Label}
+ \pnode(! \@sz \getCLW 0.3 mul sub 0){tempNode@B@}
+ \else\ifx\POK@coupler@type\POS@coupler@type@none
+ \pnode(0,0){tempNode@A@1}
+ \pnode(0,0){tempNode@A@2}
+ \pnode(0,0){tempNode@B@}
+ \pnode(0,0){tempNode@Label}
+ \fi\fi
+}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% WDM SPLITTER
+%
+\def\wdmsplitter@ii{%
+ \edef\@sz{\POK@coupler@size\space}%
+ \edef\@sep{\POK@coupler@sep\space 0.5 mul\space}%
+ %
+ \ifx\POK@align\POS@optexp@top
+ \pst@Verb{/@yshift \@sep neg def}%
+ \else\ifx\POK@align\POS@optexp@bottom
+ \pst@Verb{/@yshift \@sep def}%
+ \else
+ \pst@Verb{/@yshift 0 def}%
+ \fi\fi
+ \ifx\POK@coupler@type\POS@coupler@type@elliptic
+ \psellipse[dimen=outer](! 0 @yshift)(! \@sz \@sz 0.4 mul)
+ \pnode(! \@sz neg \getCLW 0.3 mul add 0){tempNode@A@}
+ \pnode(! \@sz \getCLW 0.3 mul sub @yshift \@sep add){tempNode@B@1}
+ \pnode(! \@sz \getCLW 0.3 mul sub @yshift \@sep sub){tempNode@B@2}
+ \pnode(! 0 @yshift){tempNode@Label}
+ \else\ifx\POK@coupler@type\POS@coupler@type@none
+ \pnode(0,0){tempNode@A@}
+ \pnode(0,0){tempNode@B@1}
+ \pnode(0,0){tempNode@B@2}
+ \pnode(0,0){tempNode@Label}
+ \fi\fi
+}%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FIBER COLLIMATOR
+%
+\def\fibercollimator@iii{%
+ \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}
+ \pnode(!\@sz 0){\optexp@nodeB}
+}%
+%
%
\endinput
%