From 0dc159eb1fa3ccbb3ac3160606b35fd6cb124582 Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Wed, 30 Nov 2016 02:29:02 -0800 Subject: [PATCH] fix ellipse picking --- web/app/sketcher/shapes/ellipse.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/sketcher/shapes/ellipse.js b/web/app/sketcher/shapes/ellipse.js index 001dfce2..04521f74 100644 --- a/web/app/sketcher/shapes/ellipse.js +++ b/web/app/sketcher/shapes/ellipse.js @@ -45,7 +45,7 @@ export class Ellipse extends SketchObject { toEllipseCoordinateSystem(point) { let x = point.x - this.centerX; let y = point.y - this.centerY; - const angle = Math.atan2(y, x) - this.rotation; + const angle = Math.atan2(y, x) + this.rotation; const distance = math.distance(0, 0, x, y); x = distance * Math.cos(angle); y = distance * Math.sin(angle); @@ -55,7 +55,7 @@ export class Ellipse extends SketchObject { normalDistance(aim) { const trInfo = this.toEllipseCoordinateSystem(aim); const sq = (a) => a * a; - const L = Math.sqrt(1/( sq(Math.sin(trInfo.angle)/this.radiusX) + sq(Math.cos(trInfo.angle)/this.radiusY))); + const L = Math.sqrt(1/( sq(Math.cos(trInfo.angle)/this.radiusX) + sq(Math.sin(trInfo.angle)/this.radiusY))); return Math.abs(trInfo.distance - L); } }