From 5f876adc1c57f2779ffe1ef552890d48f4b2cf89 Mon Sep 17 00:00:00 2001 From: sapics Date: Fri, 8 Jan 2016 11:15:10 +0900 Subject: [PATCH] Replace atan to atan2 for avoiding NaN --- src/path/Path.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/path/Path.js b/src/path/Path.js index 2bf39b61..b0528a5f 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -2836,10 +2836,10 @@ statics: { var sin = Math.sin(phi), cos = Math.cos(phi), tan = Math.tan(phi), - tx = -Math.atan(b * tan / a), - ty = Math.atan(b / (tan * a)); + tx = Math.atan2(b * tan, a), + ty = Math.atan2(b, tan * a); // Due to symetry, we don't need to cycle through pi * n solutions: - return [Math.abs(a * Math.cos(tx) * cos - b * Math.sin(tx) * sin), + return [Math.abs(a * Math.cos(tx) * cos + b * Math.sin(tx) * sin), Math.abs(b * Math.sin(ty) * cos + a * Math.cos(ty) * sin)]; },