由网友(丿深海、亡灵)分享简介:什么是正确的算法来计算一个WPF线角的度数?What is the "correct" algorithm to calculate the angle in degrees from a WPF Line?推荐答案您需要的 ATAN2 。然而,这将让你在弧度的角度,转换成度必须是易于:-)角度的计算公式为...
什么是正确的算法来计算一个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.
相关推荐
最新文章