xaviergonz / js-angusj-clipper

Polygon and line clipping and offsetting library (Javascript) - a port of Angus Johnson's clipper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using preserveCollinear, etc, in ClipParams

pentacular opened this issue · comments

When using preserveCollinear: true, strictlySimple: true, etc, I'm getting the following error.

TypeError {
message: 'Cannot convert "0[object Object]" to int',
}

Any idea what's going wrong?

import {
ClipType,
NativeClipperLibRequestedFormat,
PolyFillType,
loadNativeClipperLibInstanceAsync
} from 'js-angusj-clipper/web';

import test from 'ava';

test('strictlySimple', async t => {
const clipper = await loadNativeClipperLibInstanceAsync(NativeClipperLibRequestedFormat.WasmOnly);
const request =
{
clipType: ClipType.Union,
subjectInputs: [{ data: [{ x: 50, y: 50 }, { x: -50, y: 50 }, { x: -50, y: -50 }, { x: 50, y: -50 }], closed: true },
{ data: [{ x: -5, y: -5 }, { x: -5, y: 5 }, { x: 5, y: 5 }, { x: 5, y: -5 }], closed: true }],
subjectFillType: PolyFillType.NonZero,
strictlySimple: true
};
const result = clipper.clipToPolyTree(request);
t.deepEqual(result, []);
});

reproduces the problem for me.

Released as 1.0.4