views:

39

answers:

1

I want to plot 3D points in real time that lie upon the surface of a unit sphere (r = 1).

There are two spin vectors at work here. One vector rotates around the Y axis, it's X and Z values are calculated using the cos() and sin() of a circle that lies completely on the X/Z plane with all Y values being equal to 0. The other rotates around the X axis, it's Z and Y values calculated using the cos() and sin() of a circle that lies completely on the Z/Y plane with all X values being equal to 0. The angular momentum of the two vectors are usually not the same. However, the endpoints of the vectors lie along the surface of a common sphere with a radius equal to 1. They are therefore of equal magnitude and both originate from the same 0, 0, 0 point.

Let's say the first vector has an angular momentum term called angXZ and the second angZY. That means at any time I can calculate two points, one for each spin vector, using angXY and angZY. With those two 3D points, what is the formula for calculating a third point that also would lie on the surface of the unit sphere and would be the correct interpolation between the two points calculated from angXZ and angZY?

I can see in my head that given any two 3D points that lie on the surface of a unit sphere, there is one and only circle (plane) whose circumference they would both lie on. I can also intuit that calculating the coordinates of the interpolated point comes down to bisecting the angle that is created by the two calculated points when projected onto the circle whose circumference they both share. But I just can't wrap my head around the translations and mathematics.

Is there a simple formula that takes two 3D points that lie upon the surface of a unit sphere, to calculate a third point that also would lie upon that surface and would be the correct interpolation between the first two points?

I am using Delphi Pro 6 if that matters.

FOLLOW-UP: It seems intuitively that I should be able to take the linear midpoint of the two points calculated from the pair of spin vectors, and project that point back on to the unit sphere. For example, the formula found on the link below gives equations for calculating the midpoint between any two 3D points. Should't I be able to then take that 3D point and using some formula, adjust it's XYZ coordinates in a manner that projects it back to the surface of the unit sphere?

http://stackoverflow.com/questions/2886092/finding-coordinates-of-a-point-between-two-points

+2  A: 

Let M and N be your two points and O the origin. We will find P, the middle of MN segment: OP = OM + ON / 2. You compute the magnitude of OP: |OP|. Your needed point will be R with OR = OP / |OP| = OM + ON / 2|OP|.

Good luck with computing this. I don't know Delphi, but maybe it allows direct vector operations. If not do it with analytic geometry.

The coordinates for the middle point are the arithmetic averages of the coordinates of M and N (you said you can calculate those). To get the magnitude of |OP| you extract the square root of x^2+y^2+z^2. To get R you just divide the coordinates of P to the magnitude calculated just now.

You handle separately when M and N are opposing (P==O).

Alin Purcaru
After adding the follow-up to my original post, and now re-reading your answer, I believe just reiterated what you already said in your comment. However, it is the calculation/extrapolation of that midpoint back to the unit sphere which is what I need.
Robert Oschler
Just normalize your midpoint vector (OP) to get it back on the unit sphere. Also be careful of singularities when your vectors are antiparallel.
Ron Warholic
Hello Ron. Thanks. Just to save some time, would you happen to know if the equations shown on the following URL are correct for normalizing a 3D vector properly?: http://www.wikihow.com/Normalize-a-Vector
Robert Oschler