Esempio n. 1
0
        // Метод поиска разделяющих. // TODO: Переделать.
        private double Find(Polygon2d.Iterator iti, Polygon2d.Iterator itj)
        {
            int gi = -1;
            int gj = -1;
            double ged = double.NegativeInfinity;

            for (int i = 0; i < iti.Count; i++)
            {
                int lj = -1;
                double led = double.PositiveInfinity;
                for (int j = 0; j < itj.Count; j++)
                {
                    double ed = Plane2dExt.Расширенное_расстояние(iti.Plane(i), itj.Point(j));
                    if (led > ed)
                    {
                        led = ed;
                        lj = j;
                    }
                    if (ed < 0)
                    {
                        led = double.PositiveInfinity;
                        break;
                    }
                }

                if (!double.IsPositiveInfinity(led))
                {
                    if (ged < led)
                    {
                        ged = led;
                        gi = i;
                        gj = lj;
                    }
                }
            }

            if (!double.IsNegativeInfinity(ged))
            {
                iti.Move(gi);
                itj.Move(gj);
            }

            return ged;
        }