curvy 2.0.0-alpha.0 → 2.0.0-alpha.4

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 (67) hide show
  1. package/dist/characteristic/index.d.mts +9 -9
  2. package/dist/characteristic/index.mjs +1 -1
  3. package/dist/curve/index.d.mts +10 -2
  4. package/dist/curve/index.mjs +1 -1
  5. package/dist/interval/index.d.mts +9 -2
  6. package/dist/interval/index.mjs +3 -2
  7. package/dist/matrix/index.d.mts +9 -2
  8. package/dist/number.mjs.map +1 -1
  9. package/dist/path/index.d.mts +16 -204
  10. package/dist/path/index.mjs +36 -3
  11. package/dist/path/index.mjs.map +1 -1
  12. package/dist/polynomial/index.d.mts +9 -2
  13. package/dist/polynomial/index.mjs +2 -2
  14. package/dist/shared/{characteristic-BGRxcxUH.mjs → characteristic-DLlhja-I.mjs} +9 -9
  15. package/dist/shared/{characteristic-BGRxcxUH.mjs.map → characteristic-DLlhja-I.mjs.map} +1 -1
  16. package/dist/shared/{cubic-CYYEUHNm.mjs → cubic-CMonq6bg.mjs} +27 -6
  17. package/dist/shared/cubic-CMonq6bg.mjs.map +1 -0
  18. package/dist/shared/cubic-DkBqcZf-.d.mts +121 -0
  19. package/dist/shared/interval-Bhzeqp8M.d.mts +62 -0
  20. package/dist/shared/{interval-CCEqzPgA.mjs → interval-X1EYuf-T.mjs} +48 -3
  21. package/dist/shared/interval-X1EYuf-T.mjs.map +1 -0
  22. package/dist/shared/interval2d-BMk5UYXD.d.mts +29 -0
  23. package/dist/shared/interval2d-ca0J1NMr.mjs +108 -0
  24. package/dist/shared/interval2d-ca0J1NMr.mjs.map +1 -0
  25. package/dist/shared/matrix4x4-CaytTaB_.d.mts +168 -0
  26. package/dist/shared/{quadratic-DEhuAKuE.mjs → quadratic-DyeMtvET.mjs} +21 -3
  27. package/dist/shared/quadratic-DyeMtvET.mjs.map +1 -0
  28. package/dist/shared/rationalCubic2d-D-UevGKu.d.mts +60 -0
  29. package/dist/shared/{rationalCubic2d-CP4oGpnk.mjs → rationalCubic2d-D658ltUM.mjs} +50 -13
  30. package/dist/shared/rationalCubic2d-D658ltUM.mjs.map +1 -0
  31. package/dist/shared/rationalCubic2d-MgMSJaAU.d.mts +104 -0
  32. package/dist/shared/{rationalCubic2d-CXa7Yren.mjs → rationalCubic2d-Vw4qGPZj.mjs} +24 -7
  33. package/dist/shared/rationalCubic2d-Vw4qGPZj.mjs.map +1 -0
  34. package/dist/shared/{solution-CbSWzXCn.mjs → solution-3TDATEMn.mjs} +28 -2
  35. package/dist/shared/solution-3TDATEMn.mjs.map +1 -0
  36. package/dist/shared/solution-DInDT2Hq.d.mts +60 -0
  37. package/dist/shared/{utils-DqTGyXrP.d.mts → utils-MCckigYk.d.mts} +1 -1
  38. package/dist/shared/{vector2-CL1HDdPr.mjs → vector2-CCuJx1rX.mjs} +6 -6
  39. package/dist/shared/{vector2-CL1HDdPr.mjs.map → vector2-CCuJx1rX.mjs.map} +1 -1
  40. package/dist/shared/vector2-euuV_bNQ.d.mts +58 -0
  41. package/dist/shared/vector3-3Xx7GVk7.d.mts +37 -0
  42. package/dist/shared/{vector3-D-tv_aKL.mjs → vector3-C-qgKAjR.mjs} +2 -2
  43. package/dist/shared/{vector3-D-tv_aKL.mjs.map → vector3-C-qgKAjR.mjs.map} +1 -1
  44. package/dist/shared/{vector4-5KbjoHVj.mjs → vector4-BhOKDhD5.mjs} +2 -2
  45. package/dist/shared/{vector4-5KbjoHVj.mjs.map → vector4-BhOKDhD5.mjs.map} +1 -1
  46. package/dist/solution/index.d.mts +7 -2
  47. package/dist/solution/index.mjs +1 -1
  48. package/dist/splines/index.d.mts +38 -607
  49. package/dist/splines/index.mjs +193 -35
  50. package/dist/splines/index.mjs.map +1 -1
  51. package/dist/utils.d.mts +1 -1
  52. package/dist/vector/index.d.mts +10 -2
  53. package/dist/vector/index.mjs +3 -3
  54. package/package.json +1 -1
  55. package/dist/shared/cubic-CYYEUHNm.mjs.map +0 -1
  56. package/dist/shared/cubic-Dfn6DB02.d.mts +0 -1099
  57. package/dist/shared/interval-CCEqzPgA.mjs.map +0 -1
  58. package/dist/shared/interval-hQDiKqj0.d.mts +0 -494
  59. package/dist/shared/matrix4x4-Bt_DBlP0.d.mts +0 -1182
  60. package/dist/shared/quadratic-DEhuAKuE.mjs.map +0 -1
  61. package/dist/shared/rationalCubic2d-BPLohNuI.d.mts +0 -787
  62. package/dist/shared/rationalCubic2d-CP4oGpnk.mjs.map +0 -1
  63. package/dist/shared/rationalCubic2d-CXa7Yren.mjs.map +0 -1
  64. package/dist/shared/rationalCubic2d-D_-XWxcm.d.mts +0 -297
  65. package/dist/shared/solution-BjoW7ov4.d.mts +0 -251
  66. package/dist/shared/solution-CbSWzXCn.mjs.map +0 -1
  67. package/dist/shared/vector2-TV0UnlxY.d.mts +0 -1168
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interval-X1EYuf-T.mjs","names":["isInterval","equals","aligned","make","makeOpenStart","makeOpenEnd","makeOpen","fromSize","fromMinMax","size","contains","containsInterval","union","filter","clamp","toStartOpen","toStartClosed","toEndOpen","toEndClosed","toClosed","toOpen","isClosed","isOpen","isOpenStart","isOpenEnd","isOpenAtStart","isOpenAtEnd","isClosedAtStart","isClosedAtEnd","unit","unitOpen","biunit","lerp","toLerpFn","normalize","toNormalizeFn","remap","toRemapFn","scaleShift","internal.isInterval","internal.equals","internal.aligned","internal.make","internal.makeOpenStart","internal.makeOpenEnd","internal.makeOpen","internal.fromSize","internal.fromMinMax","internal.size","internal.contains","internal.containsInterval","internal.union","internal.filter","internal.clamp","internal.toStartOpen","internal.toStartClosed","internal.toEndOpen","internal.toEndClosed","internal.toClosed","internal.toOpen","internal.isClosed","internal.isOpen","internal.isOpenStart","internal.isOpenEnd","internal.isOpenAtStart","internal.isOpenAtEnd","internal.isClosedAtStart","internal.isClosedAtEnd","internal.unit","internal.unitOpen","internal.biunit","internal.lerp","internal.toLerpFn","internal.normalize","internal.toNormalizeFn","internal.remap","internal.toRemapFn","internal.scaleShift"],"sources":["../../src/interval/interval.internal.ts","../../src/interval/interval.ts"],"sourcesContent":["import type { Bounds, Closed, Interval, Open, OpenEnd, OpenStart } from './interval'\nimport { dual, Pipeable } from '../utils'\nimport { epsEquals } from '../number'\n\nconst TypeId: unique symbol = Symbol.for('curvy/interval')\ntype TypeId = typeof TypeId\n\nabstract class IntervalImpl extends Pipeable {\n readonly [TypeId]: TypeId = TypeId\n\n abstract readonly kind: 'closed' | 'open-start' | 'open-end' | 'open'\n\n readonly start: number\n readonly end: number\n\n constructor(start: number, end: number) {\n super()\n\n if (end < start) {\n throw new Error('Interval end must be greater than or equal to start')\n }\n\n this.start = start\n this.end = end\n }\n\n get [Symbol.toStringTag]() {\n const open = this.kind === 'open-start' || this.kind === 'open' ? '(' : '['\n const close = this.kind === 'open-end' || this.kind === 'open' ? ')' : ']'\n return `Interval ${open}${this.start}, ${this.end}${close}`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\nclass ClosedImpl extends IntervalImpl implements Closed {\n readonly kind = 'closed' as const\n}\n\nclass OpenStartImpl extends IntervalImpl implements OpenStart {\n readonly kind = 'open-start' as const\n}\n\nclass OpenEndImpl extends IntervalImpl implements OpenEnd {\n readonly kind = 'open-end' as const\n}\n\nclass OpenImpl extends IntervalImpl implements Open {\n readonly kind = 'open' as const\n}\n\nexport const isInterval = (v: unknown): v is Interval =>\n typeof v === 'object' && v !== null && TypeId in v\n\nexport const equals = dual<\n (b: Interval) => (a: Interval) => boolean,\n (a: Interval, b: Interval) => boolean\n>(\n 2,\n (a: Interval, b: Interval) =>\n a.kind === b.kind && epsEquals(a.start, b.start) && epsEquals(a.end, b.end),\n)\n\nexport const aligned = dual<\n (b: Bounds) => (a: Bounds) => boolean,\n (a: Bounds, b: Bounds) => boolean\n>(2, (a: Bounds, b: Bounds) => epsEquals(a.start, b.start) && epsEquals(a.end, b.end))\n\nexport const make = (start: number, end?: number): Closed => new ClosedImpl(start, end ?? start)\n\nexport const makeOpenStart = (start: number, end?: number): OpenStart =>\n new OpenStartImpl(start, end ?? start)\n\nexport const makeOpenEnd = (start: number, end?: number): OpenEnd =>\n new OpenEndImpl(start, end ?? start)\n\nexport const makeOpen = (start: number, end?: number): Open => new OpenImpl(start, end ?? start)\n\nexport const fromSize = (a: number, b?: number): Closed => {\n if (b === undefined) {\n return new ClosedImpl(0, a)\n }\n return new ClosedImpl(a, a + b)\n}\n\nexport const fromMinMax = (...values: ReadonlyArray<number>): Closed =>\n new ClosedImpl(Math.min(...values), Math.max(...values))\n\nexport const size = (i: Bounds): number => Math.abs(i.end - i.start)\n\nexport const contains = dual<\n (value: number) => (interval: Interval) => boolean,\n (interval: Interval, value: number) => boolean\n>(2, (interval: Interval, value: number): boolean => {\n switch (interval.kind) {\n case 'closed':\n return value >= interval.start && value <= interval.end\n case 'open-start':\n return value > interval.start && value <= interval.end\n case 'open-end':\n return value >= interval.start && value < interval.end\n case 'open':\n return value > interval.start && value < interval.end\n }\n})\n\nconst includesStart = (i: Interval): boolean => i.kind === 'closed' || i.kind === 'open-end'\nconst includesEnd = (i: Interval): boolean => i.kind === 'closed' || i.kind === 'open-start'\n\n// Whether `outer` is a superset of `inner`. For each endpoint pair (start/start\n// and end/end), the inner endpoint must be inside outer; when the endpoints\n// are numerically equal, the outer must include that boundary or the inner\n// must exclude it. Both shapes (closed-on-closed, open-on-open with matched\n// endpoints, etc.) are handled by this kind-aware comparison.\nexport const containsInterval = dual<\n (inner: Interval) => (outer: Interval) => boolean,\n (outer: Interval, inner: Interval) => boolean\n>(2, (outer: Interval, inner: Interval): boolean => {\n const outerStart = includesStart(outer)\n const innerStart = includesStart(inner)\n const outerEnd = includesEnd(outer)\n const innerEnd = includesEnd(inner)\n\n const startOk =\n inner.start > outer.start || (inner.start === outer.start && (outerStart || !innerStart))\n const endOk = inner.end < outer.end || (inner.end === outer.end && (outerEnd || !innerEnd))\n\n return startOk && endOk\n})\n\n// Smallest interval enclosing both inputs. Each endpoint of the result is the\n// extremum of (a.start, b.start) / (a.end, b.end), and its inclusivity follows\n// whichever input contributed it. When endpoints tie, the result is closed at\n// that point if EITHER input includes it.\nexport const union = dual<\n (b: Interval) => (a: Interval) => Interval,\n (a: Interval, b: Interval) => Interval\n>(2, (a: Interval, b: Interval): Interval => {\n let startVal: number\n let startInc: boolean\n if (a.start < b.start) {\n startVal = a.start\n startInc = includesStart(a)\n } else if (a.start > b.start) {\n startVal = b.start\n startInc = includesStart(b)\n } else {\n startVal = a.start\n startInc = includesStart(a) || includesStart(b)\n }\n\n let endVal: number\n let endInc: boolean\n if (a.end > b.end) {\n endVal = a.end\n endInc = includesEnd(a)\n } else if (a.end < b.end) {\n endVal = b.end\n endInc = includesEnd(b)\n } else {\n endVal = a.end\n endInc = includesEnd(a) || includesEnd(b)\n }\n\n if (startInc && endInc) {\n return make(startVal, endVal)\n }\n if (!startInc && endInc) {\n return makeOpenStart(startVal, endVal)\n }\n if (startInc && !endInc) {\n return makeOpenEnd(startVal, endVal)\n }\n return makeOpen(startVal, endVal)\n})\n\nexport const filter = dual<\n <V extends ReadonlyArray<number>>(value: V) => (interval: Interval) => V,\n <V extends ReadonlyArray<number>>(interval: Interval, value: V) => V\n>(\n 2,\n <V extends ReadonlyArray<number>>(interval: Interval, value: V): V =>\n value.filter((v) => contains(interval, v)) as unknown as V,\n)\n\nexport const clamp = dual<\n <V extends number | ReadonlyArray<number>>(value: V) => (interval: Bounds) => V,\n <V extends number | ReadonlyArray<number>>(interval: Bounds, value: V) => V\n>(2, <V extends number | ReadonlyArray<number>>(interval: Bounds, value: V): V => {\n if (Array.isArray(value)) {\n return value.map((v) => clamp(interval, v)) as unknown as V\n }\n const v = value as number\n if (v < interval.start) {\n return interval.start as V\n }\n if (v > interval.end) {\n return interval.end as V\n }\n return v as V\n})\n\nexport const toStartOpen = ((i: Interval): OpenStart | Open => {\n switch (i.kind) {\n case 'closed':\n return new OpenStartImpl(i.start, i.end)\n case 'open-end':\n return new OpenImpl(i.start, i.end)\n case 'open-start':\n case 'open':\n return i\n }\n}) as {\n (i: Closed | OpenStart): OpenStart\n (i: OpenEnd | Open): Open\n}\n\nexport const toStartClosed = ((i: Interval): Closed | OpenEnd => {\n switch (i.kind) {\n case 'open-start':\n return new ClosedImpl(i.start, i.end)\n case 'open':\n return new OpenEndImpl(i.start, i.end)\n case 'closed':\n case 'open-end':\n return i\n }\n}) as {\n (i: Closed | OpenEnd): Closed\n (i: OpenStart | Open): OpenEnd\n}\n\nexport const toEndOpen = ((i: Interval): OpenEnd | Open => {\n switch (i.kind) {\n case 'closed':\n return new OpenEndImpl(i.start, i.end)\n case 'open-start':\n return new OpenImpl(i.start, i.end)\n case 'open-end':\n case 'open':\n return i\n }\n}) as {\n (i: Closed | OpenEnd): OpenEnd\n (i: OpenStart | Open): Open\n}\n\nexport const toEndClosed = ((i: Interval): Closed | OpenStart => {\n switch (i.kind) {\n case 'open-end':\n return new ClosedImpl(i.start, i.end)\n case 'open':\n return new OpenStartImpl(i.start, i.end)\n case 'closed':\n case 'open-start':\n return i\n }\n}) as {\n (i: Closed | OpenEnd): Closed\n (i: OpenStart | Open): OpenStart\n}\n\nexport const toClosed = (i: Interval): Closed => {\n if (i.kind === 'closed') {\n return i\n }\n return new ClosedImpl(i.start, i.end)\n}\n\nexport const toOpen = (i: Interval): Open => {\n if (i.kind === 'open') {\n return i\n }\n return new OpenImpl(i.start, i.end)\n}\n\nexport const isClosed = (i: Interval): i is Closed => i.kind === 'closed'\nexport const isOpen = (i: Interval): i is Open => i.kind === 'open'\nexport const isOpenStart = (i: Interval): i is OpenStart => i.kind === 'open-start'\nexport const isOpenEnd = (i: Interval): i is OpenEnd => i.kind === 'open-end'\n\nexport const isOpenAtStart = (i: Interval): i is OpenStart | Open =>\n i.kind === 'open-start' || i.kind === 'open'\nexport const isOpenAtEnd = (i: Interval): i is OpenEnd | Open =>\n i.kind === 'open-end' || i.kind === 'open'\nexport const isClosedAtStart = (i: Interval): i is Closed | OpenEnd =>\n i.kind === 'closed' || i.kind === 'open-end'\nexport const isClosedAtEnd = (i: Interval): i is Closed | OpenStart =>\n i.kind === 'closed' || i.kind === 'open-start'\n\nexport const unit: Closed = make(0, 1)\n\nexport const unitOpen: Open = new OpenImpl(0, 1)\n\nexport const biunit: Closed = make(-1, 1)\n\nexport const lerp = (interval: Bounds, t: number): number =>\n (1 - t) * interval.start + t * interval.end\n\nexport const toLerpFn =\n (interval: Bounds) =>\n (t: number): number =>\n lerp(interval, t)\n\nexport const normalize = (interval: Bounds, x: number): number =>\n (x - interval.start) / size(interval)\n\nexport const toNormalizeFn =\n (interval: Bounds) =>\n (x: number): number =>\n normalize(interval, x)\n\nexport const remap = (source: Bounds, target: Bounds, x: number): number =>\n target.start + ((x - source.start) * size(target)) / size(source)\n\nexport const toRemapFn =\n (source: Bounds, target: Bounds) =>\n (x: number): number =>\n remap(source, target, x)\n\nexport const scaleShift = (source: Bounds, target: Bounds) => {\n const scale = size(target) / size(source)\n\n return {\n scale,\n shift: target.start - source.start * scale,\n }\n}\n","import * as internal from './interval.internal'\nimport type { Pipeable } from '../utils'\n\n/**\n * The structural minimum: any value with numeric `start` and `end` fields.\n *\n * Operations that don't read endpoint inclusivity (e.g. `lerp`, `normalize`,\n * `remap`, `size`) accept `Bounds` so the signature itself documents what\n * the operation depends on.\n *\n * @since 2.0.0\n */\nexport interface Bounds {\n readonly start: number\n readonly end: number\n}\n\n/**\n * A mathematical interval. Discriminated union of four variants by endpoint\n * inclusivity: `Closed`, `OpenStart`, `OpenEnd`, `Open`. Operations that\n * depend on inclusivity (e.g. `contains`, `filter`, `equals`) dispatch on\n * the `kind` field; operations that don't accept the broader `Bounds` type.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 1.0.0\n */\nexport type Interval = Closed | OpenStart | OpenEnd | Open\n\n/**\n * `[start, end]` — both endpoints included.\n *\n * @since 2.0.0\n */\nexport interface Closed extends Pipeable, Bounds {\n readonly kind: 'closed'\n}\n\n/**\n * `(start, end]` — start excluded, end included.\n *\n * @since 2.0.0\n */\nexport interface OpenStart extends Pipeable, Bounds {\n readonly kind: 'open-start'\n}\n\n/**\n * `[start, end)` — start included, end excluded.\n *\n * @since 2.0.0\n */\nexport interface OpenEnd extends Pipeable, Bounds {\n readonly kind: 'open-end'\n}\n\n/**\n * `(start, end)` — both endpoints excluded.\n *\n * @since 2.0.0\n */\nexport interface Open extends Pipeable, Bounds {\n readonly kind: 'open'\n}\n\n/**\n * Checks if a value is an `Interval`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is an `Interval`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isInterval: (v: unknown) => v is Interval = internal.isInterval\n\nexport const equals: {\n /**\n * Checks if two `Interval` instances are approximately equal within the\n * default absolute tolerance ({@link EPSILON}).\n *\n * Both endpoints AND the kind must match — a `Closed` and an `OpenStart` with\n * the same numeric endpoints are not equal. Use `aligned` for the looser\n * \"same numeric range\" check.\n *\n * @param a - The first interval.\n * @param b - The second interval.\n * @returns `true` when both intervals share a kind and both endpoints are within tolerance.\n * @since 1.1.0\n */\n (a: Interval, b: Interval): boolean\n /**\n * Checks if two `Interval` instances are approximately equal within the\n * default absolute tolerance ({@link EPSILON}).\n *\n * @param b - The second interval.\n * @returns A function that takes the first interval and returns the comparison result.\n * @since 1.1.0\n */\n (b: Interval): (a: Interval) => boolean\n} = internal.equals\n\nexport const aligned: {\n /**\n * Checks if two values share the same numeric range, ignoring endpoint\n * inclusivity. Accepts any `Bounds`-shaped value.\n *\n * @param a - The first bounds.\n * @param b - The second bounds.\n * @returns `true` when both endpoints are within the default tolerance ({@link EPSILON}).\n * @since 2.0.0\n */\n (a: Bounds, b: Bounds): boolean\n /**\n * @param b - The second bounds.\n * @returns A function that takes the first bounds and returns the comparison result.\n * @since 2.0.0\n */\n (b: Bounds): (a: Bounds) => boolean\n} = internal.aligned\n\nexport const make: {\n /**\n * Creates a new closed `Interval` instance.\n *\n * @param point - The point of the interval.\n * @returns A new `Closed` interval `[point, point]`.\n * @since 1.0.0\n */\n (point: number): Closed\n /**\n * Creates a new closed `Interval` instance.\n *\n * @param start - The start of the interval.\n * @param end - The end of the interval.\n * @returns A new `Closed` interval `[start, end]`.\n * @since 1.0.0\n */\n (start: number, end: number): Closed\n} = internal.make\n\nexport const makeOpenStart: {\n /**\n * Creates a new left-open `Interval` instance.\n *\n * @param point - The point of the interval.\n * @returns A new `OpenStart` interval `(point, point]` (degenerate, empty).\n * @since 2.0.0\n */\n (point: number): OpenStart\n /**\n * Creates a new left-open `Interval` instance.\n *\n * @param start - The start of the interval (excluded).\n * @param end - The end of the interval (included).\n * @returns A new `OpenStart` interval `(start, end]`.\n * @since 2.0.0\n */\n (start: number, end: number): OpenStart\n} = internal.makeOpenStart\n\nexport const makeOpenEnd: {\n /**\n * Creates a new right-open `Interval` instance.\n *\n * @param point - The point of the interval.\n * @returns A new `OpenEnd` interval `[point, point)` (degenerate, empty).\n * @since 2.0.0\n */\n (point: number): OpenEnd\n /**\n * Creates a new right-open `Interval` instance.\n *\n * @param start - The start of the interval (included).\n * @param end - The end of the interval (excluded).\n * @returns A new `OpenEnd` interval `[start, end)`.\n * @since 2.0.0\n */\n (start: number, end: number): OpenEnd\n} = internal.makeOpenEnd\n\nexport const makeOpen: {\n /**\n * Creates a new fully open `Interval` instance.\n *\n * @param point - The point of the interval.\n * @returns A new `Open` interval `(point, point)` (degenerate, empty).\n * @since 2.0.0\n */\n (point: number): Open\n /**\n * Creates a new fully open `Interval` instance.\n *\n * @param start - The start of the interval (excluded).\n * @param end - The end of the interval (excluded).\n * @returns A new `Open` interval `(start, end)`.\n * @since 2.0.0\n */\n (start: number, end: number): Open\n} = internal.makeOpen\n\nexport const fromSize: {\n /**\n * Creates a new closed `Interval` instance from a size.\n *\n * @param size - The size of the interval.\n * @returns A new `Closed` interval `[0, size]`.\n * @since 1.0.0\n */\n (size: number): Closed\n /**\n * Creates a new closed `Interval` instance from a size.\n *\n * @param start - The start of the interval.\n * @param size - The size of the interval.\n * @returns A new `Closed` interval `[start, start + size]`.\n * @since 1.0.0\n */\n (start: number, size: number): Closed\n} = internal.fromSize\n\n/**\n * Creates a new closed `Interval` from a minimum and maximum value, in any order.\n *\n * @param values - The values to take the min and max of.\n * @returns A new `Closed` interval `[min(values), max(values)]`.\n * @since 1.0.0\n */\nexport const fromMinMax: (...values: ReadonlyArray<number>) => Closed = internal.fromMinMax\n\n/**\n * Calculates the size of an interval.\n *\n * Kind-agnostic — `size` of `[0, 1]` and `(0, 1)` are both `1`.\n *\n * @param i - The bounds to calculate the size of.\n * @returns The size of the bounds.\n * @since 1.0.0\n */\nexport const size: (i: Bounds) => number = internal.size\n\nexport const contains: {\n /**\n * Checks if a value is contained within an interval. Endpoint inclusivity\n * follows the interval's `kind`.\n *\n * @param interval - The interval to check.\n * @param value - The value to check.\n * @returns `true` if the value is contained within the interval, `false` otherwise.\n * @since 1.0.0\n */\n (interval: Interval, value: number): boolean\n /**\n * Checks if a value is contained within an interval. Endpoint inclusivity\n * follows the interval's `kind`.\n *\n * @param value - The value to check.\n * @returns A function that takes an interval and returns `true` if the value is contained within the interval, `false` otherwise.\n * @since 1.0.0\n */\n (value: number): (interval: Interval) => boolean\n} = internal.contains\n\nexport const containsInterval: {\n /**\n * Checks if `inner` is a subset of `outer` — every point of `inner` is also\n * in `outer`. Respects endpoint inclusivity on both sides: a closed inner\n * endpoint must be inside (or on a closed boundary of) the outer, while an\n * open inner endpoint can sit exactly on an open outer boundary.\n *\n * @param outer - The enclosing interval.\n * @param inner - The candidate inner interval.\n * @returns `true` when `inner` is a subset of `outer`.\n * @since 2.0.0\n */\n (outer: Interval, inner: Interval): boolean\n /**\n * @param inner - The candidate inner interval.\n * @returns A function that takes the outer interval and returns the containment result.\n * @since 2.0.0\n */\n (inner: Interval): (outer: Interval) => boolean\n} = internal.containsInterval\n\nexport const union: {\n /**\n * Returns the smallest interval enclosing both inputs. Each endpoint's\n * inclusivity follows the input that contributed it; when both endpoints\n * tie, the result is closed at that point if either input includes it.\n *\n * @param a - The first interval.\n * @param b - The second interval.\n * @returns A new interval enclosing both inputs.\n * @since 2.0.0\n */\n (a: Interval, b: Interval): Interval\n /**\n * @param b - The second interval.\n * @returns A function that takes the first interval and returns the union.\n * @since 2.0.0\n */\n (b: Interval): (a: Interval) => Interval\n} = internal.union\n\nexport const filter: {\n /**\n * Filters an array of values to those contained within an interval.\n * Endpoint inclusivity follows the interval's `kind`.\n *\n * @param interval - The interval to filter the values to.\n * @param value - The values to filter.\n * @returns The filtered values.\n * @since 1.0.0\n */\n <V extends ReadonlyArray<number>>(interval: Interval, value: V): V\n /**\n * Filters an array of values to those contained within an interval.\n *\n * @param value - The values to filter.\n * @returns A function that takes an interval and returns the filtered values.\n * @since 1.0.0\n */\n <V extends ReadonlyArray<number>>(value: V): (interval: Interval) => V\n} = internal.filter\n\nexport const clamp: {\n /**\n * Clamps a value to be within bounds. Kind-agnostic — clamps to the numeric\n * range regardless of endpoint inclusivity.\n *\n * @param interval - The bounds to clamp the value to.\n * @param value - The value to clamp.\n * @returns The clamped value.\n * @since 1.0.0\n */\n (interval: Bounds, value: number): number\n /**\n * Clamps a value to be within bounds. Kind-agnostic.\n *\n * @param value - The value to clamp.\n * @returns A function that takes bounds and returns the clamped value.\n * @since 1.0.0\n */\n (value: number): (interval: Bounds) => number\n /**\n * Clamps an array of values to be within bounds. Kind-agnostic.\n *\n * @param interval - The bounds to clamp the values to.\n * @param value - The values to clamp.\n * @returns The clamped values.\n * @since 1.0.0\n */\n (interval: Bounds, value: ReadonlyArray<number>): ReadonlyArray<number>\n /**\n * Clamps an array of values to be within bounds. Kind-agnostic.\n *\n * @param value - The values to clamp.\n * @returns A function that takes bounds and returns the clamped values.\n * @since 1.0.0\n */\n (value: ReadonlyArray<number>): (interval: Bounds) => ReadonlyArray<number>\n} = internal.clamp\n\n/**\n * Returns an interval with the start endpoint open. Preserves the end endpoint's inclusivity.\n *\n * @since 2.0.0\n */\nexport const toStartOpen: {\n (i: Closed | OpenStart): OpenStart\n (i: OpenEnd | Open): Open\n} = internal.toStartOpen\n\n/**\n * Returns an interval with the start endpoint closed. Preserves the end endpoint's inclusivity.\n *\n * @since 2.0.0\n */\nexport const toStartClosed: {\n (i: Closed | OpenEnd): Closed\n (i: OpenStart | Open): OpenEnd\n} = internal.toStartClosed\n\n/**\n * Returns an interval with the end endpoint open. Preserves the start endpoint's inclusivity.\n *\n * @since 2.0.0\n */\nexport const toEndOpen: {\n (i: Closed | OpenEnd): OpenEnd\n (i: OpenStart | Open): Open\n} = internal.toEndOpen\n\n/**\n * Returns an interval with the end endpoint closed. Preserves the start endpoint's inclusivity.\n *\n * @since 2.0.0\n */\nexport const toEndClosed: {\n (i: Closed | OpenEnd): Closed\n (i: OpenStart | Open): OpenStart\n} = internal.toEndClosed\n\n/**\n * Returns a closed interval over the same numeric range.\n *\n * @since 2.0.0\n */\nexport const toClosed: (i: Interval) => Closed = internal.toClosed\n\n/**\n * Returns a fully open interval over the same numeric range.\n *\n * @since 2.0.0\n */\nexport const toOpen: (i: Interval) => Open = internal.toOpen\n\n/**\n * Type-narrowing predicate: refines `Interval` to `Closed`.\n *\n * @since 2.0.0\n */\nexport const isClosed: (i: Interval) => i is Closed = internal.isClosed\n\n/**\n * Type-narrowing predicate: refines `Interval` to `Open`.\n *\n * @since 2.0.0\n */\nexport const isOpen: (i: Interval) => i is Open = internal.isOpen\n\n/**\n * Type-narrowing predicate: refines `Interval` to `OpenStart`.\n *\n * @since 2.0.0\n */\nexport const isOpenStart: (i: Interval) => i is OpenStart = internal.isOpenStart\n\n/**\n * Type-narrowing predicate: refines `Interval` to `OpenEnd`.\n *\n * @since 2.0.0\n */\nexport const isOpenEnd: (i: Interval) => i is OpenEnd = internal.isOpenEnd\n\n/**\n * Type-narrowing predicate: refines `Interval` to those with an open start endpoint.\n *\n * @since 2.0.0\n */\nexport const isOpenAtStart: (i: Interval) => i is OpenStart | Open = internal.isOpenAtStart\n\n/**\n * Type-narrowing predicate: refines `Interval` to those with an open end endpoint.\n *\n * @since 2.0.0\n */\nexport const isOpenAtEnd: (i: Interval) => i is OpenEnd | Open = internal.isOpenAtEnd\n\n/**\n * Type-narrowing predicate: refines `Interval` to those with a closed start endpoint.\n *\n * @since 2.0.0\n */\nexport const isClosedAtStart: (i: Interval) => i is Closed | OpenEnd = internal.isClosedAtStart\n\n/**\n * Type-narrowing predicate: refines `Interval` to those with a closed end endpoint.\n *\n * @since 2.0.0\n */\nexport const isClosedAtEnd: (i: Interval) => i is Closed | OpenStart = internal.isClosedAtEnd\n\n/**\n * The unit interval, `[0, 1]`.\n *\n * @since 1.0.0\n */\nexport const unit: Closed = internal.unit\n\n/**\n * The open unit interval, `(0, 1)`. The symmetric open analog of {@link unit};\n * convenient for \"strict interior\" use cases such as filtering roots that\n * must lie strictly inside the unit parameter range.\n *\n * @since 2.0.0\n */\nexport const unitOpen: Open = internal.unitOpen\n\n/**\n * The biunit interval, `[-1, 1]`.\n *\n * @since 1.0.0\n */\nexport const biunit: Closed = internal.biunit\n\n/**\n * Linearly interpolates a value within bounds.\n *\n * @param interval - The bounds to interpolate within.\n * @param t - The interpolation factor, typically between 0 and 1.\n * @returns The interpolated value.\n * @since 1.0.0\n */\nexport const lerp: (interval: Bounds, t: number) => number = internal.lerp\n\n/**\n * Creates a linear interpolation function for given bounds.\n *\n * @param interval - The bounds to create the interpolation function for.\n * @returns A function that takes a factor `t` and returns the interpolated value.\n * @since 1.0.0\n */\nexport const toLerpFn: (interval: Bounds) => (t: number) => number = internal.toLerpFn\n\n/**\n * Normalizes a value within bounds.\n *\n * @param interval - The bounds to normalize within.\n * @param x - The value to normalize.\n * @returns The normalized value.\n * @since 1.0.0\n */\nexport const normalize: (interval: Bounds, x: number) => number = internal.normalize\n\n/**\n * Creates a normalization function for given bounds.\n *\n * @param interval - The bounds to create the normalization function for.\n * @returns A function that takes a value `x` and returns the normalized value.\n * @since 1.0.0\n */\nexport const toNormalizeFn: (interval: Bounds) => (x: number) => number = internal.toNormalizeFn\n\n/**\n * Remaps a value from one bounds to another.\n *\n * @param source - The source bounds.\n * @param target - The target bounds.\n * @param x - The value to remap.\n * @returns The remapped value.\n * @since 1.0.0\n */\nexport const remap: (source: Bounds, target: Bounds, x: number) => number = internal.remap\n\n/**\n * Creates a remapping function for given bounds.\n *\n * @param source - The source bounds.\n * @param target - The target bounds.\n * @returns A function that takes a value `x` and returns the remapped value.\n * @since 1.0.0\n */\nexport const toRemapFn: (source: Bounds, target: Bounds) => (x: number) => number =\n internal.toRemapFn\n\n/**\n * Calculates the scale and shift needed to map a source bounds to a target bounds.\n *\n * @param source - The source bounds.\n * @param target - The target bounds.\n * @returns An object containing the scale and shift values.\n * @since 1.0.0\n */\nexport const scaleShift: (source: Bounds, target: Bounds) => ScaleShift = internal.scaleShift\n\n/**\n * The scale and shift needed to map a source bounds to a target bounds.\n *\n * @since 1.0.0\n */\nexport interface ScaleShift {\n readonly scale: number\n readonly shift: number\n}\n"],"mappings":";;;;AAIA,MAAM,SAAwB,OAAO,IAAI,iBAAiB;AAG1D,IAAe,eAAf,cAAoC,SAAS;CAC3C,CAAU,UAAkB;CAI5B;CACA;CAEA,YAAY,OAAe,KAAa;EACtC,OAAO;EAEP,IAAI,MAAM,OACR,MAAM,IAAI,MAAM,sDAAsD;EAGxE,KAAK,QAAQ;EACb,KAAK,MAAM;;CAGb,KAAK,OAAO,eAAe;EACzB,MAAM,OAAO,KAAK,SAAS,gBAAgB,KAAK,SAAS,SAAS,MAAM;EACxE,MAAM,QAAQ,KAAK,SAAS,cAAc,KAAK,SAAS,SAAS,MAAM;EACvE,OAAO,YAAY,OAAO,KAAK,MAAM,IAAI,KAAK,MAAM;;CAGtD,KAAK,OAAO,IAAI,6BAA6B,IAAI;EAC/C,OAAO,KAAK,OAAO;;;AAIvB,IAAM,aAAN,cAAyB,aAA+B;CACtD,OAAgB;;AAGlB,IAAM,gBAAN,cAA4B,aAAkC;CAC5D,OAAgB;;AAGlB,IAAM,cAAN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
+
4
+ //#region src/interval/interval2d.internal.d.ts
5
+ declare const Interval2dTypeId: unique symbol;
6
+ type Interval2dTypeId = typeof Interval2dTypeId;
7
+ //#endregion
8
+ //#region src/interval/interval2d.d.ts
9
+ /**
10
+ * An axis-aligned 2D interval — the Cartesian product of two 1D intervals.
11
+ * Used as a bounding box for curves and paths, and as a region for
12
+ * containment tests.
13
+ *
14
+ * The two type parameters carry the per-axis interval subtype so that a value
15
+ * built from closed intervals stays `Interval2d<Closed, Closed>` and a value
16
+ * with mixed openness preserves that information at the type level.
17
+ *
18
+ * All fields are readonly and immutable, and all operations create new instances.
19
+ *
20
+ * @since 2.0.0
21
+ */
22
+ interface Interval2d<X extends Interval = Interval, Y extends Interval = Interval> extends Pipeable {
23
+ readonly [Interval2dTypeId]: Interval2dTypeId;
24
+ readonly x: X;
25
+ readonly y: Y;
26
+ }
27
+ //#endregion
28
+ export { Interval2d as t };
29
+ //# sourceMappingURL=interval2d-BMk5UYXD.d.mts.map
@@ -0,0 +1,108 @@
1
+ import { t as __exportAll } from "./chunk-25Hzd3z8.mjs";
2
+ import { Pipeable, dual, invariant } from "../utils.mjs";
3
+ import { a as make$2 } from "./vector2-CCuJx1rX.mjs";
4
+ import { f as union$2, i as equals$2, n as contains, o as fromMinMax, r as containsInterval } from "./interval-X1EYuf-T.mjs";
5
+ //#region src/interval/interval2d.internal.ts
6
+ const Interval2dTypeId = Symbol("curvy/interval/interval2d");
7
+ var Interval2dImpl = class extends Pipeable {
8
+ [Interval2dTypeId] = Interval2dTypeId;
9
+ x;
10
+ y;
11
+ constructor(x, y) {
12
+ super();
13
+ this.x = x;
14
+ this.y = y;
15
+ }
16
+ get [Symbol.toStringTag]() {
17
+ return `Interval2d(${String(this.x)} × ${String(this.y)})`;
18
+ }
19
+ get [Symbol.for("nodejs.util.inspect.custom")]() {
20
+ return this[Symbol.toStringTag];
21
+ }
22
+ };
23
+ const isInterval2d$1 = (v) => typeof v === "object" && v !== null && Interval2dTypeId in v;
24
+ const make$1 = (x, y) => new Interval2dImpl(x, y);
25
+ const fromCorners$1 = (p0, p1) => new Interval2dImpl(fromMinMax(p0.x, p1.x), fromMinMax(p0.y, p1.y));
26
+ const fromVectors$1 = (...points) => {
27
+ invariant(points.length > 0, "fromVectors requires at least one point");
28
+ const xs = [];
29
+ const ys = [];
30
+ for (const p of points) {
31
+ xs.push(p.x);
32
+ ys.push(p.y);
33
+ }
34
+ return new Interval2dImpl(fromMinMax(...xs), fromMinMax(...ys));
35
+ };
36
+ const containsVector$1 = dual(2, (box, v) => contains(box.x, v.x) && contains(box.y, v.y));
37
+ const containsInterval2d$1 = dual(2, (outer, inner) => containsInterval(outer.x, inner.x) && containsInterval(outer.y, inner.y));
38
+ const size$1 = (box) => make$2(Math.abs(box.x.end - box.x.start), Math.abs(box.y.end - box.y.start));
39
+ const union$1 = dual(2, (a, b) => new Interval2dImpl(union$2(a.x, b.x), union$2(a.y, b.y)));
40
+ const equals$1 = dual(2, (a, b) => equals$2(a.x, b.x) && equals$2(a.y, b.y));
41
+ //#endregion
42
+ //#region src/interval/interval2d.ts
43
+ var interval2d_exports = /* @__PURE__ */ __exportAll({
44
+ containsInterval2d: () => containsInterval2d,
45
+ containsVector: () => containsVector,
46
+ equals: () => equals,
47
+ fromCorners: () => fromCorners,
48
+ fromVectors: () => fromVectors,
49
+ isInterval2d: () => isInterval2d,
50
+ make: () => make,
51
+ size: () => size,
52
+ union: () => union
53
+ });
54
+ /**
55
+ * Checks if a value is an `Interval2d`.
56
+ *
57
+ * @param v - The value to check.
58
+ * @returns `true` if the value is an `Interval2d`, `false` otherwise.
59
+ * @since 2.0.0
60
+ */
61
+ const isInterval2d = isInterval2d$1;
62
+ /**
63
+ * Creates a new `Interval2d` from two intervals — one for the x axis, one
64
+ * for the y axis. Preserves both interval subtypes at the type level.
65
+ *
66
+ * @param x - The x-axis interval.
67
+ * @param y - The y-axis interval.
68
+ * @returns A new `Interval2d` instance.
69
+ * @since 2.0.0
70
+ */
71
+ const make = make$1;
72
+ /**
73
+ * Creates a closed `Interval2d` from two corner points. The corners can be in
74
+ * any order — each axis is built from the min and max of the coordinate.
75
+ *
76
+ * @param p0 - The first corner.
77
+ * @param p1 - The second corner.
78
+ * @returns A new `Interval2d<Closed, Closed>` enclosing both corners.
79
+ * @since 2.0.0
80
+ */
81
+ const fromCorners = fromCorners$1;
82
+ /**
83
+ * Creates the smallest closed `Interval2d` enclosing the given points. Useful
84
+ * for computing a bounding box from sampled points.
85
+ *
86
+ * @param points - One or more points to enclose.
87
+ * @returns A new `Interval2d<Closed, Closed>` enclosing all input points.
88
+ * @throws When called with zero points.
89
+ * @since 2.0.0
90
+ */
91
+ const fromVectors = fromVectors$1;
92
+ const containsVector = containsVector$1;
93
+ const containsInterval2d = containsInterval2d$1;
94
+ /**
95
+ * Returns the size as a vector `(width, height)`. Accepts the broader
96
+ * {@link Bounds2d} type because size does not depend on endpoint inclusivity.
97
+ *
98
+ * @param box - The 2D interval (or bounds-shaped value) to measure.
99
+ * @returns The size as a `Vector2`.
100
+ * @since 2.0.0
101
+ */
102
+ const size = size$1;
103
+ const union = union$1;
104
+ const equals = equals$1;
105
+ //#endregion
106
+ export { make as n, union as r, interval2d_exports as t };
107
+
108
+ //# sourceMappingURL=interval2d-ca0J1NMr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interval2d-ca0J1NMr.mjs","names":["isInterval2d","make","fromCorners","Interval.fromMinMax","fromVectors","containsVector","Interval.contains","containsInterval2d","Interval.containsInterval","size","Vector2.make","union","Interval.union","equals","Interval.equals","internal.isInterval2d","internal.make","internal.fromCorners","internal.fromVectors","internal.containsVector","internal.containsInterval2d","internal.size","internal.union","internal.equals"],"sources":["../../src/interval/interval2d.internal.ts","../../src/interval/interval2d.ts"],"sourcesContent":["import { dual, invariant, Pipeable } from '../utils'\nimport * as Vector2 from '../vector/vector2'\nimport * as Interval from './interval'\nimport type { Bounds2d, Interval2d } from './interval2d'\n\nexport const Interval2dTypeId: unique symbol = Symbol('curvy/interval/interval2d')\nexport type Interval2dTypeId = typeof Interval2dTypeId\n\nclass Interval2dImpl<X extends Interval.Interval, Y extends Interval.Interval>\n extends Pipeable\n implements Interval2d<X, Y>\n{\n readonly [Interval2dTypeId]: Interval2dTypeId = Interval2dTypeId\n\n readonly x: X\n readonly y: Y\n\n constructor(x: X, y: Y) {\n super()\n this.x = x\n this.y = y\n }\n\n get [Symbol.toStringTag]() {\n return `Interval2d(${String(this.x)} × ${String(this.y)})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\nexport const isInterval2d = (v: unknown): v is Interval2d =>\n typeof v === 'object' && v !== null && Interval2dTypeId in v\n\nexport const make = <X extends Interval.Interval, Y extends Interval.Interval>(\n x: X,\n y: Y,\n): Interval2d<X, Y> => new Interval2dImpl(x, y)\n\nexport const fromCorners = (\n p0: Vector2.Vector2,\n p1: Vector2.Vector2,\n): Interval2d<Interval.Closed, Interval.Closed> =>\n new Interval2dImpl(Interval.fromMinMax(p0.x, p1.x), Interval.fromMinMax(p0.y, p1.y))\n\nexport const fromVectors = (\n ...points: ReadonlyArray<Vector2.Vector2>\n): Interval2d<Interval.Closed, Interval.Closed> => {\n invariant(points.length > 0, 'fromVectors requires at least one point')\n const xs: Array<number> = []\n const ys: Array<number> = []\n for (const p of points) {\n xs.push(p.x)\n ys.push(p.y)\n }\n return new Interval2dImpl(Interval.fromMinMax(...xs), Interval.fromMinMax(...ys))\n}\n\nexport const containsVector = dual<\n (v: Vector2.Vector2) => (box: Interval2d) => boolean,\n (box: Interval2d, v: Vector2.Vector2) => boolean\n>(\n 2,\n (box: Interval2d, v: Vector2.Vector2): boolean =>\n Interval.contains(box.x, v.x) && Interval.contains(box.y, v.y),\n)\n\nexport const containsInterval2d = dual<\n (inner: Interval2d) => (outer: Interval2d) => boolean,\n (outer: Interval2d, inner: Interval2d) => boolean\n>(\n 2,\n (outer: Interval2d, inner: Interval2d): boolean =>\n Interval.containsInterval(outer.x, inner.x) && Interval.containsInterval(outer.y, inner.y),\n)\n\n// Accepts the structural minimum because size doesn't read kind.\nexport const size = (box: Bounds2d): Vector2.Vector2 =>\n Vector2.make(Math.abs(box.x.end - box.x.start), Math.abs(box.y.end - box.y.start))\n\n// Per-axis union — the runtime delegates to `Interval.union`, which is\n// kind-correct (the resulting endpoint openness reflects which input\n// contributed each side). The conditional return type collapses to the\n// shared kind when both inputs match on an axis and falls back to `Interval`\n// when they differ — at runtime the result genuinely could be any of the four\n// kinds depending on which endpoint wins.\nexport const union: {\n <\n AX extends Interval.Interval,\n AY extends Interval.Interval,\n BX extends Interval.Interval,\n BY extends Interval.Interval,\n >(\n a: Interval2d<AX, AY>,\n b: Interval2d<BX, BY>,\n ): Interval2d<\n AX extends BX ? (BX extends AX ? AX : Interval.Interval) : Interval.Interval,\n AY extends BY ? (BY extends AY ? AY : Interval.Interval) : Interval.Interval\n >\n <BX extends Interval.Interval, BY extends Interval.Interval>(\n b: Interval2d<BX, BY>,\n ): <AX extends Interval.Interval, AY extends Interval.Interval>(\n a: Interval2d<AX, AY>,\n ) => Interval2d<\n AX extends BX ? (BX extends AX ? AX : Interval.Interval) : Interval.Interval,\n AY extends BY ? (BY extends AY ? AY : Interval.Interval) : Interval.Interval\n >\n} = dual(\n 2,\n (a: Interval2d, b: Interval2d) =>\n new Interval2dImpl(Interval.union(a.x, b.x), Interval.union(a.y, b.y)),\n) as never\n\nexport const equals = dual<\n (b: Interval2d) => (a: Interval2d) => boolean,\n (a: Interval2d, b: Interval2d) => boolean\n>(\n 2,\n (a: Interval2d, b: Interval2d): boolean => Interval.equals(a.x, b.x) && Interval.equals(a.y, b.y),\n)\n","import type { Pipeable } from '../utils'\nimport type { Vector2 } from '../vector/vector2'\nimport type { Bounds, Closed, Interval } from './interval'\nimport type { Interval2dTypeId } from './interval2d.internal'\nimport * as internal from './interval2d.internal'\n\n/**\n * An axis-aligned 2D interval — the Cartesian product of two 1D intervals.\n * Used as a bounding box for curves and paths, and as a region for\n * containment tests.\n *\n * The two type parameters carry the per-axis interval subtype so that a value\n * built from closed intervals stays `Interval2d<Closed, Closed>` and a value\n * with mixed openness preserves that information at the type level.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 2.0.0\n */\nexport interface Interval2d<\n X extends Interval = Interval,\n Y extends Interval = Interval,\n> extends Pipeable {\n readonly [Interval2dTypeId]: Interval2dTypeId\n readonly x: X\n readonly y: Y\n}\n\n/**\n * The structural minimum: any value with `x` and `y` fields shaped like\n * {@link Bounds}. Operations that don't read endpoint inclusivity (e.g.\n * {@link size}) accept `Bounds2d` so the signature itself documents what the\n * operation depends on. Mirrors the {@link Bounds}/{@link Interval} split in 1D.\n *\n * @since 2.0.0\n */\nexport interface Bounds2d {\n readonly x: Bounds\n readonly y: Bounds\n}\n\n/**\n * Checks if a value is an `Interval2d`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is an `Interval2d`, `false` otherwise.\n * @since 2.0.0\n */\nexport const isInterval2d: (v: unknown) => v is Interval2d = internal.isInterval2d\n\n/**\n * Creates a new `Interval2d` from two intervals — one for the x axis, one\n * for the y axis. Preserves both interval subtypes at the type level.\n *\n * @param x - The x-axis interval.\n * @param y - The y-axis interval.\n * @returns A new `Interval2d` instance.\n * @since 2.0.0\n */\nexport const make: <X extends Interval, Y extends Interval>(x: X, y: Y) => Interval2d<X, Y> =\n internal.make\n\n/**\n * Creates a closed `Interval2d` from two corner points. The corners can be in\n * any order — each axis is built from the min and max of the coordinate.\n *\n * @param p0 - The first corner.\n * @param p1 - The second corner.\n * @returns A new `Interval2d<Closed, Closed>` enclosing both corners.\n * @since 2.0.0\n */\nexport const fromCorners: (p0: Vector2, p1: Vector2) => Interval2d<Closed, Closed> =\n internal.fromCorners\n\n/**\n * Creates the smallest closed `Interval2d` enclosing the given points. Useful\n * for computing a bounding box from sampled points.\n *\n * @param points - One or more points to enclose.\n * @returns A new `Interval2d<Closed, Closed>` enclosing all input points.\n * @throws When called with zero points.\n * @since 2.0.0\n */\nexport const fromVectors: (...points: ReadonlyArray<Vector2>) => Interval2d<Closed, Closed> =\n internal.fromVectors\n\nexport const containsVector: {\n /**\n * Checks if a vector lies within the 2D interval. Per-axis endpoint\n * inclusivity follows each axis interval's `kind`.\n *\n * @param box - The 2D interval to test against.\n * @param v - The vector to test.\n * @returns `true` when the vector lies within the box on both axes.\n * @since 2.0.0\n */\n (box: Interval2d, v: Vector2): boolean\n /**\n * @param v - The vector to test.\n * @returns A function that takes a 2D interval and returns the containment result.\n * @since 2.0.0\n */\n (v: Vector2): (box: Interval2d) => boolean\n} = internal.containsVector\n\nexport const containsInterval2d: {\n /**\n * Checks if `inner` is a subset of `outer`. The check is per-axis interval\n * containment — for each axis, every point of the inner interval must also\n * be in the outer interval, respecting endpoint inclusivity on both sides.\n *\n * @param outer - The enclosing 2D interval.\n * @param inner - The candidate inner 2D interval.\n * @returns `true` when every point of `inner` is also in `outer`.\n * @since 2.0.0\n */\n (outer: Interval2d, inner: Interval2d): boolean\n /**\n * @param inner - The candidate inner 2D interval.\n * @returns A function that takes the outer 2D interval and returns the containment result.\n * @since 2.0.0\n */\n (inner: Interval2d): (outer: Interval2d) => boolean\n} = internal.containsInterval2d\n\n/**\n * Returns the size as a vector `(width, height)`. Accepts the broader\n * {@link Bounds2d} type because size does not depend on endpoint inclusivity.\n *\n * @param box - The 2D interval (or bounds-shaped value) to measure.\n * @returns The size as a `Vector2`.\n * @since 2.0.0\n */\nexport const size: (box: Bounds2d) => Vector2 = internal.size\n\nexport const union: {\n /**\n * Returns the smallest 2D interval enclosing both inputs.\n *\n * The per-axis return kind is determined by which input's endpoint wins on\n * each side, with the contributor's openness preserved (or unioned to\n * \"closed\" when endpoints are numerically equal and either is closed at\n * that point).\n *\n * When both inputs share the same kind on an axis, the result collapses\n * back to that kind. Otherwise the axis falls back to the open\n * {@link Interval} type since the runtime kind depends on the values.\n *\n * @param a - The first 2D interval.\n * @param b - The second 2D interval.\n * @returns A new `Interval2d` enclosing both inputs.\n * @since 2.0.0\n */\n <AX extends Interval, AY extends Interval, BX extends Interval, BY extends Interval>(\n a: Interval2d<AX, AY>,\n b: Interval2d<BX, BY>,\n ): Interval2d<\n AX extends BX ? (BX extends AX ? AX : Interval) : Interval,\n AY extends BY ? (BY extends AY ? AY : Interval) : Interval\n >\n /**\n * @param b - The second 2D interval.\n * @returns A function that takes the first 2D interval and returns the union.\n * @since 2.0.0\n */\n <BX extends Interval, BY extends Interval>(\n b: Interval2d<BX, BY>,\n ): <AX extends Interval, AY extends Interval>(\n a: Interval2d<AX, AY>,\n ) => Interval2d<\n AX extends BX ? (BX extends AX ? AX : Interval) : Interval,\n AY extends BY ? (BY extends AY ? AY : Interval) : Interval\n >\n} = internal.union\n\nexport const equals: {\n /**\n * Checks if two `Interval2d` values are approximately equal within the\n * default absolute tolerance ({@link EPSILON}). Both the numeric endpoints\n * AND the per-axis kinds must match.\n *\n * @param a - The first 2D interval.\n * @param b - The second 2D interval.\n * @returns `true` when both axes are equal.\n * @since 2.0.0\n */\n (a: Interval2d, b: Interval2d): boolean\n /**\n * @param b - The second 2D interval.\n * @returns A function that takes the first 2D interval and returns the comparison result.\n * @since 2.0.0\n */\n (b: Interval2d): (a: Interval2d) => boolean\n} = internal.equals\n"],"mappings":";;;;;AAKA,MAAa,mBAAkC,OAAO,4BAA4B;AAGlF,IAAM,iBAAN,cACU,SAEV;CACE,CAAU,oBAAsC;CAEhD;CACA;CAEA,YAAY,GAAM,GAAM;EACtB,OAAO;EACP,KAAK,IAAI;EACT,KAAK,IAAI;;CAGX,KAAK,OAAO,eAAe;EACzB,OAAO,cAAc,OAAO,KAAK,EAAE,CAAC,KAAK,OAAO,KAAK,EAAE,CAAC;;CAG1D,KAAK,OAAO,IAAI,6BAA6B,IAAI;EAC/C,OAAO,KAAK,OAAO;;;AAIvB,MAAaA,kBAAgB,MAC3B,OAAO,MAAM,YAAY,MAAM,QAAQ,oBAAoB;AAE7D,MAAaC,UACX,GACA,MACqB,IAAI,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BTC;AAEJ,MAAa,qBAkBTC;;;;;;;;;AAUJ,MAAa,OAAmCC;AAEhD,MAAa,QAsCTC;AAEJ,MAAa,SAkBTC"}
@@ -0,0 +1,168 @@
1
+ import { t as Pipeable } from "./utils-MCckigYk.mjs";
2
+
3
+ //#region src/matrix/matrix2x2.internal.d.ts
4
+ declare const Matrix2x2TypeId: unique symbol;
5
+ type Matrix2x2TypeId = typeof Matrix2x2TypeId;
6
+ //#endregion
7
+ //#region src/matrix/matrix2x2.d.ts
8
+ /**
9
+ * A 2D matrix with 2 rows and 2 columns.
10
+ *
11
+ * All fields are readonly and immutable, and all operations create new instances.
12
+ *
13
+ * @since 1.0.0
14
+ */
15
+ interface Matrix2x2 extends Pipeable {
16
+ readonly [Matrix2x2TypeId]: Matrix2x2TypeId;
17
+ /**
18
+ * The value in the first row and first column.
19
+ */
20
+ readonly m00: number;
21
+ /**
22
+ * The value in the first row and second column.
23
+ */
24
+ readonly m01: number;
25
+ /**
26
+ * The value in the second row and first column.
27
+ */
28
+ readonly m10: number;
29
+ /**
30
+ * The value in the second row and second column.
31
+ */
32
+ readonly m11: number;
33
+ }
34
+ //#endregion
35
+ //#region src/matrix/matrix3x3.internal.d.ts
36
+ declare const Matrix3x3TypeId: unique symbol;
37
+ type Matrix3x3TypeId = typeof Matrix3x3TypeId;
38
+ //#endregion
39
+ //#region src/matrix/matrix3x3.d.ts
40
+ /**
41
+ * A 3x3 matrix.
42
+ *
43
+ * All fields are readonly and immutable, and all operations create new instances.
44
+ *
45
+ * @since 1.0.0
46
+ */
47
+ interface Matrix3x3 extends Pipeable {
48
+ readonly [Matrix3x3TypeId]: Matrix3x3TypeId;
49
+ /**
50
+ * The value of the first row and first column.
51
+ */
52
+ readonly m00: number;
53
+ /**
54
+ * The value of the first row and second column.
55
+ */
56
+ readonly m01: number;
57
+ /**
58
+ * The value of the first row and third column.
59
+ */
60
+ readonly m02: number;
61
+ /**
62
+ * The value of the second row and first column.
63
+ */
64
+ readonly m10: number;
65
+ /**
66
+ * The value of the second row and second column.
67
+ */
68
+ readonly m11: number;
69
+ /**
70
+ * The value of the second row and third column.
71
+ */
72
+ readonly m12: number;
73
+ /**
74
+ * The value of the third row and first column.
75
+ */
76
+ readonly m20: number;
77
+ /**
78
+ * The value of the third row and second column.
79
+ */
80
+ readonly m21: number;
81
+ /**
82
+ * The value of the third row and third column.
83
+ */
84
+ readonly m22: number;
85
+ }
86
+ //#endregion
87
+ //#region src/matrix/matrix4x4.internal.d.ts
88
+ declare const Matrix4x4TypeId: unique symbol;
89
+ type Matrix4x4TypeId = typeof Matrix4x4TypeId;
90
+ //#endregion
91
+ //#region src/matrix/matrix4x4.d.ts
92
+ /**
93
+ * A 4x4 matrix.
94
+ *
95
+ * All fields are readonly and immutable, and all operations create new instances.
96
+ *
97
+ * @since 1.0.0
98
+ */
99
+ interface Matrix4x4 extends Pipeable {
100
+ readonly [Matrix4x4TypeId]: Matrix4x4TypeId;
101
+ /**
102
+ * The value of the first row and first column.
103
+ */
104
+ readonly m00: number;
105
+ /**
106
+ * The value of the first row and second column.
107
+ */
108
+ readonly m01: number;
109
+ /**
110
+ * The value of the first row and third column.
111
+ */
112
+ readonly m02: number;
113
+ /**
114
+ * The value of the first row and fourth column.
115
+ */
116
+ readonly m03: number;
117
+ /**
118
+ * The value of the second row and first column.
119
+ */
120
+ readonly m10: number;
121
+ /**
122
+ * The value of the second row and second column.
123
+ */
124
+ readonly m11: number;
125
+ /**
126
+ * The value of the second row and third column.
127
+ */
128
+ readonly m12: number;
129
+ /**
130
+ * The value of the second row and fourth column.
131
+ */
132
+ readonly m13: number;
133
+ /**
134
+ * The value of the third row and first column.
135
+ */
136
+ readonly m20: number;
137
+ /**
138
+ * The value of the third row and second column.
139
+ */
140
+ readonly m21: number;
141
+ /**
142
+ * The value of the third row and third column.
143
+ */
144
+ readonly m22: number;
145
+ /**
146
+ * The value of the third row and fourth column.
147
+ */
148
+ readonly m23: number;
149
+ /**
150
+ * The value of the fourth row and first column.
151
+ */
152
+ readonly m30: number;
153
+ /**
154
+ * The value of the fourth row and second column.
155
+ */
156
+ readonly m31: number;
157
+ /**
158
+ * The value of the fourth row and third column.
159
+ */
160
+ readonly m32: number;
161
+ /**
162
+ * The value of the fourth row and fourth column.
163
+ */
164
+ readonly m33: number;
165
+ }
166
+ //#endregion
167
+ export { Matrix3x3 as n, Matrix2x2 as r, Matrix4x4 as t };
168
+ //# sourceMappingURL=matrix4x4-CaytTaB_.d.mts.map
@@ -1,11 +1,12 @@
1
1
  import { t as __exportAll } from "./chunk-25Hzd3z8.mjs";
2
- import { $ as fromPoints$3, At as monotonicity$2, Ct as fromVector$2, Dt as isMonotonic$2, Et as isLinearPolynomial$1, Ft as toSolver$2, G as asDecreasing$3, J as curvature$1, K as asIncreasing$3, Mt as solve$2, Nt as solveInverse$2, Ot as length$2, Pt as toInverseSolver$2, Q as extreme$1, St as fromPoints$2, Tt as isIncreasing$2, W as antiderivative$3, X as domain$3, Y as derivative$3, Z as equals$3, _t as asMonotonic$2, at as length$3, bt as equals$2, ct as range$3, dt as solveInverse$3, et as fromVector$3, ft as toInverseSolver$3, gt as asIncreasing$2, ht as asDecreasing$2, it as isQuadraticPolynomial$1, jt as range$2, kt as make$2, lt as roots$1, mt as antiderivative$2, nt as isIncreasing$3, ot as make$3, pt as toSolver$3, q as asMonotonic$3, rt as isMonotonic$3, st as monotonicity$3, tt as isDecreasing$3, ut as solve$3, vt as derivative$2, wt as isDecreasing$2, xt as fromPointSlope$1, yt as domain$2 } from "./cubic-CYYEUHNm.mjs";
2
+ import { $ as equals$3, At as isMonotonic$2, Ct as equals$2, Dt as isDecreasing$2, Et as fromVector$2, Ft as solve$2, G as antiderivative$3, It as solveInverse$2, J as asMonotonic$3, K as asDecreasing$3, Lt as toInverseSolver$2, Mt as make$2, Nt as monotonicity$2, Ot as isIncreasing$2, Pt as range$2, Q as domain$3, Rt as toSolver$2, St as domain$2, Tt as fromPoints$2, X as curvature$1, Y as coefficients$3, Z as derivative$3, _t as asDecreasing$2, at as isMonotonic$3, bt as coefficients$2, ct as make$3, dt as roots$1, et as extreme$1, ft as solve$3, gt as antiderivative$2, ht as toSolver$3, it as isIncreasing$3, jt as length$2, kt as isLinearPolynomial$1, lt as monotonicity$3, mt as toInverseSolver$3, nt as fromVector$3, ot as isQuadraticPolynomial$1, pt as solveInverse$3, q as asIncreasing$3, rt as isDecreasing$3, st as length$3, tt as fromPoints$3, ut as range$3, vt as asIncreasing$2, wt as fromPointSlope$1, xt as derivative$2, yt as asMonotonic$2 } from "./cubic-CMonq6bg.mjs";
3
3
  //#region src/polynomial/linear.ts
4
4
  var linear_exports = /* @__PURE__ */ __exportAll({
5
5
  antiderivative: () => antiderivative$1,
6
6
  asDecreasing: () => asDecreasing$1,
7
7
  asIncreasing: () => asIncreasing$1,
8
8
  asMonotonic: () => asMonotonic$1,
9
+ coefficients: () => coefficients$1,
9
10
  derivative: () => derivative$1,
10
11
  domain: () => domain$1,
11
12
  equals: () => equals$1,
@@ -155,6 +156,14 @@ const asIncreasing$1 = asIncreasing$2;
155
156
  */
156
157
  const asDecreasing$1 = asDecreasing$2;
157
158
  /**
159
+ * Returns the polynomial's coefficients as a tuple `[c0, c1]`.
160
+ *
161
+ * @param p - The linear polynomial.
162
+ * @returns The coefficients in monomial order.
163
+ * @since 2.0.0
164
+ */
165
+ const coefficients$1 = coefficients$2;
166
+ /**
158
167
  * Calculates the derivative of a linear polynomial.
159
168
  *
160
169
  * @param p - The linear polynomial to differentiate.
@@ -173,6 +182,7 @@ var quadratic_exports = /* @__PURE__ */ __exportAll({
173
182
  asDecreasing: () => asDecreasing,
174
183
  asIncreasing: () => asIncreasing,
175
184
  asMonotonic: () => asMonotonic,
185
+ coefficients: () => coefficients,
176
186
  curvature: () => curvature,
177
187
  derivative: () => derivative,
178
188
  domain: () => domain,
@@ -250,6 +260,14 @@ const solveInverse = solveInverse$3;
250
260
  */
251
261
  const toInverseSolver = toInverseSolver$3;
252
262
  /**
263
+ * Returns the polynomial's coefficients as a tuple `[c0, c1, c2]`.
264
+ *
265
+ * @param p - The quadratic polynomial.
266
+ * @returns The coefficients in monomial order.
267
+ * @since 2.0.0
268
+ */
269
+ const coefficients = coefficients$3;
270
+ /**
253
271
  * Computes the derivative of the quadratic polynomial.
254
272
  *
255
273
  * @param p - The quadratic polynomial.
@@ -325,6 +343,6 @@ const range = range$3;
325
343
  const length = length$3;
326
344
  const curvature = curvature$1;
327
345
  //#endregion
328
- export { make as a, solveInverse as c, isMonotonic$1 as d, linear_exports as f, solveInverse$1 as h, isMonotonic as i, isDecreasing$1 as l, solve$1 as m, isDecreasing as n, quadratic_exports as o, make$1 as p, isIncreasing as r, solve as s, derivative as t, isIncreasing$1 as u };
346
+ export { solveInverse$1 as _, make as a, solve as c, isIncreasing$1 as d, isMonotonic$1 as f, solve$1 as g, range$1 as h, isMonotonic as i, solveInverse as l, make$1 as m, isDecreasing as n, quadratic_exports as o, linear_exports as p, isIncreasing as r, range as s, derivative as t, isDecreasing$1 as u };
329
347
 
330
- //# sourceMappingURL=quadratic-DEhuAKuE.mjs.map
348
+ //# sourceMappingURL=quadratic-DyeMtvET.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quadratic-DyeMtvET.mjs","names":["internal.isLinearPolynomial","equals","internal.equals","make","internal.make","fromVector","internal.fromVector","internal.fromPointSlope","fromPoints","internal.fromPoints","solve","internal.solve","toSolver","internal.toSolver","solveInverse","internal.solveInverse","toInverseSolver","internal.toInverseSolver","monotonicity","internal.monotonicity","isMonotonic","internal.isMonotonic","isIncreasing","internal.isIncreasing","isDecreasing","internal.isDecreasing","asMonotonic","internal.asMonotonic","asIncreasing","internal.asIncreasing","asDecreasing","internal.asDecreasing","coefficients","internal.coefficients","derivative","internal.derivative","antiderivative","internal.antiderivative","domain","internal.domain","range","internal.range","length","internal.length","internal.isQuadraticPolynomial","internal.equals","internal.make","internal.fromVector","internal.fromPoints","internal.solve","internal.toSolver","internal.solveInverse","internal.toInverseSolver","internal.coefficients","internal.derivative","internal.roots","internal.extreme","internal.monotonicity","internal.isMonotonic","internal.isIncreasing","internal.isDecreasing","internal.asMonotonic","internal.asIncreasing","internal.asDecreasing","internal.antiderivative","internal.domain","internal.range","internal.length","internal.curvature"],"sources":["../../src/polynomial/linear.ts","../../src/polynomial/quadratic.ts"],"sourcesContent":["import type { Closed, Interval } from '../interval/interval'\nimport type { Pipeable } from '../utils'\nimport type * as Solution from '../solution/solution'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPolynomialTypeId } from './linear.internal'\nimport * as internal from './linear.internal'\nimport type { GuaranteedMonotonicity } from './monotonicity'\nimport type { QuadraticPolynomial } from './quadratic'\nimport type { Decreasing, Increasing, Monotonic, PolynomialTraits } from './traits'\n\nexport type { Monotonic, Increasing, Decreasing } from './traits'\n\n/**\n * A linear polynomial.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Traits` type parameter is a phantom marker that accumulates trait\n * brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and\n * friends. The runtime value carries no trait data — `Traits` only flows\n * through the type system to enable tighter return types on operations like\n * `solveInverse`.\n *\n * @since 1.0.0\n */\nexport interface LinearPolynomial<out Traits = unknown> extends Pipeable {\n readonly [LinearPolynomialTypeId]: LinearPolynomialTypeId\n readonly [PolynomialTraits]: Traits\n\n /**\n * The coefficient of the x^0 term.\n */\n readonly c0: number\n\n /**\n * The coefficient of the x^1 term.\n */\n readonly c1: number\n}\n\n/**\n * Checks if a value is a `LinearPolynomial`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `LinearPolynomial`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isLinearPolynomial: (v: unknown) => v is LinearPolynomial = internal.isLinearPolynomial\n\nexport const equals: {\n /**\n * Checks if two `LinearPolynomial` instances are approximately equal within\n * the default absolute tolerance ({@link EPSILON}).\n *\n * @param a - The first polynomial.\n * @param b - The second polynomial.\n * @returns `true` when each pair of coefficients is within tolerance.\n * @since 1.1.0\n */\n (a: LinearPolynomial, b: LinearPolynomial): boolean\n /**\n * Checks if two `LinearPolynomial` instances are approximately equal within\n * the default absolute tolerance ({@link EPSILON}).\n *\n * @param b - The second polynomial.\n * @returns A function that takes the first polynomial and returns the comparison result.\n * @since 1.1.0\n */\n (b: LinearPolynomial): (a: LinearPolynomial) => boolean\n} = internal.equals\n\n/**\n * Creates a new `LinearPolynomial` instance.\n *\n * @param c0 - The coefficient of the x^0 term. Defaults to 0.\n * @param c1 - The coefficient of the x^1 term. Defaults to 0.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const make: (c0?: number, c1?: number) => LinearPolynomial = internal.make\n\n/**\n * Creates a new `LinearPolynomial` instance from a vector.\n *\n * @param v - The vector to create the polynomial from.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromVector: (v: Vector2) => LinearPolynomial = internal.fromVector\n\n/**\n * Creates a new `LinearPolynomial` instance from a point and slope.\n *\n * @param p - The point on the line.\n * @param slope - The slope of the line.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromPointSlope: (p: Vector2, slope: number) => LinearPolynomial =\n internal.fromPointSlope\n\n/**\n * Creates a new `LinearPolynomial` instance from two points.\n *\n * @param p1 - The first point.\n * @param p2 - The second point.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromPoints: (p1: Vector2, p2: Vector2) => LinearPolynomial = internal.fromPoints\n\nexport const solve: {\n /**\n * Solves a linear polynomial for a given value of x.\n *\n * @param p - The linear polynomial to solve.\n * @param x - The value of x to solve for.\n * @returns The result of the polynomial evaluated at x.\n * @since 1.0.0\n */\n (p: LinearPolynomial, x: number): number\n /**\n * Solves a linear polynomial for a given value of x.\n *\n * @param x - The value of x to solve for.\n * @returns A function that takes a `LinearPolynomial` and returns the result of the polynomial evaluated at x.\n * @since 1.0.0\n */\n (x: number): (p: LinearPolynomial) => number\n} = internal.solve\n\n/**\n * Converts a linear polynomial to a solver function.\n *\n * @param p - The linear polynomial to convert.\n * @returns A function that takes a value of x and returns the result of the polynomial evaluated at x.\n * @since 1.0.0\n */\nexport const toSolver: (p: LinearPolynomial) => (x: number) => number = internal.toSolver\n\n// The implementation always runs the same `c1 === 0 ? Solution.none : ...`\n// branch. For `Monotonic`-branded polynomials the empty branch is provably\n// unreachable, but TS can't see that — the cast pairs the type-level promise\n// with the runtime brand check.\nexport const solveInverse: {\n /**\n * Solves a monotonic linear polynomial for a given value of y. Because the\n * polynomial is strictly monotonic, the inverse always has exactly one\n * solution — wrapped in `Solution.One`.\n *\n * @param p - The monotonic linear polynomial to solve.\n * @param y - The value of y to solve for.\n * @since 2.0.0\n */\n <T extends Monotonic>(p: LinearPolynomial<T>, y: number): Solution.One<number>\n /**\n * Solves a linear polynomial for a given value of y. Returns `Solution.none`\n * for constant polynomials (no inverse).\n *\n * @param p - The linear polynomial to solve.\n * @param y - The value of y to solve for.\n * @since 1.0.0\n */\n <T>(p: LinearPolynomial<T>, y: number): Solution.AtMostOne<number>\n /** @since 1.0.0 */\n (y: number): {\n <T extends Monotonic>(p: LinearPolynomial<T>): Solution.One<number>\n <T>(p: LinearPolynomial<T>): Solution.AtMostOne<number>\n }\n} = internal.solveInverse as never\n\n/**\n * Converts a linear polynomial to an inverse solver function.\n *\n * @param p - The linear polynomial to convert.\n * @since 1.0.0\n */\nexport const toInverseSolver: (p: LinearPolynomial) => (y: number) => Solution.AtMostOne<number> =\n internal.toInverseSolver\n\n/**\n * Finds the roots of a linear polynomial.\n *\n * @param p - The linear polynomial to find the roots of.\n * @since 1.0.0\n */\nexport const root: (p: LinearPolynomial) => Solution.AtMostOne<number> = (p) =>\n internal.solveInverse(p, 0)\n\n/**\n * Calculates the monotonicity of a linear polynomial.\n *\n * @param p - The linear polynomial to check.\n * @returns The guaranteed monotonicity of the polynomial.\n * @since 1.0.0\n */\nexport const monotonicity: (p: LinearPolynomial) => GuaranteedMonotonicity = internal.monotonicity\n\n/**\n * Type-narrowing predicate: refines a `LinearPolynomial<T>` to\n * `LinearPolynomial<T & Monotonic>` when the polynomial is strictly monotonic.\n *\n * @param p - The linear polynomial to check.\n * @returns `true` when `monotonicity(p)` is `'increasing'` or `'decreasing'`.\n * @since 2.0.0\n */\nexport const isMonotonic: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Monotonic> =\n internal.isMonotonic\n\n/**\n * Type-narrowing predicate: refines to `LinearPolynomial<T & Increasing>`.\n *\n * @param p - The linear polynomial to check.\n * @returns `true` when `monotonicity(p)` is `'increasing'`.\n * @since 2.0.0\n */\nexport const isIncreasing: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Increasing> =\n internal.isIncreasing\n\n/**\n * Type-narrowing predicate: refines to `LinearPolynomial<T & Decreasing>`.\n *\n * @param p - The linear polynomial to check.\n * @returns `true` when `monotonicity(p)` is `'decreasing'`.\n * @since 2.0.0\n */\nexport const isDecreasing: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Decreasing> =\n internal.isDecreasing\n\n/**\n * Asserts that the linear polynomial is monotonic, throwing on failure.\n *\n * @param p - The linear polynomial to assert against.\n * @returns The same polynomial, typed with the `Monotonic` brand.\n * @throws When `monotonicity(p)` is `'constant'`.\n * @since 2.0.0\n */\nexport const asMonotonic: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Monotonic> =\n internal.asMonotonic\n\n/**\n * Asserts that the linear polynomial is increasing, throwing on failure.\n *\n * @param p - The linear polynomial to assert against.\n * @returns The same polynomial, typed with the `Increasing` brand.\n * @throws When `monotonicity(p)` is not `'increasing'`.\n * @since 2.0.0\n */\nexport const asIncreasing: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Increasing> =\n internal.asIncreasing\n\n/**\n * Asserts that the linear polynomial is decreasing, throwing on failure.\n *\n * @param p - The linear polynomial to assert against.\n * @returns The same polynomial, typed with the `Decreasing` brand.\n * @throws When `monotonicity(p)` is not `'decreasing'`.\n * @since 2.0.0\n */\nexport const asDecreasing: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Decreasing> =\n internal.asDecreasing\n\n/**\n * Returns the polynomial's coefficients as a tuple `[c0, c1]`.\n *\n * @param p - The linear polynomial.\n * @returns The coefficients in monomial order.\n * @since 2.0.0\n */\nexport const coefficients: (p: LinearPolynomial) => readonly [number, number] =\n internal.coefficients\n\n/**\n * Calculates the derivative of a linear polynomial.\n *\n * @param p - The linear polynomial to differentiate.\n * @returns The derivative of the linear polynomial.\n * @since 1.0.0\n */\nexport const derivative: (p: LinearPolynomial) => number = internal.derivative\n\nexport const antiderivative: {\n /**\n * Calculates the antiderivative of a linear polynomial.\n *\n * @param p - The linear polynomial to integrate.\n * @param constant - The constant of integration. Defaults to 0.\n * @returns The antiderivative of the linear polynomial.\n * @since 1.0.0\n */\n (p: LinearPolynomial, constant?: number): QuadraticPolynomial\n /**\n * Calculates the antiderivative of a linear polynomial.\n *\n * @param constant - The constant of integration. Defaults to 0.\n * @returns A function that takes a `LinearPolynomial` and returns the antiderivative of the polynomial.\n * @since 1.0.0\n */\n (constant: number): (p: LinearPolynomial) => QuadraticPolynomial\n} = internal.antiderivative\n\nexport const domain: {\n /**\n * Calculates the domain of a linear polynomial.\n *\n * @param p - The linear polynomial to check.\n * @param range - The range to check against.\n * @returns The domain of the polynomial within the given range.\n * @since 1.0.0\n */\n (p: LinearPolynomial, range: Interval): Solution.AtMostOne<Interval>\n /**\n * Calculates the domain of a linear polynomial.\n *\n * @param range - The range to check against.\n * @returns A function that takes a `LinearPolynomial` and returns the domain of the polynomial within the given range.\n * @since 1.0.0\n */\n (range: Interval): (p: LinearPolynomial) => Solution.AtMostOne<Interval>\n} = internal.domain\n\nexport const range: {\n /**\n * Calculates the range of a linear polynomial.\n *\n * @param p - The linear polynomial to check.\n * @param domain - The domain to check against.\n * @returns The range of the polynomial within the given domain.\n * @since 1.0.0\n */\n (p: LinearPolynomial, domain: Interval): Closed\n /**\n * Calculates the range of a linear polynomial.\n *\n * @param domain - The domain to check against.\n * @returns A function that takes a `LinearPolynomial` and returns the range of the polynomial within the given domain.\n * @since 1.0.0\n */\n (domain: Interval): (p: LinearPolynomial) => Closed\n} = internal.range\n\nexport const length: {\n /**\n * Calculates the length of a linear polynomial within a particular domain `Interval`.\n *\n * @param p - The linear polynomial to analyze.\n * @param domain - The domain to restrict the analysis to.\n * @returns The length of the linear polynomial in the specified domain.\n * @since 1.0.0\n */\n (p: LinearPolynomial, domain: Interval): number\n /**\n * Calculates the length of a linear polynomial within a particular domain `Interval`.\n *\n * @param domain - The domain to restrict the analysis to.\n * @returns A function that takes a `LinearPolynomial` and returns the length of the polynomial in the specified domain.\n * @since 1.0.0\n */\n (domain: Interval): (p: LinearPolynomial) => number\n} = internal.length\n","import type { Closed, Interval } from '../interval/interval'\nimport type { Pipeable } from '../utils'\nimport type * as Solution from '../solution/solution'\nimport type { Vector2 } from '../vector/vector2'\nimport type { Vector3 } from '../vector/vector3'\nimport type { CubicPolynomial } from './cubic'\nimport type { LinearPolynomial } from './linear'\nimport type { Monotonicity } from './monotonicity'\nimport * as internal from './quadratic.internal'\nimport type { QuadraticPolynomialTypeId } from './quadratic.internal.circular'\nimport type { Decreasing, Increasing, Monotonic, PolynomialTraits } from './traits'\n\nexport type { Monotonic, Increasing, Decreasing } from './traits'\n\n/**\n * A quadratic polynomial.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Traits` type parameter is a phantom marker that accumulates trait\n * brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and\n * friends. Refinements may be parameterized by an `Interval` — a quadratic is\n * monotonic on an interval that avoids its extremum, even though it is not\n * monotonic globally.\n *\n * @since 1.0.0\n */\nexport interface QuadraticPolynomial<out Traits = unknown> extends Pipeable {\n readonly [QuadraticPolynomialTypeId]: QuadraticPolynomialTypeId\n readonly [PolynomialTraits]: Traits\n\n /**\n * The coefficient of the x^0 term.\n */\n readonly c0: number\n /**\n * The coefficient of the x^1 term.\n */\n readonly c1: number\n /**\n * The coefficient of the x^2 term.\n */\n readonly c2: number\n}\n\n/**\n * Checks if a value is a `QuadraticPolynomial`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `QuadraticPolynomial`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isQuadraticPolynomial: (v: unknown) => v is QuadraticPolynomial =\n internal.isQuadraticPolynomial\n\nexport const equals: {\n /**\n * Checks if two `QuadraticPolynomial` instances are approximately equal\n * within the default absolute tolerance ({@link EPSILON}).\n *\n * @param a - The first polynomial.\n * @param b - The second polynomial.\n * @returns `true` when each pair of coefficients is within tolerance.\n * @since 1.1.0\n */\n (a: QuadraticPolynomial, b: QuadraticPolynomial): boolean\n /**\n * Checks if two `QuadraticPolynomial` instances are approximately equal\n * within the default absolute tolerance ({@link EPSILON}).\n *\n * @param b - The second polynomial.\n * @returns A function that takes the first polynomial and returns the comparison result.\n * @since 1.1.0\n */\n (b: QuadraticPolynomial): (a: QuadraticPolynomial) => boolean\n} = internal.equals\n\n/**\n * Creates a new `QuadraticPolynomial` instance.\n *\n * @param c0 - The coefficient of the x^0 term. Defaults to 0.\n * @param c1 - The coefficient of the x^1 term. Defaults to 0.\n * @param c2 - The coefficient of the x^2 term. Defaults to 1.\n * @returns A new `QuadraticPolynomial` instance.\n * @since 1.0.0\n */\nexport const make: (c0?: number, c1?: number, c2?: number) => QuadraticPolynomial = internal.make\n\n/**\n * Creates a new `QuadraticPolynomial` instance from a vector.\n *\n * @param v - The vector to create the polynomial from.\n * @returns A new `QuadraticPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromVector: (v: Vector3) => QuadraticPolynomial = internal.fromVector\n\n/**\n * Creates a new `QuadraticPolynomial` that interpolates the three given\n * points, treating each `Vector2` as an `(x, y)` pair. The three input `x`\n * values must be distinct.\n *\n * @param p0 - The first point.\n * @param p1 - The second point.\n * @param p2 - The third point.\n * @returns The unique quadratic polynomial passing through the three points.\n * @since 2.0.0\n */\nexport const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2) => QuadraticPolynomial =\n internal.fromPoints\n\nexport const solve: {\n /**\n * Solves the quadratic polynomial for a given x value.\n *\n * @param p - The quadratic polynomial.\n * @param x - The x value to solve for.\n * @returns The result of the polynomial at the given x value.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, x: number): number\n /**\n * Solves the quadratic polynomial for a given x value.\n *\n * @param x - The x value to solve for.\n * @returns A function that takes a quadratic polynomial and returns the result of the polynomial at the given x value.\n * @since 1.0.0\n */\n (x: number): (p: QuadraticPolynomial) => number\n} = internal.solve\n\n/**\n * Creates a solver function for the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns A function that takes an x value and returns the result of the polynomial at that x value.\n */\nexport const toSolver: (p: QuadraticPolynomial) => (x: number) => number = internal.toSolver\n\nexport const solveInverse: {\n /**\n * Solves a monotonic quadratic polynomial for a given y value. Because the\n * polynomial is strictly monotonic (either globally, or over the interval\n * the `Monotonic` brand was attached for), the inverse has at most one\n * solution.\n *\n * @param p - The monotonic quadratic polynomial.\n * @param y - The y value to solve for.\n * @returns Zero or one solutions.\n * @since 2.0.0\n */\n <T extends Monotonic>(p: QuadraticPolynomial<T>, y: number): Solution.AtMostOne<number>\n /**\n * Solves the quadratic polynomial for a given y value.\n *\n * @param p - The quadratic polynomial.\n * @param y - The y value to solve for.\n * @returns The solutions to the polynomial at the given y value.\n * @since 1.0.0\n */\n <T>(p: QuadraticPolynomial<T>, y: number): Solution.AtMostTwo<number>\n /**\n * Solves the quadratic polynomial for a given y value.\n *\n * @param y - The y value to solve for.\n * @returns A function that takes a quadratic polynomial and returns the\n * solutions. Tightens to `Solution.AtMostOne<number>` for monotonic inputs.\n * @since 1.0.0\n */\n (y: number): {\n <T extends Monotonic>(p: QuadraticPolynomial<T>): Solution.AtMostOne<number>\n <T>(p: QuadraticPolynomial<T>): Solution.AtMostTwo<number>\n }\n} = internal.solveInverse as never\n\n/**\n * Creates an inverse solver function for the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns A function that takes a y value and returns the solutions to the polynomial at that y value.\n */\nexport const toInverseSolver: (\n p: QuadraticPolynomial,\n) => (y: number) => Solution.AtMostTwo<number> = internal.toInverseSolver\n\n/**\n * Returns the polynomial's coefficients as a tuple `[c0, c1, c2]`.\n *\n * @param p - The quadratic polynomial.\n * @returns The coefficients in monomial order.\n * @since 2.0.0\n */\nexport const coefficients: (p: QuadraticPolynomial) => readonly [number, number, number] =\n internal.coefficients\n\n/**\n * Computes the derivative of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns The derivative of the polynomial as a linear polynomial.\n * @since 1.0.0\n */\nexport const derivative: (p: QuadraticPolynomial) => LinearPolynomial = internal.derivative\n\n/**\n * Finds the roots of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns The roots of the polynomial as a tuple of solutions.\n * @since 1.0.0\n */\nexport const roots: (p: QuadraticPolynomial) => Solution.AtMostTwo<number> = internal.roots\n\n/**\n * Finds the extreme point of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns The extreme point of the polynomial as a solution.\n * @since 1.0.0\n */\nexport const extreme: (p: QuadraticPolynomial) => Vector2 | null = internal.extreme\n\nexport const monotonicity: {\n /**\n * Computes the monotonicity of the quadratic polynomial over a given\n * interval. Throws when the interval has zero width — the question is\n * undefined at a single point.\n *\n * @param p - The quadratic polynomial.\n * @param i - The interval to compute the monotonicity over.\n * @returns The monotonicity of the polynomial over the interval.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, i?: Interval): Monotonicity\n /**\n * Computes the monotonicity of the quadratic polynomial over a given\n * interval. Throws when the interval has zero width.\n *\n * @param i - The interval to compute the monotonicity over.\n * @returns A function that takes a quadratic polynomial and returns the\n * monotonicity of the polynomial over the interval.\n * @since 1.0.0\n */\n (i: Interval): (p: QuadraticPolynomial) => Monotonicity\n} = internal.monotonicity\n\n/**\n * Type-narrowing predicate: refines a `QuadraticPolynomial<T>` to\n * `QuadraticPolynomial<T & Monotonic>` when the polynomial is strictly\n * monotonic over the given interval (or globally, when no interval is given).\n *\n * @param p - The quadratic polynomial to check.\n * @param i - Optional interval over which to check monotonicity.\n * @returns `true` when monotonicity is `'increasing'` or `'decreasing'`.\n * @since 2.0.0\n */\nexport const isMonotonic: {\n <T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Monotonic>\n (i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Monotonic>\n} = internal.isMonotonic\n\n/**\n * Type-narrowing predicate: refines to `QuadraticPolynomial<T & Increasing>`.\n *\n * @since 2.0.0\n */\nexport const isIncreasing: {\n <T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Increasing>\n (i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Increasing>\n} = internal.isIncreasing\n\n/**\n * Type-narrowing predicate: refines to `QuadraticPolynomial<T & Decreasing>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasing: {\n <T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Decreasing>\n (i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Decreasing>\n} = internal.isDecreasing\n\n/**\n * Asserts that the quadratic polynomial is monotonic, throwing on failure.\n *\n * @param p - The quadratic polynomial to assert against.\n * @param i - Optional interval over which to check monotonicity.\n * @returns The same polynomial, typed with the `Monotonic` brand.\n * @throws When the polynomial is not monotonic over the given (or global) interval.\n * @since 2.0.0\n */\nexport const asMonotonic: <T>(\n p: QuadraticPolynomial<T>,\n i?: Interval,\n) => QuadraticPolynomial<T & Monotonic> = internal.asMonotonic\n\n/**\n * Asserts that the quadratic polynomial is increasing, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasing: <T>(\n p: QuadraticPolynomial<T>,\n i?: Interval,\n) => QuadraticPolynomial<T & Increasing> = internal.asIncreasing\n\n/**\n * Asserts that the quadratic polynomial is decreasing, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasing: <T>(\n p: QuadraticPolynomial<T>,\n i?: Interval,\n) => QuadraticPolynomial<T & Decreasing> = internal.asDecreasing\n\nexport const antiderivative: {\n /**\n * Computes the antiderivative of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @param constant - The constant of integration. Defaults to 0.\n * @returns The antiderivative of the polynomial as a cubic polynomial.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, constant?: number): CubicPolynomial\n /**\n * Computes the antiderivative of the quadratic polynomial.\n *\n * @param constant - The constant of integration. Defaults to 0.\n * @returns A function that takes a quadratic polynomial and returns the antiderivative of the polynomial as a cubic polynomial.\n * @since 1.0.0\n */\n (constant: number): (p: QuadraticPolynomial) => CubicPolynomial\n} = internal.antiderivative\n\nexport const domain: {\n /**\n * Computes the domain of the quadratic polynomial over a given range.\n *\n * @param p - The quadratic polynomial.\n * @param range - The range to compute the domain over.\n * @returns The domain of the polynomial over the range.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, range: Interval): Solution.AtMostOne<Interval>\n /**\n * Computes the domain of the quadratic polynomial over a given range.\n *\n * @param range - The range to compute the domain over.\n * @returns A function that takes a quadratic polynomial and returns the domain of the polynomial over the range.\n * @since 1.0.0\n */\n (range: Interval): (p: QuadraticPolynomial) => Solution.AtMostOne<Interval>\n} = internal.domain\n\nexport const range: {\n /**\n * Computes the range of the quadratic polynomial over a given domain.\n *\n * @param p - The quadratic polynomial.\n * @param domain - The domain to compute the range over.\n * @returns The range of the polynomial over the domain.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, domain: Interval): Closed\n /**\n * Computes the range of the quadratic polynomial over a given domain.\n *\n * @param domain - The domain to compute the range over.\n * @returns A function that takes a quadratic polynomial and returns the range of the polynomial over the domain.\n * @since 1.0.0\n */\n (domain: Interval): (p: QuadraticPolynomial) => Closed\n} = internal.range\n\nexport const length: {\n /**\n * Computes the length of the quadratic polynomial over a given interval.\n *\n * @param p - The quadratic polynomial.\n * @param i - The interval to compute the length over.\n * @returns The length of the polynomial over the interval.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, i: Interval): number\n /**\n * Computes the length of the quadratic polynomial over a given interval.\n *\n * @param i - The interval to compute the length over.\n * @returns A function that takes a quadratic polynomial and returns the length of the polynomial over the interval.\n * @since 1.0.0\n */\n (i: Interval): (p: QuadraticPolynomial) => number\n} = internal.length\n\nexport const curvature: {\n /**\n * Computes the curvature of the quadratic polynomial at a given x value.\n *\n * @param p - The quadratic polynomial.\n * @param x - The x value to compute the curvature at.\n * @returns The curvature of the polynomial at the given x value.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, x: number): number\n /**\n * Computes the curvature of the quadratic polynomial at a given x value.\n *\n * @param x - The x value to compute the curvature at.\n * @returns A function that takes a quadratic polynomial and returns the curvature of the polynomial at the given x value.\n * @since 1.0.0\n */\n (x: number): (p: QuadraticPolynomial) => number\n} = internal.curvature\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,qBAA4DA;AAEzE,MAAaC,WAoBTC;;;;;;;;;AAUJ,MAAaC,SAAuDC;;;;;;;;AASpE,MAAaC,eAA+CC;;;;;;;;;AAU5D,MAAa,iBACXC;;;;;;;;;AAUF,MAAaC,eAA6DC;AAE1E,MAAaC,UAkBTC;;;;;;;;AASJ,MAAaC,aAA2DC;AAMxE,MAAaC,iBAyBTC;;;;;;;AAQJ,MAAaC,oBACXC;;;;;;;AAQF,MAAa,QAA6D,MACxEF,eAAsB,GAAG,EAAE;;;;;;;;AAS7B,MAAaG,iBAAgEC;;;;;;;;;AAU7E,MAAaC,gBACXC;;;;;;;;AASF,MAAaC,iBACXC;;;;;;;;AASF,MAAaC,iBACXC;;;;;;;;;AAUF,MAAaC,gBACXC;;;;;;;;;AAUF,MAAaC,iBACXC;;;;;;;;;AAUF,MAAaC,iBACXC;;;;;;;;AASF,MAAaC,iBACXC;;;;;;;;AASF,MAAaC,eAA8CC;AAE3D,MAAaC,mBAkBTC;AAEJ,MAAaC,WAkBTC;AAEJ,MAAaC,UAkBTC;AAEJ,MAAaC,WAkBTC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnTJ,MAAa,wBACXC;AAEF,MAAa,SAoBTC;;;;;;;;;;AAWJ,MAAa,OAAuEC;;;;;;;;AASpF,MAAa,aAAkDC;;;;;;;;;;;;AAa/D,MAAa,aACXC;AAEF,MAAa,QAkBTC;;;;;;;AAQJ,MAAa,WAA8DC;AAE3E,MAAa,eAkCTC;;;;;;;AAQJ,MAAa,kBAEoCC;;;;;;;;AASjD,MAAa,eACXC;;;;;;;;AASF,MAAa,aAA2DC;;;;;;;;AASxE,MAAa,QAAgEC;;;;;;;;AAS7E,MAAa,UAAsDC;AAEnE,MAAa,eAsBTC;;;;;;;;;;;AAYJ,MAAa,cAGTC;;;;;;AAOJ,MAAa,eAGTC;;;;;;AAOJ,MAAa,eAGTC;;;;;;;;;;AAWJ,MAAa,cAG6BC;;;;;;AAO1C,MAAa,eAG8BC;;;;;;AAO3C,MAAa,eAG8BC;AAE3C,MAAa,iBAkBTC;AAEJ,MAAa,SAkBTC;AAEJ,MAAa,QAkBTC;AAEJ,MAAa,SAkBTC;AAEJ,MAAa,YAkBTC"}
@@ -0,0 +1,60 @@
1
+ import { t as Pipeable } from "./utils-MCckigYk.mjs";
2
+ import { n as CubicCurve2d, t as RationalCubicCurve2d } from "./rationalCubic2d-MgMSJaAU.mjs";
3
+
4
+ //#region src/path/traits.d.ts
5
+ /**
6
+ * Phantom property key used by path interfaces to hold their `Trait` type
7
+ * parameter. The runtime object never has a value at this key.
8
+ *
9
+ * @since 2.0.0
10
+ */
11
+ declare const PathTraits: unique symbol;
12
+ type PathTraits = typeof PathTraits;
13
+ //#endregion
14
+ //#region src/path/cubic2d.internal.d.ts
15
+ declare const CubicPath2dTypeId: unique symbol;
16
+ type CubicPath2dTypeId = typeof CubicPath2dTypeId;
17
+ //#endregion
18
+ //#region src/path/cubic2d.d.ts
19
+ /**
20
+ * A cubic path in 2D space.
21
+ *
22
+ * All fields are readonly and immutable, and all operations create new instances.
23
+ *
24
+ * The `Trait` type parameter accumulates trait brands as the path is refined
25
+ * via `isContinuous` / `asContinuous`.
26
+ *
27
+ * @since 1.0.0
28
+ */
29
+ interface CubicPath2d<out Trait = unknown> extends Pipeable, Iterable<CubicCurve2d> {
30
+ readonly [CubicPath2dTypeId]: CubicPath2dTypeId;
31
+ readonly [PathTraits]: Trait;
32
+ }
33
+ //#endregion
34
+ //#region src/path/rationalCubic2d.internal.d.ts
35
+ declare const RationalCubicPath2dTypeId: unique symbol;
36
+ type RationalCubicPath2dTypeId = typeof RationalCubicPath2dTypeId;
37
+ //#endregion
38
+ //#region src/path/rationalCubic2d.d.ts
39
+ /**
40
+ * A rational cubic path in 2D space.
41
+ *
42
+ * Holds a non-empty sequence of `RationalCubicCurve2d` segments; iteration
43
+ * yields the segments in order. The path parameter `u ∈ [0, 1]` is mapped
44
+ * uniformly across segments — `u = 0` is the start of the first segment,
45
+ * `u = 1` is the end of the last segment, and intermediate values pick a
46
+ * segment by index and a local parameter within it.
47
+ *
48
+ * Counterpart to `CubicPath2d` for curves whose evaluation includes the
49
+ * homogeneous-to-plane projection.
50
+ *
51
+ * All fields are readonly and immutable, and all operations create new instances.
52
+ *
53
+ * @since 2.0.0
54
+ */
55
+ interface RationalCubicPath2d extends Pipeable, Iterable<RationalCubicCurve2d> {
56
+ readonly [RationalCubicPath2dTypeId]: RationalCubicPath2dTypeId;
57
+ }
58
+ //#endregion
59
+ export { CubicPath2d as n, PathTraits as r, RationalCubicPath2d as t };
60
+ //# sourceMappingURL=rationalCubic2d-D-UevGKu.d.mts.map