Skip to content

Instantly share code, notes, and snippets.

@vkgtaro
Created April 27, 2015 03:21
Show Gist options
  • Save vkgtaro/f77e496910695cbaa877 to your computer and use it in GitHub Desktop.
Save vkgtaro/f77e496910695cbaa877 to your computer and use it in GitHub Desktop.
ベクトルの角度を求める ref: http://qiita.com/vkgtaro/items/b2cd00f376c427cb9ea6
calculate_cosine = function (x, y) { return x / Math.sqrt(x*x + y*y); };
calculate_radian = function (cos) { return Math.acos(cos) / (Math.PI / 180); };
> calculate_radian( calculate_cosine(50, 20) );
21.80140948635181
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment