Special relativity: train, dock and inclined beam I am sure there is a flaw in my reasoning; but how could I make it right?
• In a stationary wagon, an experiment is carried out: a photon is sent from point $A$ to point $B$ by reflection at $C$ (equidistant from $A$ and $B$); The values $H$ and $L$ are known.
Two synchronized clocks are operating in $A$ and $B$. In $A$, it is triggered at the emission of the photon; In $B$, it stops at the reception of the photon.
The recorded duration is $\Delta t_w$:
$$\Delta t_w=\frac{2x}{c} \quad{} \Rightarrow \quad{} 4x^2=c^2\,\Delta t_w^2$$
With:
$$4x^2=4H^2+L^2 \quad{} \Rightarrow \quad{}4H^2+L^2=c^2\, \Delta t_w^2$$

• The wagon is now supposed to move at a speed $\overrightarrow{v}$ along a dock where there is a fixed observer equipped with a clock. It triggers its clock at the emission of the photon and stops it at the reception. He sees the photon moving along an elongated triangle due to the moving of the wagon:

The duration recorded $\Delta t_q$ is expressed as a function of the distance $D$ traveled by the wagon and the distance $2y$ traveled by the photon :
$$\Delta t_q=\frac{2y}{c} \quad{} \Rightarrow \quad{} 4y^2=c^2 \,\Delta t_q^2 \quad{}\quad{} \Delta t_q=\frac{D}{v} \quad{} \Rightarrow \quad{} D=v\, \Delta t_q $$
With:
$$y^2=H^2+(\frac{D+L}{2})^2$$
• So we get :
$$4y^2=4H^2+(D+L)^2$$
$$c^2 \,\Delta t_q^2=c^2 \,\Delta t_w^2-L^2+(v\,\Delta t_q+L)^2$$
$$\Delta t_q=...$$
This should be wrong, isn't it?
 A: The problem with your analysis is that it has more unknowns than it has equations, which means you should not expect it to be able to determine the values of any of the unknowns.
Write (as you have) $\Delta t_w$ and $\Delta t_q$ for the transit time of the light beam, measured in the two frames.  Write $L_w$ and $L_q$ for the distance from $A$ to $B$, measured in the two frames.
You have correctly shown that
$$\Delta t_w^2=L_w^2+4H^2$$
A similar analysis will show that
$$\Delta t_q^2=(D+L_q)^2+4H^2=(v\Delta t_q+L_q)^2+4H^2$$
These two equations involve the six quantities $v,L_w,H,\Delta t_w,L_q,\Delta t_q$.  You want to take three of these ($v$, $L_w$ and $H$) as given and solve for the other three.  But you have only two equations to solve for these three unknowns.  
You need another equation, which means you need another thought experiment.
The only thing that saves you in the classic case where $L_w=0$ is that we then feel justified in  assuming that $L_q=0$, which gives you the extra equation you need. 
So if your question is:  "What do I do from here?", the answer is:  Find another thought experiment to give yourself one more equation.  Then you can solve your  system.
A: The two equations are:
$$c^2 \Delta t_w^2 = 4H^2+L_w^2$$
$$c^2 \Delta t_q^2 = 4H^2+(v \Delta t_q+L_q)^2$$
By substracting:
$$c^2 (\Delta t_q^2 - \Delta t_w^2) = (v \Delta t_q+L_q)^2-L_w^2$$
When $L_w=0$, it means that $L_q=0$, which leads to the well-known relation:
$$c^2 (\Delta t_q^2 - \Delta t_w^2) = (v \Delta t_q)^2$$
And:
$$\Delta t_q^2 =\frac{1}{1-\frac{v^2}{c^2}} \Delta t_w^2 = \gamma^2 \Delta t_w^2$$
Now, if $L_w\neq0$ and $L_q\neq0$, we get:
$$(c^2-v^2)\Delta t_q^2-2vL_q \Delta t_q -c^2\Delta t_w^2 -L_q^2+L_w^2=0$$
and in order to calculate $\Delta t_q$ as a function of $\Delta t_w$, we have to resolve a quadratic equation... (by the way, in this equation, $L_q$ should be $L_w/\gamma$, I think).
