Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getAngle(startPoint: number[], arcPath: PathCommand) {
let { startAngle, endAngle } = getArcParams(startPoint, arcPath);
if (!isNumberEqual(startAngle, -Math.PI * 0.5) && startAngle < -Math.PI * 0.5) {
startAngle += Math.PI * 2;
}
if (!isNumberEqual(endAngle, -Math.PI * 0.5) && endAngle < -Math.PI * 0.5) {
endAngle += Math.PI * 2;
}
if (arcPath[5] === 0) {
// 逆时针,需要将 startAngle 和 endAngle 转置,因为 G2 极坐标系为顺时针方向
[startAngle, endAngle] = [endAngle, startAngle];
}
if (isNumberEqual(startAngle, Math.PI * 1.5)) {
startAngle = Math.PI * -0.5;
}