Пример #1
0
        private static Polygon2D[] smethod_10(
            Polygon2D[] polies,
            bool right,
            bool outer,
            Interface28 xInterval,
            Interface28 yInterval,
            double epsilon)
        {
            bool isPeriodic1 = xInterval.IsPeriodic;
            bool isPeriodic2 = yInterval.IsPeriodic;

            if (!isPeriodic1 && !isPeriodic2)
            {
                return(polies);
            }
            List <Polygon2D> polygon2DList   = new List <Polygon2D>();
            double           periodicLength1 = xInterval.PeriodicLength;
            double           periodicLength2 = yInterval.PeriodicLength;
            Polygon2D        polygon2D1      = new Polygon2D();

            foreach (Polygon2D poly in polies)
            {
                int count = poly.Count;
                if (count > 0)
                {
                    Point2D p1 = Class794.smethod_8(xInterval, yInterval, poly[0]);
                    for (int index = 1; index <= count; ++index)
                    {
                        Point2D p2    = Class794.smethod_8(xInterval, yInterval, poly[index % count]);
                        bool    flag1 = isPeriodic1 && 2.0 * System.Math.Abs(p2.X - p1.X) > periodicLength1;
                        bool    flag2 = isPeriodic2 && 2.0 * System.Math.Abs(p2.Y - p1.Y) > periodicLength2;
                        if (flag1 || flag2)
                        {
                            if (flag1 && flag2)
                            {
                                throw new NotSupportedException("Double interval crossing not yet supported!");
                            }
                            Class794.Struct7 struct7 = flag1 ? Class794.smethod_11(xInterval, p1.X, p2.X) : Class794.smethod_11(yInterval, p1.Y, p2.Y);
                            Point2D          point2D = Class794.smethod_12(p1, p2, struct7.double_0);
                            if (flag1)
                            {
                                point2D = new Point2D(struct7.bool_0 ? xInterval.End : xInterval.Start, point2D.Y);
                                p2      = new Point2D(struct7.bool_0 ? xInterval.Start : xInterval.End, point2D.Y);
                            }
                            else
                            {
                                point2D = new Point2D(point2D.X, struct7.bool_0 ? yInterval.End : yInterval.Start);
                                p2      = new Point2D(point2D.X, struct7.bool_0 ? yInterval.Start : yInterval.End);
                            }
                            polygon2D1.Add(point2D);
                            polygon2DList.Add(polygon2D1);
                            polygon2D1 = new Polygon2D();
                        }
                        polygon2D1.Add(p2);
                        p1 = p2;
                    }
                }
            }
            if (polygon2D1.Count > 0)
            {
                if (polygon2DList.Count == 0)
                {
                    polygon2DList.Add(polygon2D1);
                }
                else
                {
                    polygon2DList.Add(polygon2D1);
                }
            }
            foreach (Polygon2D polygon2D2 in polygon2DList)
            {
                ;
            }
            return(polygon2DList.ToArray());
        }