mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Simplify Point#getDirectedAngle().
This commit is contained in:
parent
ab634f2391
commit
2b5e9296f7
1 changed files with 1 additions and 7 deletions
|
@ -273,13 +273,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();
|
var angle = this.getAngle() - point.getAngle();
|
||||||
var bounds = 180;
|
return angle < -180 ? angle + 360 : angle > 180 ? angle - 360 : angle;
|
||||||
if (angle < - bounds) {
|
|
||||||
return angle + bounds * 2;
|
|
||||||
} else if (angle > bounds) {
|
|
||||||
return angle - bounds * 2;
|
|
||||||
}
|
|
||||||
return angle;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue