Move boolean composition out of kits.

This commit is contained in:
be5invis 2021-03-02 18:37:15 -08:00
parent 4cf5faf93c
commit 3ef9aaa2e2
7 changed files with 103 additions and 42 deletions

View file

@ -4,6 +4,7 @@ const TypoGeom = require("typo-geom");
const Point = require("./point");
const Transform = require("./transform");
exports.SPIRO_PRECISION = 1 / 2;
exports.GEOMETRY_PRECISION = 1 / 4;
exports.RECIP_GEOMETRY_PRECISION = 4;
exports.BOOLE_RESOLUTION = 0x4000;
@ -34,6 +35,18 @@ exports.OffsetCurve = class OffsetCurve {
}
};
exports.ReverseCurve = class ReverseCurve {
constructor(original) {
this.m_original = original;
}
eval(t) {
return this.m_original.eval(1 - t);
}
derivative(t) {
return -this.m_original.derivative(1 - t);
}
};
exports.convertShapeToArcs = function convertShapeToArcs(shape) {
return shape.map(convertContourToArcs);
};