public static Vector3 Multiply(this Matrix matrix, Vector3 vector) { if (matrix == null) { throw new ArgumentNullException("matrix"); } if (vector == null) { throw new ArgumentNullException("vector"); } var product = new Vector3(); for (var i = 0; i < 3; i++) { for (var k = 0; k < 3; k++) { product.SetIndex(i, product.Index(i) + matrix[i, k] * vector.Index(k)); } } return(product); }