我想在一个圆上的两个点之间绘制一个半圆。主要代表一个时钟,我想画另一条线代表一个小时到另一个小时的进度,因此积分的位置可能会有所不同。首先,我知道我感兴趣的2个点的X和Y。这就是我尝试在UIBezierPath中添加角度的方法。我的问题是,新圈子正确开始,但在完全随机的位置结束
let firstAngle = atan2(redPoint.y - circleCenter.y, redPoint.x - circleCenter.x)
let secondAngle = atan2(bluePoint.y - circleCenter.y, bluePoint.x - circleCenter.x) ```
let circlePath1 = UIBezierPath(arcCenter: circleCenter,
radius: circleRadius,
startAngle: firstAngle,
endAngle: secondAngle,
clockwise: true) ```
无论我设置了redPoint,圆都从正确的位置开始,但是圆永远不会在bluePoint上。