I find myself with a cylinder of radius r, positioned along the x-axis, with equation y^2 + z^2 = r^2.
If I have two arbitrary points which lie on the surface of such a cylinder, is there a"two-point formula" which would give me some equation of a curve (which also curves along the surface of the cylinder) connecting the two points?
I envision an equation similar to the two-point equation of a line in 2D or 3D, but I do not know if such an equation is possible or makes sense.
My use case is wanting to render a curve connecting two points laying on such a cylinder, in a program I am writing in Python. I would like to render this curve but also understand the underlying mathematics.
Thank you in advance.
Best Answer
You can convert the problem into cylindrical coordinates $(x,y,z)\mapsto (x,\theta,r) $
$$ x = x, \ y = r\cos\theta, \ z = r\sin\theta $$
The constant surface $r = r_0$ in this coordinates system is somewhat equivalent to a "plane" in traditional Cartesian, in that any point on the surface is only dependent on two coordinates $(x,\theta)$
Suppose our two points are described by $(x_1,\theta_1)$ and $(x_2,\theta_2)$, then the shortest path between them is the linear parametrization (equivalent to defining a line in Cartesian space)
$$ x(t) = x_1(1-t) + x_2t $$ $$ \theta(t) = \theta_1(1-t) + \theta_2t $$
where the angles are picked so that $|\theta_2-\theta_1|\le \pi$