Reputation: 75615
I have three points that are on the surface of a globe. I want to determine if one of the points lays to the left or right of a line that joins the other two points, when travelling in a certain direction down that line.
So, parameters are:
globe (x,y,z,radius)
journey_start (x,y,z)
journey_end (x,y,z)
point (x,y,z)
My reasoning so far has got me this:
globe origin, journey start and end are three points on a great circle and describe a plane. I want to know if the other point is above or below this plane.
but I haven't managed to extend that to an equation.
How can I solve this?
Upvotes: 0
Views: 931
Reputation: 179779
Define the vectors S and E as the vectors from the center of the globe to journey_start and journey_end. Their crossproduct is the normal N of the plane in which S and E lie. This plane of course divides the globe in two hemispheres, which correspond to your left and right. You can subsequently calculate the inner product of this normal with the vector from the center to your third point. It's either positive (right), negative (left) or zero (on the same great circle)
Upvotes: 2
Reputation: 798516
Find the plane that the two points and the center are on, the parallel plane that passes through the third point, the offset between the two planes, the cross product of the two points and the center, and whether or not the direction of the offset is the same as the direction of the cross product.
Upvotes: 1