- #1
TheDestroyer
- 402
- 1
Hello people,
I'm creating an algorithm on Matlab and need to find the distance between two points in spherical coordinates where I have (r1,theta1,phi1) for the first point and (r2,theta2,phi2) for the second point.
Of course, since I'm programming, I shouldn't use the dummy Cartesian coordinates distance rule because it'll consume the processor for some dummy math! I could think that the problem can be reduced to calculating the angle between the position vectors of these two points, then it'll become very simple because we can then use the law of cosines and find the distance between the 2 points with the modified Pythagorean.
Is there a way to calculate that angle? the angle between the two position vectors of the two points.
Any other proposals are welcome :-)
Thank you in advance, for anything, even just for reading :D
I'm creating an algorithm on Matlab and need to find the distance between two points in spherical coordinates where I have (r1,theta1,phi1) for the first point and (r2,theta2,phi2) for the second point.
Of course, since I'm programming, I shouldn't use the dummy Cartesian coordinates distance rule because it'll consume the processor for some dummy math! I could think that the problem can be reduced to calculating the angle between the position vectors of these two points, then it'll become very simple because we can then use the law of cosines and find the distance between the 2 points with the modified Pythagorean.
Is there a way to calculate that angle? the angle between the two position vectors of the two points.
Any other proposals are welcome :-)
Thank you in advance, for anything, even just for reading :D