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

            // Act
            var dot = v1.Dot(v2);
            var dot_static = Vector.Dot(v1, v2);

            // Assert
            Assert.AreEqual(20, dot);
            Assert.AreEqual(20, dot_static);
        }
Exemple #2
0
 /// <summary>
 /// Calculate the dot-product of two vectors
 /// </summary>
 /// <param name="v1">The first vector</param>
 /// <param name="v2">The second vector</param>
 /// <returns>The result</returns>
 public static double Dot(Vector v1, Vector v2)
 {
     return v1.Dot(v2);
 }