improve efficiency of wasm poly diff
This commit is contained in:
parent
e3a22326d4
commit
14ee94311d
5 changed files with 60 additions and 54 deletions
|
|
@ -135,7 +135,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 poly_diff(Uint32 memat, Uint32 polysA, Uint32 polysB, Uint8 AB, Uint8 BA, Uint32 clean) {
|
||||
|
||||
Paths inA(polysA);
|
||||
Paths inB(polysB);
|
||||
|
|
@ -152,6 +152,9 @@ Uint32 poly_diff(Uint32 memat, Uint32 polysA, Uint32 polysB, Uint8 AB, Uint8 BA)
|
|||
clip.AddPaths(inA, ptSubject, true);
|
||||
clip.AddPaths(inB, ptClip, true);
|
||||
clip.Execute(ctDifference, outs, pftEvenOdd, pftEvenOdd);
|
||||
if (clean > 0) {
|
||||
CleanPolygons(outs, (double)clean);
|
||||
}
|
||||
pos = writePolys(outs, pos);
|
||||
clip.Clear();
|
||||
}
|
||||
|
|
@ -162,6 +165,9 @@ Uint32 poly_diff(Uint32 memat, Uint32 polysA, Uint32 polysB, Uint8 AB, Uint8 BA)
|
|||
clip.AddPaths(inB, ptSubject, true);
|
||||
clip.AddPaths(inA, ptClip, true);
|
||||
clip.Execute(ctDifference, outs, pftEvenOdd, pftEvenOdd);
|
||||
if (clean > 0) {
|
||||
CleanPolygons(outs, (double)clean);
|
||||
}
|
||||
pos = writePolys(outs, pos);
|
||||
clip.Clear();
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue