static public void Task3Default() { int arrayLength; int startIndex; Console.WriteLine("=== Input vector 1 :"); arrayLength = Verificaton.IntValue("Length of array"); startIndex = Verificaton.IntValue("Start index"); var vector1 = VectorGeneral.GetRandom(arrayLength, startIndex); Console.WriteLine("=== Input vector 2 (with random values :"); var vector2 = new VectorGeneral(Verificaton.DoubleArray(), Verificaton.IntValue("Start index")); Console.WriteLine("\nVector 1 :"); vector1.Output(); Console.WriteLine("\nVector 2 :"); vector2.Output(); try { Console.WriteLine("\nGetting element of vector 1 by index :"); Console.WriteLine(vector1[Verificaton.IntValue("Vector index")]); } catch (Exception e) { message = "Unable to get vector element"; Console.WriteLine(message); logger?.Error(message, e); } try { Console.WriteLine("\nVector 1 + Vector 2 :"); (vector1 + vector2).Output(); Console.WriteLine("\nVector 1 - Vector 2 :"); (vector1 - vector2).Output(); } catch (Exception e) { message = "Unable to add or substract vectors"; Console.WriteLine(message); logger?.Error(message, e); } Console.WriteLine("\nVector 1 * Scalar :"); vector1.MultScalar(Verificaton.DoubleValue("Scalar value")).Output(); Console.WriteLine($"\nVector 1 is greater than Vector 2 ? {VectorGeneral.Compare(vector1, vector2) > 0}"); }
static public void Task2Default() { Console.WriteLine("/n=== Input parameters for rectangle 1 in format : Left Top Right Bottom"); Rectangle rectangle1 = new Rectangle(Verificaton.DoubleArray()); Console.WriteLine("/n=== Input parameters for rectangle 2 in format : Left Top Right Bottom"); Rectangle rectangle2 = new Rectangle(Verificaton.DoubleArray()); rectangle1.Output(); rectangle2.Output(); Console.WriteLine("/n=== Move rectangle 1 : Left Top Right Bottom"); rectangle1.Move(Verificaton.DoubleValue("Horizontal offset"), Verificaton.DoubleValue("Vertical offset")); rectangle1.Output(); try { Console.WriteLine("/n=== Intercept rectangle 1, rectangle 2 : Left Top Right Bottom"); Rectangle.Intercept(rectangle1, rectangle2).Output(); } catch (Exception e) { message = "Unable to Intercept rectangles"; Console.WriteLine(message); logger?.Error(message, e); } try { Console.WriteLine("/n=== Union rectangle 1, rectangle 2 : Left Top Right Bottom"); Rectangle.Union(rectangle1, rectangle2).Output(); } catch (Exception e) { message = "Unable to Union rectangles"; Console.WriteLine(message); logger?.Error(message, e); } }
static public void Task1Default() { Console.WriteLine("=== Input vector 1 :"); var vector1 = new Vector3D(Verificaton.DoubleArray()); Console.WriteLine("=== Input vector 2 :"); var vector2 = new Vector3D(Verificaton.DoubleArray()); Console.WriteLine("=== Input vector 3 :"); var vector3 = new Vector3D(Verificaton.DoubleArray()); Console.WriteLine("\nVector 1 :"); vector1.Output(); Console.WriteLine("\nVector 2 :"); vector2.Output(); Console.WriteLine("\nVector 3 :"); vector3.Output(); try { Console.WriteLine("\nVector 1 + Vector 2 :"); (vector1 + vector2).Output(); Console.WriteLine("\nVector 1 - Vector 2 :"); (vector1 - vector2).Output(); } catch (Exception e) { message = "Unable to Sum or Substract 2 vector 1 and vector 2"; Console.WriteLine(message); logger?.Error(message, e); } try { Console.WriteLine("\nScalar Product (Vector 1 , Vector 2) :"); Console.WriteLine(Vector3D.ScalarProduct(vector1, vector2).ToString()); Console.WriteLine("\nAngle between (Vector 1 , Vector 2) :"); Console.WriteLine(Vector3D.Angle(vector1, vector2).ToString("F2") + " grad."); } catch (Exception e) { message = "Unable to calculate scalar product of vector 1 and vector 2"; Console.WriteLine(message); logger?.Error(message, e); } try { Console.WriteLine("\nVector Product (Vector 1 , Vector 2) :"); Vector3D.VectorProduct(vector1, vector3).Output(); } catch (Exception e) { message = "Unable to calculate vector product of vector 1 and vector 2"; Console.WriteLine(message); logger?.Error(message, e); } try { Console.WriteLine("\nTripple Product (Vector 1 , Vector 2, Vector 3) :"); Console.WriteLine(Vector3D.TrippleProduct(vector1, vector2, vector3).ToString()); } catch (Exception e) { message = "Unable to calculate tripple product"; Console.WriteLine(message); logger?.Error(message, e); } try { Console.WriteLine("\nVector Length (Vector 1) :"); Console.WriteLine(vector1.VectorLength().ToString("F2")); Console.WriteLine($"\nVector 1 is greater than Vector 2 ? {Vector3D.Compare(vector1, vector2) > 0}"); } catch (Exception e) { message = "Unable to calculate vector length"; Console.WriteLine(message); logger?.Error(message, e); } }