Пример #1
0
            public void method_5(VattiClipper2I.Class200 edge1, VattiClipper2I.Class200 edge2)
            {
                VattiClipper2I.Class197 resultPolygon1 = edge1.ResultPolygon;
                VattiClipper2I.Class197 resultPolygon2 = edge2.ResultPolygon;
                int num;

                for (num = Vector2I.CompareAngles(new Vector2I(edge1.Edge.Dx, edge1.Edge.Dy), new Vector2I(edge2.Edge.Dx, edge2.Edge.Dy)); num == 0 && (edge1.Previous != null && edge2.Previous != null); num = Vector2I.CompareAngles(new Vector2I(edge1.Edge.Dx, edge1.Edge.Dy), new Vector2I(edge2.Edge.Dx, edge2.Edge.Dy)))
                {
                    Point2I endPoint    = new Point2I(edge1.XBottom + edge1.Edge.Dx, edge1.Edge.YTop);
                    Point2I startPoint1 = new Point2I(edge1.XBottom, edge1.Edge.YTop - edge1.Edge.Dy);
                    VattiClipper2I.Class195.smethod_0(resultPolygon1, startPoint1, endPoint);
                    Point2I startPoint2 = new Point2I(edge2.XBottom, edge2.Edge.YTop - edge2.Edge.Dy);
                    VattiClipper2I.Class195.smethod_0(resultPolygon2, startPoint2, endPoint);
                    edge1 = edge1.Previous;
                    edge2 = edge2.Previous;
                }
                if (num < 0)
                {
                    for (LinkedListNode <Point2I> linkedListNode = resultPolygon1.Last; linkedListNode != null; linkedListNode = linkedListNode.Previous)
                    {
                        resultPolygon2.AddFirst(linkedListNode.Value);
                    }
                }
                else if (num >= 0)
                {
                    foreach (Point2I point2I in (LinkedList <Point2I>)resultPolygon1)
                    {
                        resultPolygon2.AddLast(point2I);
                    }
                }
                edge1.Previous.ResultPolygon = resultPolygon2;
            }
Пример #2
0
 private void method_3()
 {
     VattiClipper2I.Class200 left = (VattiClipper2I.Class200)null;
     for (int index = 0; index < this.list_0.Count; ++index)
     {
         VattiClipper2I.Class200 right = this.list_0[index];
         if (right.Edge.YTop - right.Edge.Dy == this.int_0)
         {
             if (left == null)
             {
                 if (right.Edge.Side == (byte)1)
                 {
                     left = right;
                 }
             }
             else if (right.Edge.Side == (byte)2)
             {
                 int xbottom = left.XBottom;
                 if (left.Edge.Dy == 0)
                 {
                     System.Math.Min(xbottom, xbottom + left.Edge.Dx);
                 }
                 int num = right.XBottom;
                 if (right.Edge.Dy == 0)
                 {
                     num = System.Math.Min(num, num + right.Edge.Dx);
                 }
                 this.method_4(left, right, new Point2I(num, this.int_0));
                 left = (VattiClipper2I.Class200)null;
             }
         }
     }
 }
Пример #3
0
 public void method_1(VattiClipper2I.Class191 localMinimum)
 {
     this.class196_0.Y = this.int_0;
     VattiClipper2I.Class200 edge1 = new VattiClipper2I.Class200()
     {
         Edge = localMinimum.Left
     };
     this.list_0.Insert(this.list_0.BinarySearch(edge1, (IComparer <VattiClipper2I.Class200>) this.class196_0), edge1);
     VattiClipper2I.Class199 class199 = localMinimum.Right;
     while (class199.Dy == 0)
     {
         class199 = class199.Successor;
     }
     VattiClipper2I.Class200 edge2 = (VattiClipper2I.Class200)null;
     if (class199 != null)
     {
         edge2 = new VattiClipper2I.Class200()
         {
             Edge = class199
         };
         this.list_0.Insert(this.list_0.BinarySearch(edge2, (IComparer <VattiClipper2I.Class200>) this.class196_0), edge2);
     }
     this.class35_0.Add((VattiClipper2I.Class192) new VattiClipper2I.Class194(edge1));
     if (edge2 == null)
     {
         return;
     }
     this.class35_0.Add((VattiClipper2I.Class192) new VattiClipper2I.Class194(edge2));
 }
Пример #4
0
 private void method_0(
     VattiClipper2I.Class200 e,
     bool oddEqualTypeEdgeCount,
     bool oddUnequalTypeEdgeCount,
     ref VattiClipper2I.Class197 outputPolygon)
 {
     if (e.Edge.Side == (byte)0)
     {
         e.Edge.Side = oddEqualTypeEdgeCount ? (byte)1 : (byte)2;
         if (!oddUnequalTypeEdgeCount)
         {
             return;
         }
         if (outputPolygon == null)
         {
             outputPolygon = new VattiClipper2I.Class197();
             outputPolygon.AddFirst(new Point2I(e.Edge.XBottom, this.class191_0.Y));
             e.ResultPolygon = outputPolygon;
         }
         else
         {
             if (e.Edge.XBottom != outputPolygon.First.Value.X)
             {
                 outputPolygon.AddLast(new Point2I(e.Edge.XBottom, this.class191_0.Y));
             }
             e.ResultPolygon = outputPolygon;
             outputPolygon   = (VattiClipper2I.Class197)null;
         }
     }
     else
     {
         if (!oddUnequalTypeEdgeCount)
         {
             return;
         }
         int x = (int)System.Math.Round(e.Edge.method_1(this.class191_0.Y));
         if (outputPolygon == null)
         {
             outputPolygon = new VattiClipper2I.Class197();
             outputPolygon.AddFirst(new Point2I(x, this.class191_0.Y));
         }
         else
         {
             if (x != outputPolygon.First.Value.X)
             {
                 outputPolygon.AddLast(new Point2I(x, this.class191_0.Y));
             }
             outputPolygon = (VattiClipper2I.Class197)null;
         }
     }
 }
Пример #5
0
 public VattiClipper2I.Class197 method_4(
     VattiClipper2I.Class200 left,
     VattiClipper2I.Class200 right,
     Point2I p)
 {
     VattiClipper2I.Class198 class198 = new VattiClipper2I.Class198()
     {
         Position = p
     };
     VattiClipper2I.Class197 class197 = new VattiClipper2I.Class197()
     {
         Left = class198, Right = class198
     };
     class197.AddLast(p);
     left.ResultPolygon  = class197;
     right.ResultPolygon = class197;
     return(class197);
 }
Пример #6
0
 public void method_6(
     VattiClipper2I.Class200 edge,
     VattiClipper2I.Class200 nextEdge,
     Point2I p)
 {
     if (edge.Edge.Side == (byte)1)
     {
         edge.method_0(p);
     }
     else if (edge.Edge.Side == (byte)2)
     {
         edge.method_1(p);
     }
     if (edge.ResultPolygon == null || nextEdge.ResultPolygon == null || edge.ResultPolygon == nextEdge.ResultPolygon)
     {
         return;
     }
     this.method_5(edge, nextEdge);
 }
Пример #7
0
 public void method_2(VattiClipper2I.Class200 activeEdge)
 {
     if (activeEdge.Edge.Successor == null)
     {
         this.list_0.Remove(activeEdge);
     }
     else
     {
         VattiClipper2I.Class199 successor = activeEdge.Edge.Successor;
         while (successor != null && successor.Dy == 0)
         {
             successor = activeEdge.Edge.Successor;
         }
         if (successor == null)
         {
             this.list_0.Remove(activeEdge);
         }
         else
         {
             activeEdge.Edge = activeEdge.Edge.Successor;
             this.class35_0.Add((VattiClipper2I.Class192) new VattiClipper2I.Class194(activeEdge));
         }
     }
 }
Пример #8
0
            public override void vmethod_0(
                VattiClipper2I.Class35 eventQueue,
                VattiClipper2I.Class195 scanBeam)
            {
                scanBeam.method_1(this.class191_0);
                for (VattiClipper2I.Class191 localMinimum = this.class191_0; localMinimum.Next != null; localMinimum = localMinimum.Next)
                {
                    if (localMinimum.Y == localMinimum.Next.Y)
                    {
                        scanBeam.method_1(localMinimum);
                    }
                    else
                    {
                        scanBeam.EventQueue.Add(localMinimum.Next);
                        break;
                    }
                }
                bool flag1 = false;
                bool flag2 = false;

                VattiClipper2I.Class197 outputPolygon = (VattiClipper2I.Class197)null;
                for (int index = 0; index < scanBeam.ActiveEdges.Count; ++index)
                {
                    VattiClipper2I.Class200 activeEdge = scanBeam.ActiveEdges[index];
                    if (activeEdge.Edge.Type == (byte)1)
                    {
                        this.method_0(activeEdge, flag1, flag2, ref outputPolygon);
                        flag1 = !flag1;
                    }
                    else
                    {
                        this.method_0(activeEdge, flag2, flag1, ref outputPolygon);
                        flag2 = !flag2;
                    }
                }
            }
Пример #9
0
 public Class194(VattiClipper2I.Class200 edge)
     : base(edge.Edge.YTop)
 {
     this.class200_0 = edge;
 }