Exemplo n.º 1
0
        static void Test()
        {
            Stopwatch watch = new Stopwatch();
            Stopwatch swm   = new Stopwatch();
            Stopwatch swall = new Stopwatch();

            swall.Start();

            swm.Start();
            Map map = new Map(13, 11);

            swm.Stop();

            watch.Start();
            for (int i = 0; i < 11; i++)
            {
                map.UpdateLine(InitComponents.Map[i], i);
            }
            Point p = new Point(0, 0);

            map.KoefRecalc(3);
            Point near = map.GetNearPoint(p);

            watch.Stop();
            swall.Stop();

            Console.WriteLine($"Init Map:   {swm.Elapsed:c}");
            Console.WriteLine($"Near point: {watch.Elapsed:c}");
            Console.WriteLine($"All time:   {swall.Elapsed:c}");
        }
Exemplo n.º 2
0
        static Point SearchTest(Point p, List <Point> l, Map m)
        {
            Point p2 = m.GetNearPoint(p, l.ToArray());

            Point[] boxes = m.GetBoxes(p2, 3);
            for (int i = 0; i < boxes.Length; i++)
            {
                boxes[i].BoxPlace = false;
            }
            Console.WriteLine($"Point A({p}) to Point B({p2}) length: {Map.GetLength(p, p2):0.000}");
            return(p2);
        }