Keep Math.acos() argument between -1 and 1.

Closes #482.
This commit is contained in:
Jürg Lehni 2014-07-25 21:01:58 +02:00
parent 4fab100e71
commit 04a0c995bc

View file

@ -331,7 +331,8 @@ var Point = Base.extend(/** @lends Point# */{
if (Numerical.isZero(div)) {
return NaN;
} else {
return Math.acos(this.dot(point) / div);
var a = this.dot(point) / div;
return Math.acos(a < -1 ? -1 : a > 1 ? 1 : a);
}
}
},