Distance between two points in two different planes given the dihedral angle We have four points: $p_1, p_2, p_3$ and $p_4$. The goal is to compute the distance between $p_1$ and $p_4$.
What we know:

*

*The distances between $p1$ and $p2$ ($a$) , $p2$ and $p3$ ($b$), $p3$ and $p4$ ($c$)

*The angles $\alpha$ and $\beta$ between ($p1$,$p2$,$p3$) and ($p2$,$p3$,$p4$) respectively

*The dihedral (torsion) angle $\phi$ between the two planes of $p1$ and $p4$
We do not have any coordinates of any of these points.
How do we use this information to compute the distance between $p1$ and $p4$? I tried doing something like projecting $p1$ onto the plane of $p4$, but I ended up needing information that I do not have access to.

 A: In order to take into account a certain symmetry of this issue, let us consider the intersection line of the planes as the $x$ axis with origin at the midpoint of $p_2p_3$, and the bissector plane as the reference horizontal plane.
Imagine the particular case $\varphi=0$ meaning that the figure is a flat figure in this bissector plane , i.e., all $p_k$ coplanar in the $xy$ plane.
From this case, generate the general case by rotating vector $\vec{p_1p_2}$ around the $x$ axis with a $\psi:=\varphi/2$ angle in one direction whereas vector $\vec{p_3p_4}$ is rotated in the other direction i.e., with a $-\psi$ angle.
This will give, using rotation matrices,
$$p_1=\begin{pmatrix}1&0&0\\0&\cos \psi&-\sin \psi\\0&\sin \psi&\ \ \ \ \cos \psi\end{pmatrix}\begin{pmatrix}-a \cos \alpha\\ \color{red}{+}a \sin \alpha\\0 \end{pmatrix}-\begin{pmatrix}b/2\\0\\0\end{pmatrix} $$
$$p_4=\begin{pmatrix}1&0&0\\0&\ \ \ \cos \psi& \sin \psi\\0&-\sin \psi&\cos \psi\end{pmatrix}\begin{pmatrix}-c \cos \beta\\ \color{red}{+}c \sin \beta\\0 \end{pmatrix}+\begin{pmatrix}b/2\\0\\0\end{pmatrix} $$
It remains to expand the previous expressions and then use the distance formula:
$$\delta=\sqrt{(x_1-x_4)^2+(y_1-y_4)^2+(z_1-z_4)^2}$$
A: Take projection of A on foldline as origin. If supplements of  $ \alpha, \beta \text{ are }\alpha', \beta'\text{ then } $ after projecting in three mutually perpendicular Cartesian  planes directly by 3d Pythagoras

$$ A:( a \sin \alpha' \cos \phi, 0,a \sin \alpha' \sin \phi) $$
$$B:(c \ sin \beta', a \cos \alpha'+b + c \cos \beta',0) $$
$$L=\sqrt{ (x_B-x_A)^2+ (y_B-y_A)^2+ (z_B-z_A)^2}.$$
