# how to roam on a sphere

two location cordinates on the sphere already available ,i want to know how to roam along the big circle between these two point ,who will help me ??

There is something called ‘Quaternions’ which should help, but I can’t help you using it.

Do you know the radius of the sphere?

The circle can also be determined with a 3rd point that is also on the circle.

yes ,i know the sphere’s radius,just as R
and the sphere’s center is origin

Lets call A and B the two locations, and O the center of the sphere, and N the normal at A.
What you need is probably the coordinates of n points between A and B on the sphere.
So why don’t you simply do this (pseudocode) ? :

for (i=0; i<n; i++) {
C[i] = A + (i*(B-A)/n)
}

then you have n vector C that’s between A and B and on the sphere.

(note, the trick do not work when A and B are not close, and in general the C[i] are not exactly equidistants)

is it enough ?

[This message has been edited by rixed (edited 12-19-2001).]

3x,rixed:
i use the method just as u said ,and when A and B are not so close ,it will work well,the eye cordinates maybe IN the sphere

is there any more good method

Take the cross product of the two points on the sphere (treated as vectors starting at the sphere’s origin) and use the resultant Vector as an axis to rotate around. For a full interpolation (i.e completely at one point) rotate pointA dot pointB angles. Or you could lerp spherical coordinates, but I’m not sure that would work.