示例#1
0
        public void CanCalculateCrossProduct()
        {
            // Arrange
            var v1 = new Vector(1, 2, 3);
            var v2 = new Vector(2, 3, 4);

            // Act
            var cross = v1.Cross(v2);
            var cross_static = Vector.Cross(v1, v2);

            // Assert
            Assert.AreEqual(new Vector(-1, 2, -1), cross);
            Assert.AreEqual(new Vector(-1, 2, -1), cross_static);
        }
示例#2
0
 /// <summary>
 /// Calculate the cross-product of two vectors
 /// </summary>
 /// <param name="v1">The first vector</param>
 /// <param name="v2">The second vector</param>
 /// <returns>The resultant vector</returns>
 public static Vector Cross(Vector v1, Vector v2)
 {
     return v1.Cross(v2);
 }