pantograph2d 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/QuadraticBezier-BKElJOgn.cjs +9 -0
- package/dist/QuadraticBezier-BKElJOgn.cjs.map +1 -0
- package/dist/{QuadraticBezier-BzVqiExF.js → QuadraticBezier-PcRS9HZK.js} +1809 -1772
- package/dist/QuadraticBezier-PcRS9HZK.js.map +1 -0
- package/dist/draw-L71G180-.cjs +2 -0
- package/dist/draw-L71G180-.cjs.map +1 -0
- package/dist/draw-N2ntigsw.js +417 -0
- package/dist/draw-N2ntigsw.js.map +1 -0
- package/dist/{models-Dxwusy3i.cjs → models-BXU-Gx3U.cjs} +2 -2
- package/dist/{models-Dxwusy3i.cjs.map → models-BXU-Gx3U.cjs.map} +1 -1
- package/dist/{models-WQ-B7GSL.js → models-BjaFYsN2.js} +18 -18
- package/dist/{models-WQ-B7GSL.js.map → models-BjaFYsN2.js.map} +1 -1
- package/dist/pantograph/drawShape.cjs +1 -1
- package/dist/pantograph/drawShape.cjs.map +1 -1
- package/dist/pantograph/drawShape.js +1 -1
- package/dist/pantograph/drawShape.js.map +1 -1
- package/dist/pantograph/models.cjs +1 -1
- package/dist/pantograph/models.js +2 -2
- package/dist/pantograph/svg.cjs +1 -1
- package/dist/pantograph/svg.js +1 -1
- package/dist/pantograph.cjs +2 -2
- package/dist/pantograph.cjs.map +1 -1
- package/dist/pantograph.js +428 -385
- package/dist/pantograph.js.map +1 -1
- package/dist/{svg-D0nYyMk7.cjs → svg-ZTvNxsWu.cjs} +2 -2
- package/dist/{svg-D0nYyMk7.cjs.map → svg-ZTvNxsWu.cjs.map} +1 -1
- package/dist/{svg-BylQQgsL.js → svg-hNHYuj_r.js} +2 -2
- package/dist/{svg-BylQQgsL.js.map → svg-hNHYuj_r.js.map} +1 -1
- package/dist/types/src/algorithms/conversions/bezierToArcs.d.ts +7 -0
- package/dist/types/src/algorithms/conversions/bezierToSafeBezier.d.ts +12 -0
- package/dist/types/src/algorithms/conversions/ellipseToArcs.d.ts +0 -0
- package/dist/types/src/algorithms/conversions/ellipseToBezier.d.ts +3 -0
- package/dist/types/src/algorithms/conversions/helpers.d.ts +13 -0
- package/dist/types/src/algorithms/intersections/fullLinesIntersection.d.ts +18 -0
- package/dist/types/src/algorithms/offsets/offsetSegment.d.ts +4 -1
- package/dist/types/src/algorithms/offsets/offsetStroke.d.ts +3 -1
- package/dist/types/src/conversionOperations.d.ts +8 -0
- package/dist/types/src/models/segments/Arc.d.ts +1 -0
- package/dist/types/src/models/segments/CubicBezier.d.ts +7 -0
- package/dist/types/src/models/segments/QuadraticBezier.d.ts +5 -0
- package/package.json +2 -2
- package/dist/QuadraticBezier-BAVasVfu.cjs +0 -9
- package/dist/QuadraticBezier-BAVasVfu.cjs.map +0 -1
- package/dist/QuadraticBezier-BzVqiExF.js.map +0 -1
- package/dist/draw-DqsKIWJD.js +0 -337
- package/dist/draw-DqsKIWJD.js.map +0 -1
- package/dist/draw-NcYfDZjT.cjs +0 -2
- package/dist/draw-NcYfDZjT.cjs.map +0 -1
- package/dist/types/src/algorithms/solvers/zeroViaNewton.d.ts +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var tn = Object.defineProperty;
|
|
2
2
|
var nn = (t, n, e) => n in t ? tn(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
3
|
var C = (t, n, e) => nn(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
-
import {
|
|
4
|
+
import { b as k, d as en, e as Ot, a as q, s as V, n as sn, p as Tt, r as U, A as S, g, u as Lt, E as M, T as on, v as rn, Q as A, w as $, C as I, c as ln, x as cn, L as y, y as zt, F as lt, z as N, G as un, l as an, o as fn, H as dt, B as hn } from "./QuadraticBezier-PcRS9HZK.js";
|
|
5
5
|
function pn(t, n) {
|
|
6
6
|
const e = k(n, t.firstPoint), s = en(e, t.V) / t.squareLength;
|
|
7
7
|
return t.paramPoint(s);
|
|
@@ -135,8 +135,8 @@ function Dt(t, n) {
|
|
|
135
135
|
if (Math.abs(z) < e)
|
|
136
136
|
return [[L, b]];
|
|
137
137
|
if (z > 0) {
|
|
138
|
-
const
|
|
139
|
-
return [[L +
|
|
138
|
+
const H = Math.sqrt(z);
|
|
139
|
+
return [[L + H, b], [L - H, b]];
|
|
140
140
|
}
|
|
141
141
|
return [];
|
|
142
142
|
});
|
|
@@ -206,7 +206,7 @@ function wn(t, n, e = !1) {
|
|
|
206
206
|
return g(t.center, n.center) && Math.abs(t.majorRadius - n.majorRadius) < s && Math.abs(t.minorRadius - n.minorRadius) < s && (Math.abs(t.tiltAngle - n.tiltAngle) < s || Math.abs(Math.abs(t.tiltAngle - n.tiltAngle) - Math.PI) < s) ? e ? Pn(t, n) : [] : Dt(t, n).filter((r) => t.isOnSegment(r) && n.isOnSegment(r));
|
|
207
207
|
}
|
|
208
208
|
function gt(t, n) {
|
|
209
|
-
const [e, s] = t.firstPoint, [i, o] = t.lastPoint, r = new on().rotate(-Math.atan2(o - s, i - e))
|
|
209
|
+
const [e, s] = t.firstPoint, [i, o] = t.lastPoint, r = new on().translate(-e, -s).rotate(-Math.atan2(o - s, i - e)), l = r.clone().inverse(), c = n.transform(r);
|
|
210
210
|
return c.paramsAtY(0).map((a) => c.paramPoint(a)).map((a) => l.transform(a)).filter((a) => t.isOnSegment(a));
|
|
211
211
|
}
|
|
212
212
|
const xn = (t, n = 1e-9) => {
|
|
@@ -219,8 +219,8 @@ function Rt(t, n = 1e-9) {
|
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
const Sn = (t, n) => {
|
|
222
|
-
const [[e, s, i, o], [r, l, c, a]] = n.polynomialCoefficients, f = t.coefficients, u = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, P = f.c, w = e * e, x = s * s, F = i * i, b = o * o, R = r * r, T = l * l, L = c * c, j = a * a, z = P + d * e + u * w + m * r + h * e * r + p * R,
|
|
223
|
-
return [z,
|
|
222
|
+
const [[e, s, i, o], [r, l, c, a]] = n.polynomialCoefficients, f = t.coefficients, u = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, P = f.c, w = e * e, x = s * s, F = i * i, b = o * o, R = r * r, T = l * l, L = c * c, j = a * a, z = P + d * e + u * w + m * r + h * e * r + p * R, H = d * s + 2 * u * e * s + h * s * r + m * l + h * e * l + 2 * p * r * l, Qt = u * x + d * i + 2 * u * e * i + h * i * r + h * s * l + p * T + m * c + h * e * c + 2 * p * r * c, Wt = 2 * u * s * i + d * o + 2 * u * e * o + h * o * r + h * i * l + h * s * c + 2 * p * l * c + m * a + h * e * a + 2 * p * r * a, Jt = u * F + 2 * u * s * o + h * o * l + h * i * c + p * L + h * s * a + 2 * p * l * a, Kt = 2 * u * i * o + h * o * c + h * i * a + 2 * p * c * a, Zt = u * b + h * o * a + p * j;
|
|
223
|
+
return [z, H, Qt, Wt, Jt, Kt, Zt];
|
|
224
224
|
};
|
|
225
225
|
function Pt(t, n) {
|
|
226
226
|
const e = Math.max(t.precision, n.precision), s = Sn(t, n), i = Lt(s, e).filter((o) => o >= -n.precision && o <= 1 + n.precision);
|
|
@@ -401,7 +401,7 @@ function yt(t, n) {
|
|
|
401
401
|
);
|
|
402
402
|
return o ? s.size > o.size ? o.clipCurve(n) : s.clipCurve(n) : null;
|
|
403
403
|
}
|
|
404
|
-
const W = (t) => t instanceof A ?
|
|
404
|
+
const W = (t) => t instanceof A ? $(k(t.controlPoint, t.firstPoint)) + $(k(t.controlPoint, t.lastPoint)) : $(k(t.firstControlPoint, t.firstPoint)) + $(k(t.lastControlPoint, t.firstControlPoint)) + $(k(t.lastControlPoint, t.lastPoint));
|
|
405
405
|
function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
|
|
406
406
|
const i = Math.max(e * e, Number.EPSILON * 10);
|
|
407
407
|
let o = t, r = n, l = W(o), c = W(r);
|
|
@@ -968,7 +968,7 @@ const Un = [
|
|
|
968
968
|
function jn(t) {
|
|
969
969
|
return Un.some((n) => t instanceof n);
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function Ht(t) {
|
|
972
972
|
if (t instanceof y)
|
|
973
973
|
return {
|
|
974
974
|
type: t.segmentType,
|
|
@@ -1014,34 +1014,34 @@ function $t(t) {
|
|
|
1014
1014
|
function it(t) {
|
|
1015
1015
|
return {
|
|
1016
1016
|
type: "LOOP",
|
|
1017
|
-
segments: t.segments.map(
|
|
1017
|
+
segments: t.segments.map(Ht)
|
|
1018
1018
|
};
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function $t(t) {
|
|
1021
1021
|
return {
|
|
1022
1022
|
type: "FIGURE",
|
|
1023
1023
|
contour: it(t.contour),
|
|
1024
1024
|
holes: t.holes.map(it)
|
|
1025
1025
|
};
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function Hn(t) {
|
|
1028
1028
|
return {
|
|
1029
1029
|
type: "DIAGRAM",
|
|
1030
|
-
figures: t.figures.map(
|
|
1030
|
+
figures: t.figures.map($t)
|
|
1031
1031
|
};
|
|
1032
1032
|
}
|
|
1033
1033
|
function Mt(t) {
|
|
1034
1034
|
if (t instanceof _)
|
|
1035
|
-
return
|
|
1035
|
+
return Hn(t);
|
|
1036
1036
|
if (t instanceof v)
|
|
1037
|
-
return
|
|
1037
|
+
return $t(t);
|
|
1038
1038
|
if (t instanceof O)
|
|
1039
1039
|
return it(t);
|
|
1040
1040
|
if (jn(t))
|
|
1041
|
-
return
|
|
1041
|
+
return Ht(t);
|
|
1042
1042
|
throw new Error("Unknown shape type");
|
|
1043
1043
|
}
|
|
1044
|
-
class
|
|
1044
|
+
class $n {
|
|
1045
1045
|
constructor() {
|
|
1046
1046
|
this.ids = [], this.values = [], this.length = 0;
|
|
1047
1047
|
}
|
|
@@ -1134,7 +1134,7 @@ class at {
|
|
|
1134
1134
|
const a = At.indexOf(this.ArrayType), f = c * 4 * this.ArrayType.BYTES_PER_ELEMENT;
|
|
1135
1135
|
if (a < 0)
|
|
1136
1136
|
throw new Error(`Unexpected typed array class: ${s}.`);
|
|
1137
|
-
o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, r + 8, c * 4), this._indices = new this.IndexArrayType(this.data, r + 8 + f, c), this._pos = c * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new i(8 + f + c * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, c * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, c), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (nt << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new
|
|
1137
|
+
o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, r + 8, c * 4), this._indices = new this.IndexArrayType(this.data, r + 8 + f, c), this._pos = c * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new i(8 + f + c * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, c * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, c), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (nt << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new $n();
|
|
1138
1138
|
}
|
|
1139
1139
|
/**
|
|
1140
1140
|
* Add a given rectangle to the index.
|
|
@@ -1746,4 +1746,4 @@ export {
|
|
|
1746
1746
|
pn as p,
|
|
1747
1747
|
Ft as s
|
|
1748
1748
|
};
|
|
1749
|
-
//# sourceMappingURL=models-
|
|
1749
|
+
//# sourceMappingURL=models-BjaFYsN2.js.map
|