1

I have looked everywhere but i can’t seem to find the formula to add 2 spherical vectors. All the answers tell me to convert, and I understand that this is better, but i am still curious on how you would go about adding them without a conversion, similar to this question: (Adding two polar vectors) but in 3d instead.

Josh
  • 11
  • The way such a formula would be derived would be by converting to rectangular coordinates, doing the normal addition, and then converting back to spherical coordinates. You could derive such a formula, or if you struggle, you could update your question with your attempt, and you might get a more thorough response. – A. Thomas Yerger Aug 15 '22 at 02:44
  • @A.ThomasYerger I tried to do it myself, but the closest I got was using the law of cosines to get the same answer as in the thread I linked. I am not the best at trigonometry, so I was not able to get close at all, I am hoping someone with more knowledge than me can answer the question. – Josh Aug 15 '22 at 02:57
  • You can use versors, which are unit quaternions. Then composition of rotations merely becomes multiplication. They're also more numerically stable than rotation matrices. – CyclotomicField Aug 15 '22 at 03:03

1 Answers1

1

You can do it using formulas that are used in great-circle navigation.

First, find the angle $\theta$ between the two vectors, which is equivalent to finding the distance between two points on a spherical Earth (for example by using the haversine formula).

Then $\theta$ is the exterior angle between the sides corresponding to the two input vectors in the triangle form of the sum of the vectors. Use $\pi - \theta$ as the interior angle at that vertex and apply the cosine formula to find the length of the sum of the vectors.

You can now use the known three sides and the one known angle of the triangle to find the other two angles of the triangle.

Suppose the angle between the vector sum and the first input vector is $\alpha$. Then to find the direction of the vector sum, you start at the direction of the first input vector and rotate through an angle $\alpha$ toward the direction of the second input vector. This involves only the two angle coordinates, not the radius. This is equivalent to traveling a distance $R\alpha$ from one latitude and longitude on a sphere of radius $R$ toward a second latitude and longitude on the sphere.

I would probably not do it this way, but it could be done.

David K
  • 108,155