問題:
In a programming language (Python, C#, etc) I need to determine how to calculate the angle between a line and the horizontal axis?在編程語言(Python、C# 等)中,我需要確定如何計算直線與水平軸之間的角度?
I think an image describes best what I want:我認爲一張圖片最能描述我想要的東西:
Given (P1 x ,P1 y ) and (P2 x ,P2 y ) what is the best way to calculate this angle?給定 (P1 x ,P1 y ) 和 (P2 x ,P2 y ) 計算這個角度的最佳方法是什麼? The origin is in the topleft and only the positive quadrant is used.原點位於左上角,僅使用正象限。
解決方案:
參考一: https://stackoom.com/question/VpTr參考二: How to calculate the angle between a line and the horizontal axis?