@@ -9,7 +9,7 @@ export PolyType, PolyTypeSubject, PolyTypeClip, ClipType, ClipTypeIntersection,
9
9
EndTypeClosedLine, EndTypeOpenSquare, EndTypeOpenRound, EndTypeOpenButt, Clip,
10
10
add_path!, add_paths!, execute, clear!, get_bounds, IntPoint, IntRect, orientation,
11
11
area, pointinpolygon, ClipperOffset, PolyNode, execute_pt, contour, ishole, contour,
12
- children, tofloat
12
+ children, tofloat, minkowski_sum, minkowski_difference
13
13
14
14
@enum PolyType PolyTypeSubject = 0 PolyTypeClip = 1
15
15
@@ -296,4 +296,26 @@ function simplify_polygons(polys::Vector{Vector{IntPoint}},
296
296
return simplified
297
297
end
298
298
299
+ function minkowski_sum (poly1:: Vector{IntPoint} , poly2:: Vector{IntPoint} ,
300
+ is_closed:: Bool = true )
301
+ polys = Vector {Vector{IntPoint}} ()
302
+ @ccall libcclipper. minkowski_sum (
303
+ poly1:: Ptr{IntPoint} , length (poly1):: Csize_t ,
304
+ poly2:: Ptr{IntPoint} , length (poly2):: Csize_t ,
305
+ polys:: Any ,
306
+ @cfunction (append_poly!, Any, (Ptr{Cvoid}, Csize_t, IntPoint)):: Ptr{Cvoid} ,
307
+ is_closed:: Cuchar ):: Cvoid
308
+ return polys
309
+ end
310
+ function minkowski_difference (poly1:: Vector{IntPoint} , poly2:: Vector{IntPoint} )
311
+ polys = Vector {Vector{IntPoint}} ()
312
+ @ccall libcclipper. minkowski_difference (
313
+ poly1:: Ptr{IntPoint} , length (poly1):: Csize_t ,
314
+ poly2:: Ptr{IntPoint} , length (poly2):: Csize_t ,
315
+ polys:: Any ,
316
+ @cfunction (append_poly!, Any, (Ptr{Cvoid}, Csize_t, IntPoint)):: Ptr{Cvoid} ):: Cvoid
317
+ return polys
318
+ end
319
+
320
+
299
321
end
0 commit comments