Esempio n. 1
0
        static void Main(string[] args)
        {
            Grid2D point = new Grid2D(100, 100, 18, 18);

            Console.WriteLine("\nPoint 1\n");
            V5DataOnGrid a = new V5DataOnGrid("Pyatakov Nikita", DateTime.Now, point);

            Console.WriteLine("\n");
            a.InitRandom(2, 15);
            Console.WriteLine(a.ToLongString());
            V5DataCollection b = (V5DataCollection)a;

            Console.WriteLine(b.ToLongString());

            Console.WriteLine("\nPoint 2\n");
            V5MainCollection c = new V5MainCollection();

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

            Console.WriteLine("\nPoint 3\n");
            Vector2[] array;
            foreach (V5Data obj in c)
            {
                array = obj.NearEqual(2);
                for (int i = 0; i < array.Length; i++)
                {
                    Console.WriteLine("[" + array[i].X + ", " + array[i].Y + "]");
                }
            }
            Console.ReadKey();
        }
Esempio n. 2
0
        public void AddDefaults()
        {
            Random           rand = new Random();
            int              NElem = rand.Next(2, 11), Rand1, Rand2;
            Grid2D           Gr;
            V5DataCollection DataColl;
            V5DataOnGrid     DataGrid;

            V5List = new List <V5Data>();
            for (int i = 0; i < NElem; i++)
            {
                Rand1 = rand.Next(0, 2);
                Gr    = new Grid2D(100, 100, 18, 18);
                if (Rand1 == 0)
                {
                    DataGrid = new V5DataOnGrid("", DateTime.Now, Gr);
                    DataGrid.InitRandom(0, 9);
                    V5List.Add(DataGrid);
                }
                else
                {
                    Rand2    = rand.Next(1, 10);
                    DataColl = new V5DataCollection("", DateTime.Now);
                    DataColl.InitRandom(Rand2, 3, 18, 3, 5);
                    V5List.Add(DataColl);
                }
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            V5DataCollection a = new V5DataCollection("", DateTime.Now, "l_2.txt");

            Console.WriteLine(a.ToLongString("f4"));

            V5MainCollection task2 = new V5MainCollection();

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

            Vector2 p;

            p.X = 1;
            p.Y = 2;

            Console.WriteLine("MaxDistance");
            Console.WriteLine(task2.MaxDistance(p).ToString("f4"));

            Console.WriteLine("MaxDistanceItem");
            foreach (DataItem s1 in task2.MaxDistanceItems(p))
            {
                Console.WriteLine(s1.ToString("f4"));
            }

            Console.WriteLine("DataItems");
            foreach (DataItem s2 in task2.DataItems)
            {
                Console.WriteLine(s2.ToString());
            }
        }