如何在 pst-optexp 中自定义透射光栅?

如何在 pst-optexp 中自定义透射光栅?

我当前的工作示例:

\documentclass[preview,border=20pt]{standalone}
\usepackage{pst-optexp}
\usepackage{pst-node}

\begin{document}
\begin{pspicture}[showgrid](2, 2)
    \pnodes(0,1){A}
    \pnodes(2,1){B}
    \pnodes(1,1){C}
    \begin{optexp}
    \transmissiongrating[angle=180,gratingcount=10,gratingwidth=0.8,gratingheight=0.07,gratingdepth=0.03,gratingtype=binary](A)(C)(B)
    \optbox[abspos=1.5, optboxwidth=0.1,optboxheight=0.8](A)(B)
    \addtopsstyle{Beam}{linestyle=none, fillstyle=solid, fillcolor=green!70!black, beaminside=false}
    \drawwidebeam[beamwidth=0.4,beamdiv=4](A){1-2}
    \end{optexp}
\end{pspicture}
\end{document}

我现在的例子

我想要做:

  • 封装内有一个类似菲涅尔透镜的二元透射光栅pst-optexp。无需光线追踪。
  • 使光束远离该光栅。

这是我的愿望的草图:

我的希望

感谢您的任何帮助和建议。

答案1

这种特殊的光栅不是现成支持的。但是,您可以使用\optdipole任何类型的对象作为组件:

\documentclass[preview,border=20pt]{standalone}
\usepackage{pst-optexp}

\begin{document}
\begin{pspicture}[showgrid](2, 2)
    \pnodes(0,1){A}
    \pnodes(2,1){B}
    \begin{optexp}
        \optdipole(A)(B){%
             \pspolygon[fillstyle=solid,fillcolor=white]
            (0.05,0.5)(-0.05,0.5)(-0.05,0.45)(0,0.45)(0,0.35)(-0.05,0.35)(-0.05,0.2)(0,0.2)(0,0.15)(-0.05,0.15)
            (-0.05,-0.15)(0,-0.15)(0,-0.2)(-0.05,-0.2)(-0.05,-0.35)(0,-0.35)(0,-0.45)(-0.05,-0.45)(-0.05,-0.5)
            (0.05,-0.5)
        }
        \optbox[abspos=1.5, optboxwidth=0.1,optboxheight=0.8](A)(B)
        \addtopsstyle{Beam}{linestyle=none, fillstyle=solid, fillcolor=green!70!black, beaminside=false}
        \drawwidebeam[beamwidth=0.4,beamdiv=4](A){1-2}
    \end{optexp}
\end{pspicture}
\end{document}

在此处输入图片描述

如果您更频繁地需要该组件,则可以使用\newpsobject和参数定义它optdipolecomp

\documentclass[preview,border=20pt]{standalone}
\usepackage{pst-optexp}
\def\fresnelgratingcomp{%
  \pspolygon[fillstyle=solid,fillcolor=white]
        (0.05,0.5)(-0.05,0.5)(-0.05,0.45)(0,0.45)(0,0.35)(-0.05,0.35)(-0.05,0.2)(0,0.2)(0,0.15)(-0.05,0.15)
        (-0.05,-0.15)(0,-0.15)(0,-0.2)(-0.05,-0.2)(-0.05,-0.35)(0,-0.35)(0,-0.45)(-0.05,-0.45)(-0.05,-0.5)
        (0.05,-0.5)}
\newpsobject{fresnelgrating}{optdipole}{optdipolecomp={\fresnelgratingcomp}}
\begin{document}

\begin{pspicture}[showgrid](2, 2)
    \pnodes(0,1){A}
    \pnodes(2,1){B}
    \begin{optexp}
      \fresnelgrating(A)(B)
      \optbox[abspos=1.5, optboxwidth=0.1,optboxheight=0.8](A)(B)
      \addtopsstyle{Beam}{linestyle=none, fillstyle=solid, fillcolor=green!70!black, beaminside=false}
      \drawwidebeam[beamwidth=0.4,beamdiv=4](A){1-2}
    \end{optexp}
\end{pspicture}
\end{document}

相关内容