26 lines
706 B
Text
26 lines
706 B
Text
HAVERSINE
|
|
=LAMBDA(lla,
|
|
LAMBDA(llb,
|
|
LET(
|
|
REM, "Approximate radius of Earth in km.",
|
|
earthRadius, 6372.8,
|
|
|
|
sinHalfDeltaSquared, LAMBDA(x, SIN(x / 2) ^ 2)(
|
|
RADIANS(llb - lla)
|
|
),
|
|
|
|
2 * earthRadius * ASIN(
|
|
SQRT(
|
|
INDEX(sinHalfDeltaSquared, 1) + (
|
|
PRODUCT(COS(RADIANS(
|
|
CHOOSE({1,2},
|
|
INDEX(lla, 1),
|
|
INDEX(llb, 1)
|
|
)
|
|
)))
|
|
) * INDEX(sinHalfDeltaSquared, 2)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|