user258279
user258279

Reputation: 381

Where does the axis of the great circle through two points meet the sphere?

The great circle through two points with lat/lon φ1, λ1 and φ2, λ2 can be calculated. The axis of this great circle meets the sphere at two antipodal points. Do these points have a name? What is the formula to derive them from φ1, λ1 and φ2, λ2?

Upvotes: 0

Views: 69

Answers (1)

user258279
user258279

Reputation: 381

You can do it by converting to Cartesian coordinates, taking a vector cross-product, and converting back to spherical coordinates:-

def fromSpherical(point): # φ, λ -> x, y, x
    φ, λ = point
    θ, φ = π / 2 - φ, λ
    return sin(θ) * cos(φ), sin(θ) * sin(φ), cos(θ)

def toSpherical(point): # x, y, x -> φ, λ
    x, y, z = point
    θ = acos(z)
    φ = atan2(y, x)
    return π / 2 - θ, φ

def nodes(pt1, pt2):
    x1, y1, z1 = fromSpherical(pt1)
    x2, y2, z2 = fromSpherical(pt2)
    v = np.cross(np.array((x1, y1, z1)), np.array((x2, y2, z2)))
    v /= np.linalg.norm(v)
    return toSpherical(v), toSpherical(-v)

Upvotes: 0

Related Questions