curvy 2.0.0-alpha.0 → 2.0.0-alpha.2

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 (51) hide show
  1. package/dist/characteristic/index.d.mts +3 -3
  2. package/dist/characteristic/index.mjs +1 -1
  3. package/dist/curve/index.d.mts +1 -1
  4. package/dist/curve/index.mjs +1 -1
  5. package/dist/interval/index.d.mts +3 -2
  6. package/dist/interval/index.mjs +3 -2
  7. package/dist/matrix/index.d.mts +1 -1
  8. package/dist/number.mjs.map +1 -1
  9. package/dist/path/index.d.mts +26 -6
  10. package/dist/path/index.mjs +36 -3
  11. package/dist/path/index.mjs.map +1 -1
  12. package/dist/polynomial/index.d.mts +1 -1
  13. package/dist/polynomial/index.mjs +2 -2
  14. package/dist/shared/{characteristic-BGRxcxUH.mjs → characteristic-B9nCh_cx.mjs} +2 -2
  15. package/dist/shared/{characteristic-BGRxcxUH.mjs.map → characteristic-B9nCh_cx.mjs.map} +1 -1
  16. package/dist/shared/{cubic-Dfn6DB02.d.mts → cubic-BajUY0JT.d.mts} +12 -11
  17. package/dist/shared/{cubic-CYYEUHNm.mjs → cubic-CpHAx8cC.mjs} +5 -5
  18. package/dist/shared/cubic-CpHAx8cC.mjs.map +1 -0
  19. package/dist/shared/{interval-CCEqzPgA.mjs → interval-05CR6eBf.mjs} +47 -2
  20. package/dist/shared/interval-05CR6eBf.mjs.map +1 -0
  21. package/dist/shared/{interval-hQDiKqj0.d.mts → interval-Dy-RMEE3.d.mts} +43 -4
  22. package/dist/shared/interval2d-8IBZnUOq.mjs +108 -0
  23. package/dist/shared/interval2d-8IBZnUOq.mjs.map +1 -0
  24. package/dist/shared/interval2d-C2id9u31.d.mts +172 -0
  25. package/dist/shared/{matrix4x4-Bt_DBlP0.d.mts → matrix4x4-Dm_tSiH1.d.mts} +4 -3
  26. package/dist/shared/{quadratic-DEhuAKuE.mjs → quadratic-CamozcFc.mjs} +3 -3
  27. package/dist/shared/quadratic-CamozcFc.mjs.map +1 -0
  28. package/dist/shared/{rationalCubic2d-D_-XWxcm.d.mts → rationalCubic2d-B6g97ryJ.d.mts} +16 -5
  29. package/dist/shared/{rationalCubic2d-CXa7Yren.mjs → rationalCubic2d-BEgUGSFf.mjs} +20 -3
  30. package/dist/shared/rationalCubic2d-BEgUGSFf.mjs.map +1 -0
  31. package/dist/shared/{rationalCubic2d-CP4oGpnk.mjs → rationalCubic2d-Bys2Uory.mjs} +44 -7
  32. package/dist/shared/rationalCubic2d-Bys2Uory.mjs.map +1 -0
  33. package/dist/shared/{rationalCubic2d-BPLohNuI.d.mts → rationalCubic2d-DlQfBURs.d.mts} +40 -9
  34. package/dist/shared/{solution-CbSWzXCn.mjs → solution-CrtLfqEq.mjs} +2 -2
  35. package/dist/shared/{solution-CbSWzXCn.mjs.map → solution-CrtLfqEq.mjs.map} +1 -1
  36. package/dist/shared/{solution-BjoW7ov4.d.mts → solution-sNQ-ZVhN.d.mts} +3 -3
  37. package/dist/shared/{utils-DqTGyXrP.d.mts → utils-MCckigYk.d.mts} +1 -1
  38. package/dist/shared/vector2-DPUY3_eA.d.mts +470 -0
  39. package/dist/shared/{vector2-TV0UnlxY.d.mts → vector3-DqeOZtOB.d.mts} +43 -508
  40. package/dist/solution/index.d.mts +1 -1
  41. package/dist/solution/index.mjs +1 -1
  42. package/dist/splines/index.d.mts +4 -4
  43. package/dist/splines/index.mjs +4 -4
  44. package/dist/utils.d.mts +1 -1
  45. package/dist/vector/index.d.mts +2 -1
  46. package/package.json +1 -1
  47. package/dist/shared/cubic-CYYEUHNm.mjs.map +0 -1
  48. package/dist/shared/interval-CCEqzPgA.mjs.map +0 -1
  49. package/dist/shared/quadratic-DEhuAKuE.mjs.map +0 -1
  50. package/dist/shared/rationalCubic2d-CP4oGpnk.mjs.map +0 -1
  51. package/dist/shared/rationalCubic2d-CXa7Yren.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
- import { o as Vector4 } from "../shared/vector2-TV0UnlxY.mjs";
2
- import { t as Matrix4x4 } from "../shared/matrix4x4-Bt_DBlP0.mjs";
3
- import { t as CubicPolynomial } from "../shared/cubic-Dfn6DB02.mjs";
1
+ import { r as Vector4 } from "../shared/vector3-DqeOZtOB.mjs";
2
+ import { t as Matrix4x4 } from "../shared/matrix4x4-Dm_tSiH1.mjs";
3
+ import { t as CubicPolynomial } from "../shared/cubic-BajUY0JT.mjs";
4
4
 
5
5
  //#region src/characteristic/characteristic.d.ts
6
6
  declare namespace characteristic_d_exports {
@@ -1,2 +1,2 @@
1
- import { n as characteristic_exports } from "../shared/characteristic-BGRxcxUH.mjs";
1
+ import { n as characteristic_exports } from "../shared/characteristic-B9nCh_cx.mjs";
2
2
  export { characteristic_exports as Characteristic };
@@ -1,2 +1,2 @@
1
- import { c as linear2d_d_exports, i as cubic2d_d_exports, n as rationalCubic2d_d_exports, o as quadratic2d_d_exports } from "../shared/rationalCubic2d-BPLohNuI.mjs";
1
+ import { c as linear2d_d_exports, i as cubic2d_d_exports, n as rationalCubic2d_d_exports, o as quadratic2d_d_exports } from "../shared/rationalCubic2d-DlQfBURs.mjs";
2
2
  export { cubic2d_d_exports as CubicCurve2d, linear2d_d_exports as LinearCurve2d, quadratic2d_d_exports as QuadraticCurve2d, rationalCubic2d_d_exports as RationalCubicCurve2d };
@@ -1,2 +1,2 @@
1
- import { a as cubic2d_exports, d as quadratic2d_exports, m as linear2d_exports, r as rationalCubic2d_exports } from "../shared/rationalCubic2d-CP4oGpnk.mjs";
1
+ import { _ as linear2d_exports, o as cubic2d_exports, p as quadratic2d_exports, r as rationalCubic2d_exports } from "../shared/rationalCubic2d-Bys2Uory.mjs";
2
2
  export { cubic2d_exports as CubicCurve2d, linear2d_exports as LinearCurve2d, quadratic2d_exports as QuadraticCurve2d, rationalCubic2d_exports as RationalCubicCurve2d };
@@ -1,2 +1,3 @@
1
- import { n as interval_d_exports } from "../shared/interval-hQDiKqj0.mjs";
2
- export { interval_d_exports as Interval };
1
+ import { i as interval_d_exports } from "../shared/interval-Dy-RMEE3.mjs";
2
+ import { n as interval2d_d_exports } from "../shared/interval2d-C2id9u31.mjs";
3
+ export { interval_d_exports as Interval, interval2d_d_exports as Interval2d };
@@ -1,2 +1,3 @@
1
- import { a as interval_exports } from "../shared/interval-CCEqzPgA.mjs";
2
- export { interval_exports as Interval };
1
+ import { s as interval_exports } from "../shared/interval-05CR6eBf.mjs";
2
+ import { t as interval2d_exports } from "../shared/interval2d-8IBZnUOq.mjs";
3
+ export { interval_exports as Interval, interval2d_exports as Interval2d };
@@ -1,2 +1,2 @@
1
- import { i as matrix2x2_d_exports, n as matrix4x4_d_exports, r as matrix3x3_d_exports } from "../shared/matrix4x4-Bt_DBlP0.mjs";
1
+ import { i as matrix2x2_d_exports, n as matrix4x4_d_exports, r as matrix3x3_d_exports } from "../shared/matrix4x4-Dm_tSiH1.mjs";
2
2
  export { matrix2x2_d_exports as Matrix2x2, matrix3x3_d_exports as Matrix3x3, matrix4x4_d_exports as Matrix4x4 };
@@ -1 +1 @@
1
- {"version":3,"file":"number.mjs","names":[],"sources":["../src/number.ts"],"sourcesContent":["import { dual } from './utils'\n\nconst PRECISION = 8\n\n/**\n * Default tolerance for approximate equality between floating-point numbers.\n *\n * @since 1.1.0\n */\nexport const EPSILON = 1e-10\n\n/**\n * Approximate equality between two numbers, within an absolute tolerance.\n *\n * @param a - The first value.\n * @param b - The second value.\n * @param eps - The maximum allowed absolute difference. Defaults to {@link EPSILON}.\n * @returns `true` when `|a - b| <= eps`.\n * @since 1.1.0\n */\nexport function epsEquals(a: number, b: number, eps: number = EPSILON): boolean {\n return Math.abs(a - b) <= eps\n}\n\n/**\n * Snaps near-zero values to exactly zero for stable sign tests.\n *\n * @param value - The value to test.\n * @param eps - The threshold below which `value` is considered zero.\n * @returns `0` when `|value| < eps`, otherwise `value` unchanged.\n * @since 1.1.0\n */\nexport function clampToZero(value: number, eps: number): number {\n return Math.abs(value) < eps ? 0 : value\n}\n\n/**\n * Rounding function that rounds a number to a specified precision.\n *\n * @param value - The number to round.\n * @param precision - The number of decimal places to round to (default is 8).\n * @returns The rounded number.\n * @example\n * ```ts\n * import { round } from 'curvy/utils'\n *\n * const roundedValue = round(1.23456789, 4) // 1.2346\n * const roundedValue2 = round(1.23456789) // 1.23456789\n * ```\n * @since 1.0.0\n */\nexport function round(value: number, precision = PRECISION): number {\n const scale = 10 ** precision\n const result = Math.round(value * scale) / scale\n if (result === 0) {\n return 0\n }\n return result\n}\n\n/**\n * Rounding function that rounds a number down to a specified precision.\n *\n * @param value - The number to round down.\n * @param precision - The number of decimal places to round down to (default is 8).\n * @returns The rounded down number.\n * @example\n * ```ts\n * import { roundDown } from 'curvy/utils'\n *\n * const roundedDownValue = roundDown(1.23456789, 4) // 1.2345\n * const roundedDownValue2 = roundDown(1.23456789) // 1.23456789\n * ```\n * @since 1.0.0\n */\nexport function roundDown(value: number, precision = PRECISION): number {\n const scale = 10 ** precision\n const result = Math.floor(value * scale) / scale\n if (result === 0) {\n return 0\n }\n return result\n}\n\n/**\n * Rounding function that rounds a number up to a specified precision.\n *\n * @param value - The number to round up.\n * @param precision - The number of decimal places to round up to (default is 8).\n * @returns The rounded up number.\n * @example\n * ```ts\n * import { roundUp } from 'curvy/utils'\n *\n * const roundedUpValue = roundUp(1.23456789, 4) // 1.2346\n * const roundedUpValue2 = roundUp(1.23456789) // 1.23456789\n * ```\n * @since 1.0.0\n */\nexport function roundUp(value: number, precision = PRECISION): number {\n const scale = 10 ** precision\n const result = Math.ceil(value * scale) / scale\n if (result === 0) {\n return 0\n }\n return result\n}\n\nexport const lerp: {\n /**\n * Linearly interpolates between two values.\n *\n * @param t - The interpolation factor (between 0 and 1).\n * @param a - The start value.\n * @param b - The end value.\n * @returns The interpolated value.\n * @example\n * ```ts\n * import { lerp } from 'curvy/utils'\n *\n * lerp(0.5, 10, 20) // 15\n * ```\n * @since 1.0.0\n */\n (t: number, a: number, b: number): number\n /**\n * Linearly interpolates between two values.\n *\n * @param a - The start value.\n * @param b - The end value.\n * @returns A function that takes the interpolation factor and returns the interpolated value.\n * @example\n * ```ts\n * import { lerp } from 'curvy/utils'\n *\n * lerp(10, 20)(0.5) // 15\n * ```\n * @since 1.0.0\n */\n (a: number, b: number): (t: number) => number\n} = dual(3, (t: number, a: number, b: number) => b * t + a * (1 - t))\n\nexport const normalize: {\n /**\n * Normalizes a value between two bounds to the unit interval.\n *\n * @param x - The value to normalize.\n * @param a - The lower bound.\n * @param b - The upper bound.\n * @returns The normalized value.\n * @example\n * ```ts\n * import { normalize } from 'curvy/utils'\n *\n * normalize(15, 10, 20) // 0.5\n * ```\n * @since 1.0.0\n */\n (x: number, a: number, b: number): number\n /**\n * Normalizes a value between two bounds to the unit interval.\n *\n * @param a - The lower bound.\n * @param b - The upper bound.\n * @returns A function that takes a value and returns the normalized value.\n * @example\n * ```ts\n * import { normalize } from 'curvy/utils'\n *\n * normalize(10, 20)(15) // 0.5\n * ```\n * @since 1.0.0\n */\n (a: number, b: number): (x: number) => number\n} = dual(3, (x: number, a: number, b: number) => (x - a) / (b - a))\n\nexport const remap: {\n /**\n * Remaps a value from one range to another.\n *\n * @param x - The value to remap.\n * @param x1 - The lower bound of the original range.\n * @param x2 - The upper bound of the original range.\n * @param y1 - The lower bound of the new range.\n * @param y2 - The upper bound of the new range.\n * @returns The remapped value.\n * @example\n * ```ts\n * import { remap } from 'curvy/utils'\n *\n * remap(15, 10, 20, 0, 100) // 50\n * ```\n * @since 1.0.0\n */\n (x: number, x1: number, x2: number, y1: number, y2: number): number\n /**\n * Remaps a value from one range to another.\n *\n * @param x1 - The lower bound of the original range.\n * @param x2 - The upper bound of the original range.\n * @param y1 - The lower bound of the new range.\n * @param y2 - The upper bound of the new range.\n * @returns A function that takes a value and returns the remapped value.\n * @example\n * ```ts\n * import { remap } from 'curvy/utils'\n *\n * remap(10, 20, 0, 100)(15) // 50\n * ```\n * @since 1.0.0\n */\n (x1: number, x2: number, y1: number, y2: number): (x: number) => number\n} = dual(\n 5,\n (x: number, x1: number, x2: number, y1: number, y2: number) =>\n y1 + ((x - x1) / (x2 - x1)) * (y2 - y1),\n)\n\nexport const clamp: {\n /**\n * Clamps a value between two bounds.\n *\n * @param value - The value to clamp.\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @returns The clamped value.\n * @example\n * ```ts\n * import { clamp } from 'curvy/utils'\n *\n * clamp(25, 10, 20) // 20\n * ```\n * @since 1.0.0\n */\n (value: number, min: number, max: number): number\n /**\n * Clamps a value between two bounds.\n *\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @returns A function that takes a value and returns the clamped value.\n * @example\n * ```ts\n * import { clamp } from 'curvy/utils'\n *\n * clamp(10, 20)(25) // 20\n * ```\n * @since 1.0.0\n */\n (min: number, max: number): (value: number) => number\n} = dual(3, (value: number, min: number, max: number) =>\n value < min ? min : value > max ? max : value,\n)\n\nexport const clip: {\n /**\n * Clips a value to a specified range, returning a fallback value if the value is outside the range.\n *\n * @param value - The value to clip.\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @param onClip - The fallback value to return if the value is outside the range.\n * @returns The original value if within range, otherwise the fallback.\n * @example\n * ```ts\n * import { clip } from 'curvy/utils'\n *\n * clip(25, 10, 20, 15) // 15\n * ```\n * @since 1.0.0\n */\n <T>(value: number, min: number, max: number, onClip: T): T | number\n /**\n * Clips a value to a specified range, returning a fallback value if the value is outside the range.\n *\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @param onClip - The fallback value to return if the value is outside the range.\n * @returns A function that takes a value and returns it if within range, otherwise the fallback.\n * @example\n * ```ts\n * import { clip } from 'curvy/utils'\n *\n * clip(10, 20, 15)(25) // 15\n * ```\n * @since 1.0.0\n */\n <T>(min: number, max: number, onClip: T): (value: number) => T | number\n} = dual(4, (value: number, min: number, max: number, onClip: unknown) =>\n value < min ? onClip : value > max ? onClip : value,\n)\n\n/**\n * Returns the minimum and maximum of two numbers.\n *\n * @param a - The first number.\n * @param b - The second number.\n * @returns A tuple containing the minimum and maximum values.\n * @example\n * ```ts\n * import { minMax } from 'curvy/utils'\n *\n * const [minValue, maxValue] = minMax(10, 20) // [10, 20]\n * const [minValue2, maxValue2] = minMax(20, 10) // [10, 20]\n * ```\n * @since 1.0.0\n */\nexport function minMax(a: number, b: number): [number, number] {\n return a < b ? [a, b] : [b, a]\n}\n\n/**\n * Calculates the modulus of a number.\n *\n * @param n - The number to calculate the modulus of.\n * @param m - The modulus.\n * @returns The modulus of the number.\n * @example\n * ```ts\n * import { mod } from 'curvy/utils'\n *\n * const modulus = mod(10, 3) // 1\n * const modulus2 = mod(-10, 3) // 2\n * ```\n * @since 1.0.0\n */\nexport function mod(n: number, m: number): number {\n return ((n % m) + m) % m\n}\n\n"],"mappings":";;AAEA,MAAM,YAAY;;;;;;AAOlB,MAAa,UAAU;;;;;;;;;;AAWvB,SAAgB,UAAU,GAAW,GAAW,MAAc,SAAkB;CAC9E,OAAO,KAAK,IAAI,IAAI,EAAE,IAAI;;;;;;;;;;AAW5B,SAAgB,YAAY,OAAe,KAAqB;CAC9D,OAAO,KAAK,IAAI,MAAM,GAAG,MAAM,IAAI;;;;;;;;;;;;;;;;;AAkBrC,SAAgB,MAAM,OAAe,YAAY,WAAmB;CAClE,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,KAAK,MAAM,QAAQ,MAAM,GAAG;CAC3C,IAAI,WAAW,GACb,OAAO;CAET,OAAO;;;;;;;;;;;;;;;;;AAkBT,SAAgB,UAAU,OAAe,YAAY,WAAmB;CACtE,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,KAAK,MAAM,QAAQ,MAAM,GAAG;CAC3C,IAAI,WAAW,GACb,OAAO;CAET,OAAO;;;;;;;;;;;;;;;;;AAkBT,SAAgB,QAAQ,OAAe,YAAY,WAAmB;CACpE,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,KAAK,KAAK,QAAQ,MAAM,GAAG;CAC1C,IAAI,WAAW,GACb,OAAO;CAET,OAAO;;AAGT,MAAa,OAgCT,KAAK,IAAI,GAAW,GAAW,MAAc,IAAI,IAAI,KAAK,IAAI,GAAG;AAErE,MAAa,YAgCT,KAAK,IAAI,GAAW,GAAW,OAAe,IAAI,MAAM,IAAI,GAAG;AAEnE,MAAa,QAoCT,KACF,IACC,GAAW,IAAY,IAAY,IAAY,OAC9C,MAAO,IAAI,OAAO,KAAK,OAAQ,KAAK,IACvC;AAED,MAAa,QAgCT,KAAK,IAAI,OAAe,KAAa,QACvC,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,MACzC;AAED,MAAa,OAkCT,KAAK,IAAI,OAAe,KAAa,KAAa,WACpD,QAAQ,MAAM,SAAS,QAAQ,MAAM,SAAS,MAC/C;;;;;;;;;;;;;;;;AAiBD,SAAgB,OAAO,GAAW,GAA6B;CAC7D,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE;;;;;;;;;;;;;;;;;AAkBhC,SAAgB,IAAI,GAAW,GAAmB;CAChD,QAAS,IAAI,IAAK,KAAK"}
1
+ {"version":3,"file":"number.mjs","names":[],"sources":["../src/number.ts"],"sourcesContent":["import { dual } from './utils'\n\nconst PRECISION = 8\n\n/**\n * Default tolerance for approximate equality between floating-point numbers.\n *\n * @since 1.1.0\n */\nexport const EPSILON = 1e-10\n\n/**\n * Approximate equality between two numbers, within an absolute tolerance.\n *\n * @param a - The first value.\n * @param b - The second value.\n * @param eps - The maximum allowed absolute difference. Defaults to {@link EPSILON}.\n * @returns `true` when `|a - b| <= eps`.\n * @since 1.1.0\n */\nexport function epsEquals(a: number, b: number, eps: number = EPSILON): boolean {\n return Math.abs(a - b) <= eps\n}\n\n/**\n * Snaps near-zero values to exactly zero for stable sign tests.\n *\n * @param value - The value to test.\n * @param eps - The threshold below which `value` is considered zero.\n * @returns `0` when `|value| < eps`, otherwise `value` unchanged.\n * @since 1.1.0\n */\nexport function clampToZero(value: number, eps: number): number {\n return Math.abs(value) < eps ? 0 : value\n}\n\n/**\n * Rounding function that rounds a number to a specified precision.\n *\n * @param value - The number to round.\n * @param precision - The number of decimal places to round to (default is 8).\n * @returns The rounded number.\n * @example\n * ```ts\n * import { round } from 'curvy/utils'\n *\n * const roundedValue = round(1.23456789, 4) // 1.2346\n * const roundedValue2 = round(1.23456789) // 1.23456789\n * ```\n * @since 1.0.0\n */\nexport function round(value: number, precision = PRECISION): number {\n const scale = 10 ** precision\n const result = Math.round(value * scale) / scale\n if (result === 0) {\n return 0\n }\n return result\n}\n\n/**\n * Rounding function that rounds a number down to a specified precision.\n *\n * @param value - The number to round down.\n * @param precision - The number of decimal places to round down to (default is 8).\n * @returns The rounded down number.\n * @example\n * ```ts\n * import { roundDown } from 'curvy/utils'\n *\n * const roundedDownValue = roundDown(1.23456789, 4) // 1.2345\n * const roundedDownValue2 = roundDown(1.23456789) // 1.23456789\n * ```\n * @since 1.0.0\n */\nexport function roundDown(value: number, precision = PRECISION): number {\n const scale = 10 ** precision\n const result = Math.floor(value * scale) / scale\n if (result === 0) {\n return 0\n }\n return result\n}\n\n/**\n * Rounding function that rounds a number up to a specified precision.\n *\n * @param value - The number to round up.\n * @param precision - The number of decimal places to round up to (default is 8).\n * @returns The rounded up number.\n * @example\n * ```ts\n * import { roundUp } from 'curvy/utils'\n *\n * const roundedUpValue = roundUp(1.23456789, 4) // 1.2346\n * const roundedUpValue2 = roundUp(1.23456789) // 1.23456789\n * ```\n * @since 1.0.0\n */\nexport function roundUp(value: number, precision = PRECISION): number {\n const scale = 10 ** precision\n const result = Math.ceil(value * scale) / scale\n if (result === 0) {\n return 0\n }\n return result\n}\n\nexport const lerp: {\n /**\n * Linearly interpolates between two values.\n *\n * @param t - The interpolation factor (between 0 and 1).\n * @param a - The start value.\n * @param b - The end value.\n * @returns The interpolated value.\n * @example\n * ```ts\n * import { lerp } from 'curvy/utils'\n *\n * lerp(0.5, 10, 20) // 15\n * ```\n * @since 1.0.0\n */\n (t: number, a: number, b: number): number\n /**\n * Linearly interpolates between two values.\n *\n * @param a - The start value.\n * @param b - The end value.\n * @returns A function that takes the interpolation factor and returns the interpolated value.\n * @example\n * ```ts\n * import { lerp } from 'curvy/utils'\n *\n * lerp(10, 20)(0.5) // 15\n * ```\n * @since 1.0.0\n */\n (a: number, b: number): (t: number) => number\n} = dual(3, (t: number, a: number, b: number) => b * t + a * (1 - t))\n\nexport const normalize: {\n /**\n * Normalizes a value between two bounds to the unit interval.\n *\n * @param x - The value to normalize.\n * @param a - The lower bound.\n * @param b - The upper bound.\n * @returns The normalized value.\n * @example\n * ```ts\n * import { normalize } from 'curvy/utils'\n *\n * normalize(15, 10, 20) // 0.5\n * ```\n * @since 1.0.0\n */\n (x: number, a: number, b: number): number\n /**\n * Normalizes a value between two bounds to the unit interval.\n *\n * @param a - The lower bound.\n * @param b - The upper bound.\n * @returns A function that takes a value and returns the normalized value.\n * @example\n * ```ts\n * import { normalize } from 'curvy/utils'\n *\n * normalize(10, 20)(15) // 0.5\n * ```\n * @since 1.0.0\n */\n (a: number, b: number): (x: number) => number\n} = dual(3, (x: number, a: number, b: number) => (x - a) / (b - a))\n\nexport const remap: {\n /**\n * Remaps a value from one range to another.\n *\n * @param x - The value to remap.\n * @param x1 - The lower bound of the original range.\n * @param x2 - The upper bound of the original range.\n * @param y1 - The lower bound of the new range.\n * @param y2 - The upper bound of the new range.\n * @returns The remapped value.\n * @example\n * ```ts\n * import { remap } from 'curvy/utils'\n *\n * remap(15, 10, 20, 0, 100) // 50\n * ```\n * @since 1.0.0\n */\n (x: number, x1: number, x2: number, y1: number, y2: number): number\n /**\n * Remaps a value from one range to another.\n *\n * @param x1 - The lower bound of the original range.\n * @param x2 - The upper bound of the original range.\n * @param y1 - The lower bound of the new range.\n * @param y2 - The upper bound of the new range.\n * @returns A function that takes a value and returns the remapped value.\n * @example\n * ```ts\n * import { remap } from 'curvy/utils'\n *\n * remap(10, 20, 0, 100)(15) // 50\n * ```\n * @since 1.0.0\n */\n (x1: number, x2: number, y1: number, y2: number): (x: number) => number\n} = dual(\n 5,\n (x: number, x1: number, x2: number, y1: number, y2: number) =>\n y1 + ((x - x1) / (x2 - x1)) * (y2 - y1),\n)\n\nexport const clamp: {\n /**\n * Clamps a value between two bounds.\n *\n * @param value - The value to clamp.\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @returns The clamped value.\n * @example\n * ```ts\n * import { clamp } from 'curvy/utils'\n *\n * clamp(25, 10, 20) // 20\n * ```\n * @since 1.0.0\n */\n (value: number, min: number, max: number): number\n /**\n * Clamps a value between two bounds.\n *\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @returns A function that takes a value and returns the clamped value.\n * @example\n * ```ts\n * import { clamp } from 'curvy/utils'\n *\n * clamp(10, 20)(25) // 20\n * ```\n * @since 1.0.0\n */\n (min: number, max: number): (value: number) => number\n} = dual(3, (value: number, min: number, max: number) =>\n value < min ? min : value > max ? max : value,\n)\n\nexport const clip: {\n /**\n * Clips a value to a specified range, returning a fallback value if the value is outside the range.\n *\n * @param value - The value to clip.\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @param onClip - The fallback value to return if the value is outside the range.\n * @returns The original value if within range, otherwise the fallback.\n * @example\n * ```ts\n * import { clip } from 'curvy/utils'\n *\n * clip(25, 10, 20, 15) // 15\n * ```\n * @since 1.0.0\n */\n <T>(value: number, min: number, max: number, onClip: T): T | number\n /**\n * Clips a value to a specified range, returning a fallback value if the value is outside the range.\n *\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @param onClip - The fallback value to return if the value is outside the range.\n * @returns A function that takes a value and returns it if within range, otherwise the fallback.\n * @example\n * ```ts\n * import { clip } from 'curvy/utils'\n *\n * clip(10, 20, 15)(25) // 15\n * ```\n * @since 1.0.0\n */\n <T>(min: number, max: number, onClip: T): (value: number) => T | number\n} = dual(4, (value: number, min: number, max: number, onClip: unknown) =>\n value < min ? onClip : value > max ? onClip : value,\n)\n\n/**\n * Returns the minimum and maximum of two numbers.\n *\n * @param a - The first number.\n * @param b - The second number.\n * @returns A tuple containing the minimum and maximum values.\n * @example\n * ```ts\n * import { minMax } from 'curvy/utils'\n *\n * const [minValue, maxValue] = minMax(10, 20) // [10, 20]\n * const [minValue2, maxValue2] = minMax(20, 10) // [10, 20]\n * ```\n * @since 1.0.0\n */\nexport function minMax(a: number, b: number): [number, number] {\n return a < b ? [a, b] : [b, a]\n}\n\n/**\n * Calculates the modulus of a number.\n *\n * @param n - The number to calculate the modulus of.\n * @param m - The modulus.\n * @returns The modulus of the number.\n * @example\n * ```ts\n * import { mod } from 'curvy/utils'\n *\n * const modulus = mod(10, 3) // 1\n * const modulus2 = mod(-10, 3) // 2\n * ```\n * @since 1.0.0\n */\nexport function mod(n: number, m: number): number {\n return ((n % m) + m) % m\n}\n"],"mappings":";;AAEA,MAAM,YAAY;;;;;;AAOlB,MAAa,UAAU;;;;;;;;;;AAWvB,SAAgB,UAAU,GAAW,GAAW,MAAc,SAAkB;CAC9E,OAAO,KAAK,IAAI,IAAI,EAAE,IAAI;;;;;;;;;;AAW5B,SAAgB,YAAY,OAAe,KAAqB;CAC9D,OAAO,KAAK,IAAI,MAAM,GAAG,MAAM,IAAI;;;;;;;;;;;;;;;;;AAkBrC,SAAgB,MAAM,OAAe,YAAY,WAAmB;CAClE,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,KAAK,MAAM,QAAQ,MAAM,GAAG;CAC3C,IAAI,WAAW,GACb,OAAO;CAET,OAAO;;;;;;;;;;;;;;;;;AAkBT,SAAgB,UAAU,OAAe,YAAY,WAAmB;CACtE,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,KAAK,MAAM,QAAQ,MAAM,GAAG;CAC3C,IAAI,WAAW,GACb,OAAO;CAET,OAAO;;;;;;;;;;;;;;;;;AAkBT,SAAgB,QAAQ,OAAe,YAAY,WAAmB;CACpE,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,KAAK,KAAK,QAAQ,MAAM,GAAG;CAC1C,IAAI,WAAW,GACb,OAAO;CAET,OAAO;;AAGT,MAAa,OAgCT,KAAK,IAAI,GAAW,GAAW,MAAc,IAAI,IAAI,KAAK,IAAI,GAAG;AAErE,MAAa,YAgCT,KAAK,IAAI,GAAW,GAAW,OAAe,IAAI,MAAM,IAAI,GAAG;AAEnE,MAAa,QAoCT,KACF,IACC,GAAW,IAAY,IAAY,IAAY,OAC9C,MAAO,IAAI,OAAO,KAAK,OAAQ,KAAK,IACvC;AAED,MAAa,QAgCT,KAAK,IAAI,OAAe,KAAa,QACvC,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,MACzC;AAED,MAAa,OAkCT,KAAK,IAAI,OAAe,KAAa,KAAa,WACpD,QAAQ,MAAM,SAAS,QAAQ,MAAM,SAAS,MAC/C;;;;;;;;;;;;;;;;AAiBD,SAAgB,OAAO,GAAW,GAA6B;CAC7D,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE;;;;;;;;;;;;;;;;;AAkBhC,SAAgB,IAAI,GAAW,GAAmB;CAChD,QAAS,IAAI,IAAK,KAAK"}
@@ -1,13 +1,15 @@
1
- import { t as Vector2 } from "../shared/vector2-TV0UnlxY.mjs";
2
- import { t as Pipeable } from "../shared/utils-DqTGyXrP.mjs";
3
- import { a as QuadraticCurve2d, s as LinearCurve2d } from "../shared/rationalCubic2d-BPLohNuI.mjs";
4
- import { a as Continuous, i as cubic2d_d_exports, n as rationalCubic2d_d_exports, o as PathTraits } from "../shared/rationalCubic2d-D_-XWxcm.mjs";
1
+ import { t as Vector2 } from "../shared/vector2-DPUY3_eA.mjs";
2
+ import { t as Pipeable } from "../shared/utils-MCckigYk.mjs";
3
+ import { n as Closed } from "../shared/interval-Dy-RMEE3.mjs";
4
+ import { t as Interval2d } from "../shared/interval2d-C2id9u31.mjs";
5
+ import { a as QuadraticCurve2d, s as LinearCurve2d } from "../shared/rationalCubic2d-DlQfBURs.mjs";
6
+ import { a as Continuous, i as cubic2d_d_exports, n as rationalCubic2d_d_exports, o as PathTraits } from "../shared/rationalCubic2d-B6g97ryJ.mjs";
5
7
 
6
8
  //#region src/path/linear2d.internal.d.ts
7
9
  declare const LinearPath2dTypeId: unique symbol;
8
10
  type LinearPath2dTypeId = typeof LinearPath2dTypeId;
9
11
  declare namespace linear2d_d_exports {
10
- export { Continuous, LinearPath2d, append$1 as append, asContinuous$1 as asContinuous, fromArray$1 as fromArray, isContinuous$1 as isContinuous, isLinearPath2d, length$1 as length, make$1 as make, solve$1 as solve, toPathData$1 as toPathData };
12
+ export { Continuous, LinearPath2d, append$1 as append, asContinuous$1 as asContinuous, boundingBox$1 as boundingBox, fromArray$1 as fromArray, isContinuous$1 as isContinuous, isLinearPath2d, length$1 as length, make$1 as make, solve$1 as solve, toPathData$1 as toPathData };
11
13
  }
12
14
  /**
13
15
  * A linear path in 2D space.
@@ -123,12 +125,21 @@ declare const isContinuous$1: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & C
123
125
  * @since 2.0.0
124
126
  */
125
127
  declare const asContinuous$1: <T>(p: LinearPath2d<T>) => LinearPath2d<T & Continuous>;
128
+ /**
129
+ * Computes the axis-aligned bounding box of the path — the smallest closed
130
+ * `Box2d` enclosing every segment.
131
+ *
132
+ * @param p - The linear path.
133
+ * @returns A closed `Box2d` enclosing the path.
134
+ * @since 2.1.0
135
+ */
136
+ declare const boundingBox$1: (p: LinearPath2d) => Interval2d<Closed, Closed>;
126
137
  //#endregion
127
138
  //#region src/path/quadratic2d.internal.d.ts
128
139
  declare const QuadraticPath2dTypeId: unique symbol;
129
140
  type QuadraticPath2dTypeId = typeof QuadraticPath2dTypeId;
130
141
  declare namespace quadratic2d_d_exports {
131
- export { Continuous, QuadraticPath2d, append, asContinuous, fromArray, isContinuous, isQuadraticPath2d, length, make, solve, toPathData };
142
+ export { Continuous, QuadraticPath2d, append, asContinuous, boundingBox, fromArray, isContinuous, isQuadraticPath2d, length, make, solve, toPathData };
132
143
  }
133
144
  /**
134
145
  * A quadratic path in 2D space.
@@ -236,6 +247,15 @@ declare const isContinuous: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T
236
247
  * @since 2.0.0
237
248
  */
238
249
  declare const asContinuous: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & Continuous>;
250
+ /**
251
+ * Computes the axis-aligned bounding box of the path — the smallest closed
252
+ * `Box2d` enclosing every segment.
253
+ *
254
+ * @param p - The quadratic path.
255
+ * @returns A closed `Box2d` enclosing the path.
256
+ * @since 2.1.0
257
+ */
258
+ declare const boundingBox: (p: QuadraticPath2d) => Interval2d<Closed, Closed>;
239
259
  //#endregion
240
260
  export { cubic2d_d_exports as CubicPath2d, linear2d_d_exports as LinearPath2d, quadratic2d_d_exports as QuadraticPath2d, rationalCubic2d_d_exports as RationalCubicPath2d };
241
261
  //# sourceMappingURL=index.d.mts.map
@@ -1,9 +1,10 @@
1
1
  import { t as __exportAll } from "../shared/chunk-25Hzd3z8.mjs";
2
2
  import { Pipeable, dual, invariant } from "../utils.mjs";
3
3
  import { epsEquals } from "../number.mjs";
4
- import { u as unit } from "../shared/interval-CCEqzPgA.mjs";
5
- import { f as solve$5, h as solve$4, p as length$4, u as length$5 } from "../shared/rationalCubic2d-CP4oGpnk.mjs";
6
- import { n as rationalCubic2d_exports, r as cubic2d_exports } from "../shared/rationalCubic2d-CXa7Yren.mjs";
4
+ import { p as unit } from "../shared/interval-05CR6eBf.mjs";
5
+ import { r as union } from "../shared/interval2d-8IBZnUOq.mjs";
6
+ import { d as boundingBox$5, f as length$5, g as length$4, h as boundingBox$4, m as solve$5, v as solve$4 } from "../shared/rationalCubic2d-Bys2Uory.mjs";
7
+ import { n as rationalCubic2d_exports, r as cubic2d_exports } from "../shared/rationalCubic2d-BEgUGSFf.mjs";
7
8
  //#region src/path/linear2d.internal.ts
8
9
  const LinearPath2dTypeId = Symbol("curvy/path/linear2d");
9
10
  var LinearPath2dImpl = class extends Pipeable {
@@ -68,11 +69,18 @@ const asContinuous$3 = (p) => {
68
69
  invariant(isContinuous$3(p), "linear path is not continuous");
69
70
  return p;
70
71
  };
72
+ const boundingBox$3 = (p) => {
73
+ const iter = p[Symbol.iterator]();
74
+ let acc = boundingBox$4(iter.next().value);
75
+ for (let next = iter.next(); !next.done; next = iter.next()) acc = union(acc, boundingBox$4(next.value));
76
+ return acc;
77
+ };
71
78
  //#endregion
72
79
  //#region src/path/linear2d.ts
73
80
  var linear2d_exports = /* @__PURE__ */ __exportAll({
74
81
  append: () => append$2,
75
82
  asContinuous: () => asContinuous$2,
83
+ boundingBox: () => boundingBox$2,
76
84
  fromArray: () => fromArray$2,
77
85
  isContinuous: () => isContinuous$2,
78
86
  isLinearPath2d: () => isLinearPath2d,
@@ -144,6 +152,15 @@ const isContinuous$2 = isContinuous$3;
144
152
  * @since 2.0.0
145
153
  */
146
154
  const asContinuous$2 = asContinuous$3;
155
+ /**
156
+ * Computes the axis-aligned bounding box of the path — the smallest closed
157
+ * `Box2d` enclosing every segment.
158
+ *
159
+ * @param p - The linear path.
160
+ * @returns A closed `Box2d` enclosing the path.
161
+ * @since 2.1.0
162
+ */
163
+ const boundingBox$2 = boundingBox$3;
147
164
  //#endregion
148
165
  //#region src/path/quadratic2d.internal.ts
149
166
  const QuadraticPath2dTypeId = Symbol("curvy/path/quadratic2d");
@@ -217,11 +234,18 @@ const asContinuous$1 = (p) => {
217
234
  invariant(isContinuous$1(p), "quadratic path is not continuous");
218
235
  return p;
219
236
  };
237
+ const boundingBox$1 = (p) => {
238
+ const iter = p[Symbol.iterator]();
239
+ let acc = boundingBox$5(iter.next().value);
240
+ for (let next = iter.next(); !next.done; next = iter.next()) acc = union(acc, boundingBox$5(next.value));
241
+ return acc;
242
+ };
220
243
  //#endregion
221
244
  //#region src/path/quadratic2d.ts
222
245
  var quadratic2d_exports = /* @__PURE__ */ __exportAll({
223
246
  append: () => append,
224
247
  asContinuous: () => asContinuous,
248
+ boundingBox: () => boundingBox,
225
249
  fromArray: () => fromArray,
226
250
  isContinuous: () => isContinuous,
227
251
  isQuadraticPath2d: () => isQuadraticPath2d,
@@ -286,6 +310,15 @@ const isContinuous = isContinuous$1;
286
310
  * @since 2.0.0
287
311
  */
288
312
  const asContinuous = asContinuous$1;
313
+ /**
314
+ * Computes the axis-aligned bounding box of the path — the smallest closed
315
+ * `Box2d` enclosing every segment.
316
+ *
317
+ * @param p - The quadratic path.
318
+ * @returns A closed `Box2d` enclosing the path.
319
+ * @since 2.1.0
320
+ */
321
+ const boundingBox = boundingBox$1;
289
322
  //#endregion
290
323
  export { cubic2d_exports as CubicPath2d, linear2d_exports as LinearPath2d, quadratic2d_exports as QuadraticPath2d, rationalCubic2d_exports as RationalCubicPath2d };
291
324
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["isLinearPath2d","make","fromArray","append","length","LinearCurve2d.length","Interval.unit","solve","LinearCurve2d.solve","toPathData","isContinuous","asContinuous","make","internal.make","fromArray","internal.fromArray","internal.isLinearPath2d","append","internal.append","length","internal.length","solve","internal.solve","toPathData","internal.toPathData","isContinuous","internal.isContinuous","asContinuous","internal.asContinuous","isQuadraticPath2d","make","fromArray","append","length","QuadraticCurve2d.length","Interval.unit","solve","QuadraticCurve2d.solve","toPathData","isContinuous","asContinuous","internal.make","internal.fromArray","internal.isQuadraticPath2d","internal.append","internal.length","internal.solve","internal.toPathData","internal.isContinuous","internal.asContinuous"],"sources":["../../src/path/linear2d.internal.ts","../../src/path/linear2d.ts","../../src/path/quadratic2d.internal.ts","../../src/path/quadratic2d.ts"],"sourcesContent":["import * as LinearCurve2d from '../curve/linear2d'\nimport * as Interval from '../interval/interval'\nimport { dual, Pipeable } from '../utils'\nimport { invariant } from '../utils'\nimport { epsEquals } from '../number'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPath2d } from './linear2d'\nimport { PathTraits, type Continuous } from './traits'\n\nexport const LinearPath2dTypeId: unique symbol = Symbol('curvy/path/linear2d')\nexport type LinearPath2dTypeId = typeof LinearPath2dTypeId\n\nexport class LinearPath2dImpl extends Pipeable implements LinearPath2d<unknown> {\n readonly [LinearPath2dTypeId]: LinearPath2dTypeId = LinearPath2dTypeId\n declare readonly [PathTraits]: unknown\n\n readonly curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>\n\n constructor(curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>) {\n super()\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<LinearCurve2d.LinearCurve2d> {\n return this.curves[Symbol.iterator]()\n }\n}\n\nexport const isLinearPath2d = (p: unknown): p is LinearPath2d =>\n typeof p === 'object' && p !== null && LinearPath2dTypeId in p\n\nexport const make = (...curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>): LinearPath2d =>\n new LinearPath2dImpl(curves)\n\nexport const fromArray = (curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>) =>\n new LinearPath2dImpl(curves)\n\nexport const append = dual<\n (c: LinearCurve2d.LinearCurve2d) => (p: LinearPath2d) => LinearPath2d,\n (p: LinearPath2d, c: LinearCurve2d.LinearCurve2d) => LinearPath2d\n>(2, (p: LinearPath2d, c: LinearCurve2d.LinearCurve2d) => fromArray([...p, c]))\n\nexport const length = (p: LinearPath2d) => {\n let total = 0\n for (const curve of p) {\n total += LinearCurve2d.length(curve, Interval.unit)\n }\n\n return total\n}\n\nexport const solve = dual<\n (u: number) => (p: LinearPath2d) => Vector2,\n (p: LinearPath2d, u: number) => Vector2\n>(2, (p: LinearPath2d, u: number) => {\n const curves = p instanceof LinearPath2dImpl ? p.curves : [...p]\n\n if (u === 1) {\n const last = curves.at(-1) as LinearCurve2d.LinearCurve2d\n return LinearCurve2d.solve(last, 1)\n }\n\n const t = u * curves.length\n const i = Math.floor(t)\n const curve = curves[i] as LinearCurve2d.LinearCurve2d\n return LinearCurve2d.solve(curve, t - i)\n})\n\nexport const toPathData = (p: LinearPath2d): string => {\n let result = ''\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n\n for (const curve of p) {\n const startX = curve.x.c0\n const startY = curve.y.c0\n const endX = curve.x.c0 + curve.x.c1\n const endY = curve.y.c0 + curve.y.c1\n\n if (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY)) {\n result += ` M ${startX},${startY}`\n }\n result += ` L ${endX},${endY}`\n\n prevEndX = endX\n prevEndY = endY\n }\n\n return result.slice(1)\n}\n\nexport const isContinuous = <T>(p: LinearPath2d<T>): p is LinearPath2d<T & Continuous> => {\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n let first = true\n\n for (const curve of p) {\n const startX = curve.x.c0\n const startY = curve.y.c0\n if (!first && (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY))) {\n return false\n }\n prevEndX = curve.x.c0 + curve.x.c1\n prevEndY = curve.y.c0 + curve.y.c1\n first = false\n }\n return true\n}\n\nexport const asContinuous = <T>(p: LinearPath2d<T>): LinearPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'linear path is not continuous')\n return p\n}\n","import type { LinearCurve2d } from '../curve/linear2d'\nimport type { Pipeable } from '../utils'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPath2dTypeId } from './linear2d.internal'\nimport * as internal from './linear2d.internal'\nimport type { Continuous, PathTraits } from './traits'\n\nexport type { Continuous } from './traits'\n\n/**\n * A linear path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`. A `Continuous` path's `toPathData`\n * skips the per-segment discontinuity check.\n *\n * @since 1.0.0\n */\nexport interface LinearPath2d<out Trait = unknown> extends Pipeable, Iterable<LinearCurve2d> {\n readonly [LinearPath2dTypeId]: LinearPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `LinearPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d = internal.make\n\n/**\n * Creates a new `LinearPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d = internal.fromArray\n\n/**\n * Checks if a value is a `LinearPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isLinearPath2d: (p: unknown) => p is LinearPath2d = internal.isLinearPath2d\n\nexport const append: {\n /**\n * Appends a linear curve to a linear path.\n *\n * @param c - The linear curve to append.\n * @returns A function that takes a linear path and returns a new linear path.\n * @since 1.0.0\n */\n (c: LinearCurve2d): (p: LinearPath2d) => LinearPath2d\n /**\n * Appends a linear curve to a linear path.\n *\n * @param p - The linear path to append to.\n * @param c - The linear curve to append.\n * @returns A new `LinearPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: LinearPath2d, c: LinearCurve2d): LinearPath2d\n} = internal.append\n\n/**\n * Calculates the length of a linear path.\n *\n * @param p - The linear path to calculate the length of.\n * @returns The length of the linear path.\n * @since 1.0.0\n */\nexport const length: (p: LinearPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a linear path for a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a linear path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: LinearPath2d) => Vector2\n /**\n * Solves a linear path for a given parameter.\n *\n * @param p - The linear path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point on the linear path.\n * @since 1.0.0\n */\n (p: LinearPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a linear path as an SVG path data string (the value of a `<path>`\n * element's `d` attribute), using `M` and `L` commands. Discontinuities between\n * curves emit a fresh `M` command.\n *\n * @param p - The linear path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: LinearPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & Continuous>` when adjacent curves connect at their join\n * points.\n *\n * @param p - The linear path to check.\n * @returns `true` when the path is continuous (G⁰).\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the linear path is continuous, throwing on failure.\n *\n * @param p - The linear path to assert against.\n * @returns The same path, typed with the `Continuous` brand.\n * @throws When the path has a discontinuity between adjacent curves.\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: LinearPath2d<T>) => LinearPath2d<T & Continuous> =\n internal.asContinuous\n","import * as QuadraticCurve2d from '../curve/quadratic2d'\nimport * as Interval from '../interval/interval'\nimport { dual, Pipeable } from '../utils'\nimport { invariant } from '../utils'\nimport { epsEquals } from '../number'\nimport type { Vector2 } from '../vector/vector2'\nimport type { QuadraticPath2d } from './quadratic2d'\nimport { PathTraits, type Continuous } from './traits'\n\nexport const QuadraticPath2dTypeId: unique symbol = Symbol('curvy/path/quadratic2d')\nexport type QuadraticPath2dTypeId = typeof QuadraticPath2dTypeId\n\nexport class QuadraticPath2dImpl extends Pipeable implements QuadraticPath2d<unknown> {\n readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId = QuadraticPath2dTypeId\n declare readonly [PathTraits]: unknown\n\n readonly curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>\n\n constructor(curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>) {\n super()\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<QuadraticCurve2d.QuadraticCurve2d> {\n return this.curves[Symbol.iterator]()\n }\n}\n\nexport const isQuadraticPath2d = (p: unknown): p is QuadraticPath2d =>\n typeof p === 'object' && p !== null && QuadraticPath2dTypeId in p\n\nexport const make = (\n ...curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>\n): QuadraticPath2d => new QuadraticPath2dImpl(curves)\n\nexport const fromArray = (\n curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>,\n): QuadraticPath2d => new QuadraticPath2dImpl(curves)\n\nexport const append = dual<\n (c: QuadraticCurve2d.QuadraticCurve2d) => (p: QuadraticPath2d) => QuadraticPath2d,\n (p: QuadraticPath2d, c: QuadraticCurve2d.QuadraticCurve2d) => QuadraticPath2d\n>(2, (p: QuadraticPath2d, c: QuadraticCurve2d.QuadraticCurve2d) => fromArray([...p, c]))\n\nexport const length = (p: QuadraticPath2d) => {\n let total = 0\n for (const curve of p) {\n total += QuadraticCurve2d.length(curve, Interval.unit)\n }\n\n return total\n}\n\nexport const solve = dual<\n (u: number) => (p: QuadraticPath2d) => Vector2,\n (p: QuadraticPath2d, u: number) => Vector2\n>(2, (p: QuadraticPath2d, u: number) => {\n const curves = p instanceof QuadraticPath2dImpl ? p.curves : [...p]\n\n if (u === 1) {\n const last = curves.at(-1) as QuadraticCurve2d.QuadraticCurve2d\n return QuadraticCurve2d.solve(last, 1)\n }\n\n const t = u * curves.length\n const i = Math.floor(t)\n const curve = curves[i] as QuadraticCurve2d.QuadraticCurve2d\n return QuadraticCurve2d.solve(curve, t - i)\n})\n\n// Quadratic Bernstein basis: P(t) = (1-t)²·p0 + 2(1-t)t·p1 + t²·p2\n// expanded gives c0 = p0, c1 = -2p0 + 2p1, c2 = p0 - 2p1 + p2, so:\n// p0 = c0, p1 = c0 + c1/2, p2 = c0 + c1 + c2.\nexport const toPathData = (p: QuadraticPath2d): string => {\n let result = ''\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n\n for (const curve of p) {\n const c0x = curve.x.c0\n const c0y = curve.y.c0\n const c1x = curve.x.c1\n const c1y = curve.y.c1\n const c2x = curve.x.c2\n const c2y = curve.y.c2\n\n const startX = c0x\n const startY = c0y\n const ctrlX = c0x + c1x / 2\n const ctrlY = c0y + c1y / 2\n const endX = c0x + c1x + c2x\n const endY = c0y + c1y + c2y\n\n if (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY)) {\n result += ` M ${startX},${startY}`\n }\n result += ` Q ${ctrlX},${ctrlY} ${endX},${endY}`\n\n prevEndX = endX\n prevEndY = endY\n }\n\n return result.slice(1)\n}\n\nexport const isContinuous = <T>(p: QuadraticPath2d<T>): p is QuadraticPath2d<T & Continuous> => {\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n let first = true\n\n for (const curve of p) {\n const startX = curve.x.c0\n const startY = curve.y.c0\n if (!first && (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY))) {\n return false\n }\n prevEndX = curve.x.c0 + curve.x.c1 + curve.x.c2\n prevEndY = curve.y.c0 + curve.y.c1 + curve.y.c2\n first = false\n }\n return true\n}\n\nexport const asContinuous = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'quadratic path is not continuous')\n return p\n}\n","import type { QuadraticCurve2d } from '../curve/quadratic2d'\nimport type { Pipeable } from '../utils'\nimport type { Vector2 } from '../vector/vector2'\nimport type { QuadraticPath2dTypeId } from './quadratic2d.internal'\nimport * as internal from './quadratic2d.internal'\nimport type { Continuous, PathTraits } from './traits'\n\nexport type { Continuous } from './traits'\n\n/**\n * A quadratic path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`.\n *\n * @since 1.0.0\n */\nexport interface QuadraticPath2d<out Trait = unknown> extends Pipeable, Iterable<QuadraticCurve2d> {\n readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `QuadraticPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d = internal.make\n\n/**\n * Creates a new `QuadraticPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d =\n internal.fromArray\n\n/**\n * Checks if a value is a `QuadraticPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `QuadraticPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isQuadraticPath2d: (p: unknown) => p is QuadraticPath2d = internal.isQuadraticPath2d\n\nexport const append: {\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param c - The quadratic curve to append.\n * @returns A function that takes a quadratic path and returns a new quadratic path.\n * @since 1.0.0\n */\n (c: QuadraticCurve2d): (p: QuadraticPath2d) => QuadraticPath2d\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param p - The quadratic path to append to.\n * @param c - The quadratic curve to append.\n * @returns A new `QuadraticPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, c: QuadraticCurve2d): QuadraticPath2d\n} = internal.append\n\n/**\n * Calculates the length of a quadratic path.\n *\n * @param p - The quadratic path to calculate the length of.\n * @returns The length of the path.\n */\nexport const length: (p: QuadraticPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a quadratic path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: QuadraticPath2d) => Vector2\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param p - The quadratic path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a quadratic path as an SVG path data string (the value of a\n * `<path>` element's `d` attribute), using `M` and `Q` commands. Discontinuities\n * between curves emit a fresh `M` command.\n *\n * @param p - The quadratic path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: QuadraticPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & Continuous>` when adjacent curves connect.\n *\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the quadratic path is continuous, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & Continuous> =\n internal.asContinuous\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.mjs","names":["isLinearPath2d","make","fromArray","append","length","LinearCurve2d.length","Interval.unit","solve","LinearCurve2d.solve","toPathData","isContinuous","asContinuous","boundingBox","LinearCurve2d.boundingBox","Interval2d.union","make","internal.make","fromArray","internal.fromArray","internal.isLinearPath2d","append","internal.append","length","internal.length","solve","internal.solve","toPathData","internal.toPathData","isContinuous","internal.isContinuous","asContinuous","internal.asContinuous","boundingBox","internal.boundingBox","isQuadraticPath2d","make","fromArray","append","length","QuadraticCurve2d.length","Interval.unit","solve","QuadraticCurve2d.solve","toPathData","isContinuous","asContinuous","boundingBox","QuadraticCurve2d.boundingBox","Interval2d.union","internal.make","internal.fromArray","internal.isQuadraticPath2d","internal.append","internal.length","internal.solve","internal.toPathData","internal.isContinuous","internal.asContinuous","internal.boundingBox"],"sources":["../../src/path/linear2d.internal.ts","../../src/path/linear2d.ts","../../src/path/quadratic2d.internal.ts","../../src/path/quadratic2d.ts"],"sourcesContent":["import * as Interval2d from '../interval/interval2d'\nimport * as LinearCurve2d from '../curve/linear2d'\nimport * as Interval from '../interval/interval'\nimport { dual, Pipeable } from '../utils'\nimport { invariant } from '../utils'\nimport { epsEquals } from '../number'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPath2d } from './linear2d'\nimport { PathTraits, type Continuous } from './traits'\n\nexport const LinearPath2dTypeId: unique symbol = Symbol('curvy/path/linear2d')\nexport type LinearPath2dTypeId = typeof LinearPath2dTypeId\n\nexport class LinearPath2dImpl extends Pipeable implements LinearPath2d<unknown> {\n readonly [LinearPath2dTypeId]: LinearPath2dTypeId = LinearPath2dTypeId\n declare readonly [PathTraits]: unknown\n\n readonly curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>\n\n constructor(curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>) {\n super()\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<LinearCurve2d.LinearCurve2d> {\n return this.curves[Symbol.iterator]()\n }\n}\n\nexport const isLinearPath2d = (p: unknown): p is LinearPath2d =>\n typeof p === 'object' && p !== null && LinearPath2dTypeId in p\n\nexport const make = (...curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>): LinearPath2d =>\n new LinearPath2dImpl(curves)\n\nexport const fromArray = (curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>) =>\n new LinearPath2dImpl(curves)\n\nexport const append = dual<\n (c: LinearCurve2d.LinearCurve2d) => (p: LinearPath2d) => LinearPath2d,\n (p: LinearPath2d, c: LinearCurve2d.LinearCurve2d) => LinearPath2d\n>(2, (p: LinearPath2d, c: LinearCurve2d.LinearCurve2d) => fromArray([...p, c]))\n\nexport const length = (p: LinearPath2d) => {\n let total = 0\n for (const curve of p) {\n total += LinearCurve2d.length(curve, Interval.unit)\n }\n\n return total\n}\n\nexport const solve = dual<\n (u: number) => (p: LinearPath2d) => Vector2,\n (p: LinearPath2d, u: number) => Vector2\n>(2, (p: LinearPath2d, u: number) => {\n const curves = p instanceof LinearPath2dImpl ? p.curves : [...p]\n\n if (u === 1) {\n const last = curves.at(-1) as LinearCurve2d.LinearCurve2d\n return LinearCurve2d.solve(last, 1)\n }\n\n const t = u * curves.length\n const i = Math.floor(t)\n const curve = curves[i] as LinearCurve2d.LinearCurve2d\n return LinearCurve2d.solve(curve, t - i)\n})\n\nexport const toPathData = (p: LinearPath2d): string => {\n let result = ''\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n\n for (const curve of p) {\n const startX = curve.x.c0\n const startY = curve.y.c0\n const endX = curve.x.c0 + curve.x.c1\n const endY = curve.y.c0 + curve.y.c1\n\n if (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY)) {\n result += ` M ${startX},${startY}`\n }\n result += ` L ${endX},${endY}`\n\n prevEndX = endX\n prevEndY = endY\n }\n\n return result.slice(1)\n}\n\nexport const isContinuous = <T>(p: LinearPath2d<T>): p is LinearPath2d<T & Continuous> => {\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n let first = true\n\n for (const curve of p) {\n const startX = curve.x.c0\n const startY = curve.y.c0\n if (!first && (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY))) {\n return false\n }\n prevEndX = curve.x.c0 + curve.x.c1\n prevEndY = curve.y.c0 + curve.y.c1\n first = false\n }\n return true\n}\n\nexport const asContinuous = <T>(p: LinearPath2d<T>): LinearPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'linear path is not continuous')\n return p\n}\n\nexport const boundingBox = (\n p: LinearPath2d,\n): Interval2d.Interval2d<Interval.Closed, Interval.Closed> => {\n const iter = p[Symbol.iterator]()\n const first = iter.next()\n // path invariant: at least one curve, so first.value is defined\n let acc = LinearCurve2d.boundingBox(first.value as LinearCurve2d.LinearCurve2d)\n for (let next = iter.next(); !next.done; next = iter.next()) {\n acc = Interval2d.union(acc, LinearCurve2d.boundingBox(next.value))\n }\n return acc\n}\n","import type { Interval2d } from '../interval/interval2d'\nimport type { LinearCurve2d } from '../curve/linear2d'\nimport type { Closed } from '../interval/interval'\nimport type { Pipeable } from '../utils'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPath2dTypeId } from './linear2d.internal'\nimport * as internal from './linear2d.internal'\nimport type { Continuous, PathTraits } from './traits'\n\nexport type { Continuous } from './traits'\n\n/**\n * A linear path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`. A `Continuous` path's `toPathData`\n * skips the per-segment discontinuity check.\n *\n * @since 1.0.0\n */\nexport interface LinearPath2d<out Trait = unknown> extends Pipeable, Iterable<LinearCurve2d> {\n readonly [LinearPath2dTypeId]: LinearPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `LinearPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d = internal.make\n\n/**\n * Creates a new `LinearPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d = internal.fromArray\n\n/**\n * Checks if a value is a `LinearPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isLinearPath2d: (p: unknown) => p is LinearPath2d = internal.isLinearPath2d\n\nexport const append: {\n /**\n * Appends a linear curve to a linear path.\n *\n * @param c - The linear curve to append.\n * @returns A function that takes a linear path and returns a new linear path.\n * @since 1.0.0\n */\n (c: LinearCurve2d): (p: LinearPath2d) => LinearPath2d\n /**\n * Appends a linear curve to a linear path.\n *\n * @param p - The linear path to append to.\n * @param c - The linear curve to append.\n * @returns A new `LinearPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: LinearPath2d, c: LinearCurve2d): LinearPath2d\n} = internal.append\n\n/**\n * Calculates the length of a linear path.\n *\n * @param p - The linear path to calculate the length of.\n * @returns The length of the linear path.\n * @since 1.0.0\n */\nexport const length: (p: LinearPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a linear path for a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a linear path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: LinearPath2d) => Vector2\n /**\n * Solves a linear path for a given parameter.\n *\n * @param p - The linear path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point on the linear path.\n * @since 1.0.0\n */\n (p: LinearPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a linear path as an SVG path data string (the value of a `<path>`\n * element's `d` attribute), using `M` and `L` commands. Discontinuities between\n * curves emit a fresh `M` command.\n *\n * @param p - The linear path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: LinearPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & Continuous>` when adjacent curves connect at their join\n * points.\n *\n * @param p - The linear path to check.\n * @returns `true` when the path is continuous (G⁰).\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the linear path is continuous, throwing on failure.\n *\n * @param p - The linear path to assert against.\n * @returns The same path, typed with the `Continuous` brand.\n * @throws When the path has a discontinuity between adjacent curves.\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: LinearPath2d<T>) => LinearPath2d<T & Continuous> =\n internal.asContinuous\n\n/**\n * Computes the axis-aligned bounding box of the path — the smallest closed\n * `Box2d` enclosing every segment.\n *\n * @param p - The linear path.\n * @returns A closed `Box2d` enclosing the path.\n * @since 2.1.0\n */\nexport const boundingBox: (p: LinearPath2d) => Interval2d<Closed, Closed> = internal.boundingBox\n","import * as Interval2d from '../interval/interval2d'\nimport * as QuadraticCurve2d from '../curve/quadratic2d'\nimport * as Interval from '../interval/interval'\nimport { dual, Pipeable } from '../utils'\nimport { invariant } from '../utils'\nimport { epsEquals } from '../number'\nimport type { Vector2 } from '../vector/vector2'\nimport type { QuadraticPath2d } from './quadratic2d'\nimport { PathTraits, type Continuous } from './traits'\n\nexport const QuadraticPath2dTypeId: unique symbol = Symbol('curvy/path/quadratic2d')\nexport type QuadraticPath2dTypeId = typeof QuadraticPath2dTypeId\n\nexport class QuadraticPath2dImpl extends Pipeable implements QuadraticPath2d<unknown> {\n readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId = QuadraticPath2dTypeId\n declare readonly [PathTraits]: unknown\n\n readonly curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>\n\n constructor(curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>) {\n super()\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<QuadraticCurve2d.QuadraticCurve2d> {\n return this.curves[Symbol.iterator]()\n }\n}\n\nexport const isQuadraticPath2d = (p: unknown): p is QuadraticPath2d =>\n typeof p === 'object' && p !== null && QuadraticPath2dTypeId in p\n\nexport const make = (\n ...curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>\n): QuadraticPath2d => new QuadraticPath2dImpl(curves)\n\nexport const fromArray = (\n curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>,\n): QuadraticPath2d => new QuadraticPath2dImpl(curves)\n\nexport const append = dual<\n (c: QuadraticCurve2d.QuadraticCurve2d) => (p: QuadraticPath2d) => QuadraticPath2d,\n (p: QuadraticPath2d, c: QuadraticCurve2d.QuadraticCurve2d) => QuadraticPath2d\n>(2, (p: QuadraticPath2d, c: QuadraticCurve2d.QuadraticCurve2d) => fromArray([...p, c]))\n\nexport const length = (p: QuadraticPath2d) => {\n let total = 0\n for (const curve of p) {\n total += QuadraticCurve2d.length(curve, Interval.unit)\n }\n\n return total\n}\n\nexport const solve = dual<\n (u: number) => (p: QuadraticPath2d) => Vector2,\n (p: QuadraticPath2d, u: number) => Vector2\n>(2, (p: QuadraticPath2d, u: number) => {\n const curves = p instanceof QuadraticPath2dImpl ? p.curves : [...p]\n\n if (u === 1) {\n const last = curves.at(-1) as QuadraticCurve2d.QuadraticCurve2d\n return QuadraticCurve2d.solve(last, 1)\n }\n\n const t = u * curves.length\n const i = Math.floor(t)\n const curve = curves[i] as QuadraticCurve2d.QuadraticCurve2d\n return QuadraticCurve2d.solve(curve, t - i)\n})\n\n// Quadratic Bernstein basis: P(t) = (1-t)²·p0 + 2(1-t)t·p1 + t²·p2\n// expanded gives c0 = p0, c1 = -2p0 + 2p1, c2 = p0 - 2p1 + p2, so:\n// p0 = c0, p1 = c0 + c1/2, p2 = c0 + c1 + c2.\nexport const toPathData = (p: QuadraticPath2d): string => {\n let result = ''\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n\n for (const curve of p) {\n const c0x = curve.x.c0\n const c0y = curve.y.c0\n const c1x = curve.x.c1\n const c1y = curve.y.c1\n const c2x = curve.x.c2\n const c2y = curve.y.c2\n\n const startX = c0x\n const startY = c0y\n const ctrlX = c0x + c1x / 2\n const ctrlY = c0y + c1y / 2\n const endX = c0x + c1x + c2x\n const endY = c0y + c1y + c2y\n\n if (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY)) {\n result += ` M ${startX},${startY}`\n }\n result += ` Q ${ctrlX},${ctrlY} ${endX},${endY}`\n\n prevEndX = endX\n prevEndY = endY\n }\n\n return result.slice(1)\n}\n\nexport const isContinuous = <T>(p: QuadraticPath2d<T>): p is QuadraticPath2d<T & Continuous> => {\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n let first = true\n\n for (const curve of p) {\n const startX = curve.x.c0\n const startY = curve.y.c0\n if (!first && (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY))) {\n return false\n }\n prevEndX = curve.x.c0 + curve.x.c1 + curve.x.c2\n prevEndY = curve.y.c0 + curve.y.c1 + curve.y.c2\n first = false\n }\n return true\n}\n\nexport const asContinuous = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'quadratic path is not continuous')\n return p\n}\n\nexport const boundingBox = (\n p: QuadraticPath2d,\n): Interval2d.Interval2d<Interval.Closed, Interval.Closed> => {\n const iter = p[Symbol.iterator]()\n const first = iter.next()\n let acc = QuadraticCurve2d.boundingBox(first.value as QuadraticCurve2d.QuadraticCurve2d)\n for (let next = iter.next(); !next.done; next = iter.next()) {\n acc = Interval2d.union(acc, QuadraticCurve2d.boundingBox(next.value))\n }\n return acc\n}\n","import type { Interval2d } from '../interval/interval2d'\nimport type { QuadraticCurve2d } from '../curve/quadratic2d'\nimport type { Closed } from '../interval/interval'\nimport type { Pipeable } from '../utils'\nimport type { Vector2 } from '../vector/vector2'\nimport type { QuadraticPath2dTypeId } from './quadratic2d.internal'\nimport * as internal from './quadratic2d.internal'\nimport type { Continuous, PathTraits } from './traits'\n\nexport type { Continuous } from './traits'\n\n/**\n * A quadratic path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`.\n *\n * @since 1.0.0\n */\nexport interface QuadraticPath2d<out Trait = unknown> extends Pipeable, Iterable<QuadraticCurve2d> {\n readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `QuadraticPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d = internal.make\n\n/**\n * Creates a new `QuadraticPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d =\n internal.fromArray\n\n/**\n * Checks if a value is a `QuadraticPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `QuadraticPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isQuadraticPath2d: (p: unknown) => p is QuadraticPath2d = internal.isQuadraticPath2d\n\nexport const append: {\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param c - The quadratic curve to append.\n * @returns A function that takes a quadratic path and returns a new quadratic path.\n * @since 1.0.0\n */\n (c: QuadraticCurve2d): (p: QuadraticPath2d) => QuadraticPath2d\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param p - The quadratic path to append to.\n * @param c - The quadratic curve to append.\n * @returns A new `QuadraticPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, c: QuadraticCurve2d): QuadraticPath2d\n} = internal.append\n\n/**\n * Calculates the length of a quadratic path.\n *\n * @param p - The quadratic path to calculate the length of.\n * @returns The length of the path.\n */\nexport const length: (p: QuadraticPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a quadratic path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: QuadraticPath2d) => Vector2\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param p - The quadratic path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a quadratic path as an SVG path data string (the value of a\n * `<path>` element's `d` attribute), using `M` and `Q` commands. Discontinuities\n * between curves emit a fresh `M` command.\n *\n * @param p - The quadratic path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: QuadraticPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & Continuous>` when adjacent curves connect.\n *\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the quadratic path is continuous, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & Continuous> =\n internal.asContinuous\n\n/**\n * Computes the axis-aligned bounding box of the path — the smallest closed\n * `Box2d` enclosing every segment.\n *\n * @param p - The quadratic path.\n * @returns A closed `Box2d` enclosing the path.\n * @since 2.1.0\n */\nexport const boundingBox: (p: QuadraticPath2d) => Interval2d<Closed, Closed> = internal.boundingBox\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import { i as quadratic_d_exports, n as cubic_d_exports, o as linear_d_exports } from "../shared/cubic-Dfn6DB02.mjs";
1
+ import { i as quadratic_d_exports, n as cubic_d_exports, o as linear_d_exports } from "../shared/cubic-BajUY0JT.mjs";
2
2
  export { cubic_d_exports as CubicPolynomial, linear_d_exports as LinearPolynomial, quadratic_d_exports as QuadraticPolynomial };
@@ -1,3 +1,3 @@
1
- import { t as cubic_exports } from "../shared/cubic-CYYEUHNm.mjs";
2
- import { f as linear_exports, o as quadratic_exports } from "../shared/quadratic-DEhuAKuE.mjs";
1
+ import { t as cubic_exports } from "../shared/cubic-CpHAx8cC.mjs";
2
+ import { o as quadratic_exports, p as linear_exports } from "../shared/quadratic-CamozcFc.mjs";
3
3
  export { cubic_exports as CubicPolynomial, linear_exports as LinearPolynomial, quadratic_exports as QuadraticPolynomial };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./chunk-25Hzd3z8.mjs";
2
2
  import { roundDown } from "../number.mjs";
3
3
  import { a as vectorProductLeft, n as make } from "./matrix4x4-Ck2WROK-.mjs";
4
- import { r as fromVector } from "./cubic-CYYEUHNm.mjs";
4
+ import { r as fromVector } from "./cubic-CpHAx8cC.mjs";
5
5
  //#region src/characteristic/characteristic.ts
6
6
  var characteristic_exports = /* @__PURE__ */ __exportAll({
7
7
  apply: () => apply,
@@ -101,4 +101,4 @@ const apply = (matrix, ...channels) => {
101
101
  //#endregion
102
102
  export { cubicCardinal as a, cubicBezier as i, characteristic_exports as n, cubicHermite as o, cubicBasisSpline as r, apply as t };
103
103
 
104
- //# sourceMappingURL=characteristic-BGRxcxUH.mjs.map
104
+ //# sourceMappingURL=characteristic-B9nCh_cx.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"characteristic-BGRxcxUH.mjs","names":["Matrix4x4.make","CubicPolynomial.fromVector","Matrix4x4.vectorProductLeft"],"sources":["../../src/characteristic/characteristic.ts"],"sourcesContent":["import * as Matrix4x4 from '../matrix/matrix4x4'\nimport * as CubicPolynomial from '../polynomial/cubic'\nimport { roundDown } from '../number'\nimport type * as Vector4 from '../vector/vector4'\n\n/**\n * The cubic Bézier characteristic matrix.\n *\n * Maps Bernstein-basis control points `(P₀, P₁, P₂, P₃)` to monomial cubic\n * coefficients `(c₀, c₁, c₂, c₃)` for `c₀ + c₁·t + c₂·t² + c₃·t³`. The matrix\n * IS the Bézier spline family — combined with control points (via {@link apply}),\n * it produces the cubic polynomial that parameterizes the curve.\n *\n * @since 2.1.0\n */\nexport const cubicBezier: Matrix4x4.Matrix4x4 = Matrix4x4.make(\n 1,\n 0,\n 0,\n 0,\n -3,\n 3,\n 0,\n 0,\n 3,\n -6,\n 3,\n 0,\n -1,\n 3,\n -3,\n 1,\n)\n\n/**\n * The cubic Hermite characteristic matrix.\n *\n * Maps Hermite control data `(P₀, V₀, P₁, V₁)` — two endpoints and two\n * tangent vectors — to monomial cubic coefficients.\n *\n * @since 2.1.0\n */\nexport const cubicHermite: Matrix4x4.Matrix4x4 = Matrix4x4.make(\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n -3,\n -2,\n 3,\n -1,\n 2,\n 1,\n -2,\n 1,\n)\n\n/**\n * The uniform cubic B-spline (basis spline) characteristic matrix.\n *\n * Maps a window of four control points to the monomial cubic coefficients\n * of one segment of the corresponding uniform cubic B-spline. Stride-1\n * application produces a C² piecewise spline; the curve does not generally\n * pass through the control points.\n *\n * @since 2.1.0\n */\nexport const cubicBasisSpline: Matrix4x4.Matrix4x4 = Matrix4x4.make(\n 1 / 6,\n 4 / 6,\n roundDown(1 / 6),\n 0,\n -0.5,\n 0,\n 0.5,\n 0,\n 0.5,\n -1,\n 0.5,\n 0,\n -1 / 6,\n 0.5,\n -0.5,\n 1 / 6,\n)\n\nconst cardinalCache = new Map<number, Matrix4x4.Matrix4x4>()\n\n/**\n * The cubic Cardinal spline characteristic matrix, parameterized by tension.\n *\n * Maps four control points to the monomial cubic coefficients of one\n * Cardinal segment. The tension `s` controls how tightly the curve hugs\n * the control points: `s = 0` produces straight-line segments between\n * adjacent points, `s = 0.5` is the Catmull-Rom variant (see\n * {@link cubicCatmullRom}), and higher values produce looser, more curved\n * shapes.\n *\n * Cached per tension value — repeated calls with the same tension return\n * the same matrix instance.\n *\n * @param tension - The tension parameter.\n * @returns The characteristic matrix for that tension.\n * @since 2.1.0\n */\nexport const cubicCardinal = (tension: number): Matrix4x4.Matrix4x4 => {\n let m = cardinalCache.get(tension)\n if (m === undefined) {\n m = Matrix4x4.make(\n 0,\n 1,\n 0,\n 0,\n -tension,\n 0,\n tension,\n 0,\n 2 * tension,\n tension - 3,\n 3 - 2 * tension,\n -tension,\n -tension,\n 2 - tension,\n tension - 2,\n tension,\n )\n cardinalCache.set(tension, m)\n }\n return m\n}\n\n/**\n * The cubic Catmull-Rom characteristic matrix — Cardinal with tension `0.5`.\n * The most common Cardinal-family variant; reused widely enough to deserve\n * a constant.\n *\n * @since 2.1.0\n */\nexport const cubicCatmullRom: Matrix4x4.Matrix4x4 = cubicCardinal(0.5)\n\n/**\n * Applies a characteristic matrix to N channels of control values, producing\n * N cubic polynomials in monomial form.\n *\n * Each channel is a `Vector4` packing one axis's values across the four\n * control points: `(v₀, v₁, v₂, v₃)`. The result tuple has the same arity\n * as the input.\n *\n * The polynomial 2D spline pipeline applies this with two channels (x, y);\n * the rational 2D pipeline uses three (x, y, w) where `w` is the projective\n * denominator. Higher channel counts generalize to 3D, rational 3D, and\n * beyond — the characteristic matrix doesn't care about the geometric\n * domain, only about how to combine four samples per channel.\n *\n * @param matrix - The characteristic matrix of the spline family.\n * @param channels - One `Vector4` per output polynomial, packing the four control values for that channel.\n * @returns A tuple of cubic polynomials, one per input channel.\n * @since 2.1.0\n */\nexport const apply = <const Channels extends ReadonlyArray<Vector4.Vector4>>(\n matrix: Matrix4x4.Matrix4x4,\n ...channels: Channels\n): { readonly [K in keyof Channels]: CubicPolynomial.CubicPolynomial } => {\n const result = channels.map((c) =>\n CubicPolynomial.fromVector(Matrix4x4.vectorProductLeft(matrix, c)),\n )\n return result as { readonly [K in keyof Channels]: CubicPolynomial.CubicPolynomial }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,cAAmCA,KAC9C,GACA,GACA,GACA,GACA,IACA,GACA,GACA,GACA,GACA,IACA,GACA,GACA,IACA,GACA,IACA,EACD;;;;;;;;;AAUD,MAAa,eAAoCA,KAC/C,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,GACA,IACA,GACA,GACA,IACA,EACD;;;;;;;;;;;AAYD,MAAa,mBAAwCA,KACnD,IAAI,GACJ,IAAI,GACJ,UAAU,IAAI,EAAE,EAChB,GACA,KACA,GACA,IACA,GACA,IACA,IACA,IACA,GACA,KAAK,GACL,IACA,KACA,IAAI,EACL;AAED,MAAM,gCAAgB,IAAI,KAAkC;;;;;;;;;;;;;;;;;;AAmB5D,MAAa,iBAAiB,YAAyC;CACrE,IAAI,IAAI,cAAc,IAAI,QAAQ;CAClC,IAAI,MAAM,KAAA,GAAW;EACnB,IAAIA,KACF,GACA,GACA,GACA,GACA,CAAC,SACD,GACA,SACA,GACA,IAAI,SACJ,UAAU,GACV,IAAI,IAAI,SACR,CAAC,SACD,CAAC,SACD,IAAI,SACJ,UAAU,GACV,QACD;EACD,cAAc,IAAI,SAAS,EAAE;;CAE/B,OAAO;;;;;;;;;AAUT,MAAa,kBAAuC,cAAc,GAAI;;;;;;;;;;;;;;;;;;;;AAqBtE,MAAa,SACX,QACA,GAAG,aACqE;CAIxE,OAHe,SAAS,KAAK,MAC3BC,WAA2BC,kBAA4B,QAAQ,EAAE,CAAC,CAEvD"}
1
+ {"version":3,"file":"characteristic-B9nCh_cx.mjs","names":["Matrix4x4.make","CubicPolynomial.fromVector","Matrix4x4.vectorProductLeft"],"sources":["../../src/characteristic/characteristic.ts"],"sourcesContent":["import * as Matrix4x4 from '../matrix/matrix4x4'\nimport * as CubicPolynomial from '../polynomial/cubic'\nimport { roundDown } from '../number'\nimport type * as Vector4 from '../vector/vector4'\n\n/**\n * The cubic Bézier characteristic matrix.\n *\n * Maps Bernstein-basis control points `(P₀, P₁, P₂, P₃)` to monomial cubic\n * coefficients `(c₀, c₁, c₂, c₃)` for `c₀ + c₁·t + c₂·t² + c₃·t³`. The matrix\n * IS the Bézier spline family — combined with control points (via {@link apply}),\n * it produces the cubic polynomial that parameterizes the curve.\n *\n * @since 2.1.0\n */\nexport const cubicBezier: Matrix4x4.Matrix4x4 = Matrix4x4.make(\n 1,\n 0,\n 0,\n 0,\n -3,\n 3,\n 0,\n 0,\n 3,\n -6,\n 3,\n 0,\n -1,\n 3,\n -3,\n 1,\n)\n\n/**\n * The cubic Hermite characteristic matrix.\n *\n * Maps Hermite control data `(P₀, V₀, P₁, V₁)` — two endpoints and two\n * tangent vectors — to monomial cubic coefficients.\n *\n * @since 2.1.0\n */\nexport const cubicHermite: Matrix4x4.Matrix4x4 = Matrix4x4.make(\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n -3,\n -2,\n 3,\n -1,\n 2,\n 1,\n -2,\n 1,\n)\n\n/**\n * The uniform cubic B-spline (basis spline) characteristic matrix.\n *\n * Maps a window of four control points to the monomial cubic coefficients\n * of one segment of the corresponding uniform cubic B-spline. Stride-1\n * application produces a C² piecewise spline; the curve does not generally\n * pass through the control points.\n *\n * @since 2.1.0\n */\nexport const cubicBasisSpline: Matrix4x4.Matrix4x4 = Matrix4x4.make(\n 1 / 6,\n 4 / 6,\n roundDown(1 / 6),\n 0,\n -0.5,\n 0,\n 0.5,\n 0,\n 0.5,\n -1,\n 0.5,\n 0,\n -1 / 6,\n 0.5,\n -0.5,\n 1 / 6,\n)\n\nconst cardinalCache = new Map<number, Matrix4x4.Matrix4x4>()\n\n/**\n * The cubic Cardinal spline characteristic matrix, parameterized by tension.\n *\n * Maps four control points to the monomial cubic coefficients of one\n * Cardinal segment. The tension `s` controls how tightly the curve hugs\n * the control points: `s = 0` produces straight-line segments between\n * adjacent points, `s = 0.5` is the Catmull-Rom variant (see\n * {@link cubicCatmullRom}), and higher values produce looser, more curved\n * shapes.\n *\n * Cached per tension value — repeated calls with the same tension return\n * the same matrix instance.\n *\n * @param tension - The tension parameter.\n * @returns The characteristic matrix for that tension.\n * @since 2.1.0\n */\nexport const cubicCardinal = (tension: number): Matrix4x4.Matrix4x4 => {\n let m = cardinalCache.get(tension)\n if (m === undefined) {\n m = Matrix4x4.make(\n 0,\n 1,\n 0,\n 0,\n -tension,\n 0,\n tension,\n 0,\n 2 * tension,\n tension - 3,\n 3 - 2 * tension,\n -tension,\n -tension,\n 2 - tension,\n tension - 2,\n tension,\n )\n cardinalCache.set(tension, m)\n }\n return m\n}\n\n/**\n * The cubic Catmull-Rom characteristic matrix — Cardinal with tension `0.5`.\n * The most common Cardinal-family variant; reused widely enough to deserve\n * a constant.\n *\n * @since 2.1.0\n */\nexport const cubicCatmullRom: Matrix4x4.Matrix4x4 = cubicCardinal(0.5)\n\n/**\n * Applies a characteristic matrix to N channels of control values, producing\n * N cubic polynomials in monomial form.\n *\n * Each channel is a `Vector4` packing one axis's values across the four\n * control points: `(v₀, v₁, v₂, v₃)`. The result tuple has the same arity\n * as the input.\n *\n * The polynomial 2D spline pipeline applies this with two channels (x, y);\n * the rational 2D pipeline uses three (x, y, w) where `w` is the projective\n * denominator. Higher channel counts generalize to 3D, rational 3D, and\n * beyond — the characteristic matrix doesn't care about the geometric\n * domain, only about how to combine four samples per channel.\n *\n * @param matrix - The characteristic matrix of the spline family.\n * @param channels - One `Vector4` per output polynomial, packing the four control values for that channel.\n * @returns A tuple of cubic polynomials, one per input channel.\n * @since 2.1.0\n */\nexport const apply = <const Channels extends ReadonlyArray<Vector4.Vector4>>(\n matrix: Matrix4x4.Matrix4x4,\n ...channels: Channels\n): { readonly [K in keyof Channels]: CubicPolynomial.CubicPolynomial } => {\n const result = channels.map((c) =>\n CubicPolynomial.fromVector(Matrix4x4.vectorProductLeft(matrix, c)),\n )\n return result as { readonly [K in keyof Channels]: CubicPolynomial.CubicPolynomial }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,cAAmCA,KAC9C,GACA,GACA,GACA,GACA,IACA,GACA,GACA,GACA,GACA,IACA,GACA,GACA,IACA,GACA,IACA,EACD;;;;;;;;;AAUD,MAAa,eAAoCA,KAC/C,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,GACA,IACA,GACA,GACA,IACA,EACD;;;;;;;;;;;AAYD,MAAa,mBAAwCA,KACnD,IAAI,GACJ,IAAI,GACJ,UAAU,IAAI,EAAE,EAChB,GACA,KACA,GACA,IACA,GACA,IACA,IACA,IACA,GACA,KAAK,GACL,IACA,KACA,IAAI,EACL;AAED,MAAM,gCAAgB,IAAI,KAAkC;;;;;;;;;;;;;;;;;;AAmB5D,MAAa,iBAAiB,YAAyC;CACrE,IAAI,IAAI,cAAc,IAAI,QAAQ;CAClC,IAAI,MAAM,KAAA,GAAW;EACnB,IAAIA,KACF,GACA,GACA,GACA,GACA,CAAC,SACD,GACA,SACA,GACA,IAAI,SACJ,UAAU,GACV,IAAI,IAAI,SACR,CAAC,SACD,CAAC,SACD,IAAI,SACJ,UAAU,GACV,QACD;EACD,cAAc,IAAI,SAAS,EAAE;;CAE/B,OAAO;;;;;;;;;AAUT,MAAa,kBAAuC,cAAc,GAAI;;;;;;;;;;;;;;;;;;;;AAqBtE,MAAa,SACX,QACA,GAAG,aACqE;CAIxE,OAHe,SAAS,KAAK,MAC3BC,WAA2BC,kBAA4B,QAAQ,EAAE,CAAC,CAEvD"}
@@ -1,7 +1,8 @@
1
- import { i as Vector3, o as Vector4, t as Vector2 } from "./vector2-TV0UnlxY.mjs";
2
- import { t as Pipeable } from "./utils-DqTGyXrP.mjs";
3
- import { t as Interval } from "./interval-hQDiKqj0.mjs";
4
- import { i as One, n as AtMostThree, r as AtMostTwo, t as AtMostOne } from "./solution-BjoW7ov4.mjs";
1
+ import { t as Vector2 } from "./vector2-DPUY3_eA.mjs";
2
+ import { t as Pipeable } from "./utils-MCckigYk.mjs";
3
+ import { r as Vector4, t as Vector3 } from "./vector3-DqeOZtOB.mjs";
4
+ import { n as Closed, r as Interval } from "./interval-Dy-RMEE3.mjs";
5
+ import { i as One, n as AtMostThree, r as AtMostTwo, t as AtMostOne } from "./solution-sNQ-ZVhN.mjs";
5
6
 
6
7
  //#region src/polynomial/traits.d.ts
7
8
  /**
@@ -344,7 +345,7 @@ declare const range$2: {
344
345
  * @returns The range of the polynomial within the given domain.
345
346
  * @since 1.0.0
346
347
  */
347
- (p: LinearPolynomial, domain: Interval): Interval;
348
+ (p: LinearPolynomial, domain: Interval): Closed;
348
349
  /**
349
350
  * Calculates the range of a linear polynomial.
350
351
  *
@@ -352,7 +353,7 @@ declare const range$2: {
352
353
  * @returns A function that takes a `LinearPolynomial` and returns the range of the polynomial within the given domain.
353
354
  * @since 1.0.0
354
355
  */
355
- (domain: Interval): (p: LinearPolynomial) => Interval;
356
+ (domain: Interval): (p: LinearPolynomial) => Closed;
356
357
  };
357
358
  declare const length$2: {
358
359
  /**
@@ -684,7 +685,7 @@ declare const range$1: {
684
685
  * @returns The range of the polynomial over the domain.
685
686
  * @since 1.0.0
686
687
  */
687
- (p: QuadraticPolynomial, domain: Interval): Interval;
688
+ (p: QuadraticPolynomial, domain: Interval): Closed;
688
689
  /**
689
690
  * Computes the range of the quadratic polynomial over a given domain.
690
691
  *
@@ -692,7 +693,7 @@ declare const range$1: {
692
693
  * @returns A function that takes a quadratic polynomial and returns the range of the polynomial over the domain.
693
694
  * @since 1.0.0
694
695
  */
695
- (domain: Interval): (p: QuadraticPolynomial) => Interval;
696
+ (domain: Interval): (p: QuadraticPolynomial) => Closed;
696
697
  };
697
698
  declare const length$1: {
698
699
  /**
@@ -1046,7 +1047,7 @@ declare const range: {
1046
1047
  * @returns The range of the cubic polynomial in the specified domain.
1047
1048
  * @since 1.0.0
1048
1049
  */
1049
- (p: CubicPolynomial, domain: Interval): Interval;
1050
+ (p: CubicPolynomial, domain: Interval): Closed;
1050
1051
  /**
1051
1052
  * Calculates the range of a cubic polynomial.
1052
1053
  *
@@ -1054,7 +1055,7 @@ declare const range: {
1054
1055
  * @returns A function that takes a cubic polynomial and returns the range of the cubic polynomial in the specified domain.
1055
1056
  * @since 1.0.0
1056
1057
  */
1057
- (domain: Interval): (p: CubicPolynomial) => Interval;
1058
+ (domain: Interval): (p: CubicPolynomial) => Closed;
1058
1059
  };
1059
1060
  declare const length: {
1060
1061
  /**
@@ -1096,4 +1097,4 @@ declare const curvature: {
1096
1097
  };
1097
1098
  //#endregion
1098
1099
  export { LinearPolynomial as a, Increasing as c, quadratic_d_exports as i, Monotonic as l, cubic_d_exports as n, linear_d_exports as o, QuadraticPolynomial as r, Decreasing as s, CubicPolynomial as t };
1099
- //# sourceMappingURL=cubic-Dfn6DB02.d.mts.map
1100
+ //# sourceMappingURL=cubic-BajUY0JT.d.mts.map
@@ -2,8 +2,8 @@ import { t as __exportAll } from "./chunk-25Hzd3z8.mjs";
2
2
  import { Pipeable, dual, invariant } from "../utils.mjs";
3
3
  import { clampToZero, epsEquals } from "../number.mjs";
4
4
  import { i as make$4 } from "./vector2-CL1HDdPr.mjs";
5
- import { c as size, i as fromMinMax, l as toOpen, n as contains, o as make$5, r as filter, s as scaleShift, t as biunit } from "./interval-CCEqzPgA.mjs";
6
- import { a as match, l as two, n as fromArray, o as none, r as isNone, s as one } from "./solution-CbSWzXCn.mjs";
5
+ import { a as filter, c as make$5, d as toOpen, l as scaleShift, n as contains, o as fromMinMax, t as biunit, u as size } from "./interval-05CR6eBf.mjs";
6
+ import { a as match, l as two, n as fromArray, o as none, r as isNone, s as one } from "./solution-CrtLfqEq.mjs";
7
7
  //#region src/polynomial/quadratic.internal.circular.ts
8
8
  const QuadraticPolynomialTypeId = Symbol.for("curvy/polynomial/quadratic");
9
9
  var QuadraticPolynomialImpl = class extends Pipeable {
@@ -72,7 +72,7 @@ const domain$3 = dual(2, (p, r) => {
72
72
  if (isNone(start) || isNone(end)) return none;
73
73
  return one(make$5(start.value, end.value));
74
74
  });
75
- const range$3 = dual(2, (p, d) => make$5(solve$3(p, d.start), solve$3(p, d.end)));
75
+ const range$3 = dual(2, (p, d) => fromMinMax(solve$3(p, d.start), solve$3(p, d.end)));
76
76
  const length$3 = dual(2, (p, d) => {
77
77
  if (size(d) === 0) return 0;
78
78
  if (p.c1 === 0) return size(d);
@@ -474,6 +474,6 @@ const range = range$1;
474
474
  const length = length$1;
475
475
  const curvature = curvature$1;
476
476
  //#endregion
477
- export { fromPoints$2 as $, GL32_X10 as A, monotonicity$3 as At, GL32_X6 as B, GL32_W5 as C, fromVector$3 as Ct, GL32_W9 as D, isMonotonic$3 as Dt, GL32_W8 as E, isLinearPolynomial as Et, GL32_X15 as F, toSolver$3 as Ft, asDecreasing$2 as G, GL32_X8 as H, GL32_X2 as I, curvature$2 as J, asIncreasing$2 as K, GL32_X3 as L, GL32_X12 as M, solve$3 as Mt, GL32_X13 as N, solveInverse$3 as Nt, GL32_X0 as O, length$3 as Ot, GL32_X14 as P, toInverseSolver$3 as Pt, extreme as Q, GL32_X4 as R, GL32_W4 as S, fromPoints$3 as St, GL32_W7 as T, isIncreasing$3 as Tt, GL32_X9 as U, GL32_X7 as V, antiderivative as W, domain$2 as X, derivative$2 as Y, equals$2 as Z, GL32_W13 as _, asMonotonic$3 as _t, isIncreasing as a, length$2 as at, GL32_W2 as b, equals$3 as bt, roots as c, range$2 as ct, subdivide as d, solveInverse$2 as dt, fromVector$2 as et, GL32_W0 as f, toInverseSolver$2 as ft, GL32_W12 as g, asIncreasing$3 as gt, GL32_W11 as h, asDecreasing$3 as ht, isDecreasing as i, isQuadraticPolynomial as it, GL32_X11 as j, range$3 as jt, GL32_X1 as k, make$3 as kt, solve as l, roots$2 as lt, GL32_W10 as m, antiderivative$1 as mt, derivative as n, isIncreasing$2 as nt, isMonotonic as o, make$2 as ot, GL32_W1 as p, toSolver$2 as pt, asMonotonic$2 as q, fromVector as r, isMonotonic$2 as rt, make as s, monotonicity$2 as st, cubic_exports as t, isDecreasing$2 as tt, solveInverse as u, solve$2 as ut, GL32_W14 as v, derivative$3 as vt, GL32_W6 as w, isDecreasing$3 as wt, GL32_W3 as x, fromPointSlope as xt, GL32_W15 as y, domain$3 as yt, GL32_X5 as z };
477
+ export { extreme as $, GL32_X1 as A, make$3 as At, GL32_X5 as B, GL32_W4 as C, fromPoints$3 as Ct, GL32_W8 as D, isLinearPolynomial as Dt, GL32_W7 as E, isIncreasing$3 as Et, GL32_X14 as F, toInverseSolver$3 as Ft, antiderivative as G, GL32_X7 as H, GL32_X15 as I, toSolver$3 as It, asMonotonic$2 as J, asDecreasing$2 as K, GL32_X2 as L, GL32_X11 as M, range$3 as Mt, GL32_X12 as N, solve$3 as Nt, GL32_W9 as O, isMonotonic$3 as Ot, GL32_X13 as P, solveInverse$3 as Pt, equals$2 as Q, GL32_X3 as R, GL32_W3 as S, fromPointSlope as St, GL32_W6 as T, isDecreasing$3 as Tt, GL32_X8 as U, GL32_X6 as V, GL32_X9 as W, derivative$2 as X, curvature$2 as Y, domain$2 as Z, GL32_W12 as _, asIncreasing$3 as _t, isIncreasing as a, isQuadraticPolynomial as at, GL32_W15 as b, domain$3 as bt, range as c, monotonicity$2 as ct, solveInverse as d, solve$2 as dt, fromPoints$2 as et, subdivide as f, solveInverse$2 as ft, GL32_W11 as g, asDecreasing$3 as gt, GL32_W10 as h, antiderivative$1 as ht, isDecreasing as i, isMonotonic$2 as it, GL32_X10 as j, monotonicity$3 as jt, GL32_X0 as k, length$3 as kt, roots as l, range$2 as lt, GL32_W1 as m, toSolver$2 as mt, derivative as n, isDecreasing$2 as nt, isMonotonic as o, length$2 as ot, GL32_W0 as p, toInverseSolver$2 as pt, asIncreasing$2 as q, fromVector as r, isIncreasing$2 as rt, make as s, make$2 as st, cubic_exports as t, fromVector$2 as tt, solve as u, roots$2 as ut, GL32_W13 as v, asMonotonic$3 as vt, GL32_W5 as w, fromVector$3 as wt, GL32_W2 as x, equals$3 as xt, GL32_W14 as y, derivative$3 as yt, GL32_X4 as z };
478
478
 
479
- //# sourceMappingURL=cubic-CYYEUHNm.mjs.map
479
+ //# sourceMappingURL=cubic-CpHAx8cC.mjs.map