开发者

Interpolate x, y, z coordinates on a sphere using points from two spin vectors?

开发者 https://www.devze.com 2023-01-18 23:47 出处:网络
I want to开发者_运维百科 plot 3D points in real time that lie upon the surface of a unit sphere (r = 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?

Finding coordinates of a point between two points?


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消