mirror of
https://github.com/processing/processing4.git
synced 2026-02-18 21:05:36 +01:00
Merge pull request #2046 from boubpopsyteam/patch-5
Update PVector.java
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user