高さと斜辺から、角度と底辺を計算するサンプル

  1. import math
  2. # 高さ
  3. height = 10
  4. # 斜辺
  5. hypotenuse = 20
  6. # 高さと斜辺から角度を求める
  7. angle = math.asin(height / hypotenuse) * 180 / math.pi
  8. # 高さと斜辺から底辺を求める
  9. bottom = math.sqrt(math.pow(hypotenuse, 2) - math.pow(height, 2))
  10. print(angle)
  11. print(bottom)

戻る