Example #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;
            }
Example #2
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;
         }
     }
 }
Example #3
0
 private static void smethod_0(
     VattiClipper2I.Class197 p,
     Point2I startPoint,
     Point2I endPoint)
 {
     if (p.Last.Value == endPoint && p.Last.Previous != null && p.Last.Previous.Value == startPoint)
     {
         p.RemoveLast();
     }
     else
     {
         p.RemoveFirst();
     }
 }
Example #4
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);
 }
Example #5
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;
                    }
                }
            }