@weasel-js/geom 1.10.1 → 1.11.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.
Files changed (55) hide show
  1. package/README.md +9 -1
  2. package/dist/3d/index.d.ts +29 -2
  3. package/dist/3d/index.js +49 -1
  4. package/dist/3d/index.js.map +1 -1
  5. package/dist/booleans/index.d.ts +15 -10
  6. package/dist/booleans/index.js +306 -353
  7. package/dist/booleans/index.js.map +1 -1
  8. package/dist/{chunk-7WFFCHRL.js → chunk-6XSJY3TC.js} +6 -37
  9. package/dist/chunk-6XSJY3TC.js.map +1 -0
  10. package/dist/chunk-7KLJZFBY.js +573 -0
  11. package/dist/chunk-7KLJZFBY.js.map +1 -0
  12. package/dist/chunk-B53BERKG.js +386 -0
  13. package/dist/chunk-B53BERKG.js.map +1 -0
  14. package/dist/chunk-CE7IY7TB.js +104 -0
  15. package/dist/chunk-CE7IY7TB.js.map +1 -0
  16. package/dist/chunk-HGF5OVEN.js +129 -0
  17. package/dist/chunk-HGF5OVEN.js.map +1 -0
  18. package/dist/chunk-J2O2B54M.js +800 -0
  19. package/dist/chunk-J2O2B54M.js.map +1 -0
  20. package/dist/chunk-Q66NA2FU.js +174 -0
  21. package/dist/chunk-Q66NA2FU.js.map +1 -0
  22. package/dist/chunk-SASMXDBE.js +443 -0
  23. package/dist/chunk-SASMXDBE.js.map +1 -0
  24. package/dist/chunk-UI3FUWXM.js +533 -0
  25. package/dist/chunk-UI3FUWXM.js.map +1 -0
  26. package/dist/curvature-PkoLduGc.d.ts +454 -0
  27. package/dist/curves/index.d.ts +14 -5
  28. package/dist/curves/index.js +33 -111
  29. package/dist/curves/index.js.map +1 -1
  30. package/dist/index.d.ts +1468 -284
  31. package/dist/index.js +5450 -2672
  32. package/dist/index.js.map +1 -1
  33. package/dist/nd/index.d.ts +91 -27
  34. package/dist/nd/index.js +282 -0
  35. package/dist/nd/index.js.map +1 -1
  36. package/dist/path-BW8d_2RY.d.ts +157 -0
  37. package/dist/portCurve-C5HDWuuV.d.ts +30 -0
  38. package/dist/tessellate/index.d.ts +15 -4
  39. package/dist/tessellate/index.js +21 -277
  40. package/dist/tessellate/index.js.map +1 -1
  41. package/dist/warp/index.d.ts +252 -0
  42. package/dist/warp/index.js +1316 -0
  43. package/dist/warp/index.js.map +1 -0
  44. package/package.json +5 -1
  45. package/dist/chunk-7WFFCHRL.js.map +0 -1
  46. package/dist/chunk-IDXY2NCA.js +0 -177
  47. package/dist/chunk-IDXY2NCA.js.map +0 -1
  48. package/dist/chunk-NJ3IGAKR.js +0 -16
  49. package/dist/chunk-NJ3IGAKR.js.map +0 -1
  50. package/dist/chunk-OXH3NOXC.js +0 -62
  51. package/dist/chunk-OXH3NOXC.js.map +0 -1
  52. package/dist/chunk-URQMDR6Q.js +0 -80
  53. package/dist/chunk-URQMDR6Q.js.map +0 -1
  54. package/dist/cubicMath-BW-HJrCE.d.ts +0 -16
  55. package/dist/path-ljHxobyu.d.ts +0 -44
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/paths/curvature.ts","../src/paths/eulerSpiral.ts","../src/paths/spiro.ts","../src/paths/spiroPath.ts"],"names":[],"mappings":";;;;AAKO,SAAS,iBAAA,CAAkB,EAAA,EAAW,EAAA,EAAW,EAAA,EAAW,IAAW,CAAA,EAAkB;AAC9F,EAAA,MAAM,IAAI,CAAA,GAAI,CAAA;AACd,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,CAAA,GAAI,CAAA,IAAK,GAAG,CAAA,GAAI,EAAA,CAAG,KAAK,CAAA,GAAI,CAAA,GAAI,KAAK,EAAA,CAAG,CAAA,GAAI,GAAG,CAAA,CAAA,GAAK,CAAA,GAAI,IAAI,CAAA,IAAK,EAAA,CAAG,IAAI,EAAA,CAAG,CAAA,CAAA;AAAA,IAClF,CAAA,EAAG,IAAI,CAAA,GAAI,CAAA,IAAK,GAAG,CAAA,GAAI,EAAA,CAAG,KAAK,CAAA,GAAI,CAAA,G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,CAAA,EAAG,OAAA,CAAQ,IAAI,GAAA,CAAI,CAAA,CAAE,GAAG,CAAA,CAAE,CAAC,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA;AACvF,EAAA,IAAI,CAAA,GAAI,CAAA;AACR,EAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,CAAC,GAAA,EAAK,CAAA,MAAO;AAAA,IAC9B,MAAA,EAAQ,OAAO,CAAC,CAAA;AAAA,IAChB,MAAA,EAAQ,GAAA,CAAI,GAAA,CAAI,CAAC,CAAA,KAAM;AACrB,MAAA,MAAM,OAAO,KAAA,KAAU,GAAA,CAAI,MAAA,GAAS,GAAA,CAAI,CAAC,CAAA,CAAE,IAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,IAAI,CAAA,CAAE,CAAA,EAAG,CAAA,CAAE,CAAC,CAAC,CAAA,IAAK,QAAA;AAChF,MAAA,CAAA,EAAA;AACA,MAAA,OAAO,EAAE,CAAA,EAAG,CAAA,CAAE,GAAG,CAAA,EAAG,CAAA,CAAE,GAAG,IAAA,EAAK;AAAA,IAChC,CAAC;AAAA,GACH,CAAE,CAAA;AACJ","file":"chunk-UI3FUWXM.js","sourcesContent":["import type { AnchorSet } from './anchorEdits';\nimport { isStraightSegment, segmentEnds } from './anchors';\nimport { cubicPointAt, type Point } from './cubicMath';\n\n/** First derivative of the cubic Bezier (p0, p1, p2, p3) at t. */\nexport function cubicDerivativeAt(p0: Point, p1: Point, p2: Point, p3: Point, t: number): Point {\n const u = 1 - t;\n return {\n x: 3 * u * u * (p1.x - p0.x) + 6 * u * t * (p2.x - p1.x) + 3 * t * t * (p3.x - p2.x),\n y: 3 * u * u * (p1.y - p0.y) + 6 * u * t * (p2.y - p1.y) + 3 * t * t * (p3.y - p2.y),\n };\n}\n\nfunction cubicSecondDerivativeAt(p0: Point, p1: Point, p2: Point, p3: Point, t: number): Point {\n const u = 1 - t;\n return {\n x: 6 * u * (p2.x - 2 * p1.x + p0.x) + 6 * t * (p3.x - 2 * p2.x + p1.x),\n y: 6 * u * (p2.y - 2 * p1.y + p0.y) + 6 * t * (p3.y - 2 * p2.y + p1.y),\n };\n}\n\n/**\n * Signed curvature of the cubic Bezier (p0, p1, p2, p3) at t: one over the\n * radius of the circle that fits the curve there. Positive where the curve\n * turns toward its left normal `(-dy, dx)`, negative where it turns away, so\n * the sign flips at an inflection. 0 where the curve has no direction at t, as\n * at an end whose handle sits on its anchor.\n */\nexport function cubicCurvatureAt(p0: Point, p1: Point, p2: Point, p3: Point, t: number): number {\n const d1 = cubicDerivativeAt(p0, p1, p2, p3, t);\n const d2 = cubicSecondDerivativeAt(p0, p1, p2, p3, t);\n const den = Math.pow(d1.x * d1.x + d1.y * d1.y, 1.5);\n if (den < 1e-12) return 0;\n return (d1.x * d2.y - d1.y * d2.x) / den;\n}\n\n/** One tooth of a curvature comb: a point on the curve and the tip of the\n * tooth standing on it. */\nexport interface CombTooth {\n /** The point on the curve. */\n x: number;\n y: number;\n /** The tooth's tip: off the curve along its normal, on the outside of the\n * bend, by the curvature times the comb's scale. */\n tipX: number;\n tipY: number;\n /** Signed curvature at the point, as {@link cubicCurvatureAt} gives it. */\n curvature: number;\n}\n\n/** The comb of one curved segment, which runs from anchor `segIdx` of\n * subpath `sub` to the next. */\nexport interface SegmentComb {\n sub: number;\n segIdx: number;\n /** Evenly spaced in t, ends included. */\n teeth: CombTooth[];\n}\n\n/** Options for {@link curvatureComb} and {@link combTeeth}. */\nexport interface CurvatureCombOptions {\n /** Tooth length per unit of curvature. A tooth over a stretch of radius r is\n * `scale / r` long, in the curve's own units. */\n scale: number;\n /** Teeth per segment for {@link curvatureComb}, or along the whole source\n * for {@link combTeeth}; ends included. Default 24; at least 2. */\n samplesPerSegment?: number;\n}\n\n/**\n * A curve parameterized over t in [0, 1], as a curvature comb reads it. Any\n * curve can stand a comb this way, whether or not it is a path.\n */\nexport interface CurvatureSource {\n /** The point on the curve at t. */\n pointAt(t: number): Point;\n /** A vector along the direction of travel at t. Only its direction is read;\n * a zero vector means the curve has no direction there. */\n tangentAt(t: number): Point;\n /** Signed curvature at t, positive where the curve turns toward its left\n * normal `(-dy, dx)`, as {@link cubicCurvatureAt} gives it. */\n curvatureAt(t: number): number;\n}\n\n/** How far in from an end a tooth moves when the curve has no direction at\n * the end itself, so it reports the curvature the end is approached with. */\nconst END_NUDGE = 1e-3;\n\nfunction sampleCount(opts: CurvatureCombOptions): number {\n return Math.max(2, Math.round(opts.samplesPerSegment ?? 24));\n}\n\n/**\n * The teeth of a curvature comb along `source`, evenly spaced in t with both\n * ends included. Each stands out of the curve along its normal, on the outside\n * of the bend, `scale` times the curvature long.\n */\nexport function combTeeth(source: CurvatureSource, opts: CurvatureCombOptions): CombTooth[] {\n const samples = sampleCount(opts);\n const teeth: CombTooth[] = [];\n for (let i = 0; i < samples; i++) teeth.push(toothAt(source, i / (samples - 1), opts.scale));\n return teeth;\n}\n\n/** The cubic Bezier (p0, p1, p2, p3) as a {@link CurvatureSource}. */\nexport function cubicCurvatureSource(p0: Point, p1: Point, p2: Point, p3: Point): CurvatureSource {\n return {\n pointAt: (t) => cubicPointAt(p0, p1, p2, p3, t),\n tangentAt: (t) => cubicDerivativeAt(p0, p1, p2, p3, t),\n curvatureAt: (t) => cubicCurvatureAt(p0, p1, p2, p3, t),\n };\n}\n\n/**\n * Curvature combs for every curved segment of `set`: teeth that stand out of\n * the curve, each as long as the curvature where it stands. Joining their tips\n * draws how the bend changes along the path. A tooth that jumps in length at\n * an anchor shows a curvature break there; teeth that change side show an\n * inflection. Straight segments have no curvature, and no comb.\n */\nexport function curvatureComb(set: AnchorSet, opts: CurvatureCombOptions): SegmentComb[] {\n const out: SegmentComb[] = [];\n for (let sub = 0; sub < set.anchors.length; sub++) {\n const count = set.anchors[sub].length - (set.closed[sub] ? 0 : 1);\n for (let segIdx = 0; segIdx < count; segIdx++) {\n const ends = segmentEnds(set.anchors, set.closed, sub, segIdx);\n if (!ends || isStraightSegment(ends.a, ends.b)) continue;\n const { a, b } = ends;\n const source = cubicCurvatureSource(a, a.outHandle ?? a, b.inHandle ?? b, b);\n out.push({ sub, segIdx, teeth: combTeeth(source, opts) });\n }\n }\n return out;\n}\n\nfunction toothAt(source: CurvatureSource, t: number, scale: number): CombTooth {\n const at = source.pointAt(t);\n let d = source.tangentAt(t);\n let k = source.curvatureAt(t);\n if (Math.hypot(d.x, d.y) < 1e-9) {\n const inner = t < 0.5 ? t + END_NUDGE : t - END_NUDGE;\n d = source.tangentAt(inner);\n k = source.curvatureAt(inner);\n }\n const len = Math.hypot(d.x, d.y);\n if (len < 1e-12) return { x: at.x, y: at.y, tipX: at.x, tipY: at.y, curvature: 0 };\n // The bend's center lies along the left normal times 1/k, so the tooth goes\n // the other way: outside the bend on either side of an inflection.\n const nx = -d.y / len;\n const ny = d.x / len;\n return { x: at.x, y: at.y, tipX: at.x - nx * k * scale, tipY: at.y - ny * k * scale, curvature: k };\n}\n","/**\n * One spiral segment, fitted between two points so it leaves the first and\n * reaches the second at given angles to the chord. `solveSpiro` joins these\n * into a curvature-continuous spline.\n *\n * In its normalized frame the segment has unit arc length and, with\n * `u = s − ½`, tangent angle `φ = k0·u + (k1/2)·u² + (k2/6)·u³ + (k3/24)·u⁴`,\n * so its curvature is `k0 + k1·u + (k2/2)·u² + (k3/6)·u³`. An Euler spiral has\n * `k2 = k3 = 0`: its curvature changes linearly along it. A cubic-curvature\n * segment uses all four, which is what lets a G4 point keep the curvature's\n * first two derivatives continuous as well.\n */\nimport type { Point } from './cubicMath';\n\n/** The shape of a fitted segment, in its normalized frame. */\nexport interface EulerFit {\n k0: number;\n k1: number;\n /** Zero on an Euler spiral; set on a cubic-curvature segment. */\n k2: number;\n k3: number;\n /** Chord over arc length: the normalized segment's chord length. */\n ratio: number;\n /** The normalized chord's angle, which the world chord is rotated onto. */\n chordAngle: number;\n}\n\n/** Steps of the Simpson rule that integrates a segment's tangent. Even. */\nconst STEPS = 48;\n/** A chord-relative angle past this has no sensible spiral. */\nconst MAX_ANGLE = Math.PI * 0.95;\n\nconst clampAngle = (a: number): number => Math.max(-MAX_ANGLE, Math.min(MAX_ANGLE, a));\n\n/** `∫₀^upTo e^{iφ(s)} ds` for the normalized segment `(k0, k1, k2, k3)`. */\nexport function integrateEuler(k0: number, k1: number, upTo = 1, k2 = 0, k3 = 0): Point {\n const n = Math.max(2, Math.ceil((STEPS * upTo) / 2) * 2);\n const h = upTo / n;\n let x = 0;\n let y = 0;\n for (let i = 0; i <= n; i++) {\n const u = i * h - 0.5;\n const phi = k0 * u + u * u * (k1 / 2 + u * (k2 / 6 + (u * k3) / 24));\n const w = i === 0 || i === n ? 1 : i % 2 === 1 ? 4 : 2;\n x += w * Math.cos(phi);\n y += w * Math.sin(phi);\n }\n return { x: (x * h) / 3, y: (y * h) / 3 };\n}\n\n/** How far the start angle of `(k0, k1, k2, k3)` is from `th0`. */\nfunction startError(k0: number, k1: number, k2: number, k3: number, th0: number): number {\n const c = integrateEuler(k0, k1, 1, k2, k3);\n return -k0 / 2 + k1 / 8 - k2 / 48 + k3 / 384 - Math.atan2(c.y, c.x) - th0;\n}\n\n/**\n * The spiral leaving its chord at angle `th0` and reaching the far end at\n * angle `th1`, both measured from the chord, counterclockwise positive. With\n * `k2` and `k3` left at zero it is an Euler spiral; given, they are the\n * cubic-curvature segment's higher terms, and `k0` and `k1` are fitted around them.\n */\nexport function fitEulerSegment(th0: number, th1: number, k2 = 0, k3 = 0): EulerFit {\n const t0 = clampAngle(th0);\n const t1 = clampAngle(th1);\n // The odd terms set the total turn; the even ones bow the segment.\n const k0 = t1 - t0 - k2 / 24;\n // The small-angle solution, then Newton on the one remaining unknown.\n let k1 = 6 * (t0 + t1) - k3 / 40;\n for (let iter = 0; iter < 12; iter++) {\n const e = startError(k0, k1, k2, k3, t0);\n if (Math.abs(e) < 1e-12) break;\n const d = (startError(k0, k1 + 1e-6, k2, k3, t0) - e) / 1e-6;\n if (!Number.isFinite(d) || Math.abs(d) < 1e-12) break;\n k1 -= e / d;\n }\n const c = integrateEuler(k0, k1, 1, k2, k3);\n return { k0, k1, k2, k3, ratio: Math.hypot(c.x, c.y), chordAngle: Math.atan2(c.y, c.x) };\n}\n\n/** A fitted segment placed between two world points. */\nexport interface EulerSegment extends EulerFit {\n p0: Point;\n p1: Point;\n /** World arc length. */\n length: number;\n /** The world angle the normalized frame is turned by. */\n rotation: number;\n}\n\n/** `fit` placed so it runs from `p0` to `p1`. */\nexport function placeEulerSegment(fit: EulerFit, p0: Point, p1: Point): EulerSegment {\n const chord = Math.hypot(p1.x - p0.x, p1.y - p0.y);\n const length = fit.ratio > 1e-9 ? chord / fit.ratio : chord;\n const rotation = Math.atan2(p1.y - p0.y, p1.x - p0.x) - fit.chordAngle;\n return { ...fit, p0, p1, length, rotation };\n}\n\n/** The point at fraction `s` of the arc length along `seg`. */\nexport function eulerPointAt(seg: EulerSegment, s: number): Point {\n const c = integrateEuler(seg.k0, seg.k1, s, seg.k2, seg.k3);\n const cos = Math.cos(seg.rotation);\n const sin = Math.sin(seg.rotation);\n return {\n x: seg.p0.x + seg.length * (c.x * cos - c.y * sin),\n y: seg.p0.y + seg.length * (c.x * sin + c.y * cos),\n };\n}\n\n/** World tangent angle at fraction `s` of `seg`'s arc length. */\nexport function eulerAngleAt(seg: EulerSegment, s: number): number {\n const u = s - 0.5;\n return seg.rotation + seg.k0 * u + u * u * (seg.k1 / 2 + u * (seg.k2 / 6 + (u * seg.k3) / 24));\n}\n\n/** Normalized curvature at `u = s − ½`. */\nconst bendAt = (f: EulerFit, u: number): number => f.k0 + u * (f.k1 + u * (f.k2 / 2 + (u * f.k3) / 6));\n\n/** Signed world curvature at fraction `s` of `seg`'s arc length;\n * positive turns counterclockwise. */\nexport function eulerCurvatureAt(seg: EulerSegment, s: number): number {\n if (seg.length < 1e-12) return 0;\n return bendAt(seg, s - 0.5) / seg.length;\n}\n\n/** The first and second derivatives of `seg`'s world curvature with respect\n * to world arc length, at fraction `s` of it. */\nexport function eulerCurvatureDerivativesAt(seg: EulerSegment, s: number): [number, number] {\n if (seg.length < 1e-12) return [0, 0];\n const u = s - 0.5;\n return [\n (seg.k1 + u * (seg.k2 + (u * seg.k3) / 2)) / seg.length ** 2,\n (seg.k2 + u * seg.k3) / seg.length ** 3,\n ];\n}\n\nconst SAMPLES = 16;\n\n/** Handle lengths `[a, b]` along `u0`, `u1` that best fit `samples` at the\n * cubic parameters `ts`, by least squares. Null when the fit degenerates. */\nfunction fitHandleLengths(\n p0: Point, p1: Point, u0: Point, u1: Point, samples: readonly Point[], ts: readonly number[],\n): [number, number] | null {\n // B(t) = base(t) + a·3(1−t)²t·u0 − b·3(1−t)t²·u1, linear in a and b.\n let m00 = 0, m01 = 0, m11 = 0, r0 = 0, r1 = 0;\n samples.forEach((q, i) => {\n const t = ts[i];\n const mt = 1 - t;\n const b0 = mt * mt * mt + 3 * mt * mt * t;\n const b3 = 3 * mt * t * t + t * t * t;\n const ex = q.x - (b0 * p0.x + b3 * p1.x);\n const ey = q.y - (b0 * p0.y + b3 * p1.y);\n const f1 = 3 * mt * mt * t;\n const f2 = 3 * mt * t * t;\n const ax = f1 * u0.x, ay = f1 * u0.y;\n const bx = -f2 * u1.x, by = -f2 * u1.y;\n m00 += ax * ax + ay * ay;\n m01 += ax * bx + ay * by;\n m11 += bx * bx + by * by;\n r0 += ax * ex + ay * ey;\n r1 += bx * ex + by * ey;\n });\n const det = m00 * m11 - m01 * m01;\n if (Math.abs(det) < 1e-12) return null;\n const a = (r0 * m11 - r1 * m01) / det;\n const b = (m00 * r1 - m01 * r0) / det;\n return a > 0 && b > 0 && Number.isFinite(a) && Number.isFinite(b) ? [a, b] : null;\n}\n\n/** One Newton step moving `t` toward the point of the cubic nearest `q`. */\nfunction nearerT(p: readonly Point[], q: Point, t: number): number {\n const mt = 1 - t;\n const at = (c0: number, c1: number, c2: number, c3: number) =>\n mt * mt * mt * c0 + 3 * mt * mt * t * c1 + 3 * mt * t * t * c2 + t * t * t * c3;\n const d1 = (c0: number, c1: number, c2: number, c3: number) =>\n 3 * (mt * mt * (c1 - c0) + 2 * mt * t * (c2 - c1) + t * t * (c3 - c2));\n const d2 = (c0: number, c1: number, c2: number, c3: number) =>\n 6 * (mt * (c2 - 2 * c1 + c0) + t * (c3 - 2 * c2 + c1));\n const ex = at(p[0].x, p[1].x, p[2].x, p[3].x) - q.x;\n const ey = at(p[0].y, p[1].y, p[2].y, p[3].y) - q.y;\n const dx = d1(p[0].x, p[1].x, p[2].x, p[3].x);\n const dy = d1(p[0].y, p[1].y, p[2].y, p[3].y);\n const ddx = d2(p[0].x, p[1].x, p[2].x, p[3].x);\n const ddy = d2(p[0].y, p[1].y, p[2].y, p[3].y);\n const den = dx * dx + dy * dy + ex * ddx + ey * ddy;\n if (Math.abs(den) < 1e-12) return t;\n return Math.min(1, Math.max(0, t - (ex * dx + ey * dy) / den));\n}\n\n/**\n * The two control points of a cubic that follows `seg`: each handle lies on\n * the spiral's tangent at its end, with lengths fitted to points sampled along\n * the spiral by least squares, re-pairing each sample with its nearest cubic\n * parameter between rounds.\n */\nexport function eulerSegmentCubic(seg: EulerSegment): { c1: Point; c2: Point } {\n const { p0, p1 } = seg;\n const a0 = eulerAngleAt(seg, 0);\n const a1 = eulerAngleAt(seg, 1);\n const u0 = { x: Math.cos(a0), y: Math.sin(a0) };\n const u1 = { x: Math.cos(a1), y: Math.sin(a1) };\n const samples: Point[] = [];\n const ts: number[] = [];\n for (let i = 1; i < SAMPLES; i++) {\n samples.push(eulerPointAt(seg, i / SAMPLES));\n ts.push(i / SAMPLES);\n }\n const chord = Math.hypot(p1.x - p0.x, p1.y - p0.y);\n let lengths: [number, number] = [chord / 3, chord / 3];\n const handles = ([a, b]: [number, number]) => ({\n c1: { x: p0.x + a * u0.x, y: p0.y + a * u0.y },\n c2: { x: p1.x - b * u1.x, y: p1.y - b * u1.y },\n });\n for (let round = 0; round < 4; round++) {\n const fit = fitHandleLengths(p0, p1, u0, u1, samples, ts);\n if (!fit) break;\n lengths = fit;\n const { c1, c2 } = handles(lengths);\n const ctrl = [p0, c1, c2, p1];\n samples.forEach((q, i) => { ts[i] = nearerT(ctrl, q, ts[i]); });\n }\n return handles(lengths);\n}\n\n/** The stretch of `seg` from fraction `s0` to `s1` of its arc length, as a\n * segment of its own: a piece of an Euler spiral is one. */\nexport function subEulerSegment(seg: EulerSegment, s0: number, s1: number): EulerSegment {\n const d = s1 - s0;\n const m = (s0 + s1) / 2 - 0.5;\n // The curvature polynomial re-centered on the piece and scaled to its length.\n const k0 = bendAt(seg, m) * d;\n const k1 = (seg.k1 + m * (seg.k2 + (m * seg.k3) / 2)) * d ** 2;\n const k2 = (seg.k2 + m * seg.k3) * d ** 3;\n const k3 = seg.k3 * d ** 4;\n const c = integrateEuler(k0, k1, 1, k2, k3);\n const fit: EulerFit = { k0, k1, k2, k3, ratio: Math.hypot(c.x, c.y), chordAngle: Math.atan2(c.y, c.x) };\n return placeEulerSegment(fit, eulerPointAt(seg, s0), eulerPointAt(seg, s1));\n}\n\n/** How far the cubic `(seg.p0, c1, c2, seg.p1)` strays from `seg`, measured\n * at a few points along the spiral. */\nexport function eulerCubicError(seg: EulerSegment, c1: Point, c2: Point): number {\n const ctrl = [seg.p0, c1, c2, seg.p1];\n let worst = 0;\n for (const s of [0.2, 0.4, 0.5, 0.6, 0.8]) {\n const q = eulerPointAt(seg, s);\n let t = s;\n for (let i = 0; i < 4; i++) t = nearerT(ctrl, q, t);\n const mt = 1 - t;\n const x = mt * mt * mt * seg.p0.x + 3 * mt * mt * t * c1.x + 3 * mt * t * t * c2.x + t * t * t * seg.p1.x;\n const y = mt * mt * mt * seg.p0.y + 3 * mt * mt * t * c1.y + 3 * mt * t * t * c2.y + t * t * t * seg.p1.y;\n worst = Math.max(worst, Math.hypot(x - q.x, y - q.y));\n }\n return worst;\n}\n","/**\n * Spiro curves: a spline defined by on-curve points alone. Between each pair\n * of neighboring points runs an Euler-spiral segment (`eulerSpiral`), and the\n * segments are solved together so that, at every smooth point, both the\n * tangent and the curvature carry straight through. The curve has no handles\n * to tune; moving a point re-solves the whole curve.\n *\n * Each point's kind says what holds at it:\n *\n * | kind | at the point |\n * |---|---|\n * | `smooth` | tangent and curvature continue (G2); next to a straight segment, the curve leaves along the line |\n * | `g4` | tangent, curvature, and the curvature's first two derivatives continue (G4); otherwise as `smooth` |\n * | `corner` | the two sides are independent; each meets the point with zero curvature |\n * | `left` | the segment arriving is straight, and the curve leaving continues the line |\n * | `right` | the segment leaving is straight, and the curve arriving runs into the line |\n *\n * The ends of an open curve meet their points with zero curvature, as a\n * corner's sides do.\n *\n * A segment with a `g4` point at either end is a cubic-curvature segment,\n * with two more unknowns than an Euler spiral's two end tangents. A `g4`\n * point between two curved segments pays for its side's two with its two\n * extra equations; anywhere else, such a segment's curvature stops bending\n * at that end (its second derivative is zero there).\n */\nimport type { Point } from './cubicMath';\nimport {\n eulerAngleAt, eulerCurvatureAt, eulerCurvatureDerivativesAt, fitEulerSegment, placeEulerSegment,\n type EulerSegment,\n} from './eulerSpiral';\n\n/** What holds at a spiro point; see the table at the top of `spiro.ts`. */\nexport type SpiroKind = 'smooth' | 'g4' | 'corner' | 'left' | 'right';\n\n/** Every {@link SpiroKind}, in the order a picker lists them. */\nexport const SPIRO_KINDS: readonly SpiroKind[] = ['smooth', 'g4', 'corner', 'left', 'right'];\n\n/** One on-curve point of a spiro curve. */\nexport interface SpiroPoint {\n x: number;\n y: number;\n kind: SpiroKind;\n}\n\n/** One solved segment of a spiro curve: a straight line, or a placed Euler\n * spiral (`spiral`) between the two points. */\nexport interface SpiroSegment {\n from: Point;\n to: Point;\n spiral: EulerSegment | null;\n}\n\ntype Side = { kind: 'none' } | { kind: 'line'; angle: number } | { kind: 'curve'; seg: number };\n\nconst TAU = Math.PI * 2;\nconst wrap = (a: number): number => a - TAU * Math.round(a / TAU);\nconst angleOf = (p: Point, q: Point): number => Math.atan2(q.y - p.y, q.x - p.x);\nconst distance = (p: Point, q: Point): number => Math.hypot(q.x - p.x, q.y - p.y);\n\n/** Whether `kind` is one of the {@link SpiroKind}s. */\nexport function isSpiroKind(kind: unknown): kind is SpiroKind {\n return SPIRO_KINDS.includes(kind as SpiroKind);\n}\n\ninterface System {\n points: readonly SpiroPoint[];\n /** Segment `i` runs from point `i` to point `ends[i]`. */\n ends: number[];\n straight: boolean[];\n /** The first unknown slot of each curved segment (start tangent, end\n * tangent, then a cubic-curvature segment's two higher terms), or -1. */\n slot: number[];\n /** Whether each segment is a cubic-curvature one. */\n cubic: boolean[];\n unknowns: number;\n}\n\nfunction buildSystem(points: readonly SpiroPoint[], closed: boolean): System {\n const n = points.length;\n const count = closed ? n : n - 1;\n const ends: number[] = [];\n const straight: boolean[] = [];\n const slot: number[] = [];\n const cubic: boolean[] = [];\n let unknowns = 0;\n for (let i = 0; i < count; i++) {\n const j = (i + 1) % n;\n ends.push(j);\n const line = points[i].kind === 'right' || points[j].kind === 'left'\n || distance(points[i], points[j]) < 1e-9;\n straight.push(line);\n slot.push(line ? -1 : unknowns);\n const higher = !line && (points[i].kind === 'g4' || points[j].kind === 'g4');\n cubic.push(higher);\n if (!line) unknowns += higher ? 4 : 2;\n }\n return { points, ends, straight, slot, cubic, unknowns };\n}\n\nfunction sides(sys: System, closed: boolean, i: number): [Side, Side] {\n const n = sys.points.length;\n const count = sys.ends.length;\n const side = (seg: number): Side => {\n if (seg < 0 || seg >= count) return { kind: 'none' };\n if (sys.straight[seg]) return { kind: 'line', angle: angleOf(sys.points[seg], sys.points[sys.ends[seg]]) };\n return { kind: 'curve', seg };\n };\n const into = i > 0 ? i - 1 : closed ? n - 1 : -1;\n const outOf = closed || i < n - 1 ? i : -1;\n return [side(into), side(outOf)];\n}\n\ninterface Fitted { seg: EulerSegment; chord: number; startAngle: number; endAngle: number; cubic: boolean }\n\nfunction fitSegment(sys: System, s: number, x: readonly number[]): Fitted {\n const p0 = sys.points[s];\n const p1 = sys.points[sys.ends[s]];\n const chord = angleOf(p0, p1);\n const k = sys.slot[s];\n const fit = sys.cubic[s]\n ? fitEulerSegment(wrap(x[k] - chord), wrap(x[k + 1] - chord), x[k + 2], x[k + 3])\n : fitEulerSegment(wrap(x[k] - chord), wrap(x[k + 1] - chord));\n const seg = placeEulerSegment(fit, p0, p1);\n const startAngle = eulerAngleAt(seg, 0);\n return { seg, chord: distance(p0, p1), startAngle, endAngle: eulerAngleAt(seg, 1), cubic: sys.cubic[s] };\n}\n\n/** Curvature at one end of `f`, times its chord so every equation is on one scale. */\nconst bend = (f: Fitted, at: 0 | 1): number => eulerCurvatureAt(f.seg, at) * f.chord;\n\n/** The second derivative of curvature at one end of `f`, on the same scale. */\nconst twist = (f: Fitted, at: 0 | 1): number => eulerCurvatureDerivativesAt(f.seg, at)[1] * f.chord ** 3;\n\n/** Angle, curvature, and the curvature's first two derivatives matched where\n * `fa` ends and `fb` begins. */\nfunction g4Join(fa: Fitted, fb: Fitted): number[] {\n const scale = (fa.chord + fb.chord) / 2;\n const [a1, a2] = eulerCurvatureDerivativesAt(fa.seg, 1);\n const [b1, b2] = eulerCurvatureDerivativesAt(fb.seg, 0);\n return [\n wrap(fa.endAngle - fb.startAngle),\n (eulerCurvatureAt(fa.seg, 1) - eulerCurvatureAt(fb.seg, 0)) * scale,\n (a1 - b1) * scale ** 2,\n (a2 - b2) * scale ** 3,\n ];\n}\n\nfunction residuals(sys: System, closed: boolean, fits: readonly Fitted[]): number[] {\n const out: number[] = [];\n const fitOf = (side: Side): Fitted => fits[(side as { seg: number }).seg];\n for (let i = 0; i < sys.points.length; i++) {\n const [a, b] = sides(sys, closed, i);\n const kind = sys.points[i].kind;\n const ac = a.kind === 'curve';\n const bc = b.kind === 'curve';\n if (!ac && !bc) continue;\n if (kind === 'g4' && ac && bc) {\n out.push(...g4Join(fitOf(a), fitOf(b)));\n continue;\n }\n if (kind === 'smooth' && ac && bc) {\n const fa = fitOf(a), fb = fitOf(b);\n out.push(...g4Join(fa, fb).slice(0, 2));\n if (fa.cubic) out.push(twist(fa, 1));\n if (fb.cubic) out.push(twist(fb, 0));\n continue;\n }\n // One curved side from here on, or a corner's two independent ones.\n for (const [side, other, at] of [[a, b, 1], [b, a, 0]] as const) {\n if (side.kind !== 'curve') continue;\n const f = fitOf(side);\n const angle = at === 1 ? f.endAngle : f.startAngle;\n const followsLine = other.kind === 'line' && kind !== 'corner';\n out.push(followsLine ? wrap(angle - other.angle) : bend(f, at));\n if (f.cubic) out.push(twist(f, at));\n }\n }\n return out;\n}\n\n/** A starting tangent at each point: along the bisector of its two chords. */\nfunction initialGuess(sys: System, closed: boolean): number[] {\n const x = new Array<number>(sys.unknowns).fill(0);\n const n = sys.points.length;\n const tangentAt = (i: number, seg: number): number => {\n const chord = angleOf(sys.points[seg], sys.points[sys.ends[seg]]);\n const [a, b] = sides(sys, closed, i);\n if (sys.points[i].kind === 'corner' || a.kind === 'none' || b.kind === 'none') return chord;\n if (a.kind === 'line') return a.angle;\n if (b.kind === 'line') return b.angle;\n const prev = sys.points[(i - 1 + n) % n];\n const next = sys.points[(i + 1) % n];\n const pin = angleOf(prev, sys.points[i]);\n const pout = angleOf(sys.points[i], next);\n return pin + wrap(pout - pin) / 2;\n };\n for (let s = 0; s < sys.ends.length; s++) {\n const k = sys.slot[s];\n if (k < 0) continue;\n x[k] = tangentAt(s, s);\n x[k + 1] = tangentAt(sys.ends[s], s);\n }\n return x;\n}\n\n/** Solve `m · d = r` in place by Gaussian elimination with partial pivoting. */\nfunction solveLinear(m: number[][], r: number[]): number[] | null {\n const n = r.length;\n for (let c = 0; c < n; c++) {\n let p = c;\n for (let i = c + 1; i < n; i++) if (Math.abs(m[i][c]) > Math.abs(m[p][c])) p = i;\n if (Math.abs(m[p][c]) < 1e-14) return null;\n [m[c], m[p]] = [m[p], m[c]];\n [r[c], r[p]] = [r[p], r[c]];\n for (let i = c + 1; i < n; i++) {\n const f = m[i][c] / m[c][c];\n if (f === 0) continue;\n for (let j = c; j < n; j++) m[i][j] -= f * m[c][j];\n r[i] -= f * r[c];\n }\n }\n const out = new Array<number>(n).fill(0);\n for (let i = n - 1; i >= 0; i--) {\n let v = r[i];\n for (let j = i + 1; j < n; j++) v -= m[i][j] * out[j];\n out[i] = v / m[i][i];\n }\n return out;\n}\n\nconst norm = (v: readonly number[]): number => Math.sqrt(v.reduce((s, e) => s + e * e, 0));\n\n/**\n * Solve the spiro curve through `points`. A closed curve has a segment from\n * the last point back to the first. Fewer than two points make no segments.\n */\nexport function solveSpiro(points: readonly SpiroPoint[], closed: boolean): SpiroSegment[] {\n if (points.length < 2) return [];\n const sys = buildSystem(points, closed && points.length > 2);\n const isClosed = closed && points.length > 2;\n let x = initialGuess(sys, isClosed);\n const fitAll = (v: readonly number[]): Fitted[] =>\n sys.ends.map((_, s) => (sys.slot[s] < 0 ? (null as unknown as Fitted) : fitSegment(sys, s, v)));\n let fits = fitAll(x);\n let r = residuals(sys, isClosed, fits);\n for (let iter = 0; iter < 40 && sys.unknowns > 0; iter++) {\n const err = norm(r);\n if (err < 1e-10) break;\n // Each unknown moves only its own segment, so a column refits one segment.\n const jac = r.map(() => new Array<number>(sys.unknowns).fill(0));\n for (let s = 0; s < sys.ends.length; s++) {\n const k = sys.slot[s];\n if (k < 0) continue;\n for (let u = k; u < k + (sys.cubic[s] ? 4 : 2); u++) {\n const h = 1e-6;\n const xs = x.slice();\n xs[u] += h;\n const moved = fits.slice();\n moved[s] = fitSegment(sys, s, xs);\n const rs = residuals(sys, isClosed, moved);\n for (let e = 0; e < r.length; e++) jac[e][u] = (rs[e] - r[e]) / h;\n }\n }\n const step = solveLinear(jac, r.map((v) => -v));\n if (!step) break;\n // Halve the step until it lowers the error.\n let t = 1;\n let accepted = false;\n for (let tries = 0; tries < 12; tries++, t /= 2) {\n const xt = x.map((v, i) => v + t * step[i]);\n const ft = fitAll(xt);\n const rt = residuals(sys, isClosed, ft);\n if (norm(rt) < err) {\n x = xt; fits = ft; r = rt; accepted = true;\n break;\n }\n }\n if (!accepted) break;\n }\n return sys.ends.map((end, s) => ({\n from: { x: points[s].x, y: points[s].y },\n to: { x: points[end].x, y: points[end].y },\n spiral: sys.slot[s] < 0 ? null : fits[s].seg,\n }));\n}\n","/**\n * Spiro curves as cubic paths, and back. A solved curve is written as cubics,\n * each spiral segment split into as many as it takes to stay within tolerance,\n * so most anchors of the path are not spiro points. `at` records which are:\n * `at[i]` is the flat anchor index of point `i`, counted across subpaths. The\n * points are then read back out of the path itself, so whatever moves the path\n * — a move, a resize, a rotation — moves them with it.\n */\nimport type { PolygonPath } from '../path';\nimport { anchorsToPath, pathToAnchors, type PenAnchor } from './anchors';\nimport { eulerCubicError, eulerSegmentCubic, subEulerSegment, type EulerSegment } from './eulerSpiral';\nimport { solveSpiro, type SpiroKind, type SpiroPoint } from './spiro';\n\n/** One subpath of a spiro curve: its points, and whether it closes. */\nexport interface SpiroContour {\n points: SpiroPoint[];\n closed: boolean;\n}\n\n/** A spiro curve written as a cubic path, with the anchor each point became. */\nexport interface SpiroPath {\n path: PolygonPath;\n /** The flat anchor index of each point, in contour order. */\n at: number[];\n}\n\n/** Options for {@link spiroToPath}. */\nexport interface SpiroToPathOptions {\n /** The furthest a cubic may stray from its spiral, as a fraction of that\n * segment's arc length. Default `1e-4`. */\n tolerance?: number;\n /** The path being reshaped, whose fill rules the result keeps. */\n like?: PolygonPath;\n}\n\nconst MAX_PIECES = 16;\n\ninterface Piece { end: EulerSegment; c1: { x: number; y: number }; c2: { x: number; y: number } }\n\n/** `spiral` as the fewest equal pieces whose cubics all stay within `tol`. */\nfunction cubicPieces(spiral: EulerSegment, tol: number): Piece[] {\n let best: Piece[] = [];\n for (let m = 1; m <= MAX_PIECES; m++) {\n best = [];\n let fits = true;\n for (let j = 0; j < m; j++) {\n const piece = m === 1 ? spiral : subEulerSegment(spiral, j / m, (j + 1) / m);\n const { c1, c2 } = eulerSegmentCubic(piece);\n best.push({ end: piece, c1, c2 });\n if (eulerCubicError(piece, c1, c2) > tol * spiral.length) fits = false;\n }\n if (fits) break;\n }\n return best;\n}\n\nfunction contourAnchors(c: SpiroContour, tol: number): { anchors: PenAnchor[]; at: number[] } {\n const anchors: PenAnchor[] = [];\n const at: number[] = [];\n const segments = solveSpiro(c.points, c.closed);\n // The handle the last piece of a segment arrives with, for the point after it.\n let arriving: { x: number; y: number } | null = null;\n c.points.forEach((p, i) => {\n at.push(anchors.length);\n anchors.push({ x: p.x, y: p.y, ...(arriving ? { inHandle: arriving } : {}) });\n arriving = null;\n const spiral = segments[i]?.spiral;\n if (!spiral) return;\n const pieces = cubicPieces(spiral, tol);\n pieces.forEach((piece, j) => {\n anchors[anchors.length - 1].outHandle = { x: piece.c1.x, y: piece.c1.y };\n const c2 = { x: piece.c2.x, y: piece.c2.y };\n if (j < pieces.length - 1) anchors.push({ x: piece.end.p1.x, y: piece.end.p1.y, inHandle: c2 });\n else arriving = c2;\n });\n });\n if (arriving) anchors[0].inHandle = arriving;\n return { anchors, at };\n}\n\n/**\n * Solve each contour and write it as a cubic path. Straight segments carry no\n * handles.\n */\nexport function spiroToPath(contours: readonly SpiroContour[], options: SpiroToPathOptions = {}): SpiroPath {\n const tol = options.tolerance ?? 1e-4;\n const subs: PenAnchor[][] = [];\n const closed: boolean[] = [];\n const at: number[] = [];\n let base = 0;\n for (const c of contours) {\n if (c.points.length === 0) continue;\n const written = contourAnchors(c, tol);\n subs.push(written.anchors);\n closed.push(c.closed && c.points.length > 2);\n at.push(...written.at.map((i) => i + base));\n base += written.anchors.length;\n }\n return { path: anchorsToPath(subs, closed, options.like), at };\n}\n\n/**\n * The spiro points `path` holds, given the kind of each and the anchor each\n * became. Null when `kinds` and `at` do not describe `path`: the counts\n * differ, an index is out of order or out of range, or a subpath does not\n * start on a point.\n */\nexport function spiroContoursOf(\n path: PolygonPath,\n kinds: readonly SpiroKind[],\n at: readonly number[],\n): SpiroContour[] | null {\n if (kinds.length !== at.length || at.length === 0) return null;\n const { anchors, closed } = pathToAnchors(path);\n const contours: SpiroContour[] = [];\n let flat = 0;\n let k = 0;\n for (let s = 0; s < anchors.length; s++) {\n const sub = anchors[s];\n if (at[k] !== flat) return null;\n const points: SpiroPoint[] = [];\n while (k < at.length && at[k] < flat + sub.length) {\n if (k > 0 && at[k] <= at[k - 1]) return null;\n const a = sub[at[k] - flat];\n points.push({ x: a.x, y: a.y, kind: kinds[k] });\n k++;\n }\n contours.push({ points, closed: closed[s] });\n flat += sub.length;\n }\n return k === at.length ? contours : null;\n}\n\n/** The straight-sided path through each contour's points: what an editor\n * shows and moves in place of the curve. */\nexport function spiroControlPath(contours: readonly SpiroContour[]): PolygonPath {\n return anchorsToPath(\n contours.map((c) => c.points.map((p) => ({ x: p.x, y: p.y }))),\n contours.map((c) => c.closed),\n );\n}\n\nconst key = (x: number, y: number): string => `${Math.round(x * 1e3)},${Math.round(y * 1e3)}`;\n\n/**\n * Read an edited control path back as contours: every anchor is a point.\n * Kinds follow from `before`, the contours the edit started from: point for\n * point when the count is unchanged, else by position, with an anchor that\n * lands nowhere a point was taking `fallback`. Handles are ignored.\n */\nexport function spiroContoursFromControl(\n control: PolygonPath,\n before: readonly SpiroContour[],\n fallback: SpiroKind = 'smooth',\n): SpiroContour[] {\n const { anchors, closed } = pathToAnchors(control);\n const old = before.flatMap((c) => c.points);\n const count = anchors.reduce((n, sub) => n + sub.length, 0);\n const byPlace = new Map<string, SpiroKind>();\n for (const p of old) if (!byPlace.has(key(p.x, p.y))) byPlace.set(key(p.x, p.y), p.kind);\n let i = 0;\n return anchors.map((sub, s) => ({\n closed: closed[s],\n points: sub.map((a) => {\n const kind = count === old.length ? old[i].kind : byPlace.get(key(a.x, a.y)) ?? fallback;\n i++;\n return { x: a.x, y: a.y, kind };\n }),\n }));\n}\n"]}
@@ -0,0 +1,454 @@
1
+ import { b as Point, C as CornerSpec, P as PolygonPath, a as Path } from './path-BW8d_2RY.js';
2
+
3
+ /**
4
+ * One spiral segment, fitted between two points so it leaves the first and
5
+ * reaches the second at given angles to the chord. `solveSpiro` joins these
6
+ * into a curvature-continuous spline.
7
+ *
8
+ * In its normalized frame the segment has unit arc length and, with
9
+ * `u = s − ½`, tangent angle `φ = k0·u + (k1/2)·u² + (k2/6)·u³ + (k3/24)·u⁴`,
10
+ * so its curvature is `k0 + k1·u + (k2/2)·u² + (k3/6)·u³`. An Euler spiral has
11
+ * `k2 = k3 = 0`: its curvature changes linearly along it. A cubic-curvature
12
+ * segment uses all four, which is what lets a G4 point keep the curvature's
13
+ * first two derivatives continuous as well.
14
+ */
15
+
16
+ /** The shape of a fitted segment, in its normalized frame. */
17
+ interface EulerFit {
18
+ k0: number;
19
+ k1: number;
20
+ /** Zero on an Euler spiral; set on a cubic-curvature segment. */
21
+ k2: number;
22
+ k3: number;
23
+ /** Chord over arc length: the normalized segment's chord length. */
24
+ ratio: number;
25
+ /** The normalized chord's angle, which the world chord is rotated onto. */
26
+ chordAngle: number;
27
+ }
28
+ /**
29
+ * The spiral leaving its chord at angle `th0` and reaching the far end at
30
+ * angle `th1`, both measured from the chord, counterclockwise positive. With
31
+ * `k2` and `k3` left at zero it is an Euler spiral; given, they are the
32
+ * cubic-curvature segment's higher terms, and `k0` and `k1` are fitted around them.
33
+ */
34
+ declare function fitEulerSegment(th0: number, th1: number, k2?: number, k3?: number): EulerFit;
35
+ /** A fitted segment placed between two world points. */
36
+ interface EulerSegment extends EulerFit {
37
+ p0: Point;
38
+ p1: Point;
39
+ /** World arc length. */
40
+ length: number;
41
+ /** The world angle the normalized frame is turned by. */
42
+ rotation: number;
43
+ }
44
+ /** `fit` placed so it runs from `p0` to `p1`. */
45
+ declare function placeEulerSegment(fit: EulerFit, p0: Point, p1: Point): EulerSegment;
46
+ /** The point at fraction `s` of the arc length along `seg`. */
47
+ declare function eulerPointAt(seg: EulerSegment, s: number): Point;
48
+ /** World tangent angle at fraction `s` of `seg`'s arc length. */
49
+ declare function eulerAngleAt(seg: EulerSegment, s: number): number;
50
+ /** Signed world curvature at fraction `s` of `seg`'s arc length;
51
+ * positive turns counterclockwise. */
52
+ declare function eulerCurvatureAt(seg: EulerSegment, s: number): number;
53
+ /** The first and second derivatives of `seg`'s world curvature with respect
54
+ * to world arc length, at fraction `s` of it. */
55
+ declare function eulerCurvatureDerivativesAt(seg: EulerSegment, s: number): [number, number];
56
+
57
+ /**
58
+ * Spiro curves: a spline defined by on-curve points alone. Between each pair
59
+ * of neighboring points runs an Euler-spiral segment (`eulerSpiral`), and the
60
+ * segments are solved together so that, at every smooth point, both the
61
+ * tangent and the curvature carry straight through. The curve has no handles
62
+ * to tune; moving a point re-solves the whole curve.
63
+ *
64
+ * Each point's kind says what holds at it:
65
+ *
66
+ * | kind | at the point |
67
+ * |---|---|
68
+ * | `smooth` | tangent and curvature continue (G2); next to a straight segment, the curve leaves along the line |
69
+ * | `g4` | tangent, curvature, and the curvature's first two derivatives continue (G4); otherwise as `smooth` |
70
+ * | `corner` | the two sides are independent; each meets the point with zero curvature |
71
+ * | `left` | the segment arriving is straight, and the curve leaving continues the line |
72
+ * | `right` | the segment leaving is straight, and the curve arriving runs into the line |
73
+ *
74
+ * The ends of an open curve meet their points with zero curvature, as a
75
+ * corner's sides do.
76
+ *
77
+ * A segment with a `g4` point at either end is a cubic-curvature segment,
78
+ * with two more unknowns than an Euler spiral's two end tangents. A `g4`
79
+ * point between two curved segments pays for its side's two with its two
80
+ * extra equations; anywhere else, such a segment's curvature stops bending
81
+ * at that end (its second derivative is zero there).
82
+ */
83
+
84
+ /** What holds at a spiro point; see the table at the top of `spiro.ts`. */
85
+ type SpiroKind = 'smooth' | 'g4' | 'corner' | 'left' | 'right';
86
+ /** Every {@link SpiroKind}, in the order a picker lists them. */
87
+ declare const SPIRO_KINDS: readonly SpiroKind[];
88
+ /** One on-curve point of a spiro curve. */
89
+ interface SpiroPoint {
90
+ x: number;
91
+ y: number;
92
+ kind: SpiroKind;
93
+ }
94
+ /** One solved segment of a spiro curve: a straight line, or a placed Euler
95
+ * spiral (`spiral`) between the two points. */
96
+ interface SpiroSegment {
97
+ from: Point;
98
+ to: Point;
99
+ spiral: EulerSegment | null;
100
+ }
101
+ /** Whether `kind` is one of the {@link SpiroKind}s. */
102
+ declare function isSpiroKind(kind: unknown): kind is SpiroKind;
103
+ /**
104
+ * Solve the spiro curve through `points`. A closed curve has a segment from
105
+ * the last point back to the first. Fewer than two points make no segments.
106
+ */
107
+ declare function solveSpiro(points: readonly SpiroPoint[], closed: boolean): SpiroSegment[];
108
+
109
+ /**
110
+ * Screen-pixel lengths in world units, per axis.
111
+ *
112
+ * Chrome declares its hit zones in screen pixels — an 8px handle stays 8px at
113
+ * every zoom, because it paints in screen space. Converting one such length to
114
+ * world units with a single scalar (see `meanScale`) is exact only under
115
+ * uniform zoom; per-axis it is too generous on one axis and too mean on the
116
+ * other, so the pickable region stops matching the painted one.
117
+ *
118
+ * Prefer {@link withinPxBox} / {@link withinPxRadius}, which compare in screen
119
+ * space and so can't drift from the paint at all. {@link pxExtent} is for the
120
+ * cases that must stay in world units — a tolerance handed to geometry that
121
+ * doesn't know about the view.
122
+ */
123
+ interface Scale2 {
124
+ x: number;
125
+ y: number;
126
+ }
127
+ /** One screen-pixel length as world-space extents, per axis. `scale` is a
128
+ * view's, so neither axis is zero (see `View`).
129
+ *
130
+ * With `rotation`, the axes are a frame turned that far from world, and each
131
+ * extent is how far along it an edge across it must move to move `px` on
132
+ * screen — which, under non-uniform zoom, is not the extent along the screen
133
+ * axis nearest to it. */
134
+ declare function pxExtent(px: number, scale: Scale2, rotation?: number): {
135
+ x: number;
136
+ y: number;
137
+ };
138
+ /** World delta → screen delta. Only the scale participates: translation
139
+ * cancels in a difference, and the kit's views carry no skew. */
140
+ declare function scaleDelta(dx: number, dy: number, scale: Scale2): {
141
+ x: number;
142
+ y: number;
143
+ };
144
+ /**
145
+ * Is a world-space delta inside a screen-space square of half-extent `px`?
146
+ *
147
+ * The square is axis-aligned **on screen**, which is what a handle painted in
148
+ * screen space actually is — so this stays true under non-uniform zoom and
149
+ * under a rotated target, where an axis-aligned world-space test is a rotated
150
+ * rectangle on screen.
151
+ */
152
+ declare function withinPxBox(dx: number, dy: number, px: number, scale: Scale2): boolean;
153
+ /** Is a world-space delta inside a screen-space circle of radius `px`? */
154
+ declare function withinPxRadius(dx: number, dy: number, px: number, scale: Scale2): boolean;
155
+ /**
156
+ * A world point pushed `px` screen pixels off an edge, along the edge's normal
157
+ * as it lands on screen. `normal` is the edge's outward normal in world space.
158
+ *
159
+ * Scaling the world normal by the view is not the same thing: under
160
+ * non-uniform zoom the image of a normal is no longer perpendicular to the
161
+ * image of its edge, so chrome placed that way drifts sideways and sits closer
162
+ * than `px`. Returns the point in world coords and the on-screen unit normal.
163
+ */
164
+ declare function standoff(anchor: {
165
+ x: number;
166
+ y: number;
167
+ }, normal: {
168
+ x: number;
169
+ y: number;
170
+ }, px: number, scale: Scale2): {
171
+ x: number;
172
+ y: number;
173
+ nx: number;
174
+ ny: number;
175
+ };
176
+ /** The screen angle a frame turned `rotation` from world lands its x axis at.
177
+ * Equals `rotation` under uniform zoom; non-uniform zoom bends it. */
178
+ declare function screenAngleOf(rotation: number, scale: Scale2): number;
179
+
180
+ /**
181
+ * Counts the path anchors used by the per-anchor coloring surface. An
182
+ * "anchor" is the destination point of a path command: M, L, C, Q each
183
+ * contribute one (the (x, y) where the pen ends up); Z contributes none
184
+ * (it closes back to the subpath's first M). RectPath has four implicit
185
+ * anchors — the corners — matching its M/L/L/L/Z stroke tessellation.
186
+ *
187
+ * Consumers use this to size their per-anchor color array; the renderer
188
+ * uses it to validate the array length in dev builds.
189
+ */
190
+
191
+ /** One anchor of an editable path: its on-curve point plus the two control
192
+ * handles that shape the segments either side of it. Handles are in the same
193
+ * space as the point, and absent when the adjoining segment is straight. */
194
+ interface PenAnchor {
195
+ x: number;
196
+ y: number;
197
+ inHandle?: {
198
+ x: number;
199
+ y: number;
200
+ };
201
+ outHandle?: {
202
+ x: number;
203
+ y: number;
204
+ };
205
+ /** The corner shape cut at this anchor (`PolygonPath.corners`). */
206
+ corner?: CornerSpec;
207
+ }
208
+ /**
209
+ * Derive a per-subpath anchor model from a PolygonPath. Subpaths split on
210
+ * every `M` command; a subpath is closed iff it ends with `Z`.
211
+ *
212
+ * Cubic-segment control points become the outHandle of the previous anchor
213
+ * and the inHandle of the next anchor. A closed subpath whose last curve ends
214
+ * exactly on its first point holds that point twice; the two are one anchor,
215
+ * and the curve's second control is that anchor's inHandle. Quadratic segments are upgraded to
216
+ * cubics (each control reused for both adjacent handles) — this loses no
217
+ * geometry. Linear segments produce anchors with no handles.
218
+ */
219
+ declare function pathToAnchors(path: PolygonPath): {
220
+ anchors: PenAnchor[][];
221
+ closed: boolean[];
222
+ };
223
+ /**
224
+ * Serialize the per-subpath anchor model back to a PolygonPath. Inverse of
225
+ * `pathToAnchors`. Curve-vs-line decision per segment:
226
+ * - Both adjacent handles absent → straight L segment.
227
+ * - Either handle present → C segment, with missing handles defaulting to
228
+ * the anchor point itself (degenerate but valid; renders as a near-line).
229
+ * Given `like`, the path being reshaped, the result keeps its fill rules.
230
+ */
231
+ declare function anchorsToPath(anchors: PenAnchor[][], closed: boolean[], like?: PolygonPath): PolygonPath;
232
+ /**
233
+ * Returns true if the anchor's in-handle and out-handle are collinear with
234
+ * the anchor point, indicating "smooth" (mirror-drag) behavior. Detected via
235
+ * the magnitude of the normalized cross product of the two handle vectors.
236
+ *
237
+ * Edge cases:
238
+ * - Missing in or out handle → false (corner by definition).
239
+ * - Either handle at zero distance from anchor → false.
240
+ */
241
+ declare function isAnchorSmooth(a: PenAnchor): boolean;
242
+ /** How many anchors a path has. Matches the per-anchor arrays the renderer
243
+ * expects for `vertexColors`. */
244
+ declare function countPathAnchors(path: Path): number;
245
+ /** The segment `(sub, segIdx)` as its two end anchors, or null when it
246
+ * doesn't exist. `segIdx === sub.length - 1` names a closed subpath's
247
+ * closing segment, which runs from the last anchor back to the first. */
248
+ declare function segmentEnds(anchors: readonly PenAnchor[][], closed: readonly boolean[] | undefined, sub: number, segIdx: number): {
249
+ a: PenAnchor;
250
+ b: PenAnchor;
251
+ } | null;
252
+ /** Whether the segment from `a` to `b` is a straight line (no handles). */
253
+ declare function isStraightSegment(a: PenAnchor, b: PenAnchor): boolean;
254
+ /** The segment of a decoded path nearest `(wx, wy)`, and the parameter `t`
255
+ * on it closest to that point. Pass `closed` (from `pathToAnchors`) to
256
+ * include each closed subpath's closing segment, reported as
257
+ * `segIdx === sub.length - 1`. `t` spans `[0, 1]`, endpoints included.
258
+ * Returns `null` only when there are no segments. */
259
+ declare function nearestSegmentT(anchors: PenAnchor[][], wx: number, wy: number, closed?: readonly boolean[]): {
260
+ sub: number;
261
+ segIdx: number;
262
+ t: number;
263
+ } | null;
264
+
265
+ /**
266
+ * Pure anchor-set edits on the model `pathToAnchors` produces: subpath-major
267
+ * `PenAnchor[][]` plus a parallel `closed: boolean[]`. Every function here
268
+ * mutates that structure in place; callers decode with `pathToAnchors`,
269
+ * apply, and re-encode with `anchorsToPath` (see {@link editAnchorSet}).
270
+ *
271
+ * Callers address anchors by flat index — the sequential position in walk
272
+ * order across all subpaths, which is what `enumerateAnchors` reports.
273
+ * {@link locateAnchor} and {@link flatAnchorIndex} convert to and from the
274
+ * `(sub, idx)` pair.
275
+ *
276
+ * The two orders agree because `pathToAnchors` and `enumerateAnchors`
277
+ * walk the same command stream and emit one anchor per M/L/C/Q, less the
278
+ * end of a closing curve that lands on its subpath's first point.
279
+ * `countPathAnchors`, which sizes the renderer's per-anchor arrays, counts
280
+ * that end too and so can be one higher per closed subpath.
281
+ */
282
+
283
+ /** Subpath-major anchor model — the decoded form of a `PolygonPath`. */
284
+ interface AnchorSet {
285
+ anchors: PenAnchor[][];
286
+ closed: boolean[];
287
+ }
288
+ /** A world-space rectangle, as produced by a drag-rect gesture. */
289
+ interface AnchorRect {
290
+ x: number;
291
+ y: number;
292
+ width: number;
293
+ height: number;
294
+ }
295
+ /** Total anchors across every subpath. */
296
+ declare function anchorCount(set: AnchorSet): number;
297
+ /** Flat index → `(sub, idx)`. Returns null when out of range. */
298
+ declare function locateAnchor(set: AnchorSet, flatIndex: number): {
299
+ sub: number;
300
+ idx: number;
301
+ } | null;
302
+ /** `(sub, idx)` → flat index. Returns -1 when out of range. */
303
+ declare function flatAnchorIndex(set: AnchorSet, sub: number, idx: number): number;
304
+ /** Resolve a flat index to the anchor itself. Null when out of range. */
305
+ declare function anchorAt(set: AnchorSet, flatIndex: number): PenAnchor | null;
306
+ /**
307
+ * Decode `path`, hand the mutable anchor set to `edit`, and re-encode.
308
+ * Returns null when `edit` returns `false` (it changed nothing), so callers
309
+ * can skip a no-op commit.
310
+ */
311
+ declare function editAnchorSet(path: PolygonPath, edit: (set: AnchorSet) => boolean | void): PolygonPath | null;
312
+ /** Translate an anchor and both of its handles by `(dx, dy)`. */
313
+ declare function translateAnchorBy(set: AnchorSet, flatIndex: number, dx: number, dy: number): boolean;
314
+ /**
315
+ * Move one control handle to an absolute world position. When the anchor was
316
+ * smooth (handles collinear through the anchor) and `breakSmoothness` is
317
+ * false, the opposite handle is mirrored so the curve stays smooth.
318
+ */
319
+ declare function moveHandleTo(set: AnchorSet, flatIndex: number, side: 'in' | 'out', toX: number, toY: number, breakSmoothness: boolean): boolean;
320
+ /**
321
+ * Split the segment `(sub, segIdx) → (sub, segIdx + 1)` at parameter `t`,
322
+ * inserting a new anchor there. On a closed subpath `segIdx` may also name
323
+ * the closing segment (`sub.length - 1`); its new anchor is appended.
324
+ *
325
+ * A straight segment stays straight — the new anchor has no handles. A curved
326
+ * one splits by de Casteljau, so the two halves trace the original path.
327
+ *
328
+ * Returns the new anchor's flat index, or -1 when the segment doesn't
329
+ * exist.
330
+ */
331
+ declare function insertAnchorOnSegment(set: AnchorSet, args: {
332
+ sub: number;
333
+ segIdx: number;
334
+ t: number;
335
+ }): number;
336
+ /** A point on a segment, as {@link segmentAt} reports it. */
337
+ interface SegmentHit {
338
+ sub: number;
339
+ segIdx: number;
340
+ /** Parameter on the segment — what {@link insertAnchorOnSegment} takes. */
341
+ t: number;
342
+ /** The point on the path at `t`, in the set's own space. */
343
+ x: number;
344
+ y: number;
345
+ }
346
+ /**
347
+ * The segment point under `(x, y)`, when it lies within `tolerancePx` of
348
+ * the path on screen and no nearer than that to either of the segment's
349
+ * own anchors — a press on an anchor is about the anchor, not the segment
350
+ * beside it.
351
+ *
352
+ * `scale` is the view's, so the tolerance holds per axis under
353
+ * non-uniform zoom. The search runs in screen-scaled space: scaling is
354
+ * affine, so the curve's parameterization, and therefore `t`, carries
355
+ * straight back to world space.
356
+ */
357
+ declare function segmentAt(set: AnchorSet, x: number, y: number, opts: {
358
+ tolerancePx: number;
359
+ scale?: Scale2;
360
+ }): SegmentHit | null;
361
+ /**
362
+ * Delete the anchors at `flatIndexes`. Where a deleted anchor had
363
+ * neighbors on both sides — across the seam too, on a closed subpath — the
364
+ * surviving segment is refitted to the two it replaces (`fitCubicThroughDeletion`)
365
+ * so the path keeps its shape; a gap between two straight segments closes straight.
366
+ *
367
+ * Subpaths left with fewer than two anchors are dropped entirely. If that
368
+ * would leave the path with no subpaths at all, the whole deletion is refused
369
+ * (returns false, `set` untouched): an empty path leaves the node selected
370
+ * and in the scene with nothing on screen and no anchors to grab it by.
371
+ */
372
+ declare function deleteAnchorsAt(set: AnchorSet, flatIndexes: Iterable<number>): boolean;
373
+ /**
374
+ * Scissors: open a closed subpath at the given anchor. The anchor list is
375
+ * rotated to start there and a second anchor at the same point ends it, so
376
+ * every segment survives and the two ends can be pulled apart. No-ops on an
377
+ * already-open subpath — there's nothing to cut.
378
+ */
379
+ declare function openSubpathAt(set: AnchorSet, flatIndex: number): boolean;
380
+ /** Flat indices of every anchor whose on-curve point falls inside `rect`. */
381
+ declare function anchorsInRect(set: AnchorSet, rect: AnchorRect): number[];
382
+
383
+ /** First derivative of the cubic Bezier (p0, p1, p2, p3) at t. */
384
+ declare function cubicDerivativeAt(p0: Point, p1: Point, p2: Point, p3: Point, t: number): Point;
385
+ /**
386
+ * Signed curvature of the cubic Bezier (p0, p1, p2, p3) at t: one over the
387
+ * radius of the circle that fits the curve there. Positive where the curve
388
+ * turns toward its left normal `(-dy, dx)`, negative where it turns away, so
389
+ * the sign flips at an inflection. 0 where the curve has no direction at t, as
390
+ * at an end whose handle sits on its anchor.
391
+ */
392
+ declare function cubicCurvatureAt(p0: Point, p1: Point, p2: Point, p3: Point, t: number): number;
393
+ /** One tooth of a curvature comb: a point on the curve and the tip of the
394
+ * tooth standing on it. */
395
+ interface CombTooth {
396
+ /** The point on the curve. */
397
+ x: number;
398
+ y: number;
399
+ /** The tooth's tip: off the curve along its normal, on the outside of the
400
+ * bend, by the curvature times the comb's scale. */
401
+ tipX: number;
402
+ tipY: number;
403
+ /** Signed curvature at the point, as {@link cubicCurvatureAt} gives it. */
404
+ curvature: number;
405
+ }
406
+ /** The comb of one curved segment, which runs from anchor `segIdx` of
407
+ * subpath `sub` to the next. */
408
+ interface SegmentComb {
409
+ sub: number;
410
+ segIdx: number;
411
+ /** Evenly spaced in t, ends included. */
412
+ teeth: CombTooth[];
413
+ }
414
+ /** Options for {@link curvatureComb} and {@link combTeeth}. */
415
+ interface CurvatureCombOptions {
416
+ /** Tooth length per unit of curvature. A tooth over a stretch of radius r is
417
+ * `scale / r` long, in the curve's own units. */
418
+ scale: number;
419
+ /** Teeth per segment for {@link curvatureComb}, or along the whole source
420
+ * for {@link combTeeth}; ends included. Default 24; at least 2. */
421
+ samplesPerSegment?: number;
422
+ }
423
+ /**
424
+ * A curve parameterized over t in [0, 1], as a curvature comb reads it. Any
425
+ * curve can stand a comb this way, whether or not it is a path.
426
+ */
427
+ interface CurvatureSource {
428
+ /** The point on the curve at t. */
429
+ pointAt(t: number): Point;
430
+ /** A vector along the direction of travel at t. Only its direction is read;
431
+ * a zero vector means the curve has no direction there. */
432
+ tangentAt(t: number): Point;
433
+ /** Signed curvature at t, positive where the curve turns toward its left
434
+ * normal `(-dy, dx)`, as {@link cubicCurvatureAt} gives it. */
435
+ curvatureAt(t: number): number;
436
+ }
437
+ /**
438
+ * The teeth of a curvature comb along `source`, evenly spaced in t with both
439
+ * ends included. Each stands out of the curve along its normal, on the outside
440
+ * of the bend, `scale` times the curvature long.
441
+ */
442
+ declare function combTeeth(source: CurvatureSource, opts: CurvatureCombOptions): CombTooth[];
443
+ /** The cubic Bezier (p0, p1, p2, p3) as a {@link CurvatureSource}. */
444
+ declare function cubicCurvatureSource(p0: Point, p1: Point, p2: Point, p3: Point): CurvatureSource;
445
+ /**
446
+ * Curvature combs for every curved segment of `set`: teeth that stand out of
447
+ * the curve, each as long as the curvature where it stands. Joining their tips
448
+ * draws how the bend changes along the path. A tooth that jumps in length at
449
+ * an anchor shows a curvature break there; teeth that change side show an
450
+ * inflection. Straight segments have no curvature, and no comb.
451
+ */
452
+ declare function curvatureComb(set: AnchorSet, opts: CurvatureCombOptions): SegmentComb[];
453
+
454
+ export { type AnchorSet as A, fitEulerSegment as B, type CurvatureSource as C, flatAnchorIndex as D, type EulerFit as E, insertAnchorOnSegment as F, isAnchorSmooth as G, isSpiroKind as H, isStraightSegment as I, locateAnchor as J, moveHandleTo as K, nearestSegmentT as L, openSubpathAt as M, pathToAnchors as N, placeEulerSegment as O, type PenAnchor as P, pxExtent as Q, scaleDelta as R, type SpiroKind as S, screenAngleOf as T, segmentAt as U, segmentEnds as V, solveSpiro as W, standoff as X, translateAnchorBy as Y, withinPxBox as Z, withinPxRadius as _, type SpiroPoint as a, type Scale2 as b, type AnchorRect as c, type CombTooth as d, type CurvatureCombOptions as e, type EulerSegment as f, SPIRO_KINDS as g, type SegmentComb as h, type SegmentHit as i, type SpiroSegment as j, anchorAt as k, anchorCount as l, anchorsInRect as m, anchorsToPath as n, combTeeth as o, countPathAnchors as p, cubicCurvatureAt as q, cubicCurvatureSource as r, cubicDerivativeAt as s, curvatureComb as t, deleteAnchorsAt as u, editAnchorSet as v, eulerAngleAt as w, eulerCurvatureAt as x, eulerCurvatureDerivativesAt as y, eulerPointAt as z };
@@ -1,4 +1,5 @@
1
- import { a as PolygonPath } from '../path-ljHxobyu.js';
1
+ import { P as PolygonPath } from '../path-BW8d_2RY.js';
2
+ import { S as SpiroKind, C as CurvatureSource } from '../curvature-PkoLduGc.js';
2
3
 
3
4
  /** A point in the shared anchor set. Every representation reads only the
4
5
  * fields it cares about: cubic Bezier reads inHandle/outHandle; NURBS
@@ -20,8 +21,8 @@ interface SharedAnchor {
20
21
  /** NURBS rational weight. Default 1 (non-rational B-spline). Clamped
21
22
  * ≥ 1e-3 by the UI. */
22
23
  weight?: number;
23
- /** Spiro continuity class at this anchor. Default 'g2-smooth'. */
24
- spiroType?: 'corner' | 'g2-smooth' | 'g4-smooth';
24
+ /** What holds at this anchor read as a spiro point. Default `'smooth'`. */
25
+ spiroType?: SpiroKind;
25
26
  }
26
27
  /** Which curve representation an anchor set is interpreted through. */
27
28
  type CurveRepKind = 'bezierCubic' | 'bezierQuadratic' | 'nurbs' | 'spiro';
@@ -75,10 +76,18 @@ declare const bezierQuadratic: CurveRepresentation;
75
76
  /** NURBS: anchors act as weighted control points the curve is pulled toward rather than passing through. Flattened to line segments when converted to a path. */
76
77
  declare const nurbs: CurveRepresentation;
77
78
 
78
- /** Spiro (κ-curves): curvature-continuous through each anchor, so joins stay visually smooth without hand-tuned handles. Approximated as cubics when converted to a path. */
79
+ /** Spiro (κ-curves): curvature-continuous through each smooth anchor, so joins stay visually smooth without hand-tuned handles. Solved with `solveSpiro`, and written as cubics by `spiroToPath`. */
79
80
  declare const spiro: CurveRepresentation;
80
81
 
82
+ /**
83
+ * `anchors` read through `rep`, as a {@link CurvatureSource} over the whole
84
+ * curve, so any representation can stand a curvature comb with `combTeeth`.
85
+ * Representations carry no derivative, so the tangent is a central difference
86
+ * of `evaluate`, one-sided at the ends.
87
+ */
88
+ declare function curvatureSourceOf(rep: CurveRepresentation, anchors: SharedAnchor[]): CurvatureSource;
89
+
81
90
  /** Every curve representation the kit ships, keyed by kind. */
82
91
  declare const CURVE_REPS: Readonly<Record<CurveRepKind, CurveRepresentation>>;
83
92
 
84
- export { CURVE_REPS, type CurveRepKind, type CurveRepresentation, type Discriminator, type SharedAnchor, bezierCubic, bezierQuadratic, nurbs, spiro };
93
+ export { CURVE_REPS, type CurveRepKind, type CurveRepresentation, type Discriminator, type SharedAnchor, bezierCubic, bezierQuadratic, curvatureSourceOf, nurbs, spiro };