@Test
public void testCrossProduct() {
// we compare accurate versus naive cross product implementations
// on regular vectors (i.e. not extreme cases like in the previous test)
Well1024a random = new Well1024a(885362227452043214l);
for (int i = 0; i < 10000; ++i) {
double ux = 10000 * random.nextDouble();
double uy = 10000 * random.nextDouble();
double uz = 10000 * random.nextDouble();
double vx = 10000 * random.nextDouble();
double vy = 10000 * random.nextDouble();
double vz = 10000 * random.nextDouble();
Vector3D cNaive = new Vector3D(uy * vz - uz * vy, uz * vx - ux * vz, ux * vy - uy * vx);
Vector3D cAccurate = new Vector3D(ux, uy, uz).crossProduct(new Vector3D(vx, vy, vz));
Assert.assertEquals(0.0, cAccurate.distance(cNaive), 6.0e-15 * cAccurate.getNorm());
}
}