Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/V3RNE42/helios/llms.txt

Use this file to discover all available pages before exploring further.

trigo.js contains the spherical mathematics that allow Helios to find the geographic position of the vehicle at any fraction of its journey. It is a pure module with no external dependencies.

Exports

getNewCoords(startCoords, endCoords, fraction)

Returns the interpolated geographic position at a given progress fraction along the great-circle path between two coordinates.
startCoords
{ lat, lon }
required
Origin coordinates.
endCoords
{ lat, lon }
required
Destination coordinates.
fraction
number
required
Progress fraction between 0 (origin) and 1 (destination).
Returns { lat, lon } — the interpolated geographic position. Returns startCoords immediately if fraction === 0, and endCoords immediately if fraction === 1. Otherwise it delegates to getAngularDistance, getBearing, and getDestinationCoords for full great-circle interpolation.
function getNewCoords(startCoords, endCoords, fraction) {
    if (fraction == 0) return startCoords;
    if (fraction == 1) return endCoords;
    const distance = getAngularDistance(startCoords, endCoords);
    const fractionDistance = fraction * distance;
    const bearing = getBearing(startCoords, endCoords);
    const newCoords = getDestinationCoords(startCoords, fractionDistance, bearing);
    return newCoords;
}

getAngularDistance(startCoords, endCoords)

Returns the great-circle distance between two geographic coordinates in kilometres.
startCoords
{ lat, lon }
required
Origin coordinates.
endCoords
{ lat, lon }
required
Destination coordinates.
Returns number — distance in kilometres, computed using the haversine formula with Earth radius 6371 km.

getAbsoluteDiff(num1, num2)

Returns the absolute difference between two numbers.
num1
number
required
First number.
num2
number
required
Second number.
Returns number|num1 - num2|. Used by computeRouteSections in routeSolar.js to measure the convergence error (diff) of the iterative solar event search: once diff falls below MAX_DIFF (2500 ms), the inner loop exits.

Internal helpers

These functions are not exported and are used only within trigo.js:
HelperPurpose
getBearing(startCoords, endCoords)Computes the initial compass bearing (in radians, normalised to 0–2π) between two coordinates using the forward azimuth formula.
getDestinationCoords(startCoords, distance, bearing)Calculates the destination point given an origin, a distance in kilometres, and a bearing, using the spherical law of cosines with Earth radius 6371 km.
toRadians(degrees)Converts decimal degrees to radians (degrees × π / 180).
toDegrees(radians)Converts radians to decimal degrees (radians × 180 / π).

Build docs developers (and LLMs) love