diff --git a/src/mode/fdm/slice.js b/src/mode/fdm/slice.js index 1eb3c8d3..6195bdd9 100644 --- a/src/mode/fdm/slice.js +++ b/src/mode/fdm/slice.js @@ -1058,7 +1058,7 @@ } POLY.subtract(topInner, downInner, bridges, flats, slice.z, minArea, { - // wasm: options.wasm + wasm: options.wasm }); }; diff --git a/wasm/kiri-geo.cpp b/wasm/kiri-geo.cpp index 259c9e71..f59c455d 100644 --- a/wasm/kiri-geo.cpp +++ b/wasm/kiri-geo.cpp @@ -143,7 +143,7 @@ Uint32 poly_union(Uint32 memat, Uint32 polys, float offset) { } __attribute__ ((export_name("poly_diff"))) -Uint32 poly_diff(Uint32 memat, Uint32 polysA, Uint32 polysB, Uint8 AB, Uint8 BA, Uint32 clean) { +Uint32 poly_diff(Uint32 memat, Uint32 polysA, Uint32 polysB, Uint8 AB, Uint8 BA, float clean) { Paths inA(polysA); Paths inB(polysB); @@ -154,27 +154,33 @@ Uint32 poly_diff(Uint32 memat, Uint32 polysA, Uint32 polysB, Uint8 AB, Uint8 BA, Uint32 resat = pos; - if (AB) { + if (AB > 0) { Paths outs; Clipper clip; clip.AddPaths(inA, ptSubject, true); clip.AddPaths(inB, ptClip, true); clip.Execute(ctDifference, outs, pftEvenOdd, pftEvenOdd); if (clean > 0) { - CleanPolygons(outs, (double)clean); + // CleanPolygons(outs, clean); + for (Path po : outs) { + CleanPolygon(po, clean); + } } pos = writePolys(outs, pos); clip.Clear(); } - if (BA) { + if (BA > 0) { Paths outs; Clipper clip; clip.AddPaths(inB, ptSubject, true); clip.AddPaths(inA, ptClip, true); clip.Execute(ctDifference, outs, pftEvenOdd, pftEvenOdd); if (clean > 0) { - CleanPolygons(outs, (double)clean); + // CleanPolygons(outs, clean); + for (Path po : outs) { + CleanPolygon(po, clean); + } } pos = writePolys(outs, pos); clip.Clear(); diff --git a/wasm/kiri-geo.wasm b/wasm/kiri-geo.wasm index db0d7bd7..81158784 100755 Binary files a/wasm/kiri-geo.wasm and b/wasm/kiri-geo.wasm differ