I use js-angusj-clipper. I have three squares. Their positions are like this. I let them perform intersection operations, but I can’t get the correct results. My code is as follows:
this._clipper = await loadNativeClipperLibInstanceAsync(
NativeClipperLibRequestedFormat.WasmWithAsmJsFallback,
);
const group = [[[
{
"x": 141.88,
"y": 177.22
},
{
"x": 229.06,
"y": 177.22
},
{
"x": 229.06,
"y": 60.62
},
{
"x": 141.88,
"y": 60.62
}
],[
{
"x": 113.12,
"y": 196.81
},
{
"x": 190.58,
"y": 196.81
},
{
"x": 190.58,
"y": 123.12
},
{
"x": 113.12,
"y": 123.12
}
],[
{
"x": 164.55,
"y": 210.16
},
{
"x": 269.98,
"y": 210.16
},
{
"x": 269.98,
"y": 140.15
},
{
"x": 164.55,
"y": 140.15
}
]]];
const subjectInputs = [];
const clipInputs = [];
group.forEach((pointsList, index) => {
pointsList.forEach((points) => {
if (index !== group.length - 1) {
subjectInputs.push({ data: points, closed: true });
} else {
clipInputs.push({ data: points });
}
});
});
let polyResult =
this._clipper.clipToPaths({
clipType: 'intersect',
subjectInputs,
clipInputs,
subjectFillType: PolyFillType.EvenOdd,
clipFillType: PolyFillType.EvenOdd,
}) || [];
The positions of the three rectangles are as follows:
But the result is wrong:
The correct result should be only one middle rectangle:
What should i do? thank you!