【发布时间】:2022-05-08 22:52:19
【问题描述】:
我在 PHP 中使用一些填充的弧线,但我无法找到一种计算弧线终点坐标的方法。我知道中心点坐标、半径(宽高相同)、起始角度、结束角度(如 php imagefileldarc() 函数所要求的那样)。由此,如何计算圆弧的终点坐标?
我试过以下公式无济于事:
$end['x'] = cos($Angle) * $Radius + $CenterX;
$end['y'] = sin($Angle) * $Radius + $CenterY;
非常感谢
【问题讨论】:
-
$Angle 使用弧度,不是吗?
-
我使用度数作为角度。
-
我刚刚使用 PHP 的
deg2rad()将度数转换为弧度,现在它似乎可以工作了。非常感谢。