Beispiel #1
0
            public bool Equals(YuPengClipper.Edge e)
            {
                bool flag = e == null;

                return(!flag && YuPengClipper.VectorEqual(this.EdgeStart, e.EdgeStart) && YuPengClipper.VectorEqual(this.EdgeEnd, e.EdgeEnd));
            }
Beispiel #2
0
        private static PolyClipError BuildPolygonsFromChain(List <YuPengClipper.Edge> simplicies, out List <Vertices> result)
        {
            result = new List <Vertices>();
            PolyClipError polyClipError = PolyClipError.None;
            PolyClipError result2;

            while (simplicies.Count > 0)
            {
                Vertices vertices = new Vertices();
                vertices.Add(simplicies[0].EdgeStart);
                vertices.Add(simplicies[0].EdgeEnd);
                simplicies.RemoveAt(0);
                bool flag  = false;
                int  num   = 0;
                int  count = simplicies.Count;
                while (!flag && simplicies.Count > 0)
                {
                    bool flag2 = YuPengClipper.VectorEqual(vertices[vertices.Count - 1], simplicies[num].EdgeStart);
                    if (flag2)
                    {
                        bool flag3 = YuPengClipper.VectorEqual(simplicies[num].EdgeEnd, vertices[0]);
                        if (flag3)
                        {
                            flag = true;
                        }
                        else
                        {
                            vertices.Add(simplicies[num].EdgeEnd);
                        }
                        simplicies.RemoveAt(num);
                        num--;
                    }
                    else
                    {
                        bool flag4 = YuPengClipper.VectorEqual(vertices[vertices.Count - 1], simplicies[num].EdgeEnd);
                        if (flag4)
                        {
                            bool flag5 = YuPengClipper.VectorEqual(simplicies[num].EdgeStart, vertices[0]);
                            if (flag5)
                            {
                                flag = true;
                            }
                            else
                            {
                                vertices.Add(simplicies[num].EdgeStart);
                            }
                            simplicies.RemoveAt(num);
                            num--;
                        }
                    }
                    bool flag6 = !flag;
                    if (flag6)
                    {
                        bool flag7 = ++num == simplicies.Count;
                        if (flag7)
                        {
                            bool flag8 = count == simplicies.Count;
                            if (flag8)
                            {
                                result = new List <Vertices>();
                                Debug.WriteLine("Undefined error while building result polygon(s).");
                                result2 = PolyClipError.BrokenResult;
                                return(result2);
                            }
                            num   = 0;
                            count = simplicies.Count;
                        }
                    }
                }
                bool flag9 = vertices.Count < 3;
                if (flag9)
                {
                    polyClipError = PolyClipError.DegeneratedOutput;
                    Debug.WriteLine("Degenerated output polygon produced (vertices < 3).");
                }
                result.Add(vertices);
            }
            result2 = polyClipError;
            return(result2);
        }