fix for angleBetween issue (issue #435), plus todo items

This commit is contained in:
benfry
2010-11-07 22:14:43 +00:00
parent 362f74e5af
commit a7e75e9ce3
4 changed files with 24 additions and 6 deletions
@@ -548,8 +548,11 @@ public class PVector implements Serializable {
// http://code.google.com/p/processing/issues/detail?id=340
// Otherwise if outside the range, acos() will return NaN
// http://www.cppreference.com/wiki/c/math/acos
if (amt <= -1 || amt >= 1) {
if (amt <= -1) {
return PConstants.PI;
} else if (amt >= 1) {
// http://code.google.com/p/processing/issues/detail?id=435
return 0;
}
return (float) Math.acos(amt);
}