fail("wrong exception caught: " + e.getMessage());
}
}
public void testOrthogonal() {
Vector3D v1 = new Vector3D(0.1, 2.5, 1.3);
assertEquals(0.0, Vector3D.dotProduct(v1, v1.orthogonal()), 1.0e-12);
Vector3D v2 = new Vector3D(2.3, -0.003, 7.6);
assertEquals(0.0, Vector3D.dotProduct(v2, v2.orthogonal()), 1.0e-12);
Vector3D v3 = new Vector3D(-1.7, 1.4, 0.2);
assertEquals(0.0, Vector3D.dotProduct(v3, v3.orthogonal()), 1.0e-12);
try {
new Vector3D(0, 0, 0).orthogonal();
fail("an exception should have been thrown");
} catch (ArithmeticException ae) {
// expected behavior
} catch (Exception e) {
fail("wrong exception caught: " + e.getMessage());