Skip to content

Instantly share code, notes, and snippets.

@JudeOsborn
Created September 16, 2012 23:40
Show Gist options
  • Save JudeOsborn/3734837 to your computer and use it in GitHub Desktop.
Save JudeOsborn/3734837 to your computer and use it in GitHub Desktop.
Get the angle from two coordinates.
function angleFromPoints(p1, p2) {
return Math.atan2(p2.y - p1.y, p2.x - p1.x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment