
npm install clipper2-jsClipper class provides static methods for clipping, path-offsetting, minkowski-sums and path simplification.
Clipper64 class directly.
ts
const subj = new Paths64();
const clip = new Paths64();
subj.push(Clipper.makePath([ 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 ]));
clip.push(Clipper.makePath([98, 63, 4, 68, 77, 8, 52, 100, 19, 12]));
const solution = Clipper.Intersect(subj, clip, FillRule.NonZero);
`
$3
* An Angular project is used to host clipper2-js, but the library does not depend on Angular.
* Jest is used for unit tests
* All line units tests are passing. Some polygon tests are still failing and needs further investigation. However, the example demonstrates its basically working.
$3
Bug fixes will be integrated when original clipper2 has new releases.
Conversion to Typescript
* ChatGPT did most of the code conversion. It took a few more days to get resulting code to compile. A few more days to add unit tests and remove bugs I'd introduced.
* Context or return objects are used to replicate C# ref` (pass-by-reference) behaviour.