/// <summary> /// Subtracts one polygon from another. /// </summary> /// <param name="polygon1">The base polygon.</param> /// <param name="polygon2">The polygon to subtract from the base.</param> /// <param name="subtract">The result of the polygon subtraction</param> /// <returns>error code</returns> public static PolygonUtil.PolyUnionError PolygonSubtract(Point2DList polygon1, Point2DList polygon2, out Point2DList subtract) { PolygonOperationContext ctx = new PolygonOperationContext(); ctx.Init(PolygonUtil.PolyOperation.Subtract, polygon1, polygon2); PolygonSubtractInternal(ctx); subtract = ctx.Subtract; return ctx.mError; }
/// <summary> /// Performs one or more polygon operations on the 2 provided polygons /// </summary> /// <param name="polygon1">The first polygon.</param> /// <param name="polygon2">The second polygon</param> /// <param name="subtract">The result of the polygon subtraction</param> /// <returns>error code</returns> public static PolygonUtil.PolyUnionError PolygonOperation(PolygonUtil.PolyOperation operations, Point2DList polygon1, Point2DList polygon2, out Dictionary<uint, Point2DList> results) { PolygonOperationContext ctx = new PolygonOperationContext(); ctx.Init(operations, polygon1, polygon2); results = ctx.mOutput; return PolygonUtil.PolygonOperation(ctx); }
/// Merges two polygons, given that they intersect. /// </summary> /// <param name="polygon1">The first polygon.</param> /// <param name="polygon2">The second polygon.</param> /// <param name="union">The union of the two polygons</param> /// <returns>The error returned from union</returns> public static PolygonUtil.PolyUnionError PolygonUnion(Point2DList polygon1, Point2DList polygon2, out Point2DList union) { PolygonOperationContext ctx = new PolygonOperationContext(); ctx.Init(PolygonUtil.PolyOperation.Union, polygon1, polygon2); PolygonUnionInternal(ctx); union = ctx.Union; return ctx.mError; }