summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-06-28 22:22:09 +0000
committerKarl Berry <karl@freefriends.org>2013-06-28 22:22:09 +0000
commit7982c074840b844f8dcbfaf3eeb885a1c9216999 (patch)
treed3c1b42332e169fcd416e1ef769592c6f7e00c0f /Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
parentabf2c2731a05ca038cfbb771f3430be4481f76d8 (diff)
pst-optexp (9jun13)
git-svn-id: svn://tug.org/texlive/trunk@31015 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx')
-rw-r--r--Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx602
1 files changed, 510 insertions, 92 deletions
diff --git a/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx b/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
index 1edf01610ad..0447a1d2d4d 100644
--- a/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
+++ b/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
@@ -18,7 +18,7 @@
%<stylefile>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<stylefile>\ProvidesPackage{pst-optexp}
%<*stylefile>
- [2013/05/21 v4.1 Optical experimental setups with PSTricks]
+ [2013/06/07 v4.2 Optical experimental setups with PSTricks]
%</stylefile>
%
%<*driver>
@@ -107,17 +107,18 @@
moretexcs = [20]{lens, optbox, oenode, oenodeIn, oenodeExt, oenodeOut,
oenodeRefA, oenodeRefB, oenodeTrefA, oenodeTrefB, oenodeLabel,
oenodeRotref, oenodeBeam, oenodeBeamUp, oenodeBeamLow, oenodeCenter,
- oenodeIfc, oeBeamVec, oeBeamVecUp, oeBeamVecLow, optplate,
- optretplate, pinhole, crystal, optdetector, optdiode, doveprism,
- glanthompson, polarization, mirror, beamsplitter, optgrating,
- optprism, rightangleprism, pentaprism, optdipole, optripole,
- optfiber, optamp, optmzm, optfilter, polcontrol, optisolator,
- optswitch, fiberdelayline, optfiberpolarizer, fibercollimator,
- optcoupler, wdmcoupler, wdmsplitter, optcirculator, fiberbox,
- eleccoupler, elecsynthesizer, elecmixer, optarrowcomp, optbarcomp,
- drawbeam, drawwidebeam, drawfiber, drawwire, frontlayer, backlayer,
- newOptexpDipole, newOptexpTripole, newOptexpFiberDipole,
- newOptexpComp, newOptexpFiberComp, optplane},
+ oenodeIfc, oeBeamVec, oeBeamVecUp, oeBeamVecLow, oeBeamVecMedian,
+ oeBeamCenter, optplate, optretplate, pinhole, crystal, optdetector,
+ optdiode, doveprism, glanthompson, polarization, mirror,
+ beamsplitter, optgrating, optprism, rightangleprism, pentaprism,
+ optdipole, optripole, optfiber, optamp, optmzm, optfilter,
+ polcontrol, optisolator, optswitch, fiberdelayline,
+ optfiberpolarizer, fibercollimator, optcoupler, wdmcoupler,
+ wdmsplitter, optcirculator, fiberbox, eleccoupler, elecsynthesizer,
+ elecmixer, optarrowcomp, optbarcomp, drawbeam, drawwidebeam,
+ drawfiber, drawwire, frontlayer, backlayer, newOptexpDipole,
+ newOptexpTripole, newOptexpFiberDipole, newOptexpComp,
+ newOptexpFiberComp, optplane},
explpreset={%
pos=l, width=-99pt, hsep=5mm, overhang=\codeoverhang, varwidth,
vsep=\bigskipamount, rframe={}}, extendedchars=true
@@ -4063,7 +4064,7 @@
% \fi
\begin{LTXexample}[morekeywords={[21]prismtype}]
\begin{pspicture}(1.5,0.6)(5.1,2.2)
- \optprism[prismtype=reflective](0,1)(3,1.1)(6,1)
+ \optprism[prismtype=reflective](0,1)(3,0.9)(6,1)
\lens(1,2)(\oenodeIfc{2}{1})
\lens(\oenodeIfc{2}{1})(5,2)
\drawwidebeam[beamwidth=0.3, fillstyle=solid, fillcolor=green, opacity=0.3](1,2){2}{1}{3}(5,2)
@@ -6477,6 +6478,20 @@
% Note, that the orientation of «upper» and «lower» changed with version
% 3.3, for more details see \prettyref{sec:bwd-comp-3.3}.
% \fi
+%
+% \cmditem{oeBeamCenter}{num}
+%
+% \ifGERMAN Damit erhält man die Mitte zwischen oberem und unterem
+% Endknoten, die Koordinaten sind nur aus Postscript-Ebene verfügbar,
+% im Gegensatz zu \Lcs*{oenodeBeam*}, daher auch die an
+% \Lcs*{oeBeamVec*} angelehnte Nomenklatur. Ein Anwendungsbeispiel ist
+% \prettyref{ex:beamcenter}.
+% \fi
+% \ifENGLISH Get the mean of upper and lower beam node. The
+% coordinates are available only at Postscript level, in contrast to
+% the \Lcs*{oenodeBeam*} macros. For an example see
+% \prettyref{ex:beamcenter}.
+% \fi
% \end{ltxsyntax}
%
% \ifGERMAN
@@ -6553,18 +6568,18 @@
% \end{ltxsyntax}
%
% \ifGERMAN Bei den gespeicherten Werten handelt es sich um den
-% normierten Richtungsvektor des letzten Strahlsegments. Dieser ist im
+% normierten Richtungsvektor des letzten Strahlsegments, dieser ist nur
+% auf Postscript-Ebene verfügbar. Dieser Richtungsvektor ist im
% folgenden Beispiel in rot zu sehen. Im Gegensatz dazu wird mit
% \Lkeyword{savebeam} der Richtungsvektor gespeichert, der nach der
% letzten Grenzfläche gelten würde, also für einen nachfolgenden Strahl
% verwendet würde. Dieser ist im Beispiel in blau eingezeichnet.
% \fi
% \ifENGLISH The saved values are those of the normalized direction
-% vector of the last beam segment and is drawn in red in the next
-% example. In contrast to this, the vector saved with
-% \Lkeyword{savebeam} is that behind the last interface and would be
-% used for a following beam. This is shown in blue in the following
-% example.
+% vector of the last beam segment and are drawn in red in the next example. In contrast
+% to this, the vector saved with \Lkeyword{savebeam} is that behind the
+% last interface and would be used for a following beam. This is shown
+% in blue in the following example.
% \fi
% \iffalse
%<*ignore>
@@ -6642,8 +6657,38 @@
%</ignore>
% \fi
%
-% \ifGERMAN Ein weiteres Anwendungsbeispiel finden Sie in \prettyref{ex:glan-thompson}.\fi
-% \ifENGLISH For another example see \prettyref{ex:glan-thompson}.\fi
+% \begin{ltxsyntax}
+% \cmditem{oeBeamVecMedian}{num}
+% \ifGERMAN Der Mittelwert aus oberem und unterem Strahlvektor.\fi
+% \ifENGLISH The mean of upper and lower beam vector.\fi
+% \end{ltxsyntax}
+%
+% \iffalse
+%<*ignore>
+% \fi
+\begin{LTXexample}[caption={caption}, label={ex:beamcenter}]
+\begin{pspicture}(3.5,2.6)
+ \pnode(0,2){A}\pnode(1,2){B}\pnode(3,1){C}
+ \optprism(A)(B)(C)
+ \newpsstyle{Beam}{linestyle=none, fillstyle=solid, beamwidth=0.2, beamnodealign=vector}
+ \drawwidebeam[fillcolor=orange](A){}
+ \psset[optexp]{beampathskip=1}
+ \drawwidebeam[fillcolor=green, n=1.2, savebeam=2](A){}(C)
+ \drawwidebeam[fillcolor=red, n=1.4, savebeam=3](A){}(C)
+ \drawwidebeam[fillcolor=red!50!black, n=1.57, savebeam=4](A){}(C)
+ \multido{\i=2+1}{3}{%
+ \backlayer{%
+ \pnode(!\oeBeamCenter{\i}){Det\i}
+ \nodexn{(Det\i)-(!\oeBeamVecMedian{\i})}{Det\i'}}
+ \optdetector[detsize=0.4 0.4](Det\i')(Det\i)}
+\end{pspicture}
+\end{LTXexample}
+% \iffalse
+%</ignore>
+% \fi
+%
+% \ifGERMAN Weitere Anwendungsbeispiele sind \prettyref{ex:glan-thompson} und \prettyref{ex:wgm-pdc}.\fi
+% \ifENGLISH Further example are \prettyref{ex:glan-thompson} and \prettyref{ex:wgm-pdc}.\fi
%
%
% \ifGERMAN\section{Knotenübersicht}\fi
@@ -7474,10 +7519,17 @@
%
% \numitem[0]{beampathskip}
% \ifGERMAN
-% Überspringt \prm{num} Segmente am Anfang des Strahlengangs.
+% Überspringt \prm{num} Segmente am Anfang des Strahlengangs. Diese
+% Option beinflusst lediglich ab welchem Segment der Strahlgang
+% gezeichnet wird, das Raytracing beginnt immer noch an der ersten
+% Grenzfläche. Um das zu ändern können Sie \Lkeyword{startinsidecount}
+% verwenden.
% \fi
% \ifENGLISH
-% Skip \prm{num} segments at the beginning of the beam path.
+% Skip \prm{num} segments at the beginning of the beam path. This option
+% determines only at which segment the beam is drawn, the ray tracing
+% always starts at the first interface. To change this, see option
+% \Lkeyword{startinsidecount}.
% \fi
% \iffalse
%<*ignore>
@@ -7501,6 +7553,31 @@
% \iffalse
%</ignore>
% \fi
+%
+% \numitem[-1]{beampathcount}
+% \ifGERMAN
+% Anzahl der Strahlsegmente, die gezeichnet werden sollen. Werden am
+% Anfang Segmente mit \Lkeyword{beampathskip} übersprungen, so werden
+% diese nicht mitgezählt.
+% \fi
+% \ifENGLISH
+% Number of beam segments, which are drawn. Segments which are skipped
+% at the beam start with \Lkeyword{beampathskip} do not count.
+% \fi
+% \iffalse
+%<*ignore>
+% \fi
+\begin{LTXexample}[morekeywords = {[21]{beampathcount}}]
+\begin{pspicture}(3,2)
+ \pnode(0,2){A}\pnode(2,0.8){B}\pnode(4,2){C}
+ \optprism[compname=P, prismtype=reflective, prismangle=90](A)(B)(C)
+ \lens[abspos=1.33](\oenodeIfc{2}{P})(A)%
+ \drawwidebeam[beamwidth=0.2, beaminsidelast, beampathcount=4](A){2}{1}
+\end{pspicture}
+\end{LTXexample}
+% \iffalse
+%</ignore>
+% \fi
% \end{optionlist}
%
% \ifGERMAN\subsection{Interner Strahlengang}\fi
@@ -7667,28 +7744,69 @@
% \iffalse
%</ignore>
% \fi
+%
+% \numitem[-1]{startinsidecount}
+% \ifGERMAN
+% Anzahl der Segmente, die innerhalb der ersten Komponente verwendet
+% werden. Diese Option hat nur eine Wirkung, wenn
+% \Lkeyword{beaminsidefirst} oder \Lkeyword{startinside} auf \opt{true}
+% gesetzt sind.
+% \fi
+%
+% \numitem[-1]{stopinsidecount}
+% \ifGERMAN
+% Anzahl der Segmente, die innerhalb der letzten Komponente verwendet
+% werden. Diese Option hat nur eine Wirkung, wenn
+% \Lkeyword{beaminsidelast} oder \Lkeyword{stopinside} auf \opt{true}
+% gesetzt sind.
+% \fi
+% \iffalse
+%<*ignore>
+% \fi
+\begin{LTXexample}[morekeywords = {[21]{stopinsidecount, startinsidecout}}]
+\begin{pspicture}(4,2)
+ \pnode(0,2){A}\pnode(2,0.8){B}\pnode(4,2){C}
+ \optprism[compname=P, prismtype=reflective, prismangle=90](A)(B)(C)
+ \lens[abspos=1.33](\oenodeIfc{2}{P})(A)%
+ \lens[abspos=1.33](\oenodeIfc{2}{P})(C)%
+ \newpsstyle{Beam}{linestyle=none, fillstyle=solid}%
+ \drawwidebeam[fillcolor=green, beamwidth=0.2, beaminsidelast, stopinsidecount=1](A){2}{1}
+ \drawwidebeam[fillcolor=orange, beaminsidefirst, startinsidecount=1, loadbeam]{1}{3}(C)
+\end{pspicture}
+\end{LTXexample}
+% \iffalse
+%</ignore>
+% \fi
% \end{optionlist}
%
% \ifENGLISH\subsection{Connecting with nodes}\fi
% \ifGERMAN\subsection{Verbinden mit Knoten}\fi
%
% \ifENGLISH
-% As mentioned earlier in this chapter, beams can connect components also with
-% nodes. For raytracing you need in general a plane, which imposes some problems
-% when connecting with nodes. This is handled such, that a temporary plane is
-% constructed, which goes through the specified node and is perpendicular to the
-% connection between the node and the preceeding component. If a beam starts
-% with a node, the orientation is determined by the node and the following
-% component.
+% As mentioned earlier in this chapter, beams can connect components
+% also with nodes. For raytracing you need a plane, which can be created
+% automatically or manually in different ways.
% \fi
% \ifGERMAN
-% Wie vorher schon einmal erwähnt können Komponenten auch mit Knoten verbunden
-% werden. Für Raytracing wird in der Regel eine Ebene benötigt, was ein Problem
-% hinsichtlich der Knoten darstellt. Das wird so gehandhabt, das eine temporäre
-% Ebene definiert wird, die durch den Knoten verläuft und vertikal zur
-% Verbindung zwischen dem Knoten und der vorangegangenen Komponente steht. Fängt
-% ein Strahlengang mit einem Knoten an, so wird die Ausrichtung durch den Knoten
-% und die folgende Komponente bestimmt.
+% Wie vorher schon einmal erwähnt können Komponenten auch mit Knoten
+% verbunden werden. Für Raytracing wird in der Regel eine Ebene
+% benötigt, die auf unterschiedliche Weise automatisch oder manuell
+% erstellt werden kann.
+% \fi
+%
+% \begin{optionlist}
+% \choitem[connection]{beamnodealign}{vec, conn, vector, connection}
+% \ifENGLISH
+% This parameter controls the alignment of the automatically created
+% node interfaces. By default (\opt{connection}) the interface is
+% aligned perpendicular to the direct connection between node and the
+% previous interface node.
+% \fi
+% \ifGERMAN
+% Dieser Parameter bestimmt die Ausrichtung der automatisch erstellen
+% Grenzflächen. In der Voreinstellung (\opt{connection}) wird die Ebene
+% vertikal zur direkten Verbindung zwischen dem Knoten und dem
+% vorangegangenen Grenzflächenknoten ausgerichtet.
% \fi
% \iffalse
%<*ignore>
@@ -7701,22 +7819,87 @@
\drawbeam[beampos=\r](A){}(B)}
\end{pspicture}
\end{LTXexample}
+\begin{LTXexample}
+\begin{pspicture}(3,2)
+ \pnode(0,1){A}\pnode(3,1){B}
+ \lens[abspos=0.5](A)(B)
+ \addtopsstyle{Beam}{linecolor=black, fillstyle=solid, beamwidth=0.2, fillcolor=red, opacity=0.5, beaminside=false}
+ \multido{\r=-0.3+0.3}{3}{\drawwidebeam[beampos=\r](A){}(B)}
+\end{pspicture}
+\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
+% \ifGERMAN
+% Ist der Wert auf \opt{vector} gesetzt, dann wird die Ebene vertikal
+% zum einfallenden Strahlvektor ausgerichtet. Bei weiten Strahlen wird
+% der gemittelte Strahlenvektor (siehe \Lcs{oeBeamVecMedian}) als
+% Referenz verwendet. Beispiele in dem das sehr praktisch ist, sind
+% \prettyref{ex:beamcenter} und \prettyref{ex:wgm-pdc}.
+% \fi
% \ifENGLISH
-% This is very handy in many cases, but does not allow to rotate the node planes
-% and can give again problems with shifted and rotated components (see
-% \prettyref{sec:rotshift}).
-% For more flexibility, the package provides an «invisible» plane which can be
-% used for this purpose.
+% For a value \opt{vector}, the plane is aligned vertical to the
+% incoming beam vector. For wide beams the mean beam vector is used (see
+% \Lcs{oeBeamVecMedian}). Examples where this is very convenient are
+% \prettyref{ex:beamcenter} and \prettyref{ex:wgm-pdc}.
+% \fi
+% \iffalse
+%<*ignore>
+% \fi
+\begin{LTXexample}[morekeywords={[21]beamnodealign}]
+\begin{pspicture}(3,2)
+ \pnode(0,1){A}\pnode(3,1){B}
+ \lens[abspos=0.5](A)(B)
+ \addtopsstyle{Beam}{linecolor=black, fillstyle=solid, beamwidth=0.2, beamnodealign=vector, fillcolor=green, opacity=0.5, beaminside=false}
+ \multido{\r=-0.3+0.3}{3}{\drawwidebeam[beampos=\r](A){}(B)}
+\end{pspicture}
+\end{LTXexample}
+% \iffalse
+%</ignore>
+% \fi
+% \end{optionlist}
+%
+% \ifENGLISH
+% The automatic alignment is very handy in many cases, but does not
+% allow to rotate the node planes to a fixed angle and can give again
+% problems with shifted and rotated components (see
+% \prettyref{sec:rotshift}). In the following example the green beam is
+% with \Lkeyword{beamnodealign} set to \opt{vector}, for the red beam it
+% is set to \opt{connection}:
% \fi
% \ifGERMAN
-% Das ist in vielen Fällen sehr praktisch, kann aber wiederum unerwünschte
-% Ergebnisse bei gedrehten und verschobenen Komponenten ergeben und die
-% Ebenenausrichtung kann nicht beliebig gesetzt werden. Das kann mit einer
-% unsichtbaren Ebene erreicht werden, die mit \Lcomp{optplane} definiert wird.
+% Die automatische Ausrichtung ist in vielen Fällen sehr praktisch, kann
+% aber wiederum unerwünschte Ergebnisse bei gedrehten und verschobenen
+% Komponenten ergeben und die Ebenenausrichtung kann nicht beliebig
+% gesetzt werden. Im folgenden Beispiel ist beim grünen Strahl
+% \Lkeyword{beamnodealign} auf \opt{vector} gesetzt, bei dem roten
+% Strahl hingegen auf \opt{connection}:
+% \fi
+%
+% \hspace*{\fill}%
+% \begin{pspicture}(4,2.7)
+% \pnode(0,0.5){A}\pnode(4,0.5){B}
+% \lens[compshift=0.5, abspos=1, lens=1.5 1.5 2](A)(B)
+% \drawwidebeam[beamalign=absolute, linecolor=black, fillstyle=solid, beamwidth=0.6, fillcolor=green, opacity=0.5, beamnodealign=vector](A){}(B)
+% \rput[rb](4,0){\ttfamily vector}
+% \end{pspicture}
+% \hspace*{1cm}%
+% \begin{pspicture}(5,3)
+% \pnode(0,0.5){A}\pnode(4,0.5){B}
+% \lens[compshift=0.5, abspos=1, lens=1.5 1.5 2](A)(B)
+% \drawwidebeam[beamalign=absolute, linecolor=black, fillstyle=solid, beamwidth=0.6, fillcolor=red, opacity=0.5](A){}(B)
+% \rput[rb](5,0){\ttfamily connection}
+% \end{pspicture}
+% \hspace*{\fill}%
+%
+% \ifENGLISH
+% For more flexibility, the package provides an «invisible» plane which
+% can be used for this purpose.
+% \fi
+% \ifGERMAN
+% Das kann mit einer «unsichtbaren» Ebene erreicht werden, die mit
+% \Lcomp{optplane} definiert wird.
% \fi
%
% \begin{ltxsyntax}
@@ -8282,7 +8465,7 @@
% \fi
%
% \begin{optionlist}
-% \boolitem[true]{savebeam}
+% \choitem[true]{savebeam}{true,false,\prm{int}}
% \ifGERMAN Speichert die Endzustände, d.h. Endpunkte und Ausgangsvektoren,
% eines \nxLcs{draw*beam} Makros, vorangegangene Werte werden
% überschrieben. \Lcs{drawbeam} und \Lcs{drawwidebeam} werden getrennt
@@ -8298,7 +8481,7 @@
% is sufficient.
% \fi
%
-% \boolitem[false]{loadbeam}
+% \choitem[false]{loadbeam}{true,false,\prm{int}}
% \ifGERMAN Verwende den Endzustand (Punkte und Richtung) eines
% vorangegangenen Strahls als Anfangszustand. Der Parameter
% \Lkeyword{beamangle} kann verwendet werden um die Richtung relativ zu der
@@ -10948,6 +11131,40 @@
\end{pspicture}
\end{LTXexample}
+\begingroup
+\captionsetup[lstlisting]{format=poecaption}
+\begin{LTXexample}[pos=t, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\doiurl{10.1103/PhysRevLett.105.263904}}, label={ex:wgm-pdc}]]
+\begin{pspicture}(0.6,2.3)(6.8,7.8)
+\pnode(1,6){Laser}\pnode(1,5){M}
+\pnode(3,4){PR}\pnode(5,5){PT}\pnode(6,7){D1}
+\newpsstyle{Glass}{fillcolor=blue, fillstyle=solid, opacity=0.15, linecolor=blue!30!white}
+\begin{optexp}
+ \optbox[position=start, innerlabel, optboxwidth=1.8](Laser)(M){Nd:YAG}
+ \optprism[style=Glass, compname=P, prismtype=reflective, prismangle=90, label=1 135](M)(PR)(PT){\begin{tabular}{@{}c@{}}diamond\\ prism\end{tabular}}
+ \mirror(Laser)(M)(\oenodeIfc{2}{P})%
+ \lens[abspos=1.33, style=Glass](\oenodeIfc{2}{P})(M)%
+ \optprism[compname=PDet, style=Glass](\oenodeIfc{2}{P})(PT)(D1)%
+ \lens[abspos=1.33, style=Glass](\oenodeIfc{2}{P})(\oenodeOut{PDet})%
+ \newpsstyle{Beam}{linestyle=none, fillstyle=solid}%
+ \drawwidebeam[fillcolor=green, beamwidth=0.2, beaminsidelast, beampathcount=5]{1}{3}{4}{2}%
+ \drawwidebeam[fillcolor=orange, beaminsidefirst, startinsidecount=1, loadbeam, beaminsidelast]{2}{6}%
+ \psset{savebeam=false, loadbeam, beamnodealign=vector}%
+ \drawwidebeam[fillcolor=orange]{6}{5}%
+ \drawwidebeam[fillcolor=green, n=1.2, beampathskip=1, savebeam=2]{6}{5}(D1)
+ \drawwidebeam[fillcolor=red, beampathskip=1, n=1.4, savebeam=3]{6}{5}(D1)
+ \drawwidebeam[fillcolor=red!50!black, beampathskip=1, n=1.57, savebeam=4]{6}{5}(D1)
+ \multido{\i=2+1}{3}{%
+ \backlayer{%
+ \pnode(!\oeBeamCenter{\i}){Det\i}
+ \nodexn{(Det\i)-(!\oeBeamVecMedian{\i})}{Det\i'}}
+ \optdetector[detsize=0.6 0.5](Det\i')(Det\i)}
+\end{optexp}
+\pscircle[style=Glass]([offset=-0.5]\oenodeIfc{2}{P}){0.5}
+\rput[l]([offset=-0.5,Xnodesep=0.7]\oenodeIfc{2}{P}){WGM}
+\end{pspicture}
+\end{LTXexample}
+\endgroup
+
\begin{LTXexample}[pos=t, linerange={1-1}, caption={caption}]
\psset{unit=1.1, usefiberstyle=false}
@@ -11433,6 +11650,16 @@
% \rput[bl](0,0){\ttfamily\textbackslash optprism}
% \end{pspicture}%
% \hspace{\fill}%
+% \begin{pspicture}(3,1.5)
+% \pnode(0,1.5){A}\pnode(1.5,1){B}\pnode(3,1.5){C}
+% \optprism[prismtype=reflective](A)(B)(C)
+% \drawbeam[raytrace=false](A){}(C)
+% \psdot(\oenodeIn{})\uput[110](\oenodeIn{}){1}
+% \psdot(\oenodeOut{})\uput[70](\oenodeOut{}){N}
+% \psdot(\oenodeIfc{2}{})\uput[90](\oenodeIfc{2}{}){2}
+% \rput[tl](0,0.42){\ttfamily\begin{tabular}{@{}l@{}}\textbackslash optprism\\prismtype=reflective\end{tabular}}
+% \end{pspicture}%
+%
% \begin{pspicture}(3,1.5)
% \pnode(0,1){A}\pnode(2.5,1){B}\pnode(2.5,0){C}
% \optgrating(A)(B)(C)
@@ -11440,7 +11667,7 @@
% \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1, N}
% \rput[bl](0,0){\ttfamily\textbackslash optgrating}
% \end{pspicture}%
-%
+% \hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.7)
% \pnode(0,0.7){A}\pnode(3,0.7){B}
% \glanthompson[glanthompsonsize=1.8 1, glanthompsongap=0.2](A)(B)
@@ -11453,10 +11680,10 @@
% \rput[bl](0,-0.4){\ttfamily\textbackslash glanthompson}
% \end{pspicture}%
% \hspace{\fill}%
-% \showdipoleifc{optarrowcomp}\hspace{\fill}%
-% \showdipoleifc{optbarcomp}
-%
-% \noindent\begin{pspicture}(0,-0.5)(3,1.7)
+% \showdipoleifc{optarrowcomp}%
+%
+% \showdipoleifc{optbarcomp}\hspace{\fill}%
+% \begin{pspicture}(0,-0.5)(3,1.7)
% \pnode(0,0.7){A}\pnode(3,0.7){B}
% \optdipole[optdipolesize=1](A)(B){}
% \drawbeam(A){}(B)
@@ -11634,6 +11861,25 @@
% Version beachten müssen, und was sie bei älteren Dokumenten gegebenenfalls
% ändern müssen um mit der neuen Version korrekt zu funktionieren. \fi
%
+% \subsection{Version 4.2}\label{sec:bwd-comp-4.2}
+%
+% \begin{optionlist}
+% \poeitem{prismtype}
+% \ifGERMAN
+% Die in Version 4.1 eingeführte Option \Lkeyword{prismtype} benötigte
+% immer eine zusätzliche Drehung der Komponente um 180\textdegree. Das
+% entfällt nun, da die Komponentenausrichtung korrigiert wurde,
+% erfordert aber gegebenenfalls eine Korrektur von Skizzen, die mit
+% Version 4.1 erstellt wurden.
+% \fi
+% \ifENGLISH
+% The option \Lkeyword{prismtype}, introduced in version 4.1, always
+% needed an additional angle rotation of 180\textdegree. This is not
+% necessary anymore, the component behavior was corrected, but this may
+% require adjustment of drawings created with version 4.1.
+% \fi
+% \end{optionlist}
+%
% \subsection{Version 4.0}\label{sec:bwd-comp-4.0}
%
% \ifGERMAN Die Option \Lkeyword*{conn} und das alte, fehlerhafte
@@ -12050,6 +12296,19 @@
%
% \begin{changelog}
%\patchcmd{\release}{\setlength{\itemsep}{0pt}}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}}{}{}
+% \begin{release}{4.2}{2013-06-07}
+% \item Added option \opt{startinsidecount}\see{prm:startinsidecount}
+% \item Added option \opt{stopinsidecount}\see{prm:stopinsidecount}
+% \item Added option \opt{beampathcount}\see{prm:beampathcount}
+% \item Added option \opt{beamnodealign}\see{prm:beamnodealign}
+% \item Added \cs{oeBeamVecMedian}\see{cs:oeBeamVecMedian}
+% \item Added \cs{oeBeamCenter}\see{cs:oeBeamCenter}
+% \item Modified the orientation of a reflective \cs{optprism}\see{sec:bwd-comp-4.2}
+% \item Fixed bug of \cs{optprism} and \cs{rightangleprism} inside
+% an \env{optexp} environment.
+% \item Fixed bug of wrong \cs{rightangleprism} rotation in special cases.
+% \item Fixed buggy handling of multiple saved beams\see{prm:savebeam}
+% \end{release}
% \begin{release}{4.1}{2013-05-21}
% \item Added option \opt{prismtype}\see{prm:prismtype}
% \end{release}
@@ -12448,6 +12707,7 @@
\def\POE@str@center{center}
\def\POE@str@circle{circle}
\def\POE@str@closed{closed}
+\def\POE@str@connection{connection}
\def\POE@str@coupling{coupling}
\def\POE@str@cross{cross}
\def\POE@str@cube{cube}
@@ -12487,6 +12747,7 @@
\def\POE@str@top{top}
\def\POE@str@transmittive{transmittive}
\def\POE@str@triangle{triangle}
+\def\POE@str@vector{vector}
\def\POE@str@verbose{verbose}
% \end{macrocode}
%
@@ -13885,6 +14146,12 @@
}%
\define@boolkey[psset]{optexp}[POE@]{startinside}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{stopinside}[true]{}%
+\define@key[psset]{optexp}{startinsidecount}{%
+ \pst@checknum{#1}\POE@key@startinsidecount
+}
+\define@key[psset]{optexp}{stopinsidecount}{%
+ \pst@checknum{#1}\POE@key@stopinsidecount
+}
\define@boolkey[psset]{optexp}[POE@]{beaminsidefirst}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{beaminsidelast}[true]{}%
\define@choicekey+[psset]{optexp}{savebeampoints}%
@@ -13952,9 +14219,24 @@
\define@boolkey[psset]{optexp}[POE@]{forcebeaminside}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{raytrace}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{useNA}[true]{}%
+\define@choicekey+[psset]{optexp}{beamnodealign}%
+ [\val\nr]{vec, conn, vector, connection}%
+ {%
+ \ifcase\nr\relax
+ \let\POE@key@beamnodealign\POE@str@vector
+ \or
+ \let\POE@key@beamnodealign\POE@str@connection
+ \else
+ \def\POE@key@beamnodealign{#1}%
+ \fi
+ }%
+ {\PackageError{pst-optexp}{Unknown value '\val' for beamnodealign}}
\define@key[psset]{optexp}{beampathskip}{%
\pst@checknum{#1}\POE@key@beampathskip
}%
+\define@key[psset]{optexp}{beampathcount}{%
+ \pst@getint{#1}\POE@key@beampathcount
+}%
\define@choicekey+[psset]{optexp}{beamalign}%
[\val\nr]{rel,abs,relative,absolute}%
{%
@@ -13976,6 +14258,7 @@
\psset[optexp]{%
raytrace=true
,useNA=true
+ ,beamnodealign=connection
,startinside=false
,stopinside=false
,allowbeaminside=true
@@ -13994,6 +14277,9 @@
,beamdiv=0
,n=1.5
,beampathskip=0
+ ,beampathcount=-1
+ ,stopinsidecount=-1
+ ,startinsidecount=-1
,ArrowInsideMinLength=0.2
,ArrowInsideMaxLength=-1
}%
@@ -14454,7 +14740,7 @@
%
% \section{Layering}
% \begin{macrocode}
-\newenvironment{optexp}{\Collect@Body\POE@collect}{}
+\newenvironment{optexp}{\Collect@Body\POE@collect}{}%
\long\def\POE@collect#1{%
\psset[optexp]{optexpenv}
\global\POE@oldcnt=\POE@cnt
@@ -14677,11 +14963,23 @@
/beamdiv \POE@key@beamdiv\space def
/savebeampoints \POE@key@savebeampoints\space def
/savebeam \ifPOE@savebeam true \else false \fi def
- /beaminsidefirst \ifPOE@beaminsidefirst true \else false \fi def
- /beaminsidelast \ifPOE@beaminsidelast true \else false \fi def
+ /startinsidecount \POE@key@startinsidecount\space cvi def
+ startinsidecount 0 eq {
+ /beaminsidefirst false def
+ /startinside false def
+ } {
+ /beaminsidefirst \ifPOE@beaminsidefirst true \else false \fi def
+ /startinside \ifPOE@startinside true \else false \fi def
+ } ifelse
+ /stopinsidecount \POE@key@stopinsidecount\space cvi def
+ stopinsidecount 0 eq {
+ /beaminsidelast false def
+ /stopinside false def
+ } {
+ /beaminsidelast \ifPOE@beaminsidelast true \else false \fi def
+ /stopinside \ifPOE@stopinside true \else false \fi def
+ } ifelse
/beaminside \ifPOE@beaminside true \else false \fi def
- /startinside \ifPOE@startinside true \else false \fi def
- /stopinside \ifPOE@stopinside true \else false \fi def
/connectifc \ifPOE@raytrace false \else true \fi def
/beamalign
\ifx\POE@key@beamalign\POE@str@absolute\space
@@ -14690,7 +14988,9 @@
relative
\fi def
/beampathskip \POE@key@beampathskip\space def
+ \POE@key@beampathcount\space dup -1 gt { beampathskip add } if /beampathcount ED
/useNA \ifPOE@useNA true \else false \fi def
+ /aligntovector \ifx\POE@key@beamnodealign\POE@str@vector true \else false \fi def
}%
}%
% \end{macrocode}
@@ -15590,6 +15890,14 @@
\def\oeBeamVec#1{\POE@beamvec{}{#1}}%
\def\oeBeamVecUp#1{\POE@beamvec{Up}{#1}}%
\def\oeBeamVecLow#1{\POE@beamvec{Low}{#1}}%
+\def\oeBeamVecMedian#1{%
+ \oeBeamVecUp{#1} \oeBeamVecLow{#1} \POE@dict{VecAdd NormalizeVec}
+}%
+\def\oeBeamCenter#1{%
+ \psGetNodeCenter{\oenodeBeamUp{#1}} \oenodeBeamUp{#1}.x \oenodeBeamUp{#1}.y
+ \psGetNodeCenter{\oenodeBeamLow{#1}} \oenodeBeamLow{#1}.x \oenodeBeamLow{#1}.y
+ \POE@dict{VecAdd 0.5 VecScale}
+}%
% \end{macrocode}
% \end{macro}
%
@@ -17901,6 +18209,19 @@
%
% \subsubsection{optprism}
%
+% \begin{macro}{\optprism@ref}
+% \begin{macrocode}
+\def\optprism@ref{%
+ \ifPOE@backlayer
+ \POE@Verb{/OEangle\the\POE@cnt\space OEangle def }%
+ \fi
+ \ifPOE@frontlayer
+ \POE@Verb{/OEangle OEangle\the\POE@cnt\space def }%
+ \fi
+}%
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\optprism@nodes}
% \begin{macrocode}
\def\optprism@nodes{%
@@ -17917,19 +18238,30 @@
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}
- \ifx\POE@key@prismtype\POE@str@transmittive\else
- {0 \@sz -0.4 mul \@hshift sub }
- {1 0} \@ang tan \@sz mul dup neg exch refl {PlainIfc}
+ \begingroup
+ \ifx\POE@key@prismtype\POE@str@reflective
+ \pst@def{ScreenCoor}< \pst@number\psyunit neg mul exch \pst@number\psxunit mul exch >
\fi
- {\@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 }%
- \pnode(! 0 \@hshift neg){\oenodeCenter{}}
+ \pnode(! 0 \@hshift neg){\oenodeCenter{}}
+ \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}
+% \end{macrocode}
+% Need to change the order of the two interfaces on the stack and add an
+% additional interface.
+% \begin{macrocode}
+ \ifx\POE@key@prismtype\POE@str@reflective
+ 12 6 roll
+ {0 \@sz -0.4 mul \@hshift sub }
+ {1 0} \@ang tan \@sz mul dup neg exch refl {PlainIfc}
+ 12 6 roll
+ \fi
+ \POE@key@n true }%
+ \endgroup
}%
% \end{macrocode}
% \end{macro}
@@ -17950,9 +18282,10 @@
0
\fi
}%
- \pspolygon(! \@sz neg \@altan mul \@sz -0.4 mul \@hshift sub)
- (! \@sz \@altan mul \@sz -0.4 mul \@hshift sub)
- (! 0 \@sz 0.6 mul \@hshift sub)
+ \edef\POE@temp{\ifx\POE@key@prismtype\POE@str@reflective -1 mul \fi}%
+ \pspolygon(! \@sz neg \@altan mul \@sz -0.4 mul \@hshift sub \POE@temp)
+ (! \@sz \@altan mul \@sz -0.4 mul \@hshift sub \POE@temp)
+ (! 0 \@sz 0.6 mul \@hshift sub \POE@temp)
}%
% \end{macrocode}
% \end{macro}
@@ -17962,12 +18295,26 @@
% \begin{macro}{\rightangleprism@ref}
% \begin{macrocode}
\def\rightangleprism@ref{%
+ \ifPOE@backlayer
+ \POE@Verb{/OEangle\the\POE@cnt\space OEangle def }%
+ \fi
+ \ifPOE@frontlayer
+ \POE@Verb{/OEangle OEangle\the\POE@cnt\space def }%
+ \fi
\POE@setref{%
+ OEangle 0.5 mul
+ { x sin modA mul }
+ { OEangle x sub sin modB mul }
tx@EcldDict begin
- OEangle 0.5 mul
- { x sin modA mul }
- { OEangle x sub sin modB mul }
- NewtonSolving pop
+% \end{macrocode}
+% Need to redefine /ZeroEq locally, because 1e-6 is too low for
+% e.g. \cs{rightangleprism(2,2)(4,1)(2,0)}, which oscillates around \pm
+% 1.7e-6.
+% \begin{macrocode}
+ 10 dict begin
+ /ZeroEq { abs 5e-6 lt } bind def
+ NewtonSolving pop
+ end
end
/@htA exch def
OEangle 0.5 mul exch sub /dOEangle exch def
@@ -17976,6 +18323,7 @@
}%
% \end{macrocode}
% \end{macro}
+%
% \begin{macro}{\rightangleprism@nodes}
% \begin{macrocode}
\def\rightangleprism@nodes{%
@@ -20226,6 +20574,9 @@ tx@OptexpDict begin
exit
} if
(checked) DebugMsg
+ beampathcount 0 eq {
+ cleartomark mark exit
+ } if
% \end{macrocode}
% iterate over all planes
% \begin{macrocode}
@@ -20245,6 +20596,24 @@ tx@OptexpDict begin
{ relAngle } { 0 } ifelse connectInterfaces
/relAngle ED
} if
+% \end{macrocode}
+% Adjust the alignment of a node interface, if it is to be aligned
+% perpendicular to the beam vector (beamnodealign=vector).
+% \begin{macrocode}
+ CompName cvn load begin
+ currentdict /adjustRel known aligntovector and {
+ IfcNum IfcName load begin
+ currentdict /RX known not {
+% \end{macrocode}
+% Only exchange the coordinates of the beam vector, the sign is not
+% important for the interface vector.
+% \begin{macrocode}
+ 2 copy neg exch CM dtransform CompMtrx idtransform
+ /DY ED /DX ED
+ } if
+ end
+ } if
+ end
IfcNum CompName Mode n2 8 4 roll HandleInterface
missed eq {
counttomark PN 1 sub 3 mul sub {pop} repeat
@@ -20280,6 +20649,10 @@ tx@OptexpDict begin
Warning
exit
} if
+ beampathcount 1 add PN eq {
+ IfcCnt PN sub {pop} repeat
+ exit
+ } if
/PN PN 1 add def
} ifelse
} loop
@@ -20403,6 +20776,9 @@ tx@OptexpDict begin
PN IfcCnt gt {
exit
} if
+ beampathcount 0 eq {
+ cleartomark mark exit
+ } if
dup xcheck not {
% \end{macrocode}
% Found an array (not executable) instead of a procedure. This is an ambiguous
@@ -20429,6 +20805,34 @@ tx@OptexpDict begin
GetIfcCenter ToVec /CurrPCenter ED
/oldn1 n1 def
% \end{macrocode}
+% Adjust the alignment of a node interface, if it is to be aligned
+% perpendicular to the beam vector (beamnodealign=vector). The alignment
+% is carried out with the median vector of upper and lower beam.
+% \begin{macrocode}
+ CompName cvn load /adjustRel known aligntovector and {
+ connectifc PrevCorrect PN 2 gt and PN 2 eq or and {
+ CurrVecUp CurrVecUp CurrPCenter PrevPCenter PrevMode
+ currentdict /relAngleUp known { relAngleUp } { 0 } ifelse
+ connectInterfaces pop
+ CurrVecLow CurrVecLow CurrPCenter PrevPCenter PrevMode
+ currentdict /relAngleLow known { relAngleLow } { 0 } ifelse
+ connectInterfaces pop
+ } {
+ CurrVecUp CurrVecLow
+ } ifelse
+ VecAdd NormalizeVec
+ CompName cvn load begin
+ IfcNum IfcName load begin
+ currentdict /RX known not {
+ CM dtransform CompMtrx idtransform
+ /DX ED neg /DY ED
+ } {
+ pop pop
+ } ifelse
+ end
+ end
+ } if
+% \end{macrocode}
% Calculate new upper vector and intersection point
% \begin{macrocode}
CurrUp CurrVecUp
@@ -20537,13 +20941,14 @@ tx@OptexpDict begin
strokeBeam {
CurrUp draw CurrLow draw counttomark 1 add 6 roll
} if
- PN IfcCnt eq ret tir eq or {
+ PN IfcCnt eq ret tir eq or
+ beampathcount 1 add PN eq or {
DrawnSegm 0 gt currentdict /fillBeam known and {
fillBeam newpath
/DrawnSegm 0 def
} if
+ IfcCnt PN sub {pop} repeat
ret tir eq {
- IfcCnt PN sub {pop} repeat
(Total internal reflection occured, this is not supported)
Warning
} if
@@ -20561,9 +20966,6 @@ tx@OptexpDict begin
/DrawnSegm 0 def
} if
ret missed eq not {
- currentdict /lastVecTmpUp known currentdict /lastVecTmpLow known and dup {
- /lastVecTmpUp load /lastVecTmpLow load 3 -1 roll
- } if
% \end{macrocode}
% Check if Up and Low must be swapped for next beam. This depends both
% on the relative orientation (chirality) of the incoming beam vector
@@ -20596,9 +20998,7 @@ tx@OptexpDict begin
/lastVecTmpUp /CurrVecUp load def
/lastVecTmpLow /CurrVecLow load def
} ifelse
- not {
- /lastVecTmpUp load /lastVecTmpLow load
- } if
+ /lastVecTmpUp load /lastVecTmpLow load
/prevVecLow ED /prevVecUp ED
} if
DebugEnd
@@ -20865,14 +21265,16 @@ tx@OptexpDict begin
%
% \begin{macro}{AdjustRelRot}
% Adjusts the relative orientation of \PSstring{CompB} based on the
-% relative connection between \PSstring{CompA} and \PSstring{CompB}.
+% relative connection between \PSstring{CompA} and
+% \PSstring{CompB}. This is only done for ``node interfaces'', which
+% are created automatically when drawing beams through nodes.
% \begin{pssyntax}
% \PSstring{CompA} \PSvar{desc|asc} \PSstring{CompB} \PSvar{desc|asc} \PSop{AdjustRelRot}
% \end{pssyntax}
% \begin{macrocode}
/AdjustRelRot {
(AdjustRelRot) DebugBegin
- exch dup cvn load /adjustRel known {
+ exch dup cvn load /adjustRel known aligntovector not and {
dup dup 4 2 roll isAmbiguous {
exch pop (C)
}{
@@ -20955,13 +21357,29 @@ tx@OptexpDict begin
} {
1 1 1 N N
} ifelse
- first startinside not and {
+ first {
+ startinside not {
% \end{macrocode}
% first comp and we do not start inside
% \begin{macrocode}
- 5 -2 roll
- pop pop
- 2 copy 5 2 roll
+ 5 -2 roll
+ pop pop
+ 2 copy 5 2 roll
+ } {
+ startinsidecount 0 gt N startinsidecount sub 1 gt and {
+% \end{macrocode}
+% we do not use all segments of the first component
+% \begin{macrocode}
+ 3 -1 roll dup 4 1 roll
+ N 1 sub startinsidecount sub mul
+ 6 -2 roll pop add dup 5 2 roll
+ } if
+ } ifelse
+ } if
+ last stopinsidecount 0 gt N stopinsidecount sub 1 gt and and {
+ % 1 1 1 N N
+ 3 -1 roll dup 4 1 roll stopinsidecount mul
+ 6 -1 roll dup 7 1 roll add 3 1 roll pop pop dup
} if
5 1 roll
{
@@ -21403,7 +21821,7 @@ tx@OptexpDict begin
} {
ReflectVec ok
} ifelse /n1 n2 def
- 5 -2 roll 2 copy 7 2 roll X0 Y0 @ABVect Xin Yin DotProd 0 lt
+ 5 -2 roll 2 copy 7 2 roll X0 Y0 @ABVect Xin Yin DotProd 0 lt
PN 1 gt and {
pop missed
} if