# Numerical method to calculate the shortest distance between two points on a cone?

Are there any numerical methods to calculate the shortest distance between two points along the surface of a cone? The motivation is to calculate the distance between two sensors on the surface of a structure. One of the sections of this structure would have a conical shape (although not a full cone; it is a truncated cone). I know that a path between two points along a general surface is called a geodesic, and I've been able to find numerical methods for geodesic distance on other kinds of shapes, but I've had trouble finding something similar for a cone.

The goal is to implement such a method in code (Python), and of course the ideal situation would be if there is an existing library that already has an implementation. I can ask a follow-up question that is more focused on the programming part of this on another StackExchange site, but for now I'm asking the question here because I haven't been able to find sufficient information on what kind of methods are available and what they are called.

• Just lookup "Geodesics in a cone". Commented May 2, 2021 at 21:23
• I have done several searches about the topic. I'm asking this question here because I haven't found information for a numerical method that could be implemented in code. Commented May 2, 2021 at 21:31
• If I'm guessing correctly, the cones you're considering are flat - you can form them by folding a flat piece of paper. This should solve your problem, but I couldn't say more without more context. Commented May 2, 2021 at 22:03
• @tangology The cone is isometric to $\mathbb{R}^2$... You can obtain a geodesic just by mapping two point onto the plane, drawing a straight line between them and mapping back onto the cone. Commented May 3, 2021 at 9:25

The Mapping $$F:U\to C$$, with $$U=\{(u,v)\in \mathbb{R}^2: u > 0\}$$, given by $$F(u,v)=(u \sin \alpha \cos v, u \sin \alpha \sin v, u \cos \alpha)$$ is an isometry between the half space and the cone. If you are given two points on the cone, $$P_1 = F(u_1,v_1)$$ and $$P_2=F(u_2,v_2)$$, the distance between them is the same as in the $$(u,v)$$ plane, i.e. $$d = \sqrt{(u_1-u_2)^2+(u_2-v_2)^2}$$. If, as an input, you are given the cartesian coordinates of the points, you just need to start by computing the $$(u,v)$$ coordinates by solving for each point the system $$\begin{cases} u \sin \alpha \cos v = x\\ u \sin \alpha\sin v = y\\ u \cos \alpha = z \end{cases}.$$