Esempio n. 1
0
        private static void ProcessVectorOptions(TVector3D baseVect)
        {
            TVector3D tmpVect;
            double    tmpNum;
            bool      execute = true;

            do
            {
                Write(CHOOSE_OPTION);
                switch (ReadLine())
                {
                case "1":
                    WriteLine(baseVect.ToString());
                    break;

                case "2":
                    tmpVect = CreateVector3D();
                    WriteLine($"Vectors are {(baseVect != tmpVect ? "un" : "")}equal");
                    break;

                case "3":
                    WriteLine("Vector length: " + baseVect.GetLength());
                    break;

                case "4":
                    WriteLine("Normalized vector: " + baseVect.Normalize());
                    break;

                case "5":
                    tmpVect = CreateVector3D();
                    WriteLine(baseVect + tmpVect);
                    break;

                case "6":
                    tmpVect = CreateVector3D();
                    WriteLine(baseVect - tmpVect);
                    break;

                case "7":
                    tmpNum = GetDouble();
                    WriteLine(baseVect * tmpNum);
                    break;

                case "8":
                    tmpNum = GetDouble();
                    WriteLine(baseVect / tmpNum);
                    break;

                case "9":
                    baseVect = CreateVector3D();
                    break;

                default:
                    execute = false;
                    break;
                }
            } while (execute);
            WriteLine("Exited from 3d vector menu");
        }
Esempio n. 2
0
        private static void Main(string[] _)
        {
            WriteLine("1. Create single dimension array");
            WriteLine("2. Create 2D vector");
            WriteLine("3. Create 3D vector");
            WriteLine(EXIT_OPTION);
            bool execute = true;

            do
            {
                Write(CHOOSE_OPTION);
                switch (ReadLine())
                {
                case "1":
                    var array = CreateDoubleArray();
                    PrintArrayOptions();
                    ProcessArrayOptions(array);
                    break;

                case "2":
                    TVector2D baseVect2D = CreateVector2D();
                    PrintVectorOptions();
                    ProcessVectorOptions(baseVect2D);
                    break;

                case "3":
                    TVector3D baseVect3D = CreateVector3D();
                    PrintVectorOptions();
                    ProcessVectorOptions(baseVect3D);
                    break;

                default:
                    execute = false;
                    break;
                }
            } while (execute);
        }
Esempio n. 3
0
 public bool Equals(TVector3D vector) => X == vector.X && Y == vector.Y && Z == vector.Z;
Esempio n. 4
0
 public TVector3D(TVector3D v1)
 {
     X = v1.X; Y = v1.Y; Z = v1.Z;
 }