Skip to content

Instantly share code, notes, and snippets.

View jesty's full-sized avatar

Davide Cerbo jesty

View GitHub Profile
@jesty
jesty / computeHeading.js
Last active September 26, 2019 02:59
Compute heading
/*
* A heading is defined in degrees from true north, where headings are measured clockwise from true north (0 degrees).
* The parameter for this function are two array that identifies a geo point with latitude at position 0 and longitude
* at position 1.
* This function is similar to https://developers.google.com/maps/documentation/javascript/geometry. I developed because
* I need it on Meteor server side.
* The result is a value between -180 and 180.
*/
var computeHeading = function (start, end){
var lat1 = start[0]*Math.PI/180;