# Positioning along optical path with pst-optexp

I am trying to draw an object (per example a lens) with the pst-optexp package. The difficulty arises when I try to have this object drawn at a given distance from another object, but along the optical path.

On the following example, I would like to have a second lens placed 3 "units" further from the first lens (L1), but following the beam trajectory. How could it be achievable ?

\begin{pspicture}[showgrid](0,0)(3,3)
\pnodes(0,0){Laser}(1,0){M1}(2,3){M2}(3,1.5){End}
\begin{optexp}
\optsource[innerlabel](Laser)(M1){Laser}
\mirror[compname=M1](Laser)(M1)(M2){M1}
\lens[position=0.3] (M1)(M2){L1}
\mirror[compname=M2](M1)(M2)(End){M2}
\drawbeam (Laser){M1}{M2}(End)
\end{optexp}
\end{pspicture}


Edit: to better specify my needs, here are some precisions. The goal of the process would be to have the lenses "automatically" aligned on the laser path (imposed by a series of mirrors). I would ideally like to be able to place the lenses in the coordinate system of the laser path; in order to have an optimal setup (in this case) the distances between two lenses should correspond to the sum of their two focal lengths.

In the following example is highlighted in red the path of length 3 separating the two lenses. Instead of calculating the path length between L1 and M2 manually (d=0.7*sqrt(9+1)) and then the remaining distance between M2 and the second lens (3-d=0.768), would it be possible to say "add the lens X units away from the point P, following the laser path" ?

\begin{pspicture}[showgrid](0,0)(3,3)
\pnodes(0,0){Laser}(1,0){M1}(2,3){M2}(3,1.5){End}
\begin{optexp}
\optsource[innerlabel](Laser)(M1){Laser}
\mirror[compname=M1](Laser)(M1)(M2){M1}
\lens[compname=L1, position=0.3] (M1)(M2){L1}
\mirror[compname=M2](M1)(M2)(End){M2}
\lens[compname=L2, abspos=0.768](M2)(End)
\drawbeam (Laser){M1}{M2}(End)
\drawbeam[linecolor=red] (\oenodeCenter{L1}){M2}(\oenodeCenter{L2})
\end{optexp}
\end{pspicture}

\begin{pspicture}[showgrid](0,0)(3,3)
\pnodes(0,0){Laser}(1,0){M1}(2,3){M2}(3,1.5){End}
\begin{optexp}
\optsource[innerlabel](Laser)(M1){Laser}
\mirror[compname=M1](Laser)(M1)(M2){M1}
\lens[compname=L1, abspos=0.3] (Laser)(M1){L1}
\mirror[compname=M2](M1)(M2)(End){M2}
\lens[compname=L2, abspos=2.3](M1)(M2)
\drawbeam (Laser){M1}{M2}(End)
\drawbeam[linecolor=red] (\oenodeCenter{L1}){M1}(\oenodeCenter{L2})
\end{optexp}
\end{pspicture}


One see that for essentially the same setup, the positions as well as the orienting elements had to be changed.

• I'm not sure to understand: you want a second lens 4 postscript units from the first, i.e. an absolute positioning, not a relative one, like for L1 between M1and M2? – Bernard Mar 20 '18 at 17:59
• Exactly, but the positioning is relative to the first lens in this case. A completely relative positioning would require a second reference point, I guess. – Mammouth Mar 20 '18 at 19:36
• You also might place w.r.t. M1 and M2, with different coefficient. – Bernard Mar 20 '18 at 19:54
• The idea would be to have the lens "follow" modifications to mirrors orientations or position. The only imposed restrictions being: the lens has to be stay on the optical path at the specified distance from another point on the same path. – Mammouth Mar 20 '18 at 20:48
• No, you cannot do such calculations – Christoph May 2 '18 at 17:38

Maybe this is close to what you want?

\documentclass[border=1cm, 12pt, dvipsnames]{standalone}%pstricks,
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts, amssymb}
\usepackage{pst-optexp}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture}[showgrid](0,0)(6,6)
\pnodes(0,0){Laser}(1,0){M1}(2,3){M2}(3,1.5){End}
\begin{optexp}
\optsource[innerlabel](Laser)(M1){Laser}
\mirror[compname=M1](Laser)(M1)(M2){M1}
\lens[position=0.3] (M1)(M2){L1}
\lens[position=1.7] (M1)(M2){L2}
\mirror[compname=M2](M1)(M2)(End){M2}
\drawbeam (Laser){M1}{M2}(End)
\end{optexp}
\end{pspicture}

\end{document}


• Thank you for your answer. Please see the edited post to which I added some missing information. – Mammouth Mar 20 '18 at 23:45