AArcNerine
Product

Product features · Unit-sphere central angles

01

Review coordinate units with the angular calculation and keep any physical distance conversion in the calling application.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Unit-sphere central angles

● ● ●ArcNerine●
A concrete starting point · Unit-sphere central angles ×
from math import asin, cos, isfinite, radians, sin, sqrt
def central_angle(lat1, lon1, lat2, lon2):
    values = (lat1, lon1, lat2, lon2)
    if any(type(x) not in (int, float) or not -limit <= x <= limit
           or not isfinite(x) for x, limit in zip(values, (90, 180, 90, 180))):
        raise ValueError("bounded finite coordinates")
    p, q = radians(lat1), radians(lat2)
    a = sin((q-p)/2)**2 + cos(p)*cos(q)*sin(radians(lon2-lon1)/2)**2
    return 2 * asin(sqrt(min(1.0, max(0.0, a))))
✳Return the central angle in radians between two unit-sphere positions with latitudes within ±90 and longitudes within ±180 degrees.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗