Skip to content

Instantly share code, notes, and snippets.

View cypreess's full-sized avatar

Kris Dorosz cypreess

View GitHub Profile
@cypreess
cypreess / compassbearing.py
Last active July 23, 2018 11:52 — forked from jeromer/compassbearing.py
compass bearing between two points in Python
import math
def calculate_initial_compass_bearing(pointA, pointB):
"""
Calculates the bearing between two points.
The formulae used is the following:
θ = atan2(sin(Δlong).cos(lat2),
cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong))
cypreess@iMac ~ cat f.cc
#include <stdio.h>
int main(){
unsigned char a = 255;
unsigned long int b = (a << 24);
unsigned long int c = ((unsigned long int) a << 24);
printf("b=%lu\n", b);
printf("c=%lu\n", c);