I'm writing a code that constructs a road network a sphere. Building the network is done by:
- Roads are added using spherical coordinates. A straight road is defined by start and end coordinates, and a up direction vector ((0, 0, 1) in spherical coordinates).
- To allow the road network to be converted to 3D cartesian coordinates, all roads are segmented into sections with a length much shorter than the radius of the sphere. By segmenting a road, I mean replacing it with multiple shorter road pieces.
- All coordinates and normals are then converted into 3D cartesian coordinates.
This works well for straight roads. However, I'm struggling with adding road bends. A bend would have an additional angle associated with it. A 90 degree bend would be a quarter circle, and a 180 degree bend a half circle etc. I can't figure out how to segment a road bend on a spherical surface.
Concretely, given two points on the surface of a sphere specified in spherical coordinates, and an angle a, how do I generate a set of points that if projected onto a map would trace the path of a road bend with angle a.
EDIT1:
The following differential relation that describes
*Small circles with bend radius $R_g $ on sphere radius R *
should be useful.
where $R_g$ is radius of bend, and $(R,\phi,\theta)$ are in spherical coordinates. $\psi $ is variable reference angle your path makes to sphere meridian.
$$ \sin \psi\cdot \big(\sin \phi +\frac {d\psi}{d\theta}\big)= \frac{R \cos \phi}{R_g} $$