mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-15 01:09:53 -04: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) {
|
getDirectedAngle: function(point) {
|
||||||
point = Point.read(arguments);
|
point = Point.read(arguments);
|
||||||
var angle = this.getAngle() - point.getAngle();
|
return Math.atan2(this.cross(point), this.dot(point)) * 180 / Math.PI;
|
||||||
return angle < -180 ? angle + 360 : angle > 180 ? angle - 360 : angle;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue