需要算法WPF线的角度 [英] Need algorithm for angle of WPF line
本文介绍了需要算法WPF线的角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是正确的算法来计算一个WPF线角的度数?
What is the "correct" algorithm to calculate the angle in degrees from a WPF Line?
推荐答案
您需要的 ATAN2
。然而,这将让你在弧度的角度,转换成度必须是易于:-)角度的计算公式为 ATAN2(Y2 - Y1,X2 - X1)
,其中(X1,Y1)
和(x2,y2)
是你的行结束。
You need atan2
. This would however give you the angle in radians, converting to degrees must be easy :-) The angle is calculated as atan2(y2 - y1, x2 - x1)
, where (x1, y1)
and (x2, y2)
are your line ends.
请注意,该常数 PI
是的可用了。
Note that the constant pi
is available, too.
这篇关于需要算法WPF线的角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文