mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix Point#getDirectedAngle, which was measured the wrong way round, and could be optimised using Math.atan2().
This commit is contained in:
parent
8d0bb3d2ae
commit
0cda1aa9dd
1 changed files with 1 additions and 2 deletions
|
@ -590,8 +590,7 @@ var Point = this.Point = Base.extend({
|
|||
*/
|
||||
getDirectedAngle: function(point) {
|
||||
point = Point.read(arguments);
|
||||
var angle = this.getAngle() - point.getAngle();
|
||||
return angle < -180 ? angle + 360 : angle > 180 ? angle - 360 : angle;
|
||||
return Math.atan2(this.cross(point), this.dot(point)) * 180 / Math.PI;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue