public void TestCrossProduct()
{
double angle = Math.PI / 4.0;
double cos = Math.Cos(angle / 2.0);
double sin = Math.Sin(angle / 2.0);
double a = cos * cos - sin * sin / 3.0;
double b = 2.0 * (sin * sin + sin * cos * Math.Sqrt(3.0)) / 3.0;
double c = 2.0 * (sin * sin - sin * cos * Math.Sqrt(3.0)) / 3.0;
// The three vectors here are the orthonormal set obtained by rotating
// the x-axis, y-axis, and z-axis through an angle of 45 degrees about
// the (1,1,1) vector.
UnitCartesian first = new UnitCartesian(a, b, c);
UnitCartesian second = new UnitCartesian(c, a, b);
UnitCartesian third = new UnitCartesian(b, c, a);
Cartesian result = first.Cross(second);
Assert.AreEqual(third.X, result.X, Constants.Epsilon14);
Assert.AreEqual(third.Y, result.Y, Constants.Epsilon14);
Assert.AreEqual(third.Z, result.Z, Constants.Epsilon14);
Cartesian Cartesian3 = new Cartesian(c, a, b);
result = first.Cross(Cartesian3);
Assert.AreEqual(third.X, result.X, Constants.Epsilon14);
Assert.AreEqual(third.Y, result.Y, Constants.Epsilon14);
Assert.AreEqual(third.Z, result.Z, Constants.Epsilon14);
}