Exemplo n.º 1
0
        public void AddDefaults()
        {
            string s     = "first one ";
            string s1    = "Hello my name is Anton ";
            string s2    = "Good morning ";
            float  st_x  = 1.5F;
            int    num_x = 10;
            float  st_y  = 1.5F;
            int    num_y = 10;
            Grid1D x1    = new Grid1D(st_x, num_x);
            Grid1D y1    = new Grid1D(st_y, num_y);
            Grid1D x2    = new Grid1D(222.0F, 30);

            DateTime date1 = DateTime.Now;
            DateTime date2 = DateTime.Today;

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

            d_grr.InitRandom(0.34, 8.94);


            V3DataOnGrid d_grr1 = new V3DataOnGrid(s1, date2, x2, x2);

            d_grr1.InitRandom(0.1, 100.0);

            V3DataCollection d_grrrrr = new V3DataCollection(s2, date1);

            d_grrrrr.InitRandom(50, 130.0F, 132.0F, 0.0, 200.0);
            v3.Add(d_grr);
            v3.Add(d_grr1);
            v3.Add(d_grrrrr);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void AddDefaults()
        {
            Grid1D       x     = new Grid1D((float)0.2, 2);
            Grid1D       y     = new Grid1D((float)0.2, 2);
            V3DataOnGrid data1 = new V3DataOnGrid("", DateTime.Now, x, y);

            data1.InitRandom(0.25, 0.5);
            V3DataCollection data2 = new V3DataCollection();

            data2.InitRandom(3, 10, 10, 0.25, 0.5);
            v3Datas.Add(data1);
            v3Datas.Add(data2);
            V3DataCollection data3 = new V3DataCollection();

            data3.dataItems.Add(new DataItem(new Vector2(0.0f, 0.0f), 1.11));
            data3.dataItems.Add(new DataItem(new Vector2(0.0f, 0.2f), 2.22));
            data3.dataItems.Add(new DataItem(new Vector2(0.2f, 0.0f), 3.33));
            data3.dataItems.Add(new DataItem(new Vector2(0.2f, 0.2f), 4.44));
            v3Datas.Add(data3);
        }
Exemplo n.º 4
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");
            }
        }