pantograph2d 0.8.1 → 0.9.1

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.
Files changed (53) hide show
  1. package/dist/QuadraticBezier--UZr_xcV.cjs +9 -0
  2. package/dist/QuadraticBezier--UZr_xcV.cjs.map +1 -0
  3. package/dist/{QuadraticBezier-BzVqiExF.js → QuadraticBezier-DxieHk9z.js} +1811 -1772
  4. package/dist/QuadraticBezier-DxieHk9z.js.map +1 -0
  5. package/dist/draw-SMxwuKNJ.cjs +2 -0
  6. package/dist/draw-SMxwuKNJ.cjs.map +1 -0
  7. package/dist/draw-yb7FrCL_.js +418 -0
  8. package/dist/draw-yb7FrCL_.js.map +1 -0
  9. package/dist/{models-Dxwusy3i.cjs → models-wvgj1vj2.cjs} +2 -2
  10. package/dist/{models-Dxwusy3i.cjs.map → models-wvgj1vj2.cjs.map} +1 -1
  11. package/dist/{models-WQ-B7GSL.js → models-zEMLdtLw.js} +18 -18
  12. package/dist/{models-WQ-B7GSL.js.map → models-zEMLdtLw.js.map} +1 -1
  13. package/dist/pantograph/drawShape.cjs +1 -1
  14. package/dist/pantograph/drawShape.cjs.map +1 -1
  15. package/dist/pantograph/drawShape.js +1 -1
  16. package/dist/pantograph/drawShape.js.map +1 -1
  17. package/dist/pantograph/models.cjs +1 -1
  18. package/dist/pantograph/models.js +2 -2
  19. package/dist/pantograph/svg.cjs +1 -1
  20. package/dist/pantograph/svg.js +1 -1
  21. package/dist/pantograph.cjs +2 -2
  22. package/dist/pantograph.cjs.map +1 -1
  23. package/dist/pantograph.js +693 -455
  24. package/dist/pantograph.js.map +1 -1
  25. package/dist/{svg-BylQQgsL.js → svg-BIphc_zE.js} +3 -3
  26. package/dist/{svg-BylQQgsL.js.map → svg-BIphc_zE.js.map} +1 -1
  27. package/dist/{svg-D0nYyMk7.cjs → svg-BY5h3CDD.cjs} +3 -3
  28. package/dist/{svg-D0nYyMk7.cjs.map → svg-BY5h3CDD.cjs.map} +1 -1
  29. package/dist/types/src/algorithms/conversions/bezierToArcs.d.ts +7 -0
  30. package/dist/types/src/algorithms/conversions/bezierToSafeBezier.d.ts +12 -0
  31. package/dist/types/src/algorithms/conversions/ellipseToArcs.d.ts +0 -0
  32. package/dist/types/src/algorithms/conversions/ellipseToBezier.d.ts +3 -0
  33. package/dist/types/src/algorithms/conversions/helpers.d.ts +13 -0
  34. package/dist/types/src/algorithms/intersections/fullLinesIntersection.d.ts +18 -0
  35. package/dist/types/src/algorithms/offsets/offsetSegment.d.ts +4 -1
  36. package/dist/types/src/algorithms/offsets/offsetStroke.d.ts +3 -1
  37. package/dist/types/src/conversionOperations.d.ts +8 -0
  38. package/dist/types/src/featureOperations.d.ts +88 -0
  39. package/dist/types/src/main.d.ts +1 -1
  40. package/dist/types/src/models/segments/Arc.d.ts +1 -0
  41. package/dist/types/src/models/segments/CubicBezier.d.ts +7 -0
  42. package/dist/types/src/models/segments/QuadraticBezier.d.ts +5 -0
  43. package/dist/types/src/operations.d.ts +1 -0
  44. package/dist/types/src/vectorOperations.d.ts +1 -1
  45. package/package.json +2 -2
  46. package/dist/QuadraticBezier-BAVasVfu.cjs +0 -9
  47. package/dist/QuadraticBezier-BAVasVfu.cjs.map +0 -1
  48. package/dist/QuadraticBezier-BzVqiExF.js.map +0 -1
  49. package/dist/draw-DqsKIWJD.js +0 -337
  50. package/dist/draw-DqsKIWJD.js.map +0 -1
  51. package/dist/draw-NcYfDZjT.cjs +0 -2
  52. package/dist/draw-NcYfDZjT.cjs.map +0 -1
  53. 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 { i as k, o as en, f as Ot, a as q, s as V, n as sn, p as Tt, r as U, A as S, d as g, q as Lt, E as M, T as on, u as rn, Q as A, v as H, C as I, c as ln, w as cn, L as y, x as zt, y as lt, z as N, F as un, l as an, m as fn, G as dt, B as hn } from "./QuadraticBezier-BzVqiExF.js";
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-DxieHk9z.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 $ = Math.sqrt(z);
139
- return [[L + $, b], [L - $, b]];
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)).translate(-e, -s), l = r.clone().inverse(), c = n.transform(r);
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, $ = 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, $, Qt, Wt, Jt, Kt, Zt];
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 ? H(k(t.controlPoint, t.firstPoint)) + H(k(t.controlPoint, t.lastPoint)) : H(k(t.firstControlPoint, t.firstPoint)) + H(k(t.lastControlPoint, t.firstControlPoint)) + H(k(t.lastControlPoint, t.lastPoint));
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 $t(t) {
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($t)
1017
+ segments: t.segments.map(Ht)
1018
1018
  };
1019
1019
  }
1020
- function Ht(t) {
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 $n(t) {
1027
+ function Hn(t) {
1028
1028
  return {
1029
1029
  type: "DIAGRAM",
1030
- figures: t.figures.map(Ht)
1030
+ figures: t.figures.map($t)
1031
1031
  };
1032
1032
  }
1033
1033
  function Mt(t) {
1034
1034
  if (t instanceof _)
1035
- return $n(t);
1035
+ return Hn(t);
1036
1036
  if (t instanceof v)
1037
- return Ht(t);
1037
+ return $t(t);
1038
1038
  if (t instanceof O)
1039
1039
  return it(t);
1040
1040
  if (jn(t))
1041
- return $t(t);
1041
+ return Ht(t);
1042
1042
  throw new Error("Unknown shape type");
1043
1043
  }
1044
- class Hn {
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 Hn();
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-WQ-B7GSL.js.map
1749
+ //# sourceMappingURL=models-zEMLdtLw.js.map