I have two intersecting planes and two arbitrary points $\mathbf{p}_1$ and $ \mathbf{p}_2$, one on each plane. I would like to calculate the minimum distance of a path from one point to the other with the path constrained to the planes. This is my current method for calculating the minimum distance:
Find an equation for the intersection of the two planes, let's call it $\mathbf{\ell}(t)$. Then by minimizing the following distance function I should get the minimum distance:
$\| \mathbf{\ell}(s)-\mathbf{p}_1 \| + \|\mathbf{\ell}(s)-\mathbf{p}_2 \|$.
We differentiate to get
$\frac{(\mathbf{\ell}(s) - \mathbf{p}_1) \cdot \nabla \mathbf{\ell}}{\| \mathbf{\ell}(s) - \mathbf{p}_1 \|}+\frac{(\mathbf{\ell}(s) - \mathbf{p}_2) \cdot \nabla \mathbf{\ell}}{\| \mathbf{\ell}(s) - \mathbf{p}_2 \|}=0$
I can solve this equation; however, the formula is rather unruly. I was wondering if there is a simple solution to this or a better approach. For instance is the shortest path the projection of the straight line (in $\mathbb{R}^3$) between $\mathbf{p}_1$ and $\mathbf{p}_2$ onto the two planes? Thanks in advance.