예제 #1
0
        private void DoSubtract()
        {
            // Do the subtraction.
            PolyClipError error;
            Vertices      subtract = TraceClipper.Difference(_left, _right, out error);

            // Check for errors
            switch (error)
            {
            case PolyClipError.NoIntersections:
                WriteMessage("ERROR: Polygons do not intersect!");
                return;

            case PolyClipError.Poly1InsidePoly2:
                WriteMessage("Polygon 1 completely inside polygon 2.");
                return;

            case PolyClipError.InfiniteLoop:
                WriteMessage("Infinite Loop detected.");
                break;

            case PolyClipError.None:
                WriteMessage("No errors with subtraction.");
                break;
            }

            SetResult(subtract);
        }
예제 #2
0
        private void DoUnion()
        {
            // Do the union
            PolyClipError error;
            Vertices      vertices = TraceClipper.Union(_left, _right, out error);

            // Check for errors.
            switch (error)
            {
            case PolyClipError.NoIntersections:
                WriteMessage("ERROR: Polygons do not intersect!");
                return;

            case PolyClipError.Poly1InsidePoly2:
                WriteMessage("Polygon 1 completely inside polygon 2.");
                return;

            case PolyClipError.InfiniteLoop:
                WriteMessage("Infinite Loop detected.");
                break;

            case PolyClipError.None:
                WriteMessage("No errors with union.");
                break;
            }

            SetResult(vertices);
        }