Shortest paths on linked tori I will make this question specific at first, and general later.
Suppose we have two linked tori, $T_1$ and $T_2$,
each of radii $(2,1)$, meaning that each torus is the result of sweeping
a circle of radius 1 orthogonally around a circle of radius 2.
$T_2$ is rotated
$90^\circ$ with respect to $T_1$, so that they link snugly together:

            


They touch along two orthogonal circles of radius 1,
$C_1$ and $C_2$.
Let $T_i$ represent the surface of each torus.

Q1.
What is the structure of a shortest path $\sigma(p_1,p_2)$ on $T_1 \cup T_2$
between two points,
$p_1 \in T_1$ and $p_2 \in T_2$?

In general I believe $\sigma(p_1,p_2)$ follows a shortest path
from $p_1$ on $T_1$ to a point $x_1$ on one of the circles,
travels along an arc of that
circle, perhaps switches at their junction to the second circle,
follows an arc to $x_2$,
and finally follows a shortest path on $T_2$ from $x_2$ to $p_2$.
I am wondering whether or not
some version of Snell's law applies
here?  Suppose the path from $p_1$ makes an angle $\alpha_1$
with one circle at $x_1$,
and an angle $\alpha_2$ where it leaves from $x_2$ on
that or the other circle on its way to $p_2$.
Is it the case, with suitable conventions on the definitions
of these angles, that $\alpha_1 = \alpha_2$?

Answer to Q1: Gjergji Zaimi showed my intuition (concerning following
arcs of the circles $C_1$ and/or $C_2$) is wrong: "The shortest path [is] the one-point union of two geodesics....
[I]n particular you will have equal angles along the tangency circle....
This problem is about shortest paths on a single surface in disguise."



Q2.
What is the general principle here, that would apply to several smooth
surfaces contacting along one-dimensional curves?

Speculations, ideas, references—all welcomed.  Thanks!

Answer to Q2: See Anton Petrunin's remarks on the graded distance function
$|x-y|_n$.

 A: The following is a bit sketchy but I think it conveys the idea. First the shortest path will only touch the orthogonal "base circles" (call them $C_1$ and $C_2$) only at one point, otherwise the path from $p_1$ to $x_1$ together with the arc will not be optimal already in $T_1$. Second, suppose we have a shortest path $p_1\to x\to p_2$. If $p_2$ is on the side of $T_2$ which makes the path have a sharp turn then consider the reflection of $T_2$ on the plane containing $C_2$, then the path will entirely lie on a surface which is half of $T_2$ cut from the $C_2$ plane and the part of $T_1$ which is basically the cylindrical tube on the side of $C_2$ where $p_1$ is. This surface is differentiable therefore the shortest path will also be differentiable and in particular you will have equal angles along the tangency circle.
A: This is mostly related to Q2.
I will make comments on number of switches of geodesic from one space to an other.
Bad case. When you glue two spaces it is useful to consider "graded distance function"
$|x-y|_n$ --- the minimal length of curve form $x$ to $y$, which switch from one space to an other at most $n$ times.
I used it once to prove gluing theorem for Alexandrov spaces.


*

*It is easy to work with "geodesics" for $|x-y|_n$.

*As $n\to\infty$,  $|x-y|_n$ converges to the distance in the glued space.

*The function  $|x-y|_n$ does not satisfy triangle inequality, but it has graded triangle inequality:


$$|x-z|_{n+m} \le |x-y|_n+|y-z|_m.$$
Good case. Some times you know that a geodesic will not switch from space to space too many times.
Say you glue $X$ and $Y$ along $A$ and the metric induces on $A$ from $X$ and $Y$ coincide;
in particular doubling of $X$ in $A$.
In this case it is easy to see that at least one geodesic between any two points will not switch more than once.
With little bit more information you may guarantee the same for any geodesic.
Your case. You can see that whole glued space admits a strictly short retracting to each of the circles. That means that any of the geodesic switch at most once on each of two circles. So you have only two switching and that should make you happy.
