diff --git a/src/main/java/com/sk89q/worldedit/Vector.java b/src/main/java/com/sk89q/worldedit/Vector.java index 1082c16d2..13dbb2428 100644 --- a/src/main/java/com/sk89q/worldedit/Vector.java +++ b/src/main/java/com/sk89q/worldedit/Vector.java @@ -503,9 +503,9 @@ public double dot(Vector other) { */ public Vector cross(Vector other) { return new Vector( - y * other.z + z * other.y, - z * other.x + x * other.z, - x * other.y + y * other.x + y * other.z - z * other.y, + z * other.x - x * other.z, + x * other.y - y * other.x ); } diff --git a/src/test/java/com/sk89q/worldedit/VectorTest.java b/src/test/java/com/sk89q/worldedit/VectorTest.java index eece15fb3..4b1830de3 100644 --- a/src/test/java/com/sk89q/worldedit/VectorTest.java +++ b/src/test/java/com/sk89q/worldedit/VectorTest.java @@ -100,16 +100,16 @@ private void assertCollinear(double ax, double ay, double az, double bx, double final Vector b = new Vector(bx,by,bz); assertTrue(a.isCollinearWith(b)); assertTrue(b.isCollinearWith(a)); - assertTrue(a.multiply(-1).isCollinearWith(b)); - assertTrue(a.isCollinearWith(b.multiply(-1))); + assertTrue(a.multiply(-1.0).isCollinearWith(b)); + assertTrue(a.isCollinearWith(b.multiply(-1.0))); } private void assertNotCollinear(double ax, double ay, double az, double bx, double by, double bz) { final Vector a = new Vector(ax,ay,az); final Vector b = new Vector(bx,by,bz); assertFalse(a.isCollinearWith(b)); assertFalse(b.isCollinearWith(a)); - assertFalse(a.multiply(-1).isCollinearWith(b)); - assertFalse(a.isCollinearWith(b.multiply(-1))); + assertFalse(a.multiply(-1.0).isCollinearWith(b)); + assertFalse(a.isCollinearWith(b.multiply(-1.0))); } private void assertCollinear(double ax, double az, double bx, double bz) { @@ -117,15 +117,15 @@ private void assertCollinear(double ax, double az, double bx, double bz) { final Vector2D b = new Vector2D(bx,bz); assertTrue(a.isCollinearWith(b)); assertTrue(b.isCollinearWith(a)); - assertTrue(a.multiply(-1).isCollinearWith(b)); - assertTrue(a.isCollinearWith(b.multiply(-1))); + assertTrue(a.multiply(-1.0).isCollinearWith(b)); + assertTrue(a.isCollinearWith(b.multiply(-1.0))); } private void assertNotCollinear(double ax, double az, double bx, double bz) { final Vector2D a = new Vector2D(ax,az); final Vector2D b = new Vector2D(bx,bz); assertFalse(a.isCollinearWith(b)); assertFalse(b.isCollinearWith(a)); - assertFalse(a.multiply(-1).isCollinearWith(b)); - assertFalse(a.isCollinearWith(b.multiply(-1))); + assertFalse(a.multiply(-1.0).isCollinearWith(b)); + assertFalse(a.isCollinearWith(b.multiply(-1.0))); } }