Given a list of Cartesian coordinates $p_0, p_1, ..., p_n$, where $p_i = (x_i, y_i, z_i) \in \mathbb{R}^3$ and $n \in \mathbb{N}$, how might one express the polar coordinates of each point recursively in the local frame of the previous point?
I can calculate the base case polar coordinates for $p_0$ in the world frame like so: $$r_0 = \sqrt{x_0^2 + y_0^2 + z_0^2 }$$ $$\theta_0 = \arctan (y_0, x_0)$$ $$\phi_0 = \arccos (z_0 \ r_0)$$
I am unsure how this would extend into local frames of each sequential point and with arbitrary point orientations.
Visually, I would like to derive a general formula to find the red text in my diagram.
I inspected your figure but it seems that the local coordinate systems (CS) seem arbitrary.
First, you can get the basis vectors $i_n,j_n,k_n$ of each local frame $X_nY_nZ_n$ represented in the world CS (the specific CS is not important though) by coordinate transformation (using Euler angles).
Then, we define $$ r: = OR = p_n - p_{n-1}\\ q: = OQ = OR + RQ = r - (r\cdot k_{n-1})k_{n-1} $$ where $r$ is the relative position vector of $P_i$ with respect to $P_{i-1}$, and $q$ is the projection of $r$ onto $XY$ plane of the local CS. The indices are omitted from now on. Let us define a unit vector $$ l = \frac{r \times k}{|r \times k|} $$ Then, we have $$ |q||r|\sin\theta_i = (q \times r ) \cdot l $$ and $$ (i \times q) \cdot k = |q|\sin\phi_i\\ i \cdot q = |q|\cos\phi_i $$ Therefore, $$ \theta_i = \arcsin\frac{(q \times r ) \cdot l}{|q||r|}\\ \phi_i = \mathrm{atan2}\left( (i \times q) \cdot k, i \cdot q\right) $$ In most cases, $\mathrm{atan2}$ is preferred to $\arctan$ due to its broader range $(-\pi, \pi]$.
The key is to find $i,j,k$ and $q,r,l$ for each local CS.