Help us understand the problem. What is going on with this article?

ベクトルの角度を求める

More than 5 years have passed since last update.

三角関数とかもう覚えてないわーってことでメモ。
原点から x, y の座標へのベクトルが x 軸から何度あるのか求めるのを javascript で。
(chrome の console で気軽に求められるので)

calculate_cosine = function (x, y) { return x / Math.sqrt(x*x + y*y); };
calculate_radian = function (cos) { return Math.acos(cos) / (Math.PI / 180); };

座標 x = 50, y = 20 のときはこうなる。

> calculate_radian( calculate_cosine(50, 20) );
21.80140948635181
vkgtaro
✿人生ボムなし残機なし気合い避け! ✿好きな言語は perl, ruby, javascript です。最近はもっぱら python を楽しんでます。
http://vkgtaro.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした