I am seeking to formalize the following idea: Take a sheet of paper and lay it flat on a table. Choose two points A and B on the paper, then draw a line segment from A to B. Fold the sheet of paper so that the crease lays across the line segment, then reopen it so that no part of the paper touches itself. Then [it seems to me that] that the shortest path from A to B while staying on the sheet of paper is marked out by the image of the line segment.
What I have tried: Formally we could identify manifold $M$ as the original sheet of paper, manifold $N$ as the result of folding and then reopening the paper, and $f : M \rightarrow N$ as the actions of 'fold and then reopen'. I think that $f$ can be taken as a homeomorphism, but I hesitate to call $f$ a geodesic map as $N$ is not smooth. How can I describe what $f$ is?
(I consulted the answers to earlier questions about turning 2D trajectories into 2D geodesics and length-minimizing curves being geodesics, and also Petrunin & Yashinski's very-approachable lectures on piecewise distance preserving maps. The formalisms there didn't quite seem to fit.)
Petrunin, Anton; Yashinski, Allan, Lectures on piecewise distance preserving maps, Mathematics (2014)
Let $M$ and $N$ be length spaces. The requirement is that $f$ is a homeomorphism that preserves shortest paths.
Details
Let $x, y$ be any two points in $M$. Since $M$ is a length spaces, there exists a path $\phi$ of finite length from $x$ to $y$ and the length of that path is equal to the distance from $x$ to $y$. We may refer to $\phi$ as being a shortest path from $x$ to $y$ (there may be many shortest paths, but at least one such path exists).
Now suppose that $f$ is a homeomorphism from $M$ to $N$. Then $f \circ \phi$ is a path in $N$ as homeomorphisms preserve continuity. The question to ask is, "Is $f \circ \phi$ necessarily a shortest path from $f(x)$ to $f(y)$?"
I think the answer is "no" by counter-example: Let $M = S^2 - \{(0,0,1), (0,0,-1)\}$, $N = [-\pi,\pi) \times (-\pi/2,\pi/2)$, and $f : M \rightarrow N$ be the plate carrée projection ($f$ maps from the surface of the Earth to a flat sheet of paper but omits the North and South Poles). Then $f$ is a homeomorphism but it does not preserve shortest paths - the great circles on $M$ are not necessarily mapped to line segments in $N$ (unlike the gnomonic projection). Indeed $f$ is also an example of a diffeomorphism that is not a geodesic map (when considering $M$ and $N$ as manifolds).
(This is a provisional answer based on comments by @[Anthony Carapetis]. I am very open to accepting a better one.)