Пример #1
0
        public void SpeedTest2()
        {
            ItemSet seta = new ItemSet();
            seta.SetUp(10);

            for (int i = 0; i < 100000; ++i)
            {
                MyList<MyPoint> set1 = new MyList<MyPoint>();
                set1.Add(new MyPoint(1, 6));
                set1.Add(new MyPoint(2, 6));
                set1.Add(new MyPoint(5, 6));
                set1.Add(new MyPoint(3, 6));
                set1.Add(new MyPoint(2, 5));
                set1.Add(new MyPoint(3, 5));
                set1.Add(new MyPoint(5, 5));
                set1.Add(new MyPoint(3, 4));
                set1.Add(new MyPoint(3, 7));
                set1.Add(new MyPoint(6, 4));

                ItemSet workSet = seta.Clone();
                ItemSet currentLine = new ItemSet();

                currentLine.Add(0);
                currentLine.Add(1);
                LineParams par = new LineParams(set1[0], set1[1]);

                workSet.RemoveAt(0);
                workSet.RemoveAt(1);

                for (int k = 0; k < workSet.Count; ++k)
                {
                    int id = workSet.GetItemIndex(k);
                    if (par.IsCollinear(set1[id]))
                    {
                        currentLine.Add(id);
                        workSet.RemoveAt(id);
                    }
                }
            }
        }