Example #1
0
        public static int Main()
        {
            Console.WriteLine("TASK №1");
            string   s     = "sdsafasf";
            float    st_x  = 1.0F;
            int      num_x = 10;
            float    st_y  = 2.0F;
            int      num_y = 15;
            Grid1D   x1    = new Grid1D(st_x, num_x);
            Grid1D   y1    = new Grid1D(st_y, num_y);
            DateTime date1 = DateTime.Today;

            V3DataOnGrid d_gr = new V3DataOnGrid(s, date1, x1, y1);

            d_gr.InitRandom(34.0, 67.0);
            V3DataCollection d_c = d_gr;

            Console.WriteLine(d_gr.ToLongString());


            Console.WriteLine("TASK №2");

            V3MainCollection v = new V3MainCollection();

            v.AddDefaults();
            Console.WriteLine(v.Count);
            Console.WriteLine("this is number of elements in list");
            Console.WriteLine("and under this you can find them");

            Console.WriteLine(v.ToString());



            Console.WriteLine("TASK №3");
            Vector2 vect    = new Vector2(23.0F, 14.0F);
            int     counter = 1;

            foreach (V3Data obj in v)
            {
                Console.WriteLine("The nearest points for object number " + counter + " are: ");
                for (int i = 0; i < obj.Nearest(vect).Length; i++)
                {
                    Console.WriteLine("" + i + ". (" + obj.Nearest(vect)[i].X + " ; " + obj.Nearest(vect)[i].Y + ")");
                }
                counter++;
            }

            return(0);
        }
Example #2
0
        static void Main(string[] args)
        {
            Grid1D       x      = new Grid1D((float)0.2, 2);
            Grid1D       y      = new Grid1D((float)0.2, 2);
            V3DataOnGrid onGrid = new V3DataOnGrid("", DateTime.Now, x, y);

            onGrid.InitRandom(0.5, 1.0);
            Console.WriteLine(onGrid.ToLongString());

            V3DataCollection dataCollection = new V3DataCollection();

            dataCollection = (V3DataCollection)onGrid;
            Console.WriteLine(dataCollection.ToLongString());

            Console.WriteLine("Основная коллекция:");
            V3MainCollection main = new V3MainCollection();

            main.AddDefaults();
            Console.WriteLine(main.ToString());

            Vector2 dot = new Vector2((float)0.1, (float)0.3);

            Console.WriteLine($"\n dot = {dot}\n");
            foreach (V3Data element in main)
            {
                Vector2[] vector2s = new Vector2[] { };
                Console.WriteLine(element.ToLongString());

                vector2s = element.Nearest(dot);
                Console.WriteLine("Nearest:");
                foreach (Vector2 vector2 in vector2s)
                {
                    Console.WriteLine(vector2);
                }
                Console.WriteLine("\n");
            }
        }