public void CrossProductReturnsCrossProduct(double ax, double ay, double az, double bx, double by, double bz, double cx, double cy, double cz) { Vector3 a = new Vector3(ax, ay, az); Vector3 b = new Vector3(bx, by, bz); Vector3 c = VectorMath.CrossProduct(a, b); Assert.Equal(cx, c.X, 12); Assert.Equal(cy, c.Y, 12); Assert.Equal(cz, c.Z, 12); }
static void Main(string[] args) { double[] vector1 = { 7, -2, 0 }; double[] vector2 = { -4, 3, 6 }; double[] result; result = VectorMath.CrossProduct(vector1, vector2); Console.WriteLine("(" + result[0] + ", " + result[1] + ", " + result[2] + ")"); }
static void Main(string[] args) { double[] vector = { 2, -2, 1 }; double[] vector1 = { -8, 8, -4 }; double[] res; res = VectorMath.CrossProduct(vector, vector1); foreach (double x in res) { Console.WriteLine(x); } }
static void Main(string[] args) { double[] vector1 = { 2, -2, 1 }; double[] vector2 = { -8, 8, -4 }; Console.Write($"{VectorToString(vector1)}\n\tCross\n{VectorToString(vector2)}\n"); Console.WriteLine($"\t=\n{VectorToString(VectorMath.CrossProduct(vector1, vector2))}"); Console.WriteLine("------------\n"); double[] vector3 = { 2, -2 }; double[] vector4 = { -8, 8, -4 }; Console.Write($"{VectorToString(vector3)}\n\tCross\n{VectorToString(vector4)}\n"); Console.WriteLine($"\t=\n{VectorToString(VectorMath.CrossProduct(vector3, vector4))}"); Console.WriteLine("------------\n"); }
public static void Main() { double[] vector1 = new double[] { 2, -2, 1 }; double[] vector2 = new double[] { -8, 8, -4 }; double[] crossVector = new double[] {}; crossVector = VectorMath.CrossProduct(vector1, vector2); Console.Write("Resulting vector is: { "); for (int i = 0; i < crossVector.Length; i++) { Console.Write($"{crossVector[i]} "); } Console.WriteLine("}"); double[] testVector = { -3.0, 1, 2, 4 }; crossVector = VectorMath.CrossProduct(vector2, testVector); Console.WriteLine($"Any Vector ss not a 2D or 3D Vector: \n {{ {crossVector[0]} }}"); }