LoginSignup
0
0

More than 5 years have passed since last update.

自分メモ用(ruby 方角)編集中

Last updated at Posted at 2019-03-06

今向いている方角を角度を使って表記

#dは方向を示す北=0 東=90 南=180 西=270としている。
d = 90

90度ずつ増やして行き360度になった時に0度に戻す。

-90.modulo(360) => 270
360.modulo(360) => 0

動く処理をした際にこれで 0<= d < 360 の範囲で表記できる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0