I have a simple simulation of 3D user interface components represented as particles on a sphere surface, where the particles are animated but I want to maintain a Poisson disk-like distribution by repelling each other if they get too close. In a Cartesian coordinate system I would just compute distance and when other particles are within a limit, I would push them away by scale * (limit - distance), where this factor is applied to the normalized direction pointing to the other particle. However, I'm having trouble doing this in the spherical coordinate system.
I want the particles to only move along the sphere surface. I compute the distance using the great circle distance formula from Wikipedia (I'm using colatitude instead of latitude since I'm with a spherical coordinate system, so I swapped sin(phi) and cos(phi) in the distance formula, which seems to work). However, I don't know how to apply it to push the particle along the direction of the great circle. I tried using delta-theta and delta-phi as the components of the direction, normalizing it and scaling by the distance-based factor as above, but it doesn't work right (visually it seems to work for theta but not phi). I'm also not sure how to deal with wraparound which may be adding to my failure to get it working. My theta is -pi to pi and phi is 0 to pi. After I compute the theta and phi deltas I return them to that range, and do likewise for the resulting particle coordinates, but it still doesn't work.