Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Fixed Vector.cross and optimized the Vector tests slightly.
Dieser Commit ist enthalten in:
Ursprung
e810113ea0
Commit
e1428602af
@ -503,9 +503,9 @@ public class Vector {
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -100,16 +100,16 @@ public class VectorTest {
|
||||
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 @@ public class VectorTest {
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren