}
public void testVectorTwoPairs() {
Vector3D u1 = new Vector3D(3, 0, 0);
Vector3D u2 = new Vector3D(0, 5, 0);
Vector3D v1 = new Vector3D(0, 0, 2);
Vector3D v2 = new Vector3D(-2, 0, 2);
Rotation r = new Rotation(u1, u2, v1, v2);
checkVector(r.applyTo(Vector3D.plusI), Vector3D.plusK);
checkVector(r.applyTo(Vector3D.plusJ), Vector3D.minusI);
r = new Rotation(u1, u2, u1.negate(), u2.negate());
Vector3D axis = r.getAxis();
if (Vector3D.dotProduct(axis, Vector3D.plusK) > 0) {
checkVector(axis, Vector3D.plusK);
} else {
checkVector(axis, Vector3D.minusK);
}
checkAngle(r.getAngle(), Math.PI);
double sqrt = Math.sqrt(2) / 2;
r = new Rotation(Vector3D.plusI, Vector3D.plusJ,
new Vector3D(0.5, 0.5, sqrt),
new Vector3D(0.5, 0.5, -sqrt));
checkRotation(r, sqrt, 0.5, 0.5, 0);
r = new Rotation(u1, u2, u1, Vector3D.crossProduct(u1, u2));
checkRotation(r, sqrt, -sqrt, 0, 0);
checkRotation(new Rotation(u1, u2, u1, u2), 1, 0, 0, 0);
try {
new Rotation(u1, u2, new Vector3D(), v2);
fail("an exception should have been thrown");
} catch (IllegalArgumentException e) {
// expected behavior
} catch (Exception e) {
fail("unexpected exception");