diff --git a/core/src/processing/core/PVector.java b/core/src/processing/core/PVector.java index 725c208b1..ca25eb1db 100644 --- a/core/src/processing/core/PVector.java +++ b/core/src/processing/core/PVector.java @@ -926,9 +926,9 @@ public class PVector implements Serializable { static public float angleBetween(PVector v1, PVector v2) { // We get NaN if we pass in a zero vector which can cause problems - // Zero seems like a reasonable angle between a (0,0) vector and something else - if (v1.x == 0 && v1.y == 0) return 0.0f; - if (v2.x == 0 && v2.y == 0) return 0.0f; + // Zero seems like a reasonable angle between a (0,0,0) vector and something else + if (v1.x == 0 && v1.y == 0 && v1.z == 0 ) return 0.0f; + if (v2.x == 0 && v2.y == 0 && v2.z == 0 ) return 0.0f; double dot = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; double v1mag = Math.sqrt(v1.x * v1.x + v1.y * v1.y + v1.z * v1.z); @@ -994,4 +994,4 @@ public class PVector implements Serializable { result = 31 * result + Float.floatToIntBits(z); return result; } -} \ No newline at end of file +}