[pstricks] transmission grating in pst-optexp (Christoph Bersch)

Christoph Bersch usenet at bersch.net
Fri Jul 12 15:19:34 CEST 2013


Hi,

Am 12.07.2013 12:26, schrieb Steffen Wittek:
>
 > The transmission gratings work like the normal
> gratings only that they are transmissive. The operation is shown here:
> http://www.light-all.com/Writable/Resource/_random_/2009-03-14/reflection_vs_transmission_gratings.jpg
>
> Do you think that the variant can be extended. Or is there a new object
> needed alltogether?

here is a partial implementation, could you try this out? There are some 
issues, which require a change of pst-optexp.sty. If this concept is 
fine for you, I would release the version with the fully functional 
component.
It is defined as a new component, because the name 'gratingtype' is 
already used to distinguish between blazed and binary gratings. However, 
all grating parameters can be used and have the same meaning.

Christoph

\documentclass{article}
\usepackage{fp}
\usepackage{pst-optexp}
\makeatletter
\newOptexpTripole{transmissiongrating}
\def\transmissiongrating at ref{%
   \POE at calcAngle
   \FPadd\POE at key@angle{\POE at key@angle0}{90}
   \FPround\POE at key@angle{\POE at key@angle}{5}
   \POE at setref{/@@y \POE at key@gratingwidth\space 0.5 mul def}%
}%
\def\transmissiongrating at nodes{%
   \newOptexpComp{%
     {0 0} \POE at key@gratingwidth\space 0.5 mul dup neg exch
     OEangle 180 sub abs 1e-5 lt {
       trans {1 0}
     } {
       refl {0 1}
     } ifelse
     4 1 roll {PlainIfc} 1}%
}%
\let\transmissiongrating at comp\optgrating at comp
\makeatother
\begin{document}
\begin{pspicture}[showgrid](2.6,2.4)
   \pnode(0,1.3){A}\pnode(2,1.3){B}\pnode(1,0.3){C}
   \optgrating[reverse, gratingcount=9](A)(B)(C)
   \optplane[angle=45](C)
   \addtopsstyle{Beam}{ArrowInside=->, ArrowInsidePos=0.8, arrowinset=0, 
arrowscale=1.5}
   \drawbeam[linecolor=black](A){1}
   \addtopsstyle{Beam}{loadbeam, savebeam=false}
   \drawbeam[linecolor=green]{1-2}
   \drawbeam[linecolor=red, beamangle=15]{1-2}
   \drawbeam[linecolor=blue, beamangle=-15]{1-2}
   \rput[lB](0,2){reflection grating}
\end{pspicture}
%
\hspace*{1cm}
\begin{pspicture}[showgrid](5,2.4)
   \pnode(0,1.3){A}\pnode(2,1.3){B}\pnode(4,0.5){C}
   \transmissiongrating[reverse, gratingcount=9](A)(B)(C)
   \optplane[angle=-30](C)
   \addtopsstyle{Beam}{ArrowInside=->, ArrowInsidePos=0.8, arrowinset=0, 
arrowscale=1.5}
   \drawbeam[linecolor=black](A){1}
   \addtopsstyle{Beam}{loadbeam, savebeam=false}
   \drawbeam[linecolor=green]{1-2}
   \drawbeam[linecolor=red, beamangle=5]{1-2}
   \drawbeam[linecolor=blue, beamangle=-5]{1-2}
   \rput[lB](0,2){transmission grating}
\end{pspicture}
\end{document}



More information about the PSTricks mailing list