Created
April 27, 2015 03:21
-
-
Save vkgtaro/f77e496910695cbaa877 to your computer and use it in GitHub Desktop.
ベクトルの角度を求める ref: http://qiita.com/vkgtaro/items/b2cd00f376c427cb9ea6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calculate_cosine = function (x, y) { return x / Math.sqrt(x*x + y*y); }; | |
calculate_radian = function (cos) { return Math.acos(cos) / (Math.PI / 180); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 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