From f9fe08d0b133db79c326f1cc09c1ef16debf16c5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 15 Apr 2013 22:23:09 +0000 Subject: pst-optexp (15apr13) git-svn-id: svn://tug.org/texlive/trunk@29953 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/pst-optexp/pst-optexp.sty | 2342 +++++++++++++------- 1 file changed, 1486 insertions(+), 856 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty b/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty index 43653daae39..1e25eabec7f 100644 --- a/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty +++ b/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: pst-optexp -%% Version: 3.6 (2013/03/20) +%% Version: 4.0 (2013/04/15) %% %% Copyright (C) 2007-2013 by Christoph Bersch %% @@ -31,7 +31,8 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{pst-optexp} - [2013/03/20 v3.6 Optical experimental setups with PSTricks] + [2013/04/15 v4.0 Optical experimental setups with PSTricks] +\RequirePackage{ifthen} \RequirePackage{pstricks} \RequirePackage{pst-xkey} \RequirePackage{pst-node} @@ -62,8 +63,8 @@ }% \def\pst@optexpdict{tx@OptexpDict begin } \def\POE@dict#1{\pst@optexpdict #1 end} +\def\POE@Verb#1{\pst@Verb{\pst@optexpdict #1 end }}% \SpecialCoor -\newif\ifPOE@connjoin \newif\ifPOE@backlayer \newif\ifPOE@frontlayer \newif\ifPOE@optexpenv @@ -79,22 +80,30 @@ \newif\ifPOE@startbox \newif\ifPOE@thicklens \newif\ifPOE@usefiberstyle -\newif\ifPOE@fiber@ -\newif\ifPOE@nofiber@ \newif\ifPOE@fiberin@ \newif\ifPOE@fiberin@top \newif\ifPOE@fiberin@bottom \newif\ifPOE@fiberout@ \newif\ifPOE@fiberout@top \newif\ifPOE@fiberout@bottom -\newif\ifPOE@fiberpreset@ -\newif\ifPOE@nofiberpreset@ \newif\ifPOE@fiberpresetin@ \newif\ifPOE@fiberpresetin@top \newif\ifPOE@fiberpresetin@bottom \newif\ifPOE@fiberpresetout@ \newif\ifPOE@fiberpresetout@top \newif\ifPOE@fiberpresetout@bottom +\newif\ifPOE@wirein@ +\newif\ifPOE@wirein@top +\newif\ifPOE@wirein@bottom +\newif\ifPOE@wireout@ +\newif\ifPOE@wireout@top +\newif\ifPOE@wireout@bottom +\newif\ifPOE@wirepresetin@ +\newif\ifPOE@wirepresetin@top +\newif\ifPOE@wirepresetin@bottom +\newif\ifPOE@wirepresetout@ +\newif\ifPOE@wirepresetout@top +\newif\ifPOE@wirepresetout@bottom \newif\ifPOE@beam \newif\ifPOE@startinside \newif\ifPOE@stopinside @@ -110,47 +119,55 @@ \newcount\POE@cnt \newcount\POE@oldcnt \newcount\POE@nodecnt -\newdimen\POE@dim -\def\POE@str@pol@polperp{perp} -\def\POE@str@pol@polparallel{parallel} -\def\POE@str@pol@polmisc{misc} -\def\POE@str@pol@polrcirc{rcirc} -\def\POE@str@pol@pollcirc{lcirc} -\def\POE@str@mirrortype@piezo{piezo} -\def\POE@str@mirrortype@plain{plain} -\def\POE@str@mirrortype@extended{extended} -\def\POE@str@mirrortype@semitrans{semitrans} -\def\POE@str@gratingtype@blazed{blazed} -\def\POE@str@gratingtype@binary{binary} -\def\POE@str@relative{relative} \def\POE@str@absolute{absolute} -\def\POE@str@labelref@relgrav{relgrav} -\def\POE@str@labelref@global{global} -\def\POE@str@filtertype@bandpass{bandpass} -\def\POE@str@filtertype@bandstop{bandstop} -\def\POE@str@filtertype@lowpass{lowpass} -\def\POE@str@filtertype@highpass{highpass} -\def\POE@str@couplertype@none{none} -\def\POE@str@couplertype@ellipse{ellipse} -\def\POE@str@couplertype@elliptic{elliptic} -\def\POE@str@couplertype@rectangle{rectangle} -\def\POE@str@couplertype@cross{cross} -\def\POE@str@polcontroltype@linear{linear} -\def\POE@str@polcontroltype@triangle{triangle} -\def\POE@str@top{top} +\def\POE@str@auto{auto} +\def\POE@str@bandpass{bandpass} +\def\POE@str@bandstop{bandstop} +\def\POE@str@binary{binary} +\def\POE@str@blazed{blazed} \def\POE@str@bottom{bottom} \def\POE@str@center{center} +\def\POE@str@circle{circle} \def\POE@str@closed{closed} +\def\POE@str@cross{cross} +\def\POE@str@cube{cube} +\def\POE@str@custom{custom} +\def\POE@str@diode{diode} +\def\POE@str@directional{directional} +\def\POE@str@ellipse{ellipse} +\def\POE@str@elliptic{elliptic} +\def\POE@str@extended{extended} +\def\POE@str@global{global} +\def\POE@str@highpass{highpass} +\def\POE@str@lcirc{lcirc} +\def\POE@str@left{left} +\def\POE@str@linear{linear} +\def\POE@str@lowpass{lowpass} +\def\POE@str@misc{misc} +\def\POE@str@none{none} \def\POE@str@opened{opened} -\def\POE@str@dettype@round{round} -\def\POE@str@dettype@diode{diode} -\def\POE@str@bsstyle@cube{cube} -\def\POE@str@bsstyle@plate{plate} -\def\POE@str@auto{auto} -\def\POE@str@center{center} -\def\POE@str@verbose{verbose} +\def\POE@str@parallel{parallel} +\def\POE@str@perp{perp} +\def\POE@str@piezo{piezo} +\def\POE@str@plain{plain} +\def\POE@str@plate{plate} +\def\POE@str@pulse{pulse} \def\POE@str@quiet{quiet} -\def\POE@Verb#1{\pst@Verb{\pst@optexpdict #1 end }}% +\def\POE@str@rcirc{rcirc} +\def\POE@str@rectangle{rectangle} +\def\POE@str@reflective{reflective} +\def\POE@str@relative{relative} +\def\POE@str@relgrav{relgrav} +\def\POE@str@right{right} +\def\POE@str@round{round} +\def\POE@str@sawtooth{sawtooth} +\def\POE@str@semitrans{semitrans} +\def\POE@str@sine{sine} +\def\POE@str@standard{standard} +\def\POE@str@top{top} +\def\POE@str@transmittive{transmittive} +\def\POE@str@triangle{triangle} +\def\POE@str@verbose{verbose} \newpsstyle{OptComp}{}% \define@key[psset]{optexp}{newOptComp}{% \newpsstyle{OptComp}{#1}% @@ -216,6 +233,56 @@ \define@key[psset]{optexp}{addtoFiberOut2}{% \addtopsstyle{FiberOut2}{#1}% } +\newpsstyle{Wire}{} +\define@key[psset]{optexp}{newWire}{% + \newpsstyle{Wire}{#1}% +} +\define@key[psset]{optexp}{addtoWire}{% + \addtopsstyle{Wire}{#1}% +} +\newpsstyle{WireIn}{style=Wire} +\define@key[psset]{optexp}{newWireIn}{% + \newpsstyle{WireIn}{#1}% +} +\define@key[psset]{optexp}{addtoWireIn}{% + \addtopsstyle{WireIn}{#1}% +} +\newpsstyle{WireIn1}{style=WireIn} +\define@key[psset]{optexp}{newWireIn1}{% + \newpsstyle{WireIn1}{#1}% +} +\define@key[psset]{optexp}{addtoWireIn1}{% + \addtopsstyle{WireIn1}{#1}% +} +\newpsstyle{WireIn2}{style=WireIn} +\define@key[psset]{optexp}{newWireIn2}{% + \newpsstyle{WireIn2}{#1}% +} +\define@key[psset]{optexp}{addtoWireIn2}{% + \addtopsstyle{WireIn2}{#1}% +} +\newpsstyle{WireOut}{style=Wire} +\define@key[psset]{optexp}{newWireOut}{% + \newpsstyle{WireOut}{#1}% +} +\define@key[psset]{optexp}{addtoWireOut}{% + \addtopsstyle{WireOut}{#1}% +} +\newpsstyle{WireOut1}{style=WireOut} +\define@key[psset]{optexp}{newWireOut1}{% + \newpsstyle{WireOut1}{#1}% +} +\define@key[psset]{optexp}{addtoWireOut1}{% + \addtopsstyle{WireOut1}{#1}% +} +\newpsstyle{WireOut2}{style=WireOut} +\define@key[psset]{optexp}{newWireOut2}{% + \newpsstyle{WireOut2}{#1}% +} +\define@key[psset]{optexp}{addtoWireOut2}{% + \addtopsstyle{WireOut2}{#1}% +} +\newpsstyle{ElecComp}{} \newpsstyle{ExtendedMirror}{% linestyle=none, hatchwidth=0.5\pslinewidth, hatchsep=1.4\pslinewidth, fillstyle=hlines @@ -309,7 +376,7 @@ [\val\nr]{absolute,relative,relgrav,global}% {% \ifcase\nr\relax - \let\POE@key@labelref\POE@str@labelref@global + \let\POE@key@labelref\POE@str@global \else \def\POE@key@labelref{#1}% \fi @@ -401,7 +468,7 @@ \def\POE@getref@r{\def\POE@key@extnode@xref{1}}% \psset[optexp]{% extnode=\@empty, - extnodealign=abs + extnodealign=absolute }% \define@key[psset]{optexp}{rotateref}{% \def\POE@temp{#1}% @@ -608,10 +675,65 @@ \fi \psset[optexp]{optboxwidth=#1, optboxheight=#2}% }% +\psset[optexp]{optboxsize=1.4 0.8}% +\define@key[psset]{optexp}{arrowcompwidth}{% + \pst@checknum{#1}\POE@key@arrowcompwidth +} +\define@key[psset]{optexp}{arrowcompheight}{% + \pst@checknum{#1}\POE@key@arrowcompheight +} +\define@key[psset]{optexp}{arrowcompsize}{% + \pst@expandafter\POE@psset@@arrowcompsize{#1} {} {} {}\@nil +}% +\def\POE@psset@@arrowcompsize#1 #2 #3\@nil{% + \ifx\\#2\\% + \psset[optexp]{arrowcompwidth=#1, arrowcompheight=#1}% + \else + \psset[optexp]{arrowcompwidth=#1, arrowcompheight=#2}% + \fi +}% +\define@key[psset]{optexp}{arrowcompangle}{% + \pst@checknum{#1}\POE@key@arrowcompangle +}% +\define@choicekey+[psset]{optexp}{arrowcompshape}% + [\val\nr]{circle, rectangle}% + {\edef\POE@key@arrowcompshape{#1}}% + {\PackageError{pst-optexp}{Unknown value '\val' for arrowcompshape}} +\psset[optexp]{% + arrowcompsize=1.4 0.8, + arrowcompangle=70, + arrowcompshape=rectangle +}% +\newpsstyle{ArrowCompStyle}{arrowinset=0, arrows=->}% +\define@key[psset]{optexp}{barcompwidth}{% + \pst@checknum{#1}\POE@key@barcompwidth +} +\define@key[psset]{optexp}{barcompheight}{% + \pst@checknum{#1}\POE@key@barcompheight +} +\define@key[psset]{optexp}{barcompsize}{% + \pst@expandafter\POE@psset@@barcompsize{#1} {} {} {}\@nil +}% +\def\POE@psset@@barcompsize#1 #2 #3\@nil{% + \ifx\\#2\\% + \psset[optexp]{barcompwidth=#1, barcompheight=#1}% + \else + \psset[optexp]{barcompwidth=#1, barcompheight=#2}% + \fi +}% +\define@key[psset]{optexp}{barcompangle}{% + \pst@checknum{#1}\POE@key@barcompangle +}% +\define@choicekey+[psset]{optexp}{barcompshape}% + [\val\nr]{circle, rectangle}% + {\edef\POE@key@barcompshape{#1}}% + {\PackageError{pst-optexp}{Unknown value '\val' for barcompshape}} \psset[optexp]{% - optboxwidth=1.4, - optboxheight=0.8 + barcompsize=1.4 0.8, + barcompangle=70, + barcompshape=rectangle }% +\newpsstyle{BarCompStyle}{}% \define@key[psset]{optexp}{platelinewidth}{% \edef\POE@key@platelinewidth{#1}% } @@ -859,10 +981,15 @@ {auto,center}% {\def\POE@key@prismalign{#1}}% {\PackageError{pst-optexp}{Unknown value '\val' for prismalign}}% +\define@choicekey+[psset]{optexp}{prismtype}[\val\nr]% + {transmission, coupling}% + {\def\POE@key@prismtype{#1}}% + {\PackageError{pst-optexp}{Unknown value '\val' for prismtype}}% \psset[optexp]{% prismsize=1, prismangle=60, - prismalign=auto + prismalign=auto, + prismtype=transmission }% \define@key[psset]{optexp}{optdipolesize}{% \pst@expandafter\POE@psset@@optdipolesize{#1} {} {} {}\@nil @@ -888,7 +1015,7 @@ \psset[optexp]{% fiberloops=3, fiberloopradius=0.4, - fiberloopsep=0.3 + fiberloopsep=0.2 }% \define@key[psset]{optexp}{filtersize}{% \pst@checknum{#1}\POE@key@filtersize @@ -1053,14 +1180,14 @@ \fi }% \define@key[psset]{optexp}{couplersep}{% - \pst@checknum{#1}\POE@key@couplersep + \edef\POE@key@couplersep{#1}% } \define@choicekey+[psset]{optexp}{couplertype}% [\val\nr]{none,elliptic,ellipse,cross,rectangle}% {% \edef\POE@key@couplertype{#1} - \ifx\POE@key@couplertype\POE@str@couplertype@elliptic - \let\POE@key@couplertype\POE@str@couplertype@ellipse + \ifx\POE@key@couplertype\POE@str@elliptic + \let\POE@key@couplertype\POE@str@ellipse \fi }% {\PackageError{pst-optexp}{Unknown value '\val' for couplertype}} @@ -1132,6 +1259,81 @@ fiberboxsepin=0.2, fiberboxsepout=0.2, fiberboxcount=2x2} +\define@key[psset]{optexp}{elecmixersize}{% + \pst@checknum{#1}\POE@key@elecmixersize +}% +\psset[optexp]{elecmixersize=0.8}% +\define@key[psset]{optexp}{eleccouplersize}{% + \pst@expandafter\POE@psset@@eleccouplersize{#1} {} {} {}\@nil +}% +\def\POE@psset@@eleccouplersize#1 #2 #3\@nil{% + \pst@checknum{#1}\POE@key@eleccouplerwidth + \ifx\\#2\\% + \pst@checknum{#1}\POE@key@eleccouplerheight + \else + \pst@checknum{#2}\POE@key@eleccouplerheight + \fi +}% +\define@key[psset]{optexp}{eleccouplersep}{% + \edef\POE@key@eleccouplersep{#1}% +} +\define@choicekey+[psset]{optexp}{eleccouplertype}% + [\val\nr]{standard, directional}% + {\edef\POE@key@eleccouplertype{#1}}% + {\PackageError{pst-optexp}{Unknown value '\val' for eleccouplertype}}% +\define@choicekey+[psset]{optexp}{eleccouplerinput}% + [\val\nr]{left, right}% + {\edef\POE@key@eleccouplerinput{#1}}% + {\PackageError{pst-optexp}{Unknown value '\val' for eleccouplerinput}}% +\define@choicekey+[psset]{optexp}{eleccoupleralign}% + [\val\nr]{t,b,c,top,bottom,center}% + {% + \ifcase\nr\relax + \let\POE@key@eleccoupleralign\POE@str@top + \or + \let\POE@key@eleccoupleralign\POE@str@bottom + \or + \let\POE@key@eleccoupleralign\POE@str@center + \else + \def\POE@key@eleccoupleralign{#1}% + \fi}% + {\PackageError{pst-optexp}{Unknown value '\val' for eleccoupleralign}} +\psset[optexp]{% + eleccouplersize=0.8, + eleccouplersep={}, + eleccoupleralign=center, + eleccouplertype=standard, + eleccouplerinput=left +}% +\define@key[psset]{optexp}{synthsize}{% + \pst@expandafter\POE@psset@@synthsize{#1} {} {} {}\@nil +}% +\def\POE@psset@@synthsize#1 #2 #3\@nil{% + \pst@checknum{#1}\POE@key@synthwidth + \ifx\\#2\\% + \pst@checknum{#1}\POE@key@synthheight + \else + \pst@checknum{#2}\POE@key@synthheight + \fi +}% +\define@key[psset]{optexp}{synthrectwidth}{% + \pst@checknum{#1}\POE@key@synthrectwidth +}% +\define@choicekey+[psset]{optexp}{synthshape}% + [\val\nr]{circle, rectangle}% + {\edef\POE@key@synthshape{#1}}% + {\PackageError{pst-optexp}{Unknown value '\val' for synthshape}} +\define@choicekey+[psset]{optexp}{synthtype}% + [\val\nr]{sine, pulse, rectangle, triangle, sawtooth, custom}% + {\edef\POE@key@synthtype{#1}}% + {\PackageError{pst-optexp}{Unknown value '\val' for synthtype}} +\newpsstyle{SynthStyle}{} +\psset[optexp]{% + synthsize=0.8, + synthshape=circle, + synthtype=sine, + synthrectwidth=0.2 +}% \define@boolkey[psset]{optexp}[POE@]{beam}[true]{} \define@key[psset]{optexp}{refractiveindex}{% \psset[optexp]{n=#1}% @@ -1214,7 +1416,7 @@ \fi }% \define@key[psset]{optexp}{loadbeam}[true]{% - \setkeys+[psset]{optexp}{loadbeampoints=#1}% + \setkeys[psset]{optexp}{loadbeampoints=#1}% \ifdim\POE@key@loadbeampoints pt>0pt \POE@loadbeamtrue \else @@ -1222,7 +1424,7 @@ \fi }% \define@key[psset]{optexp}{savebeam}[true]{% - \setkeys+[psset]{optexp}{savebeampoints=#1}% + \setkeys[psset]{optexp}{savebeampoints=#1}% \ifdim\POE@key@savebeampoints pt>0pt \POE@savebeamtrue \else @@ -1285,21 +1487,43 @@ \def\POE@psset@fibercheck#1#2\@nil{% \ifx#1*\relax \ifx\\#2\\% - \psset[optexp]{fiber@preset=all}% + \setkeys[psset]{optexp}{fiber@preset=all}% \else - \psset[optexp]{fiber@preset=#2}% + \setkeys[psset]{optexp}{fiber@preset=#2}% \fi \else\ifx#1+\relax \ifx\\#2\\% - \psset[optexp]{fiber@all=all}% + \setkeys[psset]{optexp}{fiber@all=all}% \else - \psset[optexp]{fiber@all=#2}% + \setkeys[psset]{optexp}{fiber@all=#2}% \fi + \POE@unset@wire \else - \psset[optexp]{fiber@all=#1#2}% - \psset[optexp]{fiber@preset=#1#2}% + \setkeys[psset]{optexp}{fiber@all=#1#2}% + \setkeys[psset]{optexp}{fiber@preset=#1#2}% + \POE@unset@wire \fi\fi }% +\def\POE@unset@wire{% + \ifPOE@fiberin@ + \setkeys[psset]{optexp}{wirepresetin@=false}% + \fi + \ifPOE@fiberout@ + \setkeys[psset]{optexp}{wirepresetout@=false}% + \fi + \ifPOE@fiberin@top + \setkeys[psset]{optexp}{wirepresetin@top=false}% + \fi + \ifPOE@fiberin@bottom + \setkeys[psset]{optexp}{wirepresetin@bottom=false}% + \fi + \ifPOE@fiberout@top + \setkeys[psset]{optexp}{wirepresetout@top=false}% + \fi + \ifPOE@fiberout@bottom + \setkeys[psset]{optexp}{wirepresetout@bottom=false}% + \fi +}% \define@choicekey*+[psset]{optexp}{fiber@preset}% [\val\nr]{false,none,true,all}[all]{% \ifcase\nr\relax @@ -1326,20 +1550,37 @@ \fi }% \def\POE@getfiberpreset@none{% - \psset[optexp]{fiberpreset@=false}% + \setkeys[psset]{optexp}{% + fiberpresetin@=false, fiberpresetout@=false, + fiberpresetin@top=false, fiberpresetin@bottom=false, + fiberpresetout@top=false, fiberpresetout@bottom=false}% }% \def\POE@getfiberpreset@all{% - \psset[optexp]{% - fiberpreset@, fiberpresetin@, fiberpresetout@, + \setkeys[psset]{optexp}{% + fiberpresetin@, fiberpresetout@, fiberpresetin@top, fiberpresetin@bottom, fiberpresetout@top, fiberpresetout@bottom}% }% \def\POE@getfiberpreset@t{% - \psset[optexp]{fiberpresetin@bottom=false, fiberpresetout@bottom=false}}% + \setkeys[psset]{optexp}{% + fiberpresetin@bottom=false, fiberpresetout@bottom=false}% +}% \def\POE@getfiberpreset@b{% - \psset[optexp]{fiberpresetin@top=false, fiberpresetout@top=false}}% -\def\POE@getfiberpreset@l{\psset[optexp]{fiberpresetout@=false}}% -\def\POE@getfiberpreset@r{\psset[optexp]{fiberpresetin@=false}}% + \setkeys[psset]{optexp}{% + fiberpresetin@top=false, fiberpresetout@top=false}% +}% +\def\POE@getfiberpreset@l{% + \setkeys[psset]{optexp}{% + fiberpresetout@=false, + fiberpresetout@top=false, + fiberpresetout@bottom=false}% +}% +\def\POE@getfiberpreset@r{% + \setkeys[psset]{optexp}{% + fiberpresetin@=false, + fiberpresetin@top=false, + fiberpresetin@bottom=false}% +}% \let\POE@getfiberpreset@i\POE@getfiberpreset@l \let\POE@getfiberpreset@o\POE@getfiberpreset@r \define@choicekey*+[psset]{optexp}{fiber@all}% @@ -1368,32 +1609,41 @@ \fi }% \def\POE@getfiber@none{% - \psset[optexp]{fiber@=false}% + \setkeys[psset]{optexp}{% + fiberin@=false, fiberout@=false, + fiberin@top=false, fiberin@bottom=false, + fiberout@top=false, fiberout@bottom=false}% }% \def\POE@getfiber@all{% - \psset[optexp]{% - fiber@, fiberin@, fiberout@, + \setkeys[psset]{optexp}{% + fiberin@, fiberout@, fiberin@top, fiberin@bottom, fiberout@top, fiberout@bottom}% }% \def\POE@getfiber@t{% - \psset[optexp]{fiberin@bottom=false, fiberout@bottom=false}}% + \setkeys[psset]{optexp}{% + fiberin@bottom=false, fiberout@bottom=false}% +}% \def\POE@getfiber@b{% - \psset[optexp]{fiberin@top=false, fiberout@top=false}}% -\def\POE@getfiber@l{\psset[optexp]{fiberout@=false}}% -\def\POE@getfiber@r{\psset[optexp]{fiberin@=false}}% + \setkeys[psset]{optexp}{% + fiberin@top=false, fiberout@top=false}% +}% +\def\POE@getfiber@l{% + \setkeys[psset]{optexp}{% + fiberout@=false, fiberout@top=false, fiberout@bottom=false}% +}% +\def\POE@getfiber@r{% + \setkeys[psset]{optexp}{% + fiberin@=false, fiberin@top=false, fiberin@bottom=false}% +}% \let\POE@getfiber@i\POE@getfiber@l \let\POE@getfiber@o\POE@getfiber@r -\define@boolkey[psset]{optexp}[POE@]{fiber@}[true]{} -\define@boolkey[psset]{optexp}[POE@]{nofiber@}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberin@}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberin@top}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberin@bottom}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberout@}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberout@top}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberout@bottom}[true]{} -\define@boolkey[psset]{optexp}[POE@]{fiberpreset@}[true]{} -\define@boolkey[psset]{optexp}[POE@]{nofiberpreset@}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberpresetin@}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberpresetin@top}[true]{} \define@boolkey[psset]{optexp}[POE@]{fiberpresetin@bottom}[true]{} @@ -1429,6 +1679,205 @@ fiberalign=relative, fiberstyle=curve }% + +\define@key[psset]{optexp}{wire}[all]{% + \POE@psset@wirecheck#1\@nil +} +\def\POE@psset@wirecheck#1#2\@nil{% + \ifx#1*\relax + \ifx\\#2\\% + \setkeys[psset]{optexp}{wire@preset=all}% + \else + \setkeys[psset]{optexp}{wire@preset=#2}% + \fi + \else\ifx#1+\relax + \ifx\\#2\\% + \setkeys[psset]{optexp}{wire@all=all}% + \else + \setkeys[psset]{optexp}{wire@all=#2}% + \fi + \POE@unset@fiber + \else + \setkeys[psset]{optexp}{wire@all=#1#2, wire@preset=#1#2}% + \POE@unset@fiber + \fi\fi +}% +\def\POE@unset@fiber{% + \ifPOE@wirein@ + \setkeys[psset]{optexp}{fiberpresetin@=false, fiberin@=false}% + \fi + \ifPOE@wireout@ + \setkeys[psset]{optexp}{fiberpresetout@=false, fiberout@=false}% + \fi + \ifPOE@wirein@top + \setkeys[psset]{optexp}{fiberpresetin@top=false, fiberin@top=false}% + \fi + \ifPOE@wirein@bottom + \setkeys[psset]{optexp}{fiberpresetin@bottom=false, fiberin@bottom=false}% + \fi + \ifPOE@wireout@top + \setkeys[psset]{optexp}{fiberpresetout@top=false, fiberout@top=false}% + \fi + \ifPOE@wireout@bottom + \setkeys[psset]{optexp}{fiberpresetout@bottom=false, fiberout@bottom=false}% + \fi +}% +\define@choicekey*+[psset]{optexp}{wire@preset}% + [\val\nr]{false,none,true,all}[all]{% + \ifcase\nr\relax + \POE@getwirepreset@none + \or + \POE@getwirepreset@none + \or + \POE@getwirepreset@all + \or + \POE@getwirepreset@all + \fi +}{% + \ifx\@empty\val + \POE@getwirepreset@none + \else + \pst@expandafter\POE@psset@@wirepreset{#1}\@empty,,\@nil + \fi +}% +\def\POE@psset@@wirepreset#1#2,#3,#4\@nil{% + \POE@getwirepreset@all + \ifx\\#3\\% + \@nameuse{POE@getwirepreset@#1}% + \@nameuse{POE@getwirepreset@#2}% + \fi +}% +\def\POE@getwirepreset@none{% + \setkeys[psset]{optexp}{% + wirepresetin@=false, wirepresetout@=false, + wirepresetin@top=false, wirepresetin@bottom=false, + wirepresetout@top=false, wirepresetout@bottom=false}% +}% + +\def\POE@getwirepreset@all{% + \setkeys[psset]{optexp}{% + wirepresetin@, wirepresetout@, + wirepresetin@top, wirepresetin@bottom, + wirepresetout@top, wirepresetout@bottom}% +}% +\def\POE@getwirepreset@t{% + \setkeys[psset]{optexp}{% + wirepresetin@bottom=false, wirepresetout@bottom=false}% +}% +\def\POE@getwirepreset@b{% + \setkeys[psset]{optexp}{% + wirepresetin@top=false, wirepresetout@top=false}% +}% +\def\POE@getwirepreset@l{% + \setkeys[psset]{optexp}{% + wirepresetout@=false, + wirepresetout@top=false, + wirepresetout@bottom=false}% +}% +\def\POE@getwirepreset@r{% + \setkeys[psset]{optexp}{% + wirepresetin@=false, + wirepresetin@top=false, + wirepresetin@bottom=false}% +}% +\let\POE@getwirepreset@i\POE@getwirepreset@l +\let\POE@getwirepreset@o\POE@getwirepreset@r +\define@choicekey*+[psset]{optexp}{wire@all}% + [\val\nr]{false,none,true,all}[all]{% + \ifcase\nr\relax + \POE@getwire@none + \or + \POE@getwire@none + \or + \POE@getwire@all + \or + \POE@getwire@all + \fi +}{% + \ifx\@empty\val + \POE@getwire@none + \else + \pst@expandafter\POE@psset@@wire{#1}\@empty,,\@nil + \fi +}% +\def\POE@psset@@wire#1#2,#3,#4\@nil{% + \POE@getwire@all + \ifx\@empty#3\@empty + \@nameuse{POE@getwire@#1}% + \@nameuse{POE@getwire@#2}% + \fi +}% +\def\POE@getwire@none{% + \setkeys[psset]{optexp}{% + wirein@=false, wireout@=false, + wirein@top=false, wirein@bottom=false, + wireout@top=false, wireout@bottom=false}% +}% +\def\POE@getwire@all{% + \setkeys[psset]{optexp}{% + wirein@, wireout@, + wirein@top, wirein@bottom, + wireout@top, wireout@bottom}% +}% +\def\POE@getwire@t{% + \setkeys[psset]{optexp}{% + wirein@bottom=false, wireout@bottom=false}% +}% +\def\POE@getwire@b{% + \setkeys[psset]{optexp}{% + wirein@top=false, wireout@top=false}% +}% +\def\POE@getwire@l{% + \setkeys[psset]{optexp}{% + wireout@=false, wireout@top=false, wireout@bottom=false}% +}% +\def\POE@getwire@r{% + \setkeys[psset]{optexp}{% + wirein@=false, wirein@top=false, wirein@bottom=false}% +}% +\let\POE@getwire@i\POE@getwire@l +\let\POE@getwire@o\POE@getwire@r +\define@boolkey[psset]{optexp}[POE@]{wirein@}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirein@top}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirein@bottom}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wireout@}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wireout@top}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wireout@bottom}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirepresetin@}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirepresetin@top}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirepresetin@bottom}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirepresetout@}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirepresetout@top}[true]{} +\define@boolkey[psset]{optexp}[POE@]{wirepresetout@bottom}[true]{} +\psset[optexp]{wire=*all}% +\define@key[psset]{optexp}{wireangleA}{% + \pst@checknum{#1}\POE@key@wireangleA +}% +\define@key[psset]{optexp}{wireangleB}{% + \pst@checknum{#1}\POE@key@wireangleB +}% +\define@choicekey+[psset]{optexp}{wirealign}% + [\val\nr]{rel,abs,relative,center,absolute}% + {% + \ifcase\nr\relax + \let\POE@key@wirealign\POE@str@relative + \or + \let\POE@key@wirealign\POE@str@absolute + \else + \def\POE@key@wirealign{#1}% + \fi + }% + {\PackageError{pst-optexp}{Unknown value '\val' for wirealign}}% +\define@key[psset]{optexp}{wirestyle}{% + \@ifundefined{nc#1}% + {\PackageError{pst-optexp}{Unknown value '#1' for wirestyle}}% + {\def\POE@key@wirestyle{#1}}} +\psset[optexp]{% + wireangleA=0, + wireangleB=0, + wirealign=relative, + wirestyle=angle +}% \define@choicekey+[psset]{optexp}{startnode}% [\val\nr]{auto,1,2,3,4,N}% {\edef\POE@key@startnode{\val}} @@ -1463,40 +1912,51 @@ }% \def\POE@getcoor(#1){\pst@@getcoor{#1}}% \def\drawfiber{\drawfiber@{Fiber}}% +\def\drawwire{\drawwire@{Wire}}% +\def\drawwire@#1{% + \def\POE@setconnparam{% + \let\POE@key@connangleA\POE@key@wireangleA + \let\POE@key@connangleB\POE@key@wireangleB + \let\POE@key@connalign\POE@key@wirealign + \let\POE@key@connstyle\POE@key@wirestyle + }% + \drawconn@{#1} +}% \def\drawfiber@#1{% + \def\POE@setconnparam{% + \let\POE@key@connangleA\POE@key@fiberangleA + \let\POE@key@connangleB\POE@key@fiberangleB + \let\POE@key@connalign\POE@key@fiberalign + \let\POE@key@connstyle\POE@key@fiberstyle + }% + \drawconn@{#1}% +}% +\def\drawconn@#1{% \ifPst@custom\else \def\pst@par{style=#1}% \fi \@ifnextchar[%] - {\drawfiber@i}{\drawfiber@i[]}% -}% -\def\drawfiber@i[#1]{% + {\drawconn@i}{\drawconn@i[]}}% +\def\drawconn@i[#1]{% \addafter@par{#1}% - \drawfiber@ii} - -\def\drawfiber@ii{% - \@ifnextchar(%) - {\drawfiber@iii}% - {\@ifnextchar\bgroup{\drawfiber@iv}{}}% -}% -\def\drawfiber@iii(#1){\drawfiber@iv{(#1)}}% -\def\drawfiber@iv#1{% - \def\POE@tempe{#1}\drawfiber@ii@ -}% -\def\drawfiber@ii@{% - \@ifnextchar(%) - {\drawfiber@iii@}% - {\@ifnextchar\bgroup{\drawfiber@iv@}{}}% -}% -\def\drawfiber@iii@(#1){\drawfiber@iv@{(#1)}}% -\def\drawfiber@iv@#1{% - \expandafter\drawfiber@v\expandafter{\POE@tempe}{#1}% - \def\POE@tempe{#1}\drawfiber@ii@}% -\def\drawfiber@v#1#2{% + \POE@normalizecomps\drawconn@ii} +\def\drawconn@ii{% + \@ifnextchar\bgroup + {\drawconn@iii}% + {}}% +\def\drawconn@iii#1{% + \def\POE@tempe{#1}\drawconn@iv}% +\def\drawconn@iv{% + \@ifnextchar\bgroup{\drawconn@v}{}}% +\def\drawconn@v#1{% + \expandafter\drawconn@vi\expandafter{\POE@tempe}{#1}% + \def\POE@tempe{#1}\drawconn@iv}% +\def\drawconn@vi#1#2{% \begingroup \let\psk@angleA\relax \let\psk@angleB\relax \use@par + \POE@setconnparam \let\POE@angleA\psk@angleA \let\POE@angleB\psk@angleB \ifx\psk@angleA\relax @@ -1548,28 +2008,28 @@ \pst@getcoor{@@A}\POE@tempa \pst@getcoor{@@B}\POE@tempb \ifx\POE@angleA\relax - \ifx\POE@key@fiberalign\POE@str@absolute - \psset{angleA=\POE@key@fiberangleA}% + \ifx\POE@key@connalign\POE@str@absolute + \psset{angleA=\POE@key@connangleA}% \else \psset{angleA=! \POE@dict{% \POE@tempb \POE@tempa \POE@comps exch - \POE@key@fiberalign\space RelFiberAngle - \POE@key@fiberangleA\space add } + \POE@key@connalign\space RelConnAngle + \POE@key@connangleA\space add } }% \fi \fi \ifx\POE@angleB\relax - \ifx\POE@key@fiberalign\POE@str@absolute - \psset{angleB=\POE@key@fiberangleB}% + \ifx\POE@key@connalign\POE@str@absolute + \psset{angleB=\POE@key@connangleB}% \else \psset{angleB=! \POE@dict{% \POE@tempa \POE@tempb \POE@comps - \POE@key@fiberalign\space RelFiberAngle - \POE@key@fiberangleB\space add} + \POE@key@connalign\space RelConnAngle + \POE@key@connangleB\space add} }% \fi \fi - \@nameuse{nc\POE@key@fiberstyle}{@@A}{@@B} + \@nameuse{nc\POE@key@connstyle}{@@A}{@@B} \fi \endgroup }% @@ -1625,7 +2085,6 @@ \let\begin@SingleBeamObj\begin@WideBeamObj \def\drawbeam{\pst@object{drawbeam}}% \def\drawbeam@i{% - \def\POE@conntable{,a-a,b-b,A-A,B-B}% \begin@SingleBeamObj \POE@getcomps[\drawbeam@ii% }% @@ -1659,13 +2118,6 @@ \end@SpecialObj% }% \def\drawbeam@ii{% - \ifx\POE@key@conn\@empty - \drawbeam@iii - \else - \drawbeam@compat - \fi -} -\def\drawbeam@iii{% \ifodd \ifx\pslinestyle\@none\ifx\psk@ArrowInside\@empty 1\else 0\fi\else 0\fi \addto@pscode{ cleartomark false false }% @@ -1931,70 +2383,66 @@ \def\POE@getcomprange#1-#2\@nil{% \ifx\\#2\\% \ifx\\#1\\% - \edef\POE@firstcomp{\the\POE@cnt}% - \edef\POE@lastcomp{\the\POE@cnt}% + \@tempcnta=\POE@cnt + \@tempcntb=\POE@cnt \else - \edef\POE@firstcomp{#1}% - \edef\POE@lastcomp{#1}% + \@tempcnta=#1 + \@tempcntb=#1 \ifodd - \ifnum 0<\POE@firstcomp\ifnum\POE@lastcomp>\the\POE@cnt \@ne\else\z@\fi\else\@ne\fi + \ifnum 0<\@tempcnta\ifnum\@tempcntb>\the\POE@cnt \@ne\else\z@\fi\else\@ne\fi \PackageError{pst-optexp}% - {Component ID \POE@firstcomp\space is not valid, + {Component ID \the\@tempcnta\space is not valid, \ifnum\the\POE@cnt=0 no components have been defined\else valid range is from 1 to \the\POE@cnt\fi} \fi \fi \else \ifx\\#1\\% - \edef\POE@firstcomp{1}% + \@tempcnta=\@ne \else - \edef\POE@firstcomp{#1}% + \@tempcnta=#1 \fi \POE@getlastcomp#2% - \ifnum\POE@firstcomp>\the\POE@cnt - \ifnum\POE@lastcomp>\the\POE@cnt\relax + \ifnum\@tempcnta>\POE@cnt + \ifnum\@tempcntb>\POE@cnt \PackageError{pst-optexp}% - {All components \POE@firstcomp-\POE@lastcomp\space out of range}% + {All components \the\@tempcnta-\the\@tempcntb\space out of range}% \fi \fi - \ifnum\POE@firstcomp<1 + \ifnum\@tempcnta<\@ne \PackageWarning{pst-optexp}% - {Component ID \POE@firstcomp\space is not valid, setting to 1.}% - \def\POE@firstcomp{1}% - \else\ifnum\POE@firstcomp>\the\POE@cnt + {Component ID \the\@tempcnta\space is not valid, setting to 1.}% + \@tempcnta=\@ne + \else\ifnum\@tempcnta>\POE@cnt \PackageWarning{pst-optexp}% - {Component ID \POE@firstcomp\space is not valid, setting to \MessageBreak + {Component ID \the\@tempcnta\space is not valid, setting to \MessageBreak the last defined value (\the\POE@cnt).}% - \edef\POE@firstcomp{\the\POE@cnt}% + \@tempcnta=\POE@cnt% \fi\fi - \ifnum\POE@lastcomp>\the\POE@cnt + \ifnum\@tempcntb>\POE@cnt \PackageWarning{pst-optexp}% - {Component ID \POE@lastcomp\space is not valid, setting to \MessageBreak + {Component ID \the\@tempcntb\space is not valid, setting to \MessageBreak the last defined value (\the\POE@cnt).}% - \edef\POE@lastcomp{\the\POE@cnt}% - \else\ifnum\POE@lastcomp<1 + \@tempcntb=\POE@cnt% + \else\ifnum\@tempcntb<\@ne \PackageWarning{pst-optexp}% - {Component ID \POE@lastcomp\space is not valid, setting to 1.}% - \def\POE@lastcomp{1}% + {Component ID \the\@tempcntb\space is not valid, setting to 1.}% + \@tempcntb=\@ne \fi\fi \fi }% \def\POE@getlastcomp#1-{% \ifx\@empty#1\relax - \ifnum\POE@firstcomp>\the\POE@cnt\relax - \PackageError{pst-optexp}{All components \POE@firstcomp- out of range.}% + \ifnum\@tempcnta>\POE@cnt + \PackageError{pst-optexp}{All components \the\@tempcnta- out of range.}% \fi - \edef\POE@lastcomp{\the\POE@cnt}% + \@tempcntb=\POE@cnt \else - \edef\POE@lastcomp{#1}% + \@tempcntb=#1 \fi }% \def\POE@getcomps#1#2{% - \ifx\POE@key@conn\@empty - \def\POE@aftercomps{\addto@pscode{#1 \POE@comps }#2}% - \else - \def\POE@aftercomps{#2}% - \fi + \def\POE@aftercomps{\addto@pscode{#1 \POE@comps }#2}% \def\POE@comps{}% \POE@getcomps@i% }% @@ -2020,13 +2468,13 @@ \POE@getcomprange#1#2-\@nil \POE@getcomp{% (\POE@str@basicname@prefix\POE@str@basicname@default) - \POE@firstcomp\space\POE@lastcomp\space GetCompRange % + \the\@tempcnta\space\the\@tempcntb\space GetCompRange % }% \else\ifx-#1\relax \POE@getcomprange#1#2-\@nil \POE@getcomp{% (\POE@str@basicname@prefix\POE@str@basicname@default) - \POE@firstcomp\space\POE@lastcomp\space GetCompRange % + \the\@tempcnta\space\the\@tempcntb\space GetCompRange % }% \else \POE@checkcompname{#1#2}% @@ -2036,17 +2484,13 @@ }% \def\POE@getplanenode(#1){% \pst@@getcoor{#1}% - \ifx\POE@key@conn\@empty - \advance\POE@nodecnt by 1 - \POE@getcomp{% - {\pst@coor} {0 1} - (\POE@str@basicname@default N@\the\POE@nodecnt) - {\tx@UserCoor} NewTempNodeComp - (\POE@str@basicname@default N@\the\POE@nodecnt) - }% - \else - \POE@getcomp{{\pst@coor} }% - \fi + \advance\POE@nodecnt by 1 + \POE@getcomp{% + {\pst@coor} {0 1} + (\POE@str@basicname@default N@\the\POE@nodecnt) + {\tx@UserCoor} NewTempNodeComp + (\POE@str@basicname@default N@\the\POE@nodecnt) + }% }% \def\POE@getplanenode@i(#1){\POE@getplanenode(#1)\POE@getcomps@i}% \def\POE@getcomp#1{% @@ -2057,233 +2501,108 @@ \fi \edef\POE@comps{#1 \POE@comps}% }% -\def\POE@drawInternalConnections{% - \ifx\POE@key@conn\@empty - \POE@drawInternalConnectionsNew +\def\POE@normalizecomps#1{% + \def\POE@aftercomps{\expandafter#1\POE@comps}% + \def\POE@comps{}% + \POE@normalizecomps@i% +}% +\def\POE@normalizecomps@i{% + \@ifnextchar(%) + {\POE@normalizecomps@ii}% + {\POE@normalizecomps@iii} +}% +\def\POE@normalizecomps@ii(#1){% + \edef\POE@comps{\POE@comps{(#1)}}% + \POE@normalizecomps@i +}% +\def\POE@normalizecomps@iii{% + \@ifnextchar\bgroup{\POE@normalizecomps@iv}{\POE@aftercomps}% +}% +\def\POE@normalizecomps@iv#1{% + \def\POE@temp{#1\@empty}% + \expandafter\POE@normalizecomps@v\POE@temp\@nil +}% +\def\POE@normalizecomps@v#1#2\@nil{% + \edef\POE@temp{#1}% + \ifnum9<1#1\relax + \def\POE@tempa{1} + \else\ifx-#1\relax + \def\POE@tempa{1} + \else + \def\POE@tempa{0} + \fi\fi + \ifodd\POE@tempa + \POE@getcomprange#1#2-\@nil + \ifnum\@tempcnta<\@tempcntb \def\POE@rel{<}\def\POE@inc{\@ne}% + \else \def\POE@rel{>}\def\POE@inc{\m@ne}\fi + \advance\@tempcntb\POE@inc + \whiledo{\@tempcnta\POE@rel\@tempcntb}{% + \edef\POE@comps{\POE@comps{\the\@tempcnta}}% + \advance\@tempcnta\POE@inc + }% \else - \POE@drawInternalConnectionsOld + \edef\POE@comps{\POE@comps{#1#2}}% + \fi + \POE@normalizecomps@i% +}% +\def\POE@PresetWireConn{% + \ifPOE@startbox\else + \ifPOE@wirepresetin@ + \drawwire@{WireIn}(\oenodeRefA{}){} + \else\ifPOE@fiberin@ + \drawfiber@{FiberIn}(\oenodeRefA{}){} + \fi\fi + \fi + \ifPOE@endbox\else + \ifPOE@wirepresetout@ + \drawwire@{WireOut}{}(\oenodeRefB{}) + \else\ifPOE@fiberout@ + \drawfiber@{FiberOut}{}(\oenodeRefB{}) + \fi\fi \fi }% -\def\POE@drawPresetFibers{% - \ifPOE@endbox - \ifPOE@fiberpresetin@ - \drawfiber@{FiberIn}{(\oenodeRefA{})}{} - \fi - \else\ifPOE@startbox - \ifPOE@fiberpresetout@ - \drawfiber@{FiberOut}{}{(\oenodeRefB{})} - \fi - \else +\def\POE@PresetFiberConn{% + \ifPOE@startbox\else \ifPOE@fiberpresetin@ - \drawfiber@{FiberIn}{(\oenodeRefA{})}{} - \fi + \drawfiber@{FiberIn}(\oenodeRefA{}){} + \else\ifPOE@wirein@ + \drawwire@{WireIn}(\oenodeRefA{}){} + \fi\fi + \fi + \ifPOE@endbox\else \ifPOE@fiberpresetout@ - \drawfiber@{FiberOut}{}{(\oenodeRefB{})} - \fi - \fi\fi + \drawfiber@{FiberOut}{}(\oenodeRefB{}) + \else\ifPOE@wireout@ + \drawwire@{WireOut}{}(\oenodeRefB{}) + \fi\fi + \fi }% -\def\POE@drawInternalConnectionsNew{% +\def\POE@InternalConn{% \ifPOE@beam \ifPOE@endbox - \drawbeam[raytrace=false]{(\oenodeRefA{})}{} - \else\ifPOE@startbox - \drawbeam[raytrace=false]{}{(\oenodeRefB{})} - \else - \drawbeam[raytrace=false]{(\oenodeRefA{})}{}{(\oenodeRefB{})} - \fi\fi - \else\ifPOE@fiber@ - \ifPOE@endbox - \ifPOE@fiberin@ - \drawfiber@{FiberIn}{(\oenodeRefA{})}{} - \fi + \drawbeam[raytrace=false](\oenodeRefA{}){} \else\ifPOE@startbox - \ifPOE@fiberout@ - \drawfiber@{FiberOut}{}{(\oenodeRefB{})} - \fi + \drawbeam[raytrace=false]{}(\oenodeRefB{}) \else - \ifPOE@fiberin@ - \drawfiber@{FiberIn}{(\oenodeRefA{})}{} - \fi - \ifPOE@fiberout@ - \drawfiber@{FiberOut}{}{(\oenodeRefB{})} - \fi + \drawbeam[raytrace=false](\oenodeRefA{}){}(\oenodeRefB{}) \fi\fi - \fi\fi -}% -\def\POE@drawInternalConnectionsOld{% - \ifPOE@endbox - \@nameuse{\POE@connIn} \else - \ifPOE@fiber@ + \ifPOE@startbox\else \ifPOE@fiberin@ - \@nameuse{\POE@connIn} - \fi + \drawfiber@{FiberIn}(\oenodeRefA{}){} + \else\ifPOE@wirein@ + \drawwire@{WireIn}(\oenodeRefA{}){} + \fi\fi + \fi + \ifPOE@endbox\else \ifPOE@fiberout@ - \@nameuse{\POE@connOut} - \fi - \else - \ifPOE@connjoin - \def\POE@tempa{POE@conn@in@i}% - \ifx\POE@tempa\POE@connIn - \def\POE@tempb{POE@conn@out@o} - \ifx\POE@tempb\POE@connOut - \pscustom[style=Beam, linejoin=\POE@key@connjoin]{% - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}}% - \else\ifx\@empty\POE@connOut - \pscustom[style=Beam, linejoin=\POE@key@connjoin]{% - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}}% - \else - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}% - \fi\fi - \else - \def\POE@tempa{POE@conn@in@o}% - \ifx\POE@tempa\POE@connIn - \def\POE@tempb{POE@conn@out@o} - \ifx\POE@tempb\POE@connOut - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}% - \else\ifx\@empty\POE@connOut - \pscustom[style=Beam, linejoin=\POE@key@connjoin]{% - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}}% - \else - \pscustom[style=Beam, linejoin=\POE@key@connjoin]{% - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}}% - \fi\fi - \else - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}% - \fi - \fi - \else - \@nameuse{\POE@connIn}\@nameuse{\POE@connOut}% - \fi + \drawfiber@{FiberOut}{}(\oenodeRefB{}) + \else\ifPOE@wireout@ + \drawwire@{WireOut}{}(\oenodeRefB{}) + \fi\fi \fi \fi }% -\def\optexp@nodeA{\oenodeIn{}}% -\def\optexp@nodeB{\oenodeOut{}}% -\define@key[psset]{optexp}{connjoin}{% - \edef\POE@temp{#1}% - \ifnum\POE@temp<0 - \POE@connjoinfalse - \else\ifnum\POE@temp>2 - \POE@connjoinfalse - \else - \POE@connjointrue - \edef\POE@key@connjoin{\POE@temp} - \fi\fi -}% -\def\POE@key@conn{}% -\define@key[psset]{optexp}{conn}{% - \edef\POE@key@conn{#1}% - \expandafter\POE@psset@@conn\POE@key@conn\@empty-\@empty\@nil - \if@pst\else - \PackageError{pst-optexp}{Bad connection specification: #1}% - \fi -}% -\def\POE@psset@@conn#1-#2\@empty#3\@nil{% - \@psttrue - \def\POE@next##1,#1-##2,##3\@nil{\def\POE@temp{##2}}% - \expandafter\POE@next\POE@conntable,#1-#1,\@nil - \@ifundefined{POE@conn@in@\POE@temp}% - {\@pstfalse\def\POE@connIn{}}% - {\edef\POE@connIn{POE@conn@in@\POE@temp}}% - \@ifundefined{POE@conn@out@#2}% - {\@pstfalse\def\POE@connOut{}}% - {\def\POE@connOut{POE@conn@out@#2}}% -}% -\def\POE@connIn{}% -\def\POE@connOut{}% -\def\POE@conntable{,o-o,i-i,f-f}% -\def\POE@conn@out@{\ifPOE@insideobj\else\POE@conn@out@a\fi}% -\def\POE@conn@in@{\ifPOE@insideobj\else\POE@conn@in@a\fi}% -\def\POE@conn@in@o{% - \psline[style=Beam](\oenodeRefA{})(\optexp@nodeA)% -}% -\def\POE@conn@out@o{% - \psline[style=Beam](\optexp@nodeB)(\oenodeRefB{})% -}% -\def\POE@conn@in@f{% - \pccurve[% - angleA=!\POE@dict{/N@\oenodeRefA{} /N@\oenodeRefB{} SlopeAngle}, - angleB=!\POE@dict{/N@\oenodeRefB{} /N@\oenodeRefA{} SlopeAngle}, - style=FiberIn](\oenodeRefA{})(\optexp@nodeA)% -}% -\def\POE@conn@out@f{% - \pccurve[% - angleA=!\POE@dict{/N@\oenodeRefA{} /N@\oenodeRefB{} SlopeAngle}, - angleB=!\POE@dict{/N@\oenodeRefB{} /N@\oenodeRefA{} SlopeAngle}, - style=FiberOut](\optexp@nodeB)(\oenodeRefB{})% -}% -\def\POE@conn@in@i{% - \def\pst@par{style=Beam} - \begin@OpenObj - \addto@pscode{% - [%] - \pst@optexpdict - (\oenode{}{}) true GetInternalBeamNodesCompat - /N@\oenodeRefA{} @GetCenter - end - }% - \psline@ii -}% -\def\POE@conn@out@i{% - \def\pst@par{style=Beam} - \begin@OpenObj - \addto@pscode{% - [%] - \pst@optexpdict - /N@\oenodeRefB{} @GetCenter - (\oenode{}{}) true GetInternalBeamNodesCompat - end - }% - \psline@ii -}% -\def\POE@conn@in@a{% - dup xcheck not { - \POE@dict{1 GetInternalBeamNodeCompat} - } if - exec -}% -\def\POE@conn@in@A{% - dup xcheck not { - false \POE@dict{GetInternalBeamNodesCompat} % - } if - exec -}% -\def\POE@conn@in@b{% - dup xcheck not { - \POE@dict{(N) GetInternalBeamNodeCompat} - } if - exec -}% -\def\POE@conn@in@B{% - dup xcheck not { - true \POE@dict{GetInternalBeamNodesCompat} % - } if - exec -}% -\let\POE@conn@out@a\POE@conn@in@a -\let\POE@conn@out@A\POE@conn@in@B -\let\POE@conn@out@b\POE@conn@in@b -\let\POE@conn@out@B\POE@conn@in@A -\def\drawbeam@compat{% - \ifPOE@connjoin - \setkeys+[psset]{optexp}{linejoin=\POE@key@connjoin}% - \fi - \addto@pscode{[% ] - \POE@tempd\space - \@nameuse{\POE@connOut} - \POE@tempc\space - \@nameuse{\POE@connIn}}% - \psline@ii -\ignorespaces}% -\def\defShiftedNode(#1)(#2)#3{% - \PackageWarning{pst-optexp}{% - \string\defShiftedNode\space is deprecated,\MessageBreak - use \string\nodexn\space(pst-node) instead.}% - \pst@getcoor{#1}\pst@tempa% - \pst@getcoor{#2}\pst@tempb% - \pnode(! \pst@tempb \pst@tempa \POE@dict{VecAdd} \tx@UserCoor){#3}% -}% \def\POE@checkcompname#1{% \@expandtwoargs\in@{,#1,}{,\POE@complist,}% \ifin@\else @@ -2410,6 +2729,7 @@ NewOptexpFiberComp }% \ignorespaces}% +\let\newOptexpElecComp\newOptexpFiberComp \def\POE@compalias#1#2{% \POE@Verb{% /\oenode{}{#1} dup currentdict exch known { @@ -2474,7 +2794,6 @@ \POE@transformnode{\oenodeRefB{}}{\oenodeTrefB{}}% }% }% -\let\begin@OptexpFiberObj\begin@OptexpObj \let\POE@disablepos\relax \def\begin@OptexpTripole{% \begin@OptexpObj @@ -2523,12 +2842,6 @@ \@ifnextchar[%] {\POE@newdipole}{\POE@newdipole[]}% }% -\def\newOptexpDipoleNolabel{% - \PackageWarning{pst-optexp}{% - \string\newOptexpDipoleNolabel\space is deprecated,\MessageBreak - use \string\newOptexpDipole\space instead.}% - \newOptexpDipole -}% \def\newOptexpTripole{% \@ifnextchar[%] {\POE@newtripole}{\POE@newtripole[]}% @@ -2537,74 +2850,82 @@ \@ifnextchar[%] {\POE@newfiberdipole}{\POE@newfiberdipole[]}% }% -\def\POE@newdipole[#1]#2#3{% +\def\POE@newdipole[#1]#2{% + \@ifnextchar\bgroup + {\POE@newdipole@i[#1]{#2}}{\POE@newdipole@i[#1]{#2}{}}% +}% +\def\POE@newdipole@i[#1]#2#3{% \@ifundefined{#2@i}{% \@namedef{#2}{\pst@object{#2}}% \expandafter\def\csname #2@i\endcsname(##1)(##2){% \@ifnextchar\bgroup% - {\@nameuse{#2@i@}(##1)(##2)}% - {\@nameuse{#2@i@}(##1)(##2){}}% + {\@nameuse{#2@ii}(##1)(##2)}% + {\@nameuse{#2@ii}(##1)(##2){}}% }% - \expandafter\def\csname #2@i@\endcsname(##1)(##2)##3{% + \expandafter\def\csname #2@ii\endcsname(##1)(##2)##3{% \addbefore@par{#3}% \addafter@par{#1}% \begin@OptexpObj \ifPOE@backlayer \POE@regNodes{##1}{##2} - \POE@extnodealign \fi - \POE@drawcomponent[#2]{##3}{\@nameuse{#2@ii}} + \POE@drawcomponent{#2}{##3} \ifPOE@backlayer \POE@Verb{ (1) (N) (\oenode{}{}) CorrectDipoleIfc }% - \POE@drawInternalConnections + \@ifundefined{#2@conn}{\POE@InternalConn}{\@nameuse{#2@conn}}% \fi \end@OptexpDipole }% - \dipole@iimacro{#2}% + \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@dipole@nodes}}{}% }{% \PackageError{pst-optexp}{% dipole component '#2' already defined}% }% \ignorespaces}% -\def\POE@newfiberdipole[#1]#2#3{% +\def\POE@newfiberdipole[#1]#2{% + \@ifnextchar\bgroup + {\POE@newfiberdipole@i[#1]{#2}}{\POE@newfiberdipole@i[#1]{#2}{}}% +}% +\def\POE@newfiberdipole@i[#1]#2#3{% \@ifundefined{#2@i}{% \@namedef{#2}{\pst@object{#2}}% \expandafter\def\csname #2@i\endcsname(##1)(##2){% \@ifnextchar\bgroup% - {\@nameuse{#2@i@}(##1)(##2)}% - {\@nameuse{#2@i@}(##1)(##2){}}% + {\@nameuse{#2@ii}(##1)(##2)}% + {\@nameuse{#2@ii}(##1)(##2){}}% }% - \expandafter\def\csname #2@i@\endcsname(##1)(##2)##3{% + \expandafter\def\csname #2@ii\endcsname(##1)(##2)##3{% \addbefore@par{#3}% \addafter@par{#1}% - \begin@OptexpFiberObj + \begin@OptexpObj \ifPOE@backlayer \POE@regNodes{##1}{##2} - \POE@extnodealign \fi - \POE@drawcomponent[#2]{##3}{\@nameuse{#2@ii}} + \POE@drawcomponent{#2}{##3} \ifPOE@backlayer \POE@Verb{ (1) (N) (\oenode{}{}) CorrectDipoleIfc }% - \ifPOE@fiberpreset@ - \POE@drawPresetFibers - \fi + \POE@PresetFiberConn \fi \end@OptexpDipole }% - \fiberdipole@iimacro{#2}% + \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@fiberdipole@nodes}}{}% }{% \PackageError{pst-optexp}{% fiber dipole object '#2' already defined}% }% \ignorespaces}% -\def\POE@newtripole[#1]#2#3{% +\def\POE@newtripole[#1]#2{% + \@ifnextchar\bgroup + {\POE@newtripole@i[#1]{#2}}{\POE@newtripole@i[#1]{#2}{}}% +}% +\def\POE@newtripole@i[#1]#2#3{% \@ifundefined{#2@i}{% \@namedef{#2}{\pst@object{#2}}% \expandafter\def\csname #2@i\endcsname(##1)(##2)(##3){% - \@ifnextchar\bgroup{\@nameuse{#2@i@}(##1)(##2)(##3)}% - {\@nameuse{#2@i@}(##1)(##2)(##3){}}% + \@ifnextchar\bgroup{\@nameuse{#2@ii}(##1)(##2)(##3)}% + {\@nameuse{#2@ii}(##1)(##2)(##3){}}% }% - \expandafter\def\csname #2@i@\endcsname(##1)(##2)(##3)##4{% + \expandafter\def\csname #2@ii\endcsname(##1)(##2)(##3)##4{% \addbefore@par{#3}% \addafter@par{ref@angle=180,#1}% \begin@OptexpTripole @@ -2612,62 +2933,31 @@ \POE@calcNodes{##1}{##2}{##3}% \POE@regNodes{##1}{##3}% \fi - \POE@drawcomponent[#2]{##4}{\@nameuse{#2@ii}} + \POE@drawcomponent{#2}{##4} \ifPOE@backlayer - \POE@drawInternalConnections + \POE@InternalConn \fi \end@OptexpTripole }% - \tripole@iimacro{#2}% + \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@tripole@nodes}}{}% }{% \PackageError{pst-optexp}{% tripole object '#2' already defined}% }% \ignorespaces}% -\def\dipole@iimacro#1{% - \POE@iimacro{#1}{\dipole@nodes}% -\ignorespaces}% -\def\fiberdipole@iimacro#1{% - \POE@iimacro{#1}{\fiberdipole@nodes}% -\ignorespaces}% -\def\tripole@iimacro#1{% - \POE@iimacro{#1}{\tripole@nodes}% -\ignorespaces}% -\def\POE@iimacro#1#2{% - \@namedef{#1@ii}{% - \ifPOE@backlayer - \pnode(0,0){\oenodeCenter{}}% - \fi - \@ifundefined{#1@iii}{% - \ifPOE@backlayer - \@ifundefined{#1@nodes}{#2}{\@nameuse{#1@nodes}}% - \fi - \ifPOE@frontlayer - \@nameuse{#1@comp}% - \fi - }{% - \ifPOE@backlayer - \PackageWarning{pst-optexp}{% - Using #1@iii, please switch to the new\MessageBreak - interface system.}% - \@nameuse{#1@iii}% - \fi - }% - }% -\ignorespaces}% \def\optcoupler{\pst@object{optcoupler}}% \def\optcoupler@i(#1)(#2){% \@ifnextchar(%) - {\optcoupler@@i@(#1)(#2)}% - {\optcoupler@@i@(#1)(#1)(#2)(#2)}% + {\optcoupler@ii(#1)(#2)}% + {\optcoupler@ii(#1)(#1)(#2)(#2)}% }% -\def\optcoupler@@i@(#1)(#2)(#3)(#4){% +\def\optcoupler@ii(#1)(#2)(#3)(#4){% \@ifnextchar\bgroup% - {\optcoupler@i@(#1)(#2)(#3)(#4)}% - {\optcoupler@i@(#1)(#2)(#3)(#4){}}% + {\optcoupler@iii(#1)(#2)(#3)(#4)}% + {\optcoupler@iii(#1)(#2)(#3)(#4){}}% }% -\def\optcoupler@i@(#1)(#2)(#3)(#4)#5{% - \begin@OptexpFiberObj +\def\optcoupler@iii(#1)(#2)(#3)(#4)#5{% + \begin@OptexpObj \ifPOE@backlayer \ifx\POE@key@coupleralign\POE@str@top \pnode(#1){\oenodeRefA{}} @@ -2688,51 +2978,44 @@ \tx@UserCoor){\oenodeRefB{}} \fi\fi \fi - \POE@drawcomponent[optcoupler]{#5}{\@nameuse{optcoupler@ii}} + \POE@drawcomponent{optcoupler}{#5} \ifPOE@backlayer \POE@Verb{% (1) (3) (\oenode{}{}) CorrectDipoleIfc (2) (N) (\oenode{}{}) CorrectDipoleIfc }% - \ifPOE@fiberpreset@ - \ifPOE@fiberpresetin@ - \ifPOE@fiberpresetin@top - \drawfiber@{FiberIn1}[stopnode=1]{(#1)}% - {\POE@key@compname} - \fi - \ifPOE@fiberpresetin@bottom - \drawfiber@{FiberIn2}[stopnode=2]{(#2)}% - {\POE@key@compname} - \fi + \ifPOE@fiberpresetin@ + \ifPOE@fiberpresetin@top + \drawfiber@{FiberIn1}[stopnode=1](#1){} \fi - \ifPOE@fiberpresetout@ - \ifPOE@fiberpresetout@top - \drawfiber@{FiberOut1}[startnode=3]{\POE@key@compname}% - {(#3)} - \fi - \ifPOE@fiberpresetout@bottom - \drawfiber@{FiberOut2}[startnode=N]{\POE@key@compname}% - {(#4)} - \fi + \ifPOE@fiberpresetin@bottom + \drawfiber@{FiberIn2}[stopnode=2](#2){} + \fi + \fi + \ifPOE@fiberpresetout@ + \ifPOE@fiberpresetout@top + \drawfiber@{FiberOut1}[startnode=3]{}(#3) + \fi + \ifPOE@fiberpresetout@bottom + \drawfiber@{FiberOut2}[startnode=N]{}(#4) \fi \fi \fi \end@OptexpObj }% -\fiberdipole@iimacro{optcoupler}% \def\wdmsplitter{\pst@object{wdmsplitter}}% \def\wdmsplitter@i(#1)(#2){% \@ifnextchar(%) - {\wdmsplitter@@i@(#1)(#2)}% - {\wdmsplitter@@i@(#1)(#2)(#2)}% + {\wdmsplitter@ii(#1)(#2)}% + {\wdmsplitter@ii(#1)(#2)(#2)}% }% -\def\wdmsplitter@@i@(#1)(#2)(#3){% +\def\wdmsplitter@ii(#1)(#2)(#3){% \@ifnextchar\bgroup% - {\wdmsplitter@i@(#1)(#2)(#3)}% - {\wdmsplitter@i@(#1)(#2)(#3){}}% + {\wdmsplitter@iii(#1)(#2)(#3)}% + {\wdmsplitter@iii(#1)(#2)(#3){}}% }% -\def\wdmsplitter@i@(#1)(#2)(#3)#4{% - \begin@OptexpFiberObj +\def\wdmsplitter@iii(#1)(#2)(#3)#4{% + \begin@OptexpObj \ifPOE@backlayer \pnode(#1){\oenodeRefA{}} \ifx\POE@key@coupleralign\POE@str@top @@ -2747,44 +3030,39 @@ \tx@UserCoor){\oenodeRefB{}} \fi\fi \fi - \POE@drawcomponent[wdmsplitter]{#4}\wdmsplitter@ii + \POE@drawcomponent{wdmsplitter}{#4} \ifPOE@backlayer \POE@Verb{% (1) (2) (\oenode{}{}) CorrectDipoleIfc (1) (N) (\oenode{}{}) CorrectDipoleIfc }% - \ifPOE@fiberpreset@ - \ifPOE@fiberpresetin@ - \drawfiber@{FiberIn}[stopnode=1]{(#1)}{\POE@key@compname} + \ifPOE@fiberpresetin@ + \drawfiber@{FiberIn}[stopnode=1](#1){} + \fi + \ifPOE@fiberpresetout@ + \ifPOE@fiberpresetout@top + \drawfiber@{FiberOut1}[startnode=2]{}(#2) \fi - \ifPOE@fiberpresetout@ - \ifPOE@fiberpresetout@top - \drawfiber@{FiberOut1}[startnode=2]% - {\POE@key@compname}{(#2)} - \fi - \ifPOE@fiberpresetout@bottom - \drawfiber@{FiberOut2}[startnode=N]% - {\POE@key@compname}{(#3)} - \fi + \ifPOE@fiberpresetout@bottom + \drawfiber@{FiberOut2}[startnode=N]{}(#3) \fi \fi \fi \end@OptexpObj }% -\fiberdipole@iimacro{wdmsplitter}% \def\wdmcoupler{\pst@object{wdmcoupler}}% \def\wdmcoupler@i(#1)(#2){% \@ifnextchar(%) - {\wdmcoupler@@i@(#1)(#2)}% - {\wdmcoupler@@i@(#1)(#1)(#2)}% + {\wdmcoupler@ii(#1)(#2)}% + {\wdmcoupler@ii(#1)(#1)(#2)}% }% -\def\wdmcoupler@@i@(#1)(#2)(#3){% +\def\wdmcoupler@ii(#1)(#2)(#3){% \@ifnextchar\bgroup% - {\wdmcoupler@i@(#1)(#2)(#3)}% - {\wdmcoupler@i@(#1)(#2)(#3){}}% + {\wdmcoupler@iii(#1)(#2)(#3)}% + {\wdmcoupler@iii(#1)(#2)(#3){}}% }% -\def\wdmcoupler@i@(#1)(#2)(#3)#4{% - \begin@OptexpFiberObj +\def\wdmcoupler@iii(#1)(#2)(#3)#4{% + \begin@OptexpObj \ifPOE@backlayer \pnode(#3){\oenodeRefB{}} \ifx\POE@key@coupleralign\POE@str@top @@ -2799,93 +3077,88 @@ \tx@UserCoor){\oenodeRefA{}} \fi\fi \fi - \POE@drawcomponent[wdmcoupler]{#4}\wdmcoupler@ii + \POE@drawcomponent{wdmcoupler}{#4} \ifPOE@backlayer \POE@Verb{% (1) (N) (\oenode{}{}) CorrectDipoleIfc (2) (N) (\oenode{}{}) CorrectDipoleIfc }% - \ifPOE@fiberpreset@ - \ifPOE@fiberpresetout@ - \drawfiber@{FiberOut}[startnode=N]{\POE@key@compname}{(#3)} + \ifPOE@fiberpresetout@ + \drawfiber@{FiberOut}[startnode=N]{}(#3) + \fi + \ifPOE@fiberpresetin@ + \ifPOE@fiberpresetin@top + \drawfiber@{FiberIn1}[stopnode=1](#1){} \fi - \ifPOE@fiberpresetin@ - \ifPOE@fiberpresetin@top - \drawfiber@{FiberIn1}[stopnode=1]{(#1)}{\POE@key@compname} - \fi - \ifPOE@fiberpresetin@bottom - \drawfiber@{FiberIn2}[stopnode=2]{(#2)}{\POE@key@compname} - \fi + \ifPOE@fiberpresetin@bottom + \drawfiber@{FiberIn2}[stopnode=2](#2){} \fi \fi \fi \end@OptexpObj }% -\fiberdipole@iimacro{wdmcoupler}% \def\optcirculator{\pst@object{optcirculator}}% \def\optcirculator@i(#1)(#2)(#3){% \@ifnextchar\bgroup% - {\optcirculator@i@(#1)(#2)(#3)}% - {\optcirculator@i@(#1)(#2)(#3){}}% + {\optcirculator@ii(#1)(#2)(#3)}% + {\optcirculator@ii(#1)(#2)(#3){}}% }% -\def\optcirculator@i@(#1)(#2)(#3)#4{% - \addafter@par{ref@angle=180}% - \begin@OptexpFiberObj - \ifPOE@backlayer - \POE@regNodes{#1}{#2} - \ifx\POE@key@position\@empty - \ifx\POE@key@abspos\@empty - \POE@positionrefnodes - \pst@getcoor{#1}\POE@tempa% - \pst@getcoor{#2}\POE@tempc% - \pst@getcoor{#3}\POE@tempb% - \pnode(! \POE@dict{% - \POE@tempa \tx@UserCoor 2 copy 2 copy - \POE@tempc \tx@UserCoor 4 2 roll @ABVect - 2 copy 2 copy 10 4 roll - \POE@tempb \tx@UserCoor 6 -2 roll @ABVect - 4 2 roll tx@EcldDict begin Project end VecAdd - 2 copy 6 -2 roll -0.5 VecScale VecAdd - }){\oenode@RefA{}}% - \pnode(! \POE@dict{4 2 roll 0.5 VecScale VecAdd})% - {\oenode@RefB{}}% - \fi +\def\POE@calcCircRefNodes#1#2#3{% +\ifPOE@backlayer + \POE@regNodes{#1}{#2} + \ifx\POE@key@position\@empty + \ifx\POE@key@abspos\@empty + \POE@positionrefnodes + \pst@getcoor{#1}\POE@tempa% + \pst@getcoor{#2}\POE@tempc% + \pst@getcoor{#3}\POE@tempb% + \pnode(! \POE@dict{% + \POE@tempa \tx@UserCoor 2 copy 2 copy + \POE@tempc \tx@UserCoor 4 2 roll @ABVect + 2 copy 2 copy 10 4 roll + \POE@tempb \tx@UserCoor 6 -2 roll @ABVect + 4 2 roll tx@EcldDict begin Project end VecAdd + 2 copy 6 -2 roll -0.5 VecScale VecAdd + }){\oenode@RefA{}}% + \pnode(! \POE@dict{4 2 roll 0.5 VecScale VecAdd})% + {\oenode@RefB{}}% \fi \fi - \POE@drawcomponent[optcirculator]{#4}\optcirculator@ii + \fi +}% +\def\optcirculator@ii(#1)(#2)(#3)#4{% + \addafter@par{ref@angle=180}% + \begin@OptexpObj + \POE@calcCircRefNodes{#1}{#2}{#3}% + \POE@drawcomponent{optcirculator}{#4} \ifPOE@backlayer - \ifPOE@fiberpreset@ - \ifPOE@fiberpresetin@top - \drawfiber@{FiberIn}[stopnode=1]{(#1)}{\POE@key@compname} + \ifPOE@fiberpresetin@top + \drawfiber@{FiberIn}[stopnode=1](#1){} + \fi + \ifPOE@fiberpresetout@ + \ifPOE@fiberpresetout@top + \drawfiber@{FiberOut1}[startnode=N]{}(#2) \fi - \ifPOE@fiberpresetout@ - \ifPOE@fiberpresetout@top - \drawfiber@{FiberOut1}[startnode=N]% - {\POE@key@compname}{(#2)} - \fi - \ifPOE@fiberpresetout@bottom - \drawfiber@{FiberOut2}[startnode=2, fiberalign=center]% - {\POE@key@compname}{(#3)} - \fi + \ifPOE@fiberpresetout@bottom + \drawfiber@{FiberOut2}[startnode=2, fiberalign=center]{}(#3) \fi \fi \fi \end@OptexpObj }% -\fiberdipole@iimacro{optcirculator}% \def\fiberbox{\pst@object{fiberbox}}% \def\fiberbox@i(#1)(#2){% \@ifnextchar(%) - {\fiberbox@@i@(#1)(#2)}% - {\fiberbox@@i@(#1)(#2)()()}% + {\fiberbox@ii(#1)(#2)}% + {\fiberbox@ii(#1)(#2)()()}% }% -\def\fiberbox@@i@(#1)(#2)(#3)(#4){% +\def\fiberbox@ii(#1)(#2)(#3)(#4){% \@ifnextchar\bgroup% - {\fiberbox@i@(#1)(#2)(#3)(#4)}% - {\fiberbox@i@(#1)(#2)(#3)(#4){}}% + {\fiberbox@iii(#1)(#2)(#3)(#4)}% + {\fiberbox@iii(#1)(#2)(#3)(#4){}}% }% -\def\fiberbox@i@(#1)(#2)(#3)(#4)#5{% - \begin@OptexpFiberObj +\def\fiberbox@iii(#1)(#2)(#3)(#4)#5{% + \begin@OptexpObj \ifnum\POE@key@fiberboxcountin=1 \ifnum\POE@key@fiberboxcountout=1 \ifdim\POE@key@fiberboxheight pt=0pt @@ -2925,45 +3198,48 @@ }% \fi \fi - \POE@drawcomponent[fiberbox]{#5}\fiberbox@ii + \POE@drawcomponent{fiberbox}{#5} \ifPOE@backlayer \ifx\\#3#4\\% - \ifPOE@fiberpreset@ - \ifnum\POE@key@fiberboxcountin=1 - \ifPOE@fiberpresetin@ - \drawfiber@{FiberIn}{(#1)}{\POE@key@compname} - \fi - \fi - \ifnum\POE@key@fiberboxcountout=1 - \ifPOE@fiberpresetout@ - \drawfiber@{FiberOut}{\POE@key@compname}{(#2)} - \fi - \fi - \fi - \else - \ifPOE@fiberpreset@ + \ifnum\POE@key@fiberboxcountin=1 \ifPOE@fiberpresetin@ - \ifPOE@fiberpresetin@top - \drawfiber@{FiberIn1}{(#1)}{\POE@key@compname} - \fi - \ifPOE@fiberpresetin@bottom - \drawfiber@{FiberIn2}{(#2)}{\POE@key@compname} - \fi - \fi + \drawfiber@{FiberIn}(#1){} + \else\ifPOE@wirein@ + \drawwire@{WireIn}(#1){} + \fi\fi + \fi + \ifnum\POE@key@fiberboxcountout=1 \ifPOE@fiberpresetout@ - \ifPOE@fiberpresetout@top - \drawfiber@{FiberOut1}{\POE@key@compname}{(#3)} - \fi - \ifPOE@fiberpresetout@bottom - \drawfiber@{FiberOut2}{\POE@key@compname}{(#4)} - \fi - \fi + \drawfiber@{FiberOut}{}(#2) + \else\ifPOE@wireout@ + \drawwire@{WireOut}{}(#2) + \fi\fi \fi + \else + \ifPOE@fiberpresetin@top + \drawfiber@{FiberIn1}(#1){} + \else\ifPOE@wirein@top + \drawwire@{WireIn1}(#1){} + \fi\fi + \ifPOE@fiberpresetin@bottom + \drawfiber@{FiberIn2}(#2){} + \else\ifPOE@wirein@bottom + \drawwire@{WireIn2}(#2){} + \fi\fi + \ifPOE@fiberpresetout@top + \drawfiber@{FiberOut1}{}(#3) + \else\ifPOE@wireout@top + \drawwire@{WireOut1}{}(#3) + \fi\fi + \ifPOE@fiberpresetout@bottom + \drawfiber@{FiberOut2}{}(#4) + \else\ifPOE@wireout@bottom + \drawwire@{WireOut2}{}(#4) + \fi\fi \fi \fi \end@OptexpObj }% -\fiberdipole@iimacro{fiberbox}% \def\POE@calcNodes#1#2#3{{% \pst@getcoor{#1}\POE@tempa% \pst@getcoor{#2}\POE@tempb% @@ -2982,12 +3258,16 @@ \POE@Verb{% /@xref \POE@key@extnode@xref\space def /@yref \POE@key@extnode@yref\space def + /@@ang + \ifx\POE@key@innercompalign\POE@str@absolute + /N@\POE@refnodeA\space /N@\POE@refnodeB\space SlopeAngle + \else + 0 + \fi def }% -\ignorespaces}% -\def\POE@extnodealign{% \ifx\POE@key@extnodealign\POE@str@absolute \POE@Verb{% - /N@\oenodeRefA{} @GetCenter /N@\oenodeRefB{} @GetCenter + /N@\POE@refnodeA\space @GetCenter /N@\POE@refnodeB\space @GetCenter @ABVect exch dup 0 gt 3 1 roll 0 eq exch 0 lt and or { /RefFac -1 def } if @@ -3064,20 +3344,20 @@ \def\POE@putlabel#1{% \def\POE@temp{#1}% \ifx\POE@temp\@empty - \ifx\POE@key@labelref\POE@str@labelref@global + \ifx\POE@key@labelref\POE@str@global \nput[labelsep=\POE@key@labeloffset]% {\POE@key@labelangle}% {\oenodeCenter{}}% {\pnode(0,0){\oenodeLabel{}}}% \fi \else - \ifx\POE@key@labelref\POE@str@labelref@global + \ifx\POE@key@labelref\POE@str@global \nput[labelsep=\POE@key@labeloffset]% {\POE@key@labelangle}% {\oenodeCenter{}}% {\pnode(0,0){\oenodeLabel{}}% \rput[\POE@key@labelalign](0,0){\POE@key@labelstyle\oelabel{#1}}}% - \else\ifx\POE@key@labelref\POE@str@labelref@relgrav + \else\ifx\POE@key@labelref\POE@str@relgrav \rput[\POE@key@labelalign](\oenodeLabel{}){% \POE@key@labelstyle\oelabel{#1}}% \else\ifx\POE@key@labelref\POE@str@relative @@ -3114,55 +3394,49 @@ \fi\fi\fi \fi }% -\newOptexpDipole{lens}{}% -\newOptexpDipole{pinhole}{}% -\newOptexpDipole{crystal}{}% -\newOptexpDipole{polarization}{}% -\newOptexpDipole{optbox}{}% -\newOptexpDipole{optplate}{}% -\newOptexpDipole{optretplate}{}% -\newOptexpDipole[endbox]{optdetector}{}% -\newOptexpDipole{optdiode}{allowbeaminside=false}% -\newOptexpDipole{doveprism}{}% -\newOptexpDipole{glanthompson}{}% -\newOptexpTripole{mirror}{}% -\newOptexpTripole[ref@angle=-135]{beamsplitter}{}% -\newOptexpTripole{optgrating}{}% +\newOptexpDipole{lens} +\newOptexpDipole{pinhole} +\newOptexpDipole{crystal} +\newOptexpDipole{polarization} +\newOptexpDipole{optbox} +\newOptexpDipole{optplate} +\newOptexpDipole{optretplate} +\newOptexpDipole{optdetector}{position=end} +\newOptexpDipole{optdiode}{allowbeaminside=false} +\newOptexpDipole{doveprism} +\newOptexpDipole{glanthompson} +\newOptexpTripole{mirror} +\newOptexpTripole[ref@angle=-135]{beamsplitter} +\newOptexpTripole{optgrating} \def\optgrid{% \PackageWarning{pst-optexp}{% \string\optgrid\space is deprecated,\MessageBreak use \string\optgrating\space instead.}% \optgrating% }% -\newOptexpTripole[ref@angle=-135]{pentaprism}{}% -\newOptexpTripole[ref@angle=-135]{rightangleprism}{}% -\newOptexpTripole[ref@angle=-135]{optprism}{}% +\newOptexpTripole[ref@angle=-135]{pentaprism} +\newOptexpTripole[ref@angle=-135]{rightangleprism} +\newOptexpTripole[ref@angle=-135]{optprism} \def\optdipole{\pst@object{optdipole}} \def\optdipole@i(#1)(#2)#3{% \@ifnextchar\bgroup% - {\optdipole@i@(#1)(#2){#3}}% - {\optdipole@i@(#1)(#2){#3}{}}% + {\optdipole@ii(#1)(#2){#3}}% + {\optdipole@ii(#1)(#2){#3}{}}% }% -\def\optdipole@i@(#1)(#2)#3#4{% +\def\optdipole@ii(#1)(#2)#3#4{% + \addbefore@par{innercompalign=relative}% \begin@OptexpObj \ifPOE@backlayer \POE@regNodes{#1}{#2} - \POE@extnodealign \fi - \POE@drawcomponent[optdipole]{#4}{% - \ifPOE@backlayer - \pnode(!\POE@dict{@@x0 @@y0}){\oenodeCenter{}}% - \dipole@nodes - \fi - \ifPOE@frontlayer - #3 - \fi - }% + \def\optdipole@comp{\psrotate(0,0){!\POE@dict{@@ang}}{#3}}% + \POE@drawcomponent{optdipole}{#4} \ifPOE@backlayer - \POE@drawInternalConnections + \POE@InternalConn \fi \end@OptexpObj }% +\def\optdipole@nodes{\POE@dipole@nodes} \def\optdipole@ref{% \POE@setref{% /@@x \POE@key@optdipolewidth\space 0.5 mul def @@ -3172,29 +3446,24 @@ \def\opttripole{\pst@object{opttripole}} \def\opttripole@i(#1)(#2)(#3)#4{% \@ifnextchar\bgroup% - {\opttripole@i@(#1)(#2)(#3){#4}}% - {\opttripole@i@(#1)(#2)(#3){#4}{}}% + {\opttripole@ii(#1)(#2)(#3){#4}}% + {\opttripole@ii(#1)(#2)(#3){#4}{}}% }% -\def\opttripole@i@(#1)(#2)(#3)#4#5{% +\def\opttripole@ii(#1)(#2)(#3)#4#5{% \addafter@par{ref@angle=180} \begin@OptexpTripole \ifPOE@backlayer \POE@calcNodes{#1}{#2}{#3}% \POE@regNodes{#1}{#3}% \fi - \POE@drawcomponent{#5}{% - \ifPOE@backlayer - \tripole@nodes - \fi - \ifPOE@frontlayer - #4 - \fi - }% + \def\opttripole@comp{#4}% + \POE@drawcomponent{opttripole}{#5} \ifPOE@backlayer - \POE@drawInternalConnections + \POE@InternalConn \fi \end@OptexpTripole }% +\def\opttripole@nodes{\POE@tripole@nodes} \def\fibercollimator{\pst@object{fibercollimator}} \def\fibercollimator@i(#1)(#2){% \def\POE@tempa{#1}% @@ -3218,56 +3487,47 @@ }% \def\fibercollimator@v#1{% \addbefore@par{allowbeaminside=false}% - \begin@OptexpFiberObj + \begin@OptexpObj \ifPOE@backlayer \POE@regNodes{\POE@tempa}{\POE@tempb}% - \POE@extnodealign \fi - \POE@drawcomponent[fibercollimator]{#1}{% - \pnode(0,0){\oenodeCenter{}}% - \ifPOE@backlayer - \fibercollimator@nodes - \fi - \ifPOE@frontlayer - \fibercollimator@comp - \fi - }% + \POE@drawcomponent{fibercollimator}{#1} \ifPOE@backlayer \ifPOE@beam - \drawbeam{(\oenodeRefA{})}{\POE@key@compname} + \drawbeam(\oenodeRefA{}){} \fi - \ifPOE@fiberpreset@ - \ifPOE@fiberpresetout@ - \ifx\@empty\POE@tempc - \drawfiber{\POE@key@compname}{(\oenodeRefB{})} - \else\ifx\@empty\POE@tempd - \psbezier[style=FiberOut](\oenodeOut{})(\POE@tempb)% - (\POE@tempb)(\POE@tempc)% - \else - \psbezier[style=FiberOut](\oenodeOut{})(\POE@tempb)% - (\POE@tempc)(\POE@tempd)% - \fi\fi - \fi + \ifPOE@fiberpresetout@ + \ifx\@empty\POE@tempc + \drawfiber{}(\oenodeRefB{}) + \else\ifx\@empty\POE@tempd + \psbezier[style=FiberOut](\oenodeOut{})(\POE@tempb)% + (\POE@tempb)(\POE@tempc)% + \else + \psbezier[style=FiberOut](\oenodeOut{})(\POE@tempb)% + (\POE@tempc)(\POE@tempd)% + \fi\fi \fi \fi \end@OptexpObj }% \newOptexpFiberDipole{optfiber}{newOptComp={}} -\newOptexpFiberDipole{optamp}{} -\newOptexpFiberDipole{optmzm}{} +\newOptexpFiberDipole{optamp} +\newOptexpFiberDipole{optmzm} \newOptexpFiberDipole{optfilter}{allowbeaminside=false} -\newOptexpFiberDipole{polcontrol}{} -\newOptexpFiberDipole{optisolator}{} -\newOptexpFiberDipole{optfiberpolarizer}{} -\newOptexpFiberDipole{optswitch}{} -\newOptexpFiberDipole{fiberdelayline}{} -\def\POE@drawcomponent{% - \@ifnextchar[%] - {\POE@drawcomponent@i}{\POE@drawcomponent@i[]}% -}% -\def\POE@drawcomponent@i[#1]#2#3{% +\newOptexpFiberDipole{polcontrol} +\newOptexpFiberDipole{optisolator} +\newOptexpFiberDipole{optfiberpolarizer} +\newOptexpFiberDipole{optswitch} +\newOptexpFiberDipole{fiberdelayline} +\def\POE@drawcomponent#1#2{% \def\POE@comp{% - #3% + \ifPOE@backlayer + \pnode(!\POE@dict{@@x0 @@y0}){\oenodeCenter{}} + \@nameuse{#1@nodes} + \fi + \ifPOE@frontlayer + \@nameuse{#1@comp} + \fi \ifx\POE@key@extnode\@empty\else \ifPOE@backlayer \pnode(! \POE@dict{ @@ -3286,9 +3546,7 @@ \fi \fi }% - \ifx\\#1\\\else - \@ifundefined{#1@ref}{}{\@nameuse{#1@ref}}% - \fi + \@ifundefined{#1@ref}{}{\@nameuse{#1@ref}}% \begingroup \ifPOE@endbox \psset[optexp]{abspos={% @@ -3393,29 +3651,31 @@ }% \end@SpecialObj }% -\def\tripole@nodes{% +\def\POE@tripole@nodes{% \newOptexpComp{{0 0} {1 0} @@x neg @@x refl {PlainIfc} 1}% - \pnode(! \POE@dict{@@y0 @@x0}){\oenodeCenter{}} \ignorespaces}% -\def\dipole@nodes{% +\def\POE@dipole@nodes{% \newOptexpComp{% {@@x0 @@x sub 0} {0 1} @@y0 @@y sub @@y0 @@y add trans {PlainIfc} @@x 0 eq not { {@@x0 @@x add 0} {0 1} @@y0 @@y sub @@y0 @@y add trans {PlainIfc} } if \POE@key@n }% - \pnode(! \POE@dict{@@x0 @@y0}){\oenodeCenter{}} \ignorespaces}% -\def\fiberdipole@nodes{% +\def\POE@fiberdipole@nodes{% \newOptexpFiberComp{% {@@x0 @@x sub 0} @@x 0 eq not { {@@x0 @@x add 0} } if }% - \pnode(! \POE@dict{@@x0 @@y0}){\oenodeCenter{}} \ignorespaces}% +\let\POE@elecdipole@nodes\POE@fiberdipole@nodes +\def\POE@comp@rectangle{% + \psframe[dimen=outer](!\POE@dict{@@x neg @@y0 @@y sub})% + (!\POE@dict{@@x @@y0 @@y add})% +}% \def\mirror@ref{% \ifdim\POE@key@mirrorradius pt=0pt - \ifx\POE@key@mirrortype\POE@str@mirrortype@piezo + \ifx\POE@key@mirrortype\POE@str@piezo \POE@setref{/@@y0 \pst@number\psyunit def}% \bgroup \psset{style=PiezoMirror}% @@ -3426,13 +3686,13 @@ \egroup \else \POE@setref{/@@x \POE@key@mirrorwidth\space 0.5 mul def}% - \ifx\POE@key@mirrortype\POE@str@mirrortype@plain\else + \ifx\POE@key@mirrortype\POE@str@plain\else \POE@setref{\POE@key@mirrordepth\space 0.5 mul dup /@@y0 ED /@@y ED}% \fi \fi \else \POE@setref{/@@x \POE@key@mirrorwidth\space 0.5 mul def}% - \ifx\POE@key@mirrortype\POE@str@mirrortype@plain\else + \ifx\POE@key@mirrortype\POE@str@plain\else \POE@setref{\POE@key@mirrordepth\space 0.5 mul dup /@@y0 ED /@@y ED}% \fi \fi @@ -3450,7 +3710,7 @@ \POE@key@mirrorwidth\space -0.5 mul dup neg refl {CurvedIfc} }% \fi - \ifx\POE@key@mirrortype\POE@str@mirrortype@semitrans + \ifx\POE@key@mirrortype\POE@str@semitrans \ifx\POE@key@mirrorradiusB\@empty \ifdim\POE@key@mirrorradius pt=0pt \addto@pscode{% @@ -3487,6 +3747,7 @@ \addto@pscode{1 }% \end@CompIfc \fi + \pnode(0,0){\oenodeCenter{}} }% \def\mirror@comp{% \edef\@ht{% @@ -3502,7 +3763,7 @@ }% \ifdim\POE@key@mirrorradius pt=0pt \edef\@ht{\POE@key@mirrorwidth\space 0.5 mul }% - \ifx\POE@key@mirrortype\POE@str@mirrortype@piezo + \ifx\POE@key@mirrortype\POE@str@piezo \psframe[style=PiezoMirror, dimen=outer](! \@ht 4 div 0)% (! \@ht -4 div \@ht 2.5 div) @@ -3512,16 +3773,16 @@ (! \@ht 2 div \@ht 2 div)% (! \@ht 4 div \@ht) \fi - \else\ifx\POE@key@mirrortype\POE@str@mirrortype@extended + \else\ifx\POE@key@mirrortype\POE@str@extended \psframe[style=ExtendedMirror]% (! \@ht neg \POE@key@mirrordepth\space )% (! \@ht 0) - \else\ifx\POE@key@mirrortype\POE@str@mirrortype@semitrans + \else\ifx\POE@key@mirrortype\POE@str@semitrans \psframe[style=SemitransMirror]% (! \@ht neg \POE@key@mirrordepth\space )% (! \@ht 0) \fi\fi\fi - \ifx\POE@key@mirrortype\POE@str@mirrortype@semitrans + \ifx\POE@key@mirrortype\POE@str@semitrans \psline[linewidth=\POE@key@mirrorlinewidth]% (! \@ht neg 0)(! \@ht 0) \else @@ -3535,14 +3796,14 @@ \def\POE@temparc{arcn } \fi \ifodd - \ifx\POE@key@mirrortype\POE@str@mirrortype@extended 1 - \else\ifx\POE@key@mirrortype\POE@str@mirrortype@semitrans 1 + \ifx\POE@key@mirrortype\POE@str@extended 1 + \else\ifx\POE@key@mirrortype\POE@str@semitrans 1 \else 0 \fi\fi \bgroup - \ifx\POE@key@mirrortype\POE@str@mirrortype@extended + \ifx\POE@key@mirrortype\POE@str@extended \psset{style=ExtendedMirror} - \else\ifx\POE@key@mirrortype\POE@str@mirrortype@semitrans + \else\ifx\POE@key@mirrortype\POE@str@semitrans \psset{style=SemitransMirror} \fi\fi \begin@ClosedObj @@ -3736,7 +3997,7 @@ }% \def\beamsplitter@nodes{% \edef\@bs@wd{\POE@key@bssize\space 0.5 mul }% - \ifx\POE@key@bsstyle\POE@str@bsstyle@cube + \ifx\POE@key@bsstyle\POE@str@cube \newOptexpCompAmb{% {\@bs@wd 2 sqrt div neg dup} {-1 1} \@bs@wd neg \@bs@wd trans {PlainIfc} @@ -3750,20 +4011,20 @@ trans {PlainIfc} 3 \POE@key@n }% - \else\ifx\POE@key@bsstyle\POE@str@bsstyle@plate + \else\ifx\POE@key@bsstyle\POE@str@plate \newOptexpCompAmb{% {0 0} {1 0} \@bs@wd neg \@bs@wd trans {PlainIfc} 1 1 }% \fi\fi \ignorespaces}% \def\beamsplitter@comp{% \edef\@bs@wd{\POE@key@bssize\space 2.0 div }% - \ifx\POE@key@bsstyle\POE@str@bsstyle@cube + \ifx\POE@key@bsstyle\POE@str@cube \psline[arrows=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\POE@key@bsstyle\POE@str@bsstyle@plate + \else\ifx\POE@key@bsstyle\POE@str@plate \psline(! \@bs@wd neg 2 sqrt mul 0)(! \@bs@wd 2 sqrt mul 0) \fi\fi \ignorespaces}% @@ -3814,23 +4075,23 @@ \def\polarization@comp{% \edef\@sz{\POE@key@polsize\space 0.5 mul }% \psset{style=Polarization}% - \ifx\POE@key@poltype\POE@str@pol@polparallel + \ifx\POE@key@poltype\POE@str@parallel \psline[arrows=<->](! 0 \@sz neg)(! 0 \@sz) \fi - \ifx\POE@key@poltype\POE@str@pol@polperp + \ifx\POE@key@poltype\POE@str@perp \psdot(0,0) \pscircle[fillstyle=none](0,0){0.12} \fi - \ifx\POE@key@poltype\POE@str@pol@polmisc + \ifx\POE@key@poltype\POE@str@misc \psline[arrows=<->](! 0 \@sz neg)(! 0 \@sz) \psdot(0,0) \pscircle[fillstyle=none](0,0){0.12} \fi - \ifx\POE@key@poltype\POE@str@pol@polrcirc + \ifx\POE@key@poltype\POE@str@rcirc \psellipticarc[fillstyle=none, arrows=->]% (0,0)(! \@sz 2 div \@sz){20}{-20} \fi - \ifx\POE@key@poltype\POE@str@pol@pollcirc + \ifx\POE@key@poltype\POE@str@lcirc \psellipticarc[fillstyle=none, arrows=<-]% (0,0)(! \@sz 2 div \@sz){20}{-20} \fi @@ -3855,7 +4116,7 @@ \edef\@ht{\@ht \POE@key@gratingdepth\space sub }% \fi \edef\@step{\POE@key@gratingwidth\space\@cnt div }% - \ifx\POE@key@gratingtype\POE@str@gratingtype@blazed + \ifx\POE@key@gratingtype\POE@str@blazed \pscustom[linewidth=\POE@key@gratinglinewidth, linejoin=1]{% \psline[liftpen=1](! \@wd \@dp)(! \@wd \@ht)% (! \@wd neg \@ht)(! \@wd neg \@dp)% @@ -3868,7 +4129,7 @@ }% \closepath }% - \else\ifx\POE@key@gratingtype\POE@str@gratingtype@binary + \else\ifx\POE@key@gratingtype\POE@str@binary \pscustom[linewidth=\POE@key@gratinglinewidth, linejoin=1]{% \psline[liftpen=1](! \@wd \@dp)(! \@wd \@ht)% (! \@wd neg \@ht)(! \@wd neg \@dp)% @@ -3898,11 +4159,7 @@ /@@y \POE@key@optboxheight\space 0.5 mul def }% }% -\def\optbox@comp{% - \edef\@wd{\POE@key@optboxwidth\space 0.5 mul } - \edef\@ht{\POE@key@optboxheight\space 0.5 mul } - \psframe[dimen=outer](! \@wd neg \@ht neg)(! \@wd \@ht) -\ignorespaces}% +\let\optbox@comp\POE@comp@rectangle \def\optplate@ref{% \POE@setref{/@@y \POE@key@plateheight\space 0.5 mul def }% }% @@ -3920,22 +4177,22 @@ \POE@setref{% /@@y \POE@key@detsize\space 0.5 mul def /@@x \POE@key@detsize\space 0.5 mul - \ifx\POE@key@dettype\POE@str@dettype@round 0.5 mul\fi + \ifx\POE@key@dettype\POE@str@round 0.5 mul\fi \space def }% \fi }% \def\optdetector@nodes{% - \dipole@nodes - \ifx\POE@key@dettype\POE@str@dettype@round + \POE@dipole@nodes + \ifx\POE@key@dettype\POE@str@round \pnode(! \POE@dict{@@x0 @@x -0.2 mul add} 0){\oenodeCenter{}}% \fi }% \def\optdetector@comp{% - \ifx\POE@key@dettype\POE@str@dettype@round + \ifx\POE@key@dettype\POE@str@round \psellipticwedge(!\POE@dict{@@x0 @@x sub @@y0})% (!\POE@dict{@@x 2 mul @@y}){-90}{90}% - \else\ifx\POE@key@dettype\POE@str@dettype@diode + \else\ifx\POE@key@dettype\POE@str@diode \ifx\POE@key@detsize\@empty \ifdim\POE@key@detwidth pt<\POE@key@detheight pt \def\@sz{\POE@key@detwidth\space 0.5 mul }% @@ -3945,8 +4202,7 @@ \else \def\@sz{\POE@key@detsize\space 0.5 mul }% \fi - \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})% - (! \POE@dict{@@x @@y})% + \POE@comp@rectangle \bgroup \psset{style=DetectorStyle} \pspolygon(! \@sz -0.2 mul \@sz -0.4 mul)% @@ -3961,6 +4217,24 @@ \egroup \fi\fi \ignorespaces}% +\def\optdetector@conn{% + \ifPOE@startbox\else + \ifPOE@beam + \drawbeam[raytrace=false](\oenodeRefA{}){} + \else\ifPOE@fiberin@ + \drawfiber@{FiberIn}(\oenodeRefA{}){} + \else\ifPOE@wirein@ + \drawwire@{WireIn}(\oenodeRefA{}){} + \fi\fi\fi + \fi + \ifPOE@endbox\else + \ifPOE@wirepresetout@ + \drawwire@{WireOut}{}(\oenodeRefB{}) + \else\ifPOE@fiberout@ + \drawfiber@{FiberOut}{}(\oenodeRefB{}) + \fi\fi + \fi +}% \def\optretplate@ref{% \POE@setref{% /@@y \POE@key@plateheight\space 0.5 mul def @@ -3975,17 +4249,17 @@ \ignorespaces}% \def\optdiode@ref{% \POE@setref{% - \POE@key@optdiodesize\space 0.5 mul dup /@@y ED /@@x ED + \POE@key@optdiodesize\space 0.5 mul dup dup /@@y ED /@@x ED + 0.4 mul /@@sz ED }% }% \def\optdiode@comp{% - \edef\@sz{\POE@key@optdiodesize\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 \POE@clwh add \@sz 0.2 mul)% - (! \@sz 0.2 mul \POE@clwh add \@sz -0.2 mul) + \POE@comp@rectangle + \pspolygon(!\POE@dict{@@sz neg dup}) + (!\POE@dict{@@sz neg @@sz}) + (!\POE@dict{@@sz 0}) + \psline(!\POE@dict{@@sz \POE@clwh add @@sz})% + (!\POE@dict{@@sz \POE@clwh add @@sz neg}) \ignorespaces}% \def\doveprism@ref{% \POE@setref{/@@x \POE@key@doveprismwidth\space 0.5 mul def @@ -4005,15 +4279,14 @@ }% \ignorespaces}% \def\doveprism@comp{% - \edef\@ht{\POE@key@doveprismheight\space 0.5 mul }% - \edef\@wd{\POE@key@doveprismwidth\space 0.5 mul }% - \pspolygon(! \@wd neg \@ht neg)% - (! \@wd \@ht neg)% - (! \@wd \@ht 2 mul sub \@ht)% - (! \@ht 2 mul \@wd sub \@ht)% + \pspolygon(!\POE@dict{@@x neg @@y neg})% + (!\POE@dict{@@x @@y neg})% + (!\POE@dict{@@x @@y 2 mul sub @@y})% + (!\POE@dict{@@y 2 mul @@x sub @@y}) \ignorespaces}% \def\glanthompson@ref{% - \POE@setref{/@@x \POE@key@glanthompsonwidth\space 0.5 mul def + \POE@setref{% + /@@x \POE@key@glanthompsonwidth\space 0.5 mul def /@@y \POE@key@glanthompsonheight\space 0.5 mul def }% }% @@ -4085,14 +4358,28 @@ 0 \fi }% - \newOptexpComp{% - {\@sz -0.6 mul \@ang tan mul \@hshift neg} - {90 \@ang sub dup cos exch sin} - \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc} - {\@sz 0.6 mul \@ang tan mul \@hshift neg} - {90 \@ang add dup cos exch sin} - \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc} - \POE@key@n true }% + \def\POE@tempA{transmission}% + \ifx\POE@key@prismtype\POE@tempA + \newOptexpComp{% + {\@sz -0.6 mul \@ang tan mul \@hshift neg} + {90 \@ang sub dup cos exch sin} + \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc} + {\@sz 0.6 mul \@ang tan mul \@hshift neg} + {90 \@ang add dup cos exch sin} + \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc} + \POE@key@n true }% + \else + \newOptexpCompAmb{% + {\@sz -0.6 mul \@ang tan mul \@hshift neg} + {90 \@ang sub dup cos exch sin} + \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc} + {0 \@sz -0.4 mul \@hshift sub } {1 0} \@ang tan \@sz mul dup neg exch + trans {PlainIfc} + {\@sz 0.6 mul \@ang tan mul \@hshift neg} + {90 \@ang add dup cos exch sin} + \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc} + 2 \POE@key@n true }% + \fi \pnode(! 0 \@hshift neg){\oenodeCenter{}} }% \def\optprism@comp{% @@ -4148,20 +4435,24 @@ (! 0 \POE@dict{@htA @OEtrafo})% \ignorespaces}% \def\optfiber@ref{% - \POE@setref{/@@x \POE@key@fiberloopsep\space\POE@key@fiberloops\space - 1 sub mul 0.5 mul def }% + \POE@setref{% + /@@x \POE@key@fiberloopsep\space\POE@key@fiberloops\space + 1 sub mul 0.5 mul def + }% }% \def\optfiber@nodes{% \newOptexpFiberComp{{@@x neg 0} {@@x 0}}% \ignorespaces}% \def\optfiber@comp{% - \edef\@f@cnt{\POE@key@fiberloops\space}% - \edef\@f@r{\POE@key@fiberloopradius\space}% - \edef\@f@sep{\POE@key@fiberloopsep\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 + \pscustom[style=Fiber, arrows=-]{% + \multido{\i=0+1}{\POE@key@fiberloops}{% + \parametricplot[liftpen=1, plotpoints=100]{0}{1}{% + t 360 mul sin 1 t 360 mul cos sub + \POE@key@fiberloopradius\space dup 3 1 roll mul 3 1 roll mul + \POE@key@fiberloops\space 1 sub -2 div \i\space add + \POE@key@fiberloopsep\space mul add exch + }% + }% }% \ignorespaces}% \def\optmzm@ref{% @@ -4171,9 +4462,8 @@ }% }% \def\optmzm@comp{% - \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})% - (!\POE@dict{@@x @@y}) - \bgroup + \POE@comp@rectangle + \begingroup \ifPOE@usefiberstyle \psset{style=Fiber, arrows=-, ArrowInside=-} \fi @@ -4185,98 +4475,82 @@ (! \POE@dict{@@x 0.4 mul @@y -0.6 mul})% (! \POE@dict{@@x -0.4 mul @@y -0.6 mul})% (! \POE@dict{@@x} -0.7 mul 0)% - \egroup + \endgroup \ignorespaces}% - \def\optfilter@ref{% +\def\optfilter@ref{% \POE@setref{% \POE@key@filtersize\space 0.5 mul dup /@@y ED /@@x ED - /@@ang - \ifx\POE@key@innercompalign\POE@str@absolute - /N@\oenodeRefA{} /N@\oenodeRefB{} SlopeAngle \POE@key@angle sub - \else - \POE@key@filterangle - \fi def + \ifx\POE@key@innercompalign\POE@str@absolute\else + /@@ang \POE@key@filterangle\space def + \fi }% - }% -\let\optfilter@nodes\dipole@nodes +}% +\let\optfilter@nodes\POE@dipole@nodes \def\optfilter@comp{% - \edef\@sz{\POE@key@filtersize\space 0.5 mul }% - \def\filter@curve{% + \def\POE@filter@curve{% \parametricplot[plotstyle=curve,arrows=-]{-1}{1}{% - t \@sz mul 0.7 mul t Pi mul RadtoDeg - 90 add cos 0.2 \@sz mul mul}% + \POE@dict{@@x} dup t mul 0.7 mul exch t Pi mul RadtoDeg + 90 add cos 0.2 mul mul}% + }% + \def\POE@strike@line{% + \psline(!\POE@dict{@@x -0.3 mul @@y -0.15 mul})% + (!\POE@dict{@@x 0.3 mul @@y 0.15 mul}) }% - \psframe[dimen=outer](! \@sz neg dup)(! \@sz dup) + \POE@comp@rectangle \psrotate(\oenodeCenter{}){!\POE@dict{@@ang}}{% \psset{style=FilterStyle}% - \ifx\POE@key@filtertype\POE@str@filtertype@bandpass - \psline(! -0.3 \@sz mul -0.65 \@sz mul)% - (! 0.3 \@sz mul -0.35 \@sz mul)% - \psline(! -0.3 \@sz mul 0.35 \@sz mul)% - (! 0.3 \@sz mul 0.65 \@sz mul)% - \rput(! 0 -0.5 \@sz mul){\filter@curve} + \ifx\POE@key@filtertype\POE@str@bandpass + \rput(!\POE@dict{0 @@x -0.5 mul}){\POE@strike@line\POE@filter@curve} \rput(0, 0){% \ifPOE@usefiberstyle \psset{style=Fiber} \fi - \filter@curve} - \rput(! 0 0.5 \@sz mul){\filter@curve} - \else\ifx\POE@key@filtertype\POE@str@filtertype@bandstop - \psline(! -0.3 \@sz mul -0.15 \@sz mul)% - (! 0.3 \@sz mul 0.15 \@sz mul)% - \rput(! 0 -0.5 \@sz mul){% + \POE@filter@curve} + \rput(!\POE@dict{0 @@x 0.5 mul}){\POE@strike@line\POE@filter@curve} + \else\ifx\POE@key@filtertype\POE@str@bandstop + \begingroup \ifPOE@usefiberstyle \psset{style=Fiber} \fi - \filter@curve} - \rput(0, 0){\filter@curve} - \rput(! 0 0.5 \@sz mul){% - \ifPOE@usefiberstyle - \psset{style=Fiber} - \fi - \filter@curve} - \else\ifx\POE@key@filtertype\POE@str@filtertype@lowpass - \psline(! -0.3 \@sz mul -0.15 \@sz mul)% - (! 0.3 \@sz mul 0.15 \@sz mul)% - \psline(! -0.3 \@sz mul 0.35 \@sz mul)% - (! 0.3 \@sz mul 0.65 \@sz mul)% - \rput(! 0 -0.5 \@sz mul){% + \rput(!\POE@dict{0 @@x -0.5 mul}){\POE@filter@curve} + \rput(!\POE@dict{0 @@x 0.5 mul}){\POE@filter@curve} + \endgroup + \rput(0,0){\POE@strike@line\POE@filter@curve} + \else\ifx\POE@key@filtertype\POE@str@lowpass + \rput(!\POE@dict{0 @@x -0.5 mul}){% \ifPOE@usefiberstyle \psset{style=Fiber} \fi - \filter@curve} - \rput(0, 0){\filter@curve} - \rput(! 0 0.5 \@sz mul){\filter@curve} - \else\ifx\POE@key@filtertype\POE@str@filtertype@highpass - \psline(! -0.3 \@sz mul -0.15 \@sz mul)% - (! 0.3 \@sz mul 0.15 \@sz mul)% - \psline(! -0.3 \@sz mul -0.65 \@sz mul)% - (! 0.3 \@sz mul -0.35 \@sz mul)% - \rput(! 0 0.5 \@sz mul){% + \POE@filter@curve} + \rput(0, 0){\POE@strike@line\POE@filter@curve} + \rput(!\POE@dict{0 @@x 0.5 mul}){\POE@strike@line\POE@filter@curve} + \else\ifx\POE@key@filtertype\POE@str@highpass + \rput(!\POE@dict{0 @@x 0.5 mul}){% \ifPOE@usefiberstyle \psset{style=Fiber} \fi - \filter@curve} - \rput(0, 0){\filter@curve} - \rput(! 0 -0.5 \@sz mul){\filter@curve} + \POE@filter@curve} + \rput(0, 0){\POE@strike@line\POE@filter@curve} + \rput(!\POE@dict{0 @@x -0.5 mul}){\POE@strike@line\POE@filter@curve} \fi\fi\fi\fi }% \ignorespaces}% \def\optamp@ref{% - \POE@setref{/@@x \POE@key@optampwidth\space 0.5 mul def - /@@y \POE@key@optampheight\space 0.5 mul def - }% + \POE@setref{% + /@@x \POE@key@optampwidth\space 0.5 mul def + /@@y \POE@key@optampheight\space 0.5 mul def + }% }% \def\optamp@nodes{% \newOptexpFiberComp{{@@x neg 0} {@@x 0}}% }% \def\optamp@comp{% - \def\@wd{\POE@key@optampwidth\space 0.5 mul }% - \def\@ht{\POE@key@optampheight\space 0.5 mul }% - \pspolygon(! \@wd 0)(! \@wd neg \@ht)(! \@wd neg \@ht neg) -\ignorespaces}% + \pspolygon(!\POE@dict{@@x 0})% + (!\POE@dict{@@x neg @@y})% + (!\POE@dict{@@x neg @@y neg}) +}% \def\polcontrol@ref{% - \ifx\POE@key@polcontroltype\POE@str@polcontroltype@linear + \ifx\POE@key@polcontroltype\POE@str@linear \POE@setref{/@@x \POE@key@polcontrolsize\space 2 mul def}% \else \POE@setref{/@@x \POE@key@polcontrolsize\space 1.5 mul def}% @@ -4294,7 +4568,7 @@ \ifPOE@usefiberstyle \psset{style=Fiber, arrows=-, ArrowInside=-}% \fi - \ifx\POE@key@polcontroltype\POE@str@polcontroltype@linear + \ifx\POE@key@polcontroltype\POE@str@linear \multips(! -2 \@sz mul \@sz)(! 2 \@sz mul 0){3}{% \pscircle(0,0){\POE@key@polcontrolsize}% }% @@ -4315,11 +4589,10 @@ }% }% \def\optisolator@comp{% - \edef\@ht{\POE@key@isolatorheight\space 0.5 mul }% - \edef\@wd{\POE@key@isolatorwidth\space 0.5 mul }% - \psframe[dimen=outer](! \@wd neg \@ht neg)(! \@wd \@ht) - \psline[style=IsolatorArrow, - arrows=->](! \@wd neg 0.6 mul 0)(!\@wd 0.6 mul 0) + \POE@comp@rectangle + \psline[style=IsolatorArrow, arrows=->]% + (!\POE@dict{@@x neg 0.6 mul 0})% + (!\POE@dict{@@x 0.6 mul 0}) \ignorespaces}% \def\optfiberpolarizer@ref{% \POE@setref{% @@ -4328,10 +4601,8 @@ }% }% \def\optfiberpolarizer@comp{% - \edef\@ht{\POE@key@fiberpolheight\space 0.5 mul }% - \edef\@wd{\POE@key@fiberpolwidth\space 0.5 mul }% - \psframe[dimen=outer](! \@wd neg \@ht neg)(! \@wd \@ht) - \psline(! \@wd neg 0.2 mul \@ht neg)(!\@wd 0.2 mul \@ht) + \POE@comp@rectangle + \psline(!\POE@dict{@@x -0.2 mul @@y neg})(!\POE@dict{@@x 0.2 mul @@y}) \ignorespaces}% \def\optswitch@ref{% \POE@setref{% @@ -4340,8 +4611,7 @@ }% }% \def\optswitch@comp{% - \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})% - (! \POE@dict{@@x @@y})% + \POE@comp@rectangle \pstVerb{tx@Dict begin /@lw \POE@clw def end}% \bgroup \ifPOE@usefiberstyle @@ -4379,8 +4649,7 @@ \def\POE@tempA{#3\space}% }% \def\fiberdelayline@comp{% - \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})% - (! \POE@dict{@@x @@y}) + \POE@comp@rectangle \begingroup \psset{style=FdlArrow} \use@par @@ -4396,6 +4665,92 @@ (! \POE@dict{@@x 0.2 mul @@y 1.3 mul \@arrowshift VecAdd}) \endgroup \ignorespaces}% +\newOptexpDipole{optarrowcomp}{} +\def\optarrowcomp@ref{% + \POE@setref{% + \ifx\POE@key@arrowcompshape\POE@str@rectangle + /@@x \POE@key@arrowcompwidth\space 0.5 mul def + /@@y \POE@key@arrowcompheight\space 0.5 mul def + \else + \POE@key@arrowcompwidth\space\POE@key@arrowcompheight\space + min 0.5 mul dup /@@x ED /@@y ED + \fi + \POE@key@arrowcompangle\space dup 0 gt { + { dup 180 ge { 180 sub } { exit } ifelse } loop + } { + { dup 0 lt { 180 add } { exit } ifelse } loop + } ifelse dup /@arrowangle ED dup dup + @@y @@x atan gt exch @@y @@x neg atan lt and { + /@@dy @@y def + tan @@y exch div /@@dx ED + }{ + /@@dx @@x def + tan @@x mul /@@dy ED + } ifelse + }% +}% +\def\optarrowcomp@comp{% + \ifx\POE@key@arrowcompshape\POE@str@rectangle + \POE@comp@rectangle + \else + \pscircle(!\POE@dict{@@x0 @@y0}){!\POE@dict{@@x}} + \fi + \begingroup + \psset{style=ArrowCompStyle} + \use@par + \pst@expandafter\POE@get@yarrowscale{\psk@arrowscale}\@nil + \def\@arrowshift{% + \psk@arrowlength\space \psk@arrowsize\space + \pst@number\pslinewidth\space mul add mul + \POE@tempA mul + @arrowangle 2 copy cos mul 3 1 roll sin mul + \tx@UserCoor\space + }% + \ifx\POE@key@arrowcompshape\POE@str@rectangle + \psline(!\POE@dict{@@dx -1.5 mul @@dy -1.5 mul})% + (!\POE@dict{@@dx 1.3 mul @@dy 1.3 mul \@arrowshift VecAdd}) + \else + \psline(!\POE@dict{@arrowangle dup cos @@x -1.5 mul mul exch sin @@x -1.5 mul mul}) + (!\POE@dict{@arrowangle dup cos @@x 1.3 mul mul exch sin @@x 1.3 mul mul \@arrowshift VecAdd}) + \fi + \endgroup +\ignorespaces}% +\newOptexpDipole{optbarcomp}{} +\def\optbarcomp@ref{% + \POE@setref{% + \ifx\POE@key@barcompshape\POE@str@rectangle + /@@x \POE@key@barcompwidth\space 0.5 mul def + /@@y \POE@key@barcompheight\space 0.5 mul def + \else + \POE@key@barcompwidth\space\POE@key@barcompheight\space + min 0.5 mul dup /@@x ED /@@y ED + \fi + \POE@key@barcompangle\space dup 0 gt { + { dup 180 ge { 180 sub } { exit } ifelse } loop + } { + { dup 0 lt { 180 add } { exit } ifelse } loop + } ifelse dup /@barangle ED dup dup + @@y @@x atan gt exch @@y @@x neg atan lt and { + /@@dy @@y def + tan @@y exch div /@@dx ED + }{ + /@@dx @@x def + tan @@x mul /@@dy ED + } ifelse + }% +}% +\def\optbarcomp@comp{% + \ifx\POE@key@barcompshape\POE@str@rectangle + \POE@comp@rectangle + \psline[style=BarCompStyle](!\POE@dict{ @@dx neg @@dy neg })% + (!\POE@dict{@@dx @@dy}) + \else + \pscircle(!\POE@dict{@@x0 @@y0}){!\POE@dict{@@x}} + \psline[style=BarCompStyle]% + (!\POE@dict{@barangle dup cos @@x neg mul exch sin @@x neg mul}) + (!\POE@dict{@barangle dup cos @@x mul exch sin @@x mul}) + \fi +\ignorespaces}% \def\fiberbox@ref{% \POE@setref{% /@@x \POE@key@fiberboxwidth\space 0.5 mul def @@ -4429,42 +4784,51 @@ } for } }% -\def\fiberbox@comp{% - \psframe[dimen=outer](!\POE@dict{@@x neg @@y neg})(!\POE@dict{@@x @@y}) -}% +\let\fiberbox@comp\POE@comp@rectangle \def\optcoupler@nodes{% - \edef\@sep{\POE@key@couplersep\space 0.5 mul }% \newOptexpFiberComp{% - {@@x neg @@y0 \@sep add} - {@@x neg @@y0 \@sep sub} - {@@x @@y0 \@sep add} - {@@x @@y0 \@sep sub} }% + {@@x neg @@y0 @@sep add} + {@@x neg @@y0 @@sep sub} + {@@x @@y0 @@sep add} + {@@x @@y0 @@sep sub} }% \pnode(0,0){\oenodeCenter{}} }% \def\POE@coupler@ref{% \POE@setref{% - /@@y0 - \ifx\POE@key@coupleralign\POE@str@top - \POE@key@couplersep\space -0.5 mul - \else\ifx\POE@key@coupleralign\POE@str@bottom - \POE@key@couplersep\space 0.5 mul - \else - 0 - \fi\fi - def /@@x \POE@key@couplerwidth\space 0.5 mul def - \ifx\POE@key@couplertype\POE@str@couplertype@none - \POE@key@couplersep + \ifx\POE@key@couplertype\POE@str@none + \ifx\POE@key@couplersep\@empty + /@@y \POE@key@couplerheight\space 0.5 mul 0.05 0.2 0.8 mul div mul def + \else + /@@y \POE@key@couplersep\space 0.5 mul def + \fi + /@@sep @@y def \else - \POE@key@couplerheight\space 0.5 mul + /@@y \POE@key@couplerheight\space 0.5 mul def + \ifx\POE@key@couplersep\@empty + \ifx\POE@key@couplertype\POE@str@ellipse + /@@sep @@y 0.05 0.2 0.8 mul div mul def + \else + /@@sep @@y 0.5 mul def + \fi + \else + /@@sep \POE@key@couplersep\space 0.5 mul def + \fi \fi - \space /@@y ED + /@@y0 @@sep + \ifx\POE@key@coupleralign\POE@str@bottom + \else\ifx\POE@key@coupleralign\POE@str@top + neg + \else + pop 0 + \fi\fi + def }% }% \let\optcoupler@ref\POE@coupler@ref \def\wdmcoupler@ref{% \POE@coupler@ref - \ifx\POE@key@couplertype\POE@str@couplertype@none + \ifx\POE@key@couplertype\POE@str@none \ifx\POE@key@coupleralign\POE@str@center \POE@setref{/@@y 0 def }% \fi @@ -4472,27 +4836,26 @@ }% \let\wdmsplitter@ref\wdmcoupler@ref \def\optcoupler@comp{% - \ifx\POE@key@couplertype\POE@str@couplertype@none + \ifx\POE@key@couplertype\POE@str@none \psline[style=Fiber](\oenode{1}{})(\oenode{3}{}) \psline[style=Fiber](\oenode{2}{})(\oenode{N}{}) \fi \POE@coupler@comp }% \def\POE@coupler@comp{% - \ifx\POE@key@couplertype\POE@str@couplertype@none - \else\ifx\POE@key@couplertype\POE@str@couplertype@ellipse + \ifx\POE@key@couplertype\POE@str@none + \else\ifx\POE@key@couplertype\POE@str@ellipse \psellipse(! 0 \POE@dict{@@y0})(! \POE@dict{@@x @@y}) \else - \psframe[dimen=outer](!\POE@dict{@@x neg @@y0 @@y sub})% - (!\POE@dict{@@x @@y0 @@y add})% - \ifx\POE@key@couplertype\POE@str@couplertype@cross + \POE@comp@rectangle + \ifx\POE@key@couplertype\POE@str@cross \psline(! \POE@dict{@@x -0.5 mul @@y0 @@y 0.5 mul sub})% (! \POE@dict{@@x 0.5 mul @@y0 @@y 0.5 mul add})% \psline(! \POE@dict{@@x -0.5 mul @@y0 @@y 0.5 mul add})% (! \POE@dict{@@x 0.5 mul @@y0 @@y 0.5 mul sub})% \fi \fi\fi - \ifx\POE@key@couplertype\POE@str@couplertype@cross\else + \ifx\POE@key@couplertype\POE@str@cross\else \ifPOE@variable \begingroup \psset{style=VariableCoupler} @@ -4514,7 +4877,7 @@ }% \def\wdmcoupler@nodes{% \edef\@sep{\POE@key@couplersep\space 0.5 mul }% - \ifx\POE@key@couplertype\POE@str@couplertype@none + \ifx\POE@key@couplertype\POE@str@none \ifx\POE@key@coupleralign\POE@str@center \edef\@sep{0 }% \fi @@ -4526,7 +4889,7 @@ \pnode(0,0){\oenodeCenter{}} }% \def\wdmcoupler@comp{% - \ifx\POE@key@couplertype\POE@str@couplertype@none + \ifx\POE@key@couplertype\POE@str@none \ifx\POE@key@coupleralign\POE@str@top \psline[style=Fiber](\oenode{1}{})(\oenodeOut{}) \psline[style=Fiber]% @@ -4545,7 +4908,7 @@ }% \def\wdmsplitter@nodes{% \edef\@sep{\POE@key@couplersep\space 0.5 mul }% - \ifx\POE@key@couplertype\POE@str@couplertype@none + \ifx\POE@key@couplertype\POE@str@none \ifx\POE@key@coupleralign\POE@str@center \edef\@sep{0 }% \fi @@ -4557,7 +4920,7 @@ \pnode(0,0){\oenodeCenter{}} }% \def\wdmsplitter@comp{% - \ifx\POE@key@couplertype\POE@str@couplertype@none + \ifx\POE@key@couplertype\POE@str@none \ifx\POE@key@coupleralign\POE@str@top \psline[style=Fiber](\oenodeIn{})(\oenode{2}{}) \psline[style=Fiber](! \POE@dict{/N@\oenodeIn{} @GetCenter} @@ -4597,10 +4960,277 @@ {@@x 0} {0 1} 0 0 trans {PlainIfc} 1 }% }% \def\fibercollimator@comp{% - \def\@wd{\POE@key@fibercolwidth\space 0.5 mul }% - \def\@ht{\POE@key@fibercolheight\space 0.5 mul }% - \pspolygon(!\@wd neg \POE@clwh add \@ht neg)% - (!\@wd 0)(!\@wd neg \POE@clwh add \@ht) + \pspolygon(!\POE@dict{@@x neg \POE@clwh add @@y neg})% + (!\POE@dict{@@x 0})% + (!\POE@dict{@@x neg \POE@clwh add @@y}) +}% +\def\elecmixer{\pst@object{elecmixer}}% +\def\elecmixer@i(#1)(#2)(#3){% + \@ifnextchar\bgroup% + {\elecmixer@ii(#1)(#2)(#3)}% + {\elecmixer@ii(#1)(#2)(#3){}}% +}% +\def\elecmixer@ii(#1)(#2)(#3)#4{% + \addafter@par{ref@angle=180}% + \begin@OptexpObj + \POE@calcCircRefNodes{#1}{#2}{#3}% + \POE@drawcomponent{elecmixer}{#4} + \ifPOE@backlayer + \ifPOE@wirepresetin@top + \drawwire@{WireIn}[stopnode=1](#1){} + \else\ifPOE@fiberin@top + \drawfiber@{FiberIn}[stopnode=1](#1){} + \fi\fi + \ifPOE@wirepresetout@top + \drawwire@{WireOut1}[startnode=N]{}(#2) + \else\ifPOE@fiberout@top + \drawfiber@{FiberOut1}[startnode=N]{}(#2) + \fi\fi + \ifPOE@wirepresetout@bottom + \drawwire@{WireOut2}[startnode=2, wirealign=center]{}(#3) + \else\ifPOE@fiberout@bottom + \drawfiber@{FiberOut2}[starnode=2, fiberalign=center]{}(#3) + \fi\fi + \fi + \end@OptexpObj +}% +\def\elecmixer@ref{% + \POE@setref{\POE@key@elecmixersize\space 0.5 mul dup /@@x ED /@@y ED }% +}% +\def\elecmixer@nodes{% + \newOptexpElecComp{{@@x neg 0} {0 @@y neg} {@@x 0}}% +}% +\def\elecmixer@comp{% + \edef\@sz{\POE@key@elecmixersize\space 0.5 mul }% + \pscircle(0,0){! \@sz} + \psline(!\@sz 2 sqrt div neg dup)(!\@sz 2 sqrt div dup) + \psline(!\@sz 2 sqrt div dup neg exch)(!\@sz 2 sqrt div dup neg) +}% +\def\eleccoupler{\pst@object{eleccoupler}}% +\def\eleccoupler@i(#1)(#2){% + \@ifnextchar(%) + {\eleccoupler@ii(#1)(#2)}% + {\eleccoupler@ii(#1)(#1)(#2)(#2)}% +}% +\def\eleccoupler@ii(#1)(#2)(#3)(#4){% + \@ifnextchar\bgroup% + {\eleccoupler@iii(#1)(#2)(#3)(#4)}% + {\eleccoupler@iii(#1)(#2)(#3)(#4){}}% +}% +\def\eleccoupler@iii(#1)(#2)(#3)(#4)#5{% + \begin@OptexpObj + \ifPOE@backlayer + \ifx\POE@key@eleccoupleralign\POE@str@top + \pnode(#1){\oenodeRefA{}} + \pnode(#3){\oenodeRefB{}} + \else\ifx\POE@key@eleccoupleralign\POE@str@bottom + \pnode(#2){\oenodeRefA{}} + \pnode(#4){\oenodeRefB{}} + \else + \pst@getcoor{#1}\POE@tempa% + \pst@getcoor{#2}\POE@tempb% + \pnode(!\POE@tempa \POE@tempb + \POE@dict{VecAdd 0.5 VecScale} + \tx@UserCoor){\oenodeRefA{}} + \pst@getcoor{#3}\POE@tempa% + \pst@getcoor{#4}\POE@tempb% + \pnode(!\POE@tempa \POE@tempb + \POE@dict{VecAdd 0.5 VecScale} + \tx@UserCoor){\oenodeRefB{}} + \fi\fi + \fi + \POE@drawcomponent{eleccoupler}{#5} + \ifPOE@backlayer + \POE@Verb{% + (1) (3) (\oenode{}{}) CorrectDipoleIfc + (2) (N) (\oenode{}{}) CorrectDipoleIfc + }% + \ifPOE@wirepresetin@top + \drawwire@{WireIn1}[stopnode=1](#1){} + \else\ifPOE@fiberin@top + \drawfiber@{FiberIn1}[stopnode=1](#1){} + \fi\fi + \ifPOE@wirepresetout@top + \drawwire@{WireOut1}[startnode=3](#3){} + \else\ifPOE@fiberout@top + \drawfiber@{FiberOut1}[startnode=3](#3){} + \fi\fi + \ifx\POE@key@eleccouplertype\POE@str@directional + \ifx\POE@key@eleccouplerinput\POE@str@left + \ifPOE@wirepresetout@bottom + \drawwire@{WireOut2}[startnode=N](#4){} + \else\ifPOE@fiberout@bottom + \drawfiber@{FiberOut2}[startnode=N](#4){} + \fi\fi + \else + \ifPOE@wirepresetin@bottom + \drawwire@{WireIn2}[stopnode=2](#2){} + \else\ifPOE@fiberin@bottom + \drawfiber@{FiberIn2}[stopnode=2](#2){} + \fi\fi + \fi + \else + \ifPOE@wirepresetout@bottom + \drawwire@{WireOut2}[startnode=N](#4){} + \else\ifPOE@fiberout@bottom + \drawfiber@{FiberOut2}[startnode=N](#4){} + \fi\fi + \ifPOE@wirepresetin@bottom + \drawwire@{WireIn2}[stopnode=2](#2){} + \else\ifPOE@fiberin@bottom + \drawfiber@{FiberIn2}[stopnode=2](#2){} + \fi\fi + \fi + \fi + \end@OptexpObj +}% +\def\eleccoupler@ref{% + \POE@setref{% + /@@x \POE@key@eleccouplerwidth\space 0.5 mul def + /@@y \POE@key@eleccouplerheight\space 0.5 mul def + \ifx\POE@key@eleccouplersep\@empty + /@@sep @@y 0.75 mul def + \else + /@@sep \POE@key@eleccouplersep\space 0.5 mul def + \fi + /@@y0 @@sep + \ifx\POE@key@eleccoupleralign\POE@str@bottom + \else\ifx\POE@key@eleccoupleralign\POE@str@top + neg + \else + pop 0 + \fi\fi + def + }% +}% +\def\eleccoupler@nodes{% + \newOptexpElecComp{% + {@@x neg @@y0 @@sep add} + {@@x neg @@y0 @@sep sub} + {@@x @@y0 @@sep add} + {@@x @@y0 @@sep sub} }% + \pnode(0,0){\oenodeCenter{}} +}% +\def\eleccoupler@comp{% + \POE@comp@rectangle + \psline(!\POE@dict{@@x -0.7 mul @@y0 @@sep sub @@y 0.15 mul add})% + (!\POE@dict{@@x 0.7 mul @@y0 @@sep add @@y 0.15 mul sub})% + \psline(!\POE@dict{@@x 0.7 mul @@y0 @@sep sub @@y 0.15 mul add})% + (!\POE@dict{@@x -0.7 mul @@y0 @@sep add @@y 0.15 mul sub})% + \psline[style=Wire, arrows=-, ArrowInside=-](\oenodeIfc{1}{})(\oenodeIfc{3}{}) + \ifx\POE@key@eleccouplertype\POE@str@directional + \ifx\POE@key@eleccouplerinput\POE@str@left + \psline[style=Wire, arrows=-, ArrowInside=-]([Xnodesep=-0.1]\oenodeIfc{2}{})(\oenodeIfc{N}{}) + \else + \psline[style=Wire, arrows=-, ArrowInside=-](\oenodeIfc{2}{})([Xnodesep=0.1]\oenodeIfc{N}{}) + \fi + \pscustom[style=OptComp]{% + \moveto(!\POE@dict{@@x 0.15 add + \ifx\POE@key@eleccouplerinput\POE@str@left neg \fi + @@y0 @@sep sub 0.14 add}) + \rlineto(0,-0.04) + \multido{\rx=0.12+-0.08}{4}{% + \rlineto(0.05,-0.02) + \rlineto(-0.1,-0.04) + \rlineto(0.05,-0.02) + }% + \rlineto(0,-0.04) + }% + \else + \psline[style=Wire, arrows=-, ArrowInside=-](\oenodeIfc{2}{})(\oenodeIfc{N}{}) + \fi +}% +\def\newOptexpElecDipole{% + \@ifnextchar[%] + {\POE@newelecdipole}{\POE@newelecdipole[]}% +}% +\def\POE@newelecdipole[#1]#2{% + \@ifnextchar\bgroup + {\POE@newelecdipole@i[#1]{#2}}{\POE@newelecdipole@i[#1]{#2}{}}% +}% +\def\POE@newelecdipole@i[#1]#2#3{% + \@ifundefined{#2@i}{% + \@namedef{#2}{\pst@object{#2}}% + \expandafter\def\csname #2@i\endcsname(##1)(##2){% + \@ifnextchar\bgroup% + {\@nameuse{#2@ii}(##1)(##2)}% + {\@nameuse{#2@ii}(##1)(##2){}}% + }% + \expandafter\def\csname #2@ii\endcsname(##1)(##2)##3{% + \addbefore@par{#3}% + \addafter@par{#1}% + \begin@OptexpObj + \ifPOE@backlayer + \POE@regNodes{##1}{##2} + \fi + \POE@drawcomponent{#2}{##3} + \ifPOE@backlayer + \POE@Verb{ (1) (N) (\oenode{}{}) CorrectDipoleIfc }% + \POE@PresetWireConn + \fi + \end@OptexpDipole + }% + \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@elecdipole@nodes}}{}% + }{% + \PackageError{pst-optexp}{% + elecdipole component '#2' already defined}% + }% +\ignorespaces}% +\newOptexpElecDipole{elecsynthesizer}{position=start, innercompalign=absolute} +\def\elecsynthesizer@ref{% + \POE@setref{% + \POE@key@synthwidth\space 0.5 mul + \POE@key@synthheight\space 0.5 mul + 2 copy min /@@sz ED + \ifx\POE@key@synthshape\POE@str@circle + pop pop @@sz dup + \fi + /@@y ED /@@x ED + }% +}% +\def\elecsynthesizer@comp{% + \ifx\POE@key@synthshape\POE@str@circle + \pscircle(!\POE@dict{@@x0 @@y0}){!\POE@dict{@@x}} + \else + \POE@comp@rectangle + \fi + \psrotate(\oenodeCenter{}){!\POE@dict{@@ang}}{% + \psset{style=SynthStyle}% + \begingroup + \let\POE@tempA\@empty + \let\POE@tempB\@empty + \ifdim\psxunit<0pt + \psset{xunit=-\psxunit} + \def\POE@tempA{-1 mul\space}% + \fi + \ifdim\psyunit<0pt + \psset{yunit=-\psyunit} + \def\POE@tempB{-1 mul\space}% + \fi + \ifx\POE@key@synthtype\POE@str@sine + \parametricplot[plotpoints=100]{-1}{1}{% + \POE@dict{@@sz 0.7 mul t mul t 180 mul \POE@tempA sin @@y -0.35 mul mul \POE@tempB }}% + \else\ifx\POE@key@synthtype\POE@str@pulse + \psplot[plotpoints=100]{-0.25}{0.25}{2.7182818 x 0.04 div dup mul neg exp 0.3 mul 0.13 sub \POE@tempB}% + \fi\fi + \endgroup + \ifx\POE@key@synthtype\POE@str@rectangle + \psline(!\POE@dict{@@sz -0.7 mul @@sz -0.35 mul})% + (!\POE@dict{@@sz 0.7 mul -1 1 \POE@key@synthrectwidth\space sub 2 mul add mul @@sz -0.35 mul})% + (!\POE@dict{@@sz 0.7 mul -1 1 \POE@key@synthrectwidth\space sub 2 mul add mul @@sz 0.35 mul})% + (!\POE@dict{@@sz 0.7 mul @@sz 0.35 mul})% + (!\POE@dict{@@sz 0.7 mul @@sz -0.35 mul}) + \else\ifx\POE@key@synthtype\POE@str@sawtooth + \psline(!\POE@dict{@@sz -0.6 mul @@sz -0.4 mul})% + (!\POE@dict{@@sz 0.6 mul @@sz 0.4 mul})% + (!\POE@dict{@@sz 0.6 mul @@sz -0.4 mul}) + \else\ifx\POE@key@synthtype\POE@str@triangle + \psline(!\POE@dict{@@sz -0.6 mul @@sz -0.4 mul})% + (!\POE@dict{0 @@sz 0.4 mul})% + (!\POE@dict{@@sz 0.6 mul @@sz -0.4 mul}) + \else + \@ifundefined{elecsynthesizer@custom}{}{\elecsynthesizer@custom}% + \fi\fi\fi}% }% \endinput %% -- cgit v1.2.3