curvy 2.0.0-alpha.2 → 2.0.0-alpha.5

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 (98) hide show
  1. package/dist/characteristic/{index.d.mts → characteristic.d.ts} +15 -23
  2. package/dist/characteristic/index.d.ts +1 -0
  3. package/dist/characteristic/index.mjs +1 -1
  4. package/dist/curve/cubic2d.d.ts +219 -0
  5. package/dist/curve/index.d.ts +12 -0
  6. package/dist/curve/index.mjs +1 -1
  7. package/dist/curve/linear2d.d.ts +199 -0
  8. package/dist/curve/quadratic2d.d.ts +227 -0
  9. package/dist/curve/rationalCubic2d.d.ts +200 -0
  10. package/dist/dimensions.d.ts +23 -0
  11. package/dist/interval/index.d.ts +6 -0
  12. package/dist/interval/index.mjs +2 -2
  13. package/dist/interval/interval.d.ts +525 -0
  14. package/dist/interval/interval2d.d.ts +167 -0
  15. package/dist/length.d.ts +32 -0
  16. package/dist/matrix/index.d.ts +9 -0
  17. package/dist/matrix/matrix2x2.d.ts +339 -0
  18. package/dist/matrix/matrix3x3.d.ts +400 -0
  19. package/dist/matrix/matrix4x4.d.ts +443 -0
  20. package/dist/number.d.ts +276 -0
  21. package/dist/path/cubic2d.d.ts +155 -0
  22. package/dist/path/index.d.ts +12 -0
  23. package/dist/path/index.mjs +6 -6
  24. package/dist/path/index.mjs.map +1 -1
  25. package/dist/path/linear2d.d.ts +135 -0
  26. package/dist/path/quadratic2d.d.ts +127 -0
  27. package/dist/path/rationalCubic2d.d.ts +120 -0
  28. package/dist/path/traits.d.ts +31 -0
  29. package/dist/polynomial/cubic.d.ts +381 -0
  30. package/dist/polynomial/index.d.ts +9 -0
  31. package/dist/polynomial/index.mjs +2 -2
  32. package/dist/polynomial/linear.d.ts +321 -0
  33. package/dist/polynomial/monotonicity.d.ts +3 -0
  34. package/dist/polynomial/quadratic.d.ts +375 -0
  35. package/dist/polynomial/traits.d.ts +56 -0
  36. package/dist/shared/{characteristic-B9nCh_cx.mjs → characteristic-DLlhja-I.mjs} +9 -9
  37. package/dist/shared/{characteristic-B9nCh_cx.mjs.map → characteristic-DLlhja-I.mjs.map} +1 -1
  38. package/dist/shared/{cubic-CpHAx8cC.mjs → cubic-CMonq6bg.mjs} +26 -5
  39. package/dist/shared/cubic-CMonq6bg.mjs.map +1 -0
  40. package/dist/shared/{interval-05CR6eBf.mjs → interval-X1EYuf-T.mjs} +2 -2
  41. package/dist/shared/{interval-05CR6eBf.mjs.map → interval-X1EYuf-T.mjs.map} +1 -1
  42. package/dist/shared/{interval2d-8IBZnUOq.mjs → interval2d-ca0J1NMr.mjs} +8 -8
  43. package/dist/shared/{interval2d-8IBZnUOq.mjs.map → interval2d-ca0J1NMr.mjs.map} +1 -1
  44. package/dist/shared/{quadratic-CamozcFc.mjs → quadratic-DyeMtvET.mjs} +20 -2
  45. package/dist/shared/quadratic-DyeMtvET.mjs.map +1 -0
  46. package/dist/shared/{rationalCubic2d-Bys2Uory.mjs → rationalCubic2d-D658ltUM.mjs} +17 -17
  47. package/dist/shared/{rationalCubic2d-Bys2Uory.mjs.map → rationalCubic2d-D658ltUM.mjs.map} +1 -1
  48. package/dist/shared/{rationalCubic2d-BEgUGSFf.mjs → rationalCubic2d-Vw4qGPZj.mjs} +9 -9
  49. package/dist/shared/{rationalCubic2d-BEgUGSFf.mjs.map → rationalCubic2d-Vw4qGPZj.mjs.map} +1 -1
  50. package/dist/shared/{solution-CrtLfqEq.mjs → solution-3TDATEMn.mjs} +28 -2
  51. package/dist/shared/solution-3TDATEMn.mjs.map +1 -0
  52. package/dist/shared/{vector2-CL1HDdPr.mjs → vector2-CCuJx1rX.mjs} +6 -6
  53. package/dist/shared/{vector2-CL1HDdPr.mjs.map → vector2-CCuJx1rX.mjs.map} +1 -1
  54. package/dist/shared/{vector3-D-tv_aKL.mjs → vector3-C-qgKAjR.mjs} +2 -2
  55. package/dist/shared/{vector3-D-tv_aKL.mjs.map → vector3-C-qgKAjR.mjs.map} +1 -1
  56. package/dist/shared/{vector4-5KbjoHVj.mjs → vector4-BhOKDhD5.mjs} +2 -2
  57. package/dist/shared/{vector4-5KbjoHVj.mjs.map → vector4-BhOKDhD5.mjs.map} +1 -1
  58. package/dist/solution/index.d.ts +3 -0
  59. package/dist/solution/index.mjs +1 -1
  60. package/dist/{shared/solution-sNQ-ZVhN.d.mts → solution/solution.d.ts} +81 -68
  61. package/dist/splines/basis2d.d.ts +122 -0
  62. package/dist/splines/bezier2d.d.ts +202 -0
  63. package/dist/splines/cardinal2d.d.ts +273 -0
  64. package/dist/splines/hermite2d.d.ts +117 -0
  65. package/dist/splines/index.d.ts +15 -0
  66. package/dist/splines/index.mjs +193 -35
  67. package/dist/splines/index.mjs.map +1 -1
  68. package/dist/splines/rationalBezier2d.d.ts +148 -0
  69. package/dist/splines/util.d.ts +5 -0
  70. package/dist/utils.d.ts +73 -0
  71. package/dist/vector/index.d.ts +9 -0
  72. package/dist/vector/index.mjs +3 -3
  73. package/dist/vector/vector2.d.ts +446 -0
  74. package/dist/vector/vector3.d.ts +449 -0
  75. package/dist/vector/vector4.d.ts +253 -0
  76. package/package.json +13 -13
  77. package/dist/curve/index.d.mts +0 -2
  78. package/dist/interval/index.d.mts +0 -3
  79. package/dist/matrix/index.d.mts +0 -2
  80. package/dist/number.d.mts +0 -280
  81. package/dist/path/index.d.mts +0 -261
  82. package/dist/polynomial/index.d.mts +0 -2
  83. package/dist/shared/cubic-BajUY0JT.d.mts +0 -1100
  84. package/dist/shared/cubic-CpHAx8cC.mjs.map +0 -1
  85. package/dist/shared/interval-Dy-RMEE3.d.mts +0 -533
  86. package/dist/shared/interval2d-C2id9u31.d.mts +0 -172
  87. package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +0 -1183
  88. package/dist/shared/quadratic-CamozcFc.mjs.map +0 -1
  89. package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +0 -308
  90. package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +0 -818
  91. package/dist/shared/solution-CrtLfqEq.mjs.map +0 -1
  92. package/dist/shared/utils-MCckigYk.d.mts +0 -76
  93. package/dist/shared/vector2-DPUY3_eA.d.mts +0 -470
  94. package/dist/shared/vector3-DqeOZtOB.d.mts +0 -703
  95. package/dist/solution/index.d.mts +0 -2
  96. package/dist/splines/index.d.mts +0 -701
  97. package/dist/utils.d.mts +0 -2
  98. package/dist/vector/index.d.mts +0 -3
@@ -1 +0,0 @@
1
- {"version":3,"file":"solution-CrtLfqEq.mjs","names":["none","one","two","three","fromArray","isNone","isSome","valueOrUndefined","last","min","max","unsafeLast","unsafeMin","unsafeMax","filter","clip","Interval.contains","map","match","internal.none","internal.one","internal.two","internal.three","internal.fromArray","internal.isNone","internal.isSome","internal.valueOrUndefined","internal.last","internal.min","internal.max","internal.unsafeLast","internal.unsafeMin","internal.unsafeMax","internal.filter","internal.clip","internal.map","internal.match"],"sources":["../../src/solution/solution.internal.ts","../../src/solution/solution.ts"],"sourcesContent":["import * as Interval from '../interval/interval'\nimport { dual, Pipeable } from '../utils'\nimport type {\n AtMostOne,\n AtMostThree,\n AtMostTwo,\n None,\n One,\n Solution,\n Some,\n Three,\n Two,\n} from './solution'\nimport { invariant } from '../utils'\n\n// Empty iterator — shared across all None instances since None has no data.\nconst EMPTY_ITERATOR: Iterator<never> = {\n next: () => ({ done: true, value: undefined as never }),\n}\n\nclass NoneImpl extends Pipeable implements None {\n readonly _tag = 'none' as const\n readonly length = 0 as const;\n\n [Symbol.iterator](): Iterator<never> {\n return EMPTY_ITERATOR\n }\n}\n\nclass OneImpl<T> extends Pipeable implements One<T> {\n readonly _tag = 'one' as const\n readonly length = 1 as const\n\n constructor(readonly value: T) {\n super()\n }\n\n [Symbol.iterator](): Iterator<T> {\n return [this.value][Symbol.iterator]()\n }\n}\n\nclass TwoImpl<T> extends Pipeable implements Two<T> {\n readonly _tag = 'two' as const\n readonly length = 2 as const\n\n constructor(readonly values: readonly [T, T]) {\n super()\n }\n\n get value(): T {\n return this.values[0]\n }\n\n [Symbol.iterator](): Iterator<T> {\n return this.values[Symbol.iterator]()\n }\n}\n\nclass ThreeImpl<T> extends Pipeable implements Three<T> {\n readonly _tag = 'three' as const\n readonly length = 3 as const\n\n constructor(readonly values: readonly [T, T, T]) {\n super()\n }\n\n get value(): T {\n return this.values[0]\n }\n\n [Symbol.iterator](): Iterator<T> {\n return this.values[Symbol.iterator]()\n }\n}\n\nexport const NONE_INSTANCE: None = new NoneImpl()\n\nexport const none: None = NONE_INSTANCE\n\nexport const one = <T>(value: T): One<T> => new OneImpl(value)\n\nexport const two = <T>(a: T, b: T): Two<T> => new TwoImpl([a, b])\n\nexport const three = <T>(a: T, b: T, c: T): Three<T> => new ThreeImpl([a, b, c])\n\nexport const fromArray = <T>(arr: ReadonlyArray<T>): Solution<T> => {\n switch (arr.length) {\n case 0:\n return NONE_INSTANCE\n case 1:\n return one(arr[0] as T)\n case 2:\n return two(arr[0] as T, arr[1] as T)\n case 3:\n return three(arr[0] as T, arr[1] as T, arr[2] as T)\n default:\n invariant(false, `Solution can hold at most 3 values, got ${arr.length}`)\n }\n}\n\nexport const isNone = <T>(s: Solution<T>): s is None => s._tag === 'none'\n\nexport const isSome = <T>(s: Solution<T>): s is Some<T> => s._tag !== 'none'\n\nexport const valueOrUndefined = <T>(s: Solution<T>): T | undefined =>\n isNone(s) ? undefined : s.value\n\nexport const last: {\n <T>(s: Some<T>): T\n <T>(s: Solution<T>): T | undefined\n} = (<T>(s: Solution<T>): T | undefined => {\n switch (s._tag) {\n case 'none':\n return undefined\n case 'one':\n return s.value\n case 'two':\n return s.values[1]\n case 'three':\n return s.values[2]\n }\n}) as never\n\nexport const min: {\n (s: Some<number>): number\n (s: Solution<number>): number | undefined\n} = ((s: Solution<number>): number | undefined => {\n switch (s._tag) {\n case 'none':\n return undefined\n case 'one':\n return s.value\n case 'two':\n return Math.min(s.values[0], s.values[1])\n case 'three':\n return Math.min(s.values[0], s.values[1], s.values[2])\n }\n}) as never\n\nexport const max: {\n (s: Some<number>): number\n (s: Solution<number>): number | undefined\n} = ((s: Solution<number>): number | undefined => {\n switch (s._tag) {\n case 'none':\n return undefined\n case 'one':\n return s.value\n case 'two':\n return Math.max(s.values[0], s.values[1])\n case 'three':\n return Math.max(s.values[0], s.values[1], s.values[2])\n }\n}) as never\n\nexport const unsafeLast = <T>(s: Solution<T>): T => {\n invariant(isSome(s), 'Solution.unsafeLast on empty Solution')\n return last(s)\n}\n\nexport const unsafeMin = (s: Solution<number>): number => {\n invariant(isSome(s), 'Solution.unsafeMin on empty Solution')\n return min(s)\n}\n\nexport const unsafeMax = (s: Solution<number>): number => {\n invariant(isSome(s), 'Solution.unsafeMax on empty Solution')\n return max(s)\n}\n\nexport const filter = <T>(s: Solution<T>, predicate: (v: T) => boolean): Solution<T> => {\n switch (s._tag) {\n case 'none':\n return s\n case 'one':\n return predicate(s.value) ? s : NONE_INSTANCE\n case 'two': {\n const a = predicate(s.values[0])\n const b = predicate(s.values[1])\n if (a && b) {\n return s\n }\n if (a) {\n return one(s.values[0])\n }\n if (b) {\n return one(s.values[1])\n }\n return NONE_INSTANCE\n }\n case 'three': {\n const survivors: Array<T> = []\n if (predicate(s.values[0])) {\n survivors.push(s.values[0])\n }\n if (predicate(s.values[1])) {\n survivors.push(s.values[1])\n }\n if (predicate(s.values[2])) {\n survivors.push(s.values[2])\n }\n return fromArray(survivors)\n }\n }\n}\n\nexport const clip = dual(\n 2,\n (s: Solution<number>, i: Interval.Interval): Solution<number> =>\n filter(s, (v) => Interval.contains(i, v)),\n)\n\nexport const map = dual(2, <A, B>(s: Solution<A>, f: (v: A) => B): Solution<B> => {\n switch (s._tag) {\n case 'none':\n return s\n case 'one':\n return one(f(s.value))\n case 'two':\n return two(f(s.values[0]), f(s.values[1]))\n case 'three':\n return three(f(s.values[0]), f(s.values[1]), f(s.values[2]))\n }\n})\n\nexport const match = dual(\n 2,\n <T, A, B>(\n self: Solution<T>,\n matcher: { readonly onNone: () => A; readonly onSome: (s: Some<T>) => B },\n ): A | B => (isNone(self) ? matcher.onNone() : matcher.onSome(self)),\n)\n\n// Re-export type aliases that the namespace consumers expect to see at runtime.\n// (Pure type re-exports — no runtime cost.)\nexport type { AtMostOne, AtMostThree, AtMostTwo, None, One, Solution, Some, Three, Two }\n","import type { Interval } from '../interval/interval'\nimport type { Pipeable } from '../utils'\nimport * as internal from './solution.internal'\n\n/**\n * A `Solution<T>` represents the result of an operation that may produce\n * between zero and three values of `T`. It generalizes the zoo of \"0 or 1\",\n * \"0 to 2\", \"0 to 3\" return shapes used throughout curvy under one type, and\n * provides a small namespace of operations (`value`, `last`, `min`, `max`,\n * `filter`, `map`, `match`, …) for working with the result.\n *\n * Each variant carries a `_tag` discriminator and a `length` field, is\n * iterable via `Symbol.iterator` (so existing `for..of` and spread patterns\n * keep working), and is `Pipeable` (so a `Solution` value can be the head of\n * a `pipe` chain).\n *\n * Variant-specific accessors:\n * - `One<T>`, `Two<T>`, and `Three<T>` all expose `.value: T` (the first /\n * primary value).\n * - `Two<T>` and `Three<T>` additionally expose `.values: readonly [T, ...]`\n * for explicit positional access.\n *\n * Operations that return narrower cardinalities (e.g. inverse-solving a\n * monotonic polynomial) use the `AtMost{One,Two,Three}` aliases to express\n * \"this could be empty, but it'll have at most N values.\"\n *\n * @since 2.0.0\n */\nexport type Solution<T> = None | One<T> | Two<T> | Three<T>\n\n/**\n * The empty solution.\n *\n * @since 2.0.0\n */\nexport interface None extends Pipeable, Iterable<never> {\n readonly _tag: 'none'\n readonly length: 0\n}\n\n/** @since 2.0.0 */\nexport interface One<T> extends Pipeable, Iterable<T> {\n readonly _tag: 'one'\n readonly length: 1\n readonly value: T\n}\n\n/** @since 2.0.0 */\nexport interface Two<T> extends Pipeable, Iterable<T> {\n readonly _tag: 'two'\n readonly length: 2\n readonly value: T\n readonly values: readonly [T, T]\n}\n\n/** @since 2.0.0 */\nexport interface Three<T> extends Pipeable, Iterable<T> {\n readonly _tag: 'three'\n readonly length: 3\n readonly value: T\n readonly values: readonly [T, T, T]\n}\n\n/**\n * Any non-empty solution. All `Some<T>` values expose `.value: T` directly —\n * no narrowing required to read the primary value.\n *\n * @since 2.0.0\n */\nexport type Some<T> = One<T> | Two<T> | Three<T>\n\n/**\n * `None | One<T>` — return type of operations that produce at most one value\n * (e.g. inverse-solving a strictly monotonic polynomial).\n *\n * @since 2.0.0\n */\nexport type AtMostOne<T> = None | One<T>\n\n/**\n * `None | One<T> | Two<T>` — return type of operations that produce at most\n * two values (e.g. inverse-solving an unrestricted quadratic polynomial).\n *\n * @since 2.0.0\n */\nexport type AtMostTwo<T> = None | One<T> | Two<T>\n\n/**\n * `None | One<T> | Two<T> | Three<T>` — equivalent to `Solution<T>`.\n *\n * @since 2.0.0\n */\nexport type AtMostThree<T> = Solution<T>\n\n/**\n * The empty solution. Reused across calls — never reallocated.\n *\n * @since 2.0.0\n */\nexport const none: None = internal.none\n\n/**\n * Constructs a single-value solution.\n *\n * @since 2.0.0\n */\nexport const one: <T>(value: T) => One<T> = internal.one\n\n/**\n * Constructs a two-value solution.\n *\n * @since 2.0.0\n */\nexport const two: <T>(a: T, b: T) => Two<T> = internal.two\n\n/**\n * Constructs a three-value solution.\n *\n * @since 2.0.0\n */\nexport const three: <T>(a: T, b: T, c: T) => Three<T> = internal.three\n\n/**\n * Constructs a `Solution<T>` from a runtime array. Throws if the array has\n * more than three elements.\n *\n * @since 2.0.0\n */\nexport const fromArray: <T>(arr: ReadonlyArray<T>) => Solution<T> = internal.fromArray\n\n/**\n * Type-narrowing predicate: refines `Solution<T>` to `None`.\n *\n * @since 2.0.0\n */\nexport const isNone: <T>(s: Solution<T>) => s is None = internal.isNone\n\n/**\n * Type-narrowing predicate: refines `Solution<T>` to `Some<T>` (non-empty).\n * After narrowing, `.value` is directly accessible without further checks.\n *\n * @since 2.0.0\n */\nexport const isSome: <T>(s: Solution<T>) => s is Some<T> = internal.isSome\n\n/**\n * Returns the primary (first) value if the solution is non-empty, or\n * `undefined` if empty. Pair with `.value` access on `Some<T>`-narrowed\n * inputs to avoid the `undefined` possibility.\n *\n * @since 2.0.0\n */\nexport const valueOrUndefined: <T>(s: Solution<T>) => T | undefined = internal.valueOrUndefined\n\n/**\n * Returns the last value in the solution, or `undefined` if empty. When\n * called on a `Some<T>`, the result is guaranteed to be `T`.\n *\n * @since 2.0.0\n */\nexport const last: {\n <T>(s: Some<T>): T\n <T>(s: Solution<T>): T | undefined\n} = internal.last\n\n/**\n * Returns the smallest numeric value in the solution, or `undefined` if empty.\n * When called on a `Some<number>`, the result is guaranteed to be `number`.\n *\n * @since 2.0.0\n */\nexport const min: {\n (s: Some<number>): number\n (s: Solution<number>): number | undefined\n} = internal.min\n\n/**\n * Returns the largest numeric value in the solution, or `undefined` if empty.\n * When called on a `Some<number>`, the result is guaranteed to be `number`.\n *\n * @since 2.0.0\n */\nexport const max: {\n (s: Some<number>): number\n (s: Solution<number>): number | undefined\n} = internal.max\n\n/**\n * Returns the last value in the solution. Throws if empty.\n *\n * @since 2.0.0\n */\nexport const unsafeLast: <T>(s: Solution<T>) => T = internal.unsafeLast\n\n/**\n * Returns the smallest numeric value in the solution. Throws on empty.\n *\n * @since 2.0.0\n */\nexport const unsafeMin: (s: Solution<number>) => number = internal.unsafeMin\n\n/**\n * Returns the largest numeric value in the solution. Throws on empty.\n *\n * @since 2.0.0\n */\nexport const unsafeMax: (s: Solution<number>) => number = internal.unsafeMax\n\n/**\n * Filters the solution by a predicate. Result cardinality is at most that of\n * the input.\n *\n * @since 2.0.0\n */\nexport const filter: <T>(s: Solution<T>, predicate: (v: T) => boolean) => Solution<T> =\n internal.filter\n\n/**\n * Restricts the solution to values contained within an interval. Endpoint\n * inclusivity follows the interval's `kind` — pass an open variant (e.g.\n * `Interval.makeOpen(0, 1)` or `Interval.unitOpen`) for strict containment.\n *\n * @param s - The solution to clip.\n * @param i - The interval to retain values within.\n * @since 2.0.0\n */\nexport const clip: {\n (i: Interval): (s: Solution<number>) => Solution<number>\n (s: Solution<number>, i: Interval): Solution<number>\n} = internal.clip\n\n/**\n * Maps every value in the solution to a new value. Result cardinality matches\n * the input.\n *\n * @since 2.0.0\n */\nexport const map: {\n <A, B>(s: Solution<A>, f: (v: A) => B): Solution<B>\n <A, B>(f: (v: A) => B): (s: Solution<A>) => Solution<B>\n} = internal.map\n\n// Drops `None` from the union of the input solution type — used by `match` to\n// give `onSome` a tighter parameter type. Distributive: a `Solution.AtMostOne<T>`\n// becomes `One<T>`; a full `Solution<T>` keeps `Some<T>`.\ntype SomeOf<S> = S extends None ? never : S\n\n/**\n * Pattern matches on a solution, calling `onNone` for the empty case and\n * `onSome` for any non-empty case. The `onSome` parameter is typed against\n * the input's narrowed shape — for an `AtMostOne<T>` input, `onSome` receives\n * `One<T>` and can read `.value` directly.\n *\n * @example\n * ```ts\n * const result = polynomial.pipe(\n * LinearPolynomial.solveInverse(0),\n * Solution.match({\n * onNone: () => null,\n * onSome: ({ value }) => Math.abs(value),\n * }),\n * )\n * ```\n *\n * @since 2.0.0\n */\nexport const match: {\n <S extends Solution<unknown>, A, B>(\n self: S,\n matcher: { readonly onNone: () => A; readonly onSome: (s: SomeOf<S>) => B },\n ): A | B\n <S extends Solution<unknown>, A, B>(matcher: {\n readonly onNone: () => A\n readonly onSome: (s: SomeOf<S>) => B\n }): (self: S) => A | B\n} = internal.match as never\n"],"mappings":";;;;AAgBA,MAAM,iBAAkC,EACtC,aAAa;CAAE,MAAM;CAAM,OAAO,KAAA;CAAoB,GACvD;AAED,IAAM,WAAN,cAAuB,SAAyB;CAC9C,OAAgB;CAChB,SAAkB;CAElB,CAAC,OAAO,YAA6B;EACnC,OAAO;;;AAIX,IAAM,UAAN,cAAyB,SAA2B;CAI7B;CAHrB,OAAgB;CAChB,SAAkB;CAElB,YAAY,OAAmB;EAC7B,OAAO;EADY,KAAA,QAAA;;CAIrB,CAAC,OAAO,YAAyB;EAC/B,OAAO,CAAC,KAAK,MAAM,CAAC,OAAO,WAAW;;;AAI1C,IAAM,UAAN,cAAyB,SAA2B;CAI7B;CAHrB,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AO1D,MAAa,YAA6CC;;;;;;;AAQ1D,MAAa,SACXC;;;;;;;;;;AAWF,MAAa,OAGTC;;;;;;;AAQJ,MAAa,MAGTC;;;;;;;;;;;;;;;;;;;;AA0BJ,MAAa,QASTC"}
@@ -1,76 +0,0 @@
1
- //#region src/utils.d.ts
2
- /**
3
- * pipe() and dual() are slightly modified versions of Effect-TS's pipe() and dual() functions.
4
- * https://github.com/effect-ts/core/blob/main/src/function.ts
5
- *
6
- * The original versions are licensed under the MIT license.
7
- * This version is licensed under the MIT license.
8
- */
9
- type AnyFunction = (...args: Array<any>) => any;
10
- declare const dual: {
11
- <DataLast extends AnyFunction, DataFirst extends AnyFunction>(arity: Parameters<DataFirst>['length'], body: DataFirst): DataLast & DataFirst;
12
- <DataLast extends AnyFunction, DataFirst extends AnyFunction>(isDataFirst: (args: IArguments) => boolean, body: DataFirst): DataLast & DataFirst;
13
- };
14
- declare function pipe<A>(a: A): A;
15
- declare function pipe<A, B = never>(a: A, ab: (a: A) => B): B;
16
- declare function pipe<A, B = never, C = never>(a: A, ab: (a: A) => B, bc: (b: B) => C): C;
17
- declare function pipe<A, B = never, C = never, D = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D;
18
- declare function pipe<A, B = never, C = never, D = never, E = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): E;
19
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F): F;
20
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G): G;
21
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H): H;
22
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): I;
23
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): J;
24
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): K;
25
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): L;
26
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): M;
27
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): N;
28
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): O;
29
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): P;
30
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): Q;
31
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): R;
32
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): S;
33
- declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): T;
34
- declare class Pipeable {
35
- pipe<A>(this: A): A;
36
- pipe<A, B = never>(this: A, ab: (_: A) => B): B;
37
- pipe<A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C;
38
- pipe<A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D;
39
- pipe<A, B = never, C = never, D = never, E = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E): E;
40
- pipe<A, B = never, C = never, D = never, E = never, F = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F): F;
41
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G): G;
42
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H): H;
43
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I): I;
44
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J): J;
45
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K): K;
46
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L): L;
47
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M): M;
48
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N): N;
49
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O): O;
50
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P): P;
51
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q): Q;
52
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R): R;
53
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S): S;
54
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S, st: (_: S) => T): T;
55
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never, U = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S, st: (_: S) => T, tu: (_: T) => U): U;
56
- pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never, U = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R, rs: (_: R) => S, st: (_: S) => T, tu: (_: T) => U): U;
57
- }
58
- /**
59
- * Asserts that a condition is true, throwing an error with the provided message if it is not.
60
- *
61
- * @param condition - The condition to assert.
62
- * @param message - The error message to throw if the condition is false.
63
- * @throws An error with the provided message if the condition is false.
64
- * @example
65
- * ```ts
66
- * import { invariant } from 'curvy/utils'
67
- *
68
- * invariant(1 + 1 === 2, 'Math is broken!') // No error
69
- * invariant(1 + 1 === 3, 'Math is broken!') // Throws: Math is broken!
70
- * ```
71
- * @since 1.0.0
72
- */
73
- declare function invariant(condition: boolean, message: string): asserts condition;
74
- //#endregion
75
- export { pipe as i, dual as n, invariant as r, Pipeable as t };
76
- //# sourceMappingURL=utils-MCckigYk.d.mts.map
@@ -1,470 +0,0 @@
1
- import { t as Pipeable } from "./utils-MCckigYk.mjs";
2
-
3
- //#region src/dimensions.d.ts
4
- type TwoDimensionalIndex = 0 | 1;
5
- type TwoDimensionalComponent = 'x' | 'y';
6
- interface TwoDimensional<out T1, out T2 = T1> {
7
- readonly x: T1;
8
- readonly y: T2;
9
- readonly 0: T1;
10
- readonly 1: T2;
11
- }
12
- type ThreeDimensionalIndex = TwoDimensionalIndex | 2;
13
- type ThreeDimensionalComponent = TwoDimensionalComponent | 'z';
14
- interface ThreeDimensional<out T1, out T2 = T1, out T3 = T2> extends TwoDimensional<T1, T2> {
15
- readonly z: T3;
16
- readonly 2: T3;
17
- }
18
- type FourDimensionalIndex = ThreeDimensionalIndex | 3;
19
- type FourDimensionalComponent = ThreeDimensionalComponent | 'w';
20
- interface FourDimensional<out T1, out T2 = T1, out T3 = T2, out T4 = T3> extends ThreeDimensional<T1, T2, T3> {
21
- readonly w: T4;
22
- readonly 3: T4;
23
- }
24
- //#endregion
25
- //#region src/vector/vector2.internal.d.ts
26
- declare const Vector2TypeId: unique symbol;
27
- type Vector2TypeId = typeof Vector2TypeId;
28
- declare const WeightedVector2TypeId: unique symbol;
29
- type WeightedVector2TypeId = typeof WeightedVector2TypeId;
30
- declare namespace vector2_d_exports {
31
- export { Vector2, Weighted, add, components, cross, dot, equals, fromPolar, getR, getTheta, getX, getY, hadamard, isVector2, isWeighted, magnitude, make, makeWeighted, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, transpose, unit, unweighted, weightedEquals, withWeight, zero };
32
- }
33
- /**
34
- * A 2D vector.
35
- *
36
- * All fields are readonly and immutable, and all operations create new instances.
37
- *
38
- * @since 1.0.0
39
- */
40
- interface Vector2 extends Pipeable, TwoDimensional<number> {
41
- readonly [Vector2TypeId]: Vector2TypeId;
42
- }
43
- /**
44
- * A 2D point with an associated positive scalar weight.
45
- *
46
- * Used by rational primitives (e.g. `RationalBezier2d`) where each control
47
- * point carries an influence weight. The interface is structurally distinct
48
- * from `Vector2` — its brand prevents accidental use with vector arithmetic
49
- * (`add`, `subtract`, `scale`, etc.) where weighted operations are not
50
- * well-defined.
51
- *
52
- * Construct via {@link makeWeighted} (from raw components) or
53
- * {@link withWeight} (from an existing `Vector2`).
54
- *
55
- * @since 2.1.0
56
- */
57
- interface Weighted extends Pipeable {
58
- readonly [WeightedVector2TypeId]: WeightedVector2TypeId;
59
- readonly x: number;
60
- readonly y: number;
61
- readonly weight: number;
62
- }
63
- /**
64
- * Checks if a value is a `Vector2`.
65
- *
66
- * @param v - The value to check.
67
- * @returns `true` if the value is a `Vector2`, `false` otherwise.
68
- * @since 1.0.0
69
- */
70
- declare const isVector2: (v: unknown) => v is Vector2;
71
- /**
72
- * Checks if a value is a `Vector2.Weighted`.
73
- *
74
- * @param v - The value to check.
75
- * @returns `true` if the value is a `Vector2.Weighted`, `false` otherwise.
76
- * @since 2.1.0
77
- */
78
- declare const isWeighted: (v: unknown) => v is Weighted;
79
- /**
80
- * Creates a new `Vector2.Weighted` from raw components. The weight must be
81
- * finite and positive.
82
- *
83
- * @param x - The x component.
84
- * @param y - The y component.
85
- * @param weight - The positive scalar weight.
86
- * @returns A new `Vector2.Weighted` instance.
87
- * @since 2.1.0
88
- */
89
- declare const makeWeighted: (x: number, y: number, weight: number) => Weighted;
90
- declare const withWeight: {
91
- /**
92
- * Promotes a `Vector2` to a `Vector2.Weighted` by attaching the given
93
- * positive scalar weight.
94
- *
95
- * @param v - The point to weight.
96
- * @param weight - The positive scalar weight.
97
- * @returns A new `Vector2.Weighted` instance.
98
- * @since 2.1.0
99
- */
100
- (v: Vector2, weight: number): Weighted;
101
- /**
102
- * Promotes a `Vector2` to a `Vector2.Weighted` by attaching the given
103
- * positive scalar weight.
104
- *
105
- * @param weight - The positive scalar weight.
106
- * @returns A function that takes a `Vector2` and returns a weighted point.
107
- * @since 2.1.0
108
- */
109
- (weight: number): (v: Vector2) => Weighted;
110
- };
111
- /**
112
- * Strips the weight from a `Vector2.Weighted`, returning the underlying point.
113
- *
114
- * @param w - The weighted point.
115
- * @returns A new `Vector2` instance with the same x and y components.
116
- * @since 2.1.0
117
- */
118
- declare const unweighted: (w: Weighted) => Vector2;
119
- declare const weightedEquals: {
120
- /**
121
- * Checks if two `Vector2.Weighted` instances are approximately equal —
122
- * point components and weight all within the default absolute tolerance.
123
- *
124
- * @param a - The first weighted point.
125
- * @param b - The second weighted point.
126
- * @returns `true` when components and weight are within tolerance.
127
- * @since 2.1.0
128
- */
129
- (a: Weighted, b: Weighted): boolean;
130
- /**
131
- * Checks if two `Vector2.Weighted` instances are approximately equal.
132
- *
133
- * @param b - The second weighted point.
134
- * @returns A function that takes the first weighted point and returns the comparison result.
135
- * @since 2.1.0
136
- */
137
- (b: Weighted): (a: Weighted) => boolean;
138
- };
139
- declare const equals: {
140
- /**
141
- * Checks if two `Vector2` instances are approximately equal within the
142
- * default absolute tolerance ({@link EPSILON}).
143
- *
144
- * @param a - The first vector.
145
- * @param b - The second vector.
146
- * @returns `true` when each pair of components is within tolerance.
147
- * @since 1.1.0
148
- */
149
- (a: Vector2, b: Vector2): boolean;
150
- /**
151
- * Checks if two `Vector2` instances are approximately equal within the
152
- * default absolute tolerance ({@link EPSILON}).
153
- *
154
- * @param b - The second vector.
155
- * @returns A function that takes the first vector and returns the comparison result.
156
- * @since 1.1.0
157
- */
158
- (b: Vector2): (a: Vector2) => boolean;
159
- };
160
- declare const make: {
161
- /**
162
- * Creates a new `Vector2` instance.
163
- *
164
- * @param xy - The x and y components of the vector.
165
- * @returns A new `Vector2` instance.
166
- * @since 1.0.0
167
- */
168
- (xy: number): Vector2;
169
- /**
170
- * Creates a new `Vector2` instance.
171
- *
172
- * @param x - The x component of the vector.
173
- * @param y - The y component of the vector.
174
- * @returns A new `Vector2` instance.
175
- * @since 1.0.0
176
- */
177
- (x: number, y: number): Vector2;
178
- };
179
- /**
180
- * Transposes a 2-tuple of items into one or more `Vector2`s, one per channel
181
- * extracted by the projection function. See {@link Vector4.transpose} for the
182
- * full operation description; this is the 2-component analog.
183
- *
184
- * @param inputs - Exactly two items of any type.
185
- * @param project - A function returning a fixed-arity tuple of numbers — one per output channel.
186
- * @returns A tuple of `Vector2`s with the same arity as the projection's return tuple.
187
- * @since 2.1.0
188
- */
189
- declare const transpose: <T, const Channels extends ReadonlyArray<number>>(inputs: readonly [T, T], project: (item: T) => Channels) => { readonly [K in keyof Channels]: Vector2 };
190
- /**
191
- * Creates a new `Vector2` instance from polar coordinates.
192
- *
193
- * @param r - The radius.
194
- * @param theta - The angle, in radians.
195
- * @returns A new `Vector2` instance.
196
- * @since 1.0.0
197
- */
198
- declare const fromPolar: (r: number, theta: number) => Vector2;
199
- /**
200
- * Calculates the magnitude of a `Vector2`.
201
- *
202
- * @param vector - The vector to calculate the magnitude of.
203
- * @returns The magnitude of the vector.
204
- * @since 1.0.0
205
- */
206
- declare const magnitude: (vector: Vector2) => number;
207
- /**
208
- * Normalizes a `Vector2`.
209
- *
210
- * @param vector - The vector to normalize.
211
- * @returns A new `Vector2` instance with the same direction and a magnitude of 1.
212
- * @since 1.0.0
213
- */
214
- declare const normalize: (vector: Vector2) => Vector2;
215
- declare const dot: {
216
- /**
217
- * Calculates the dot product of two `Vector2` instances.
218
- *
219
- * @param a - The first vector.
220
- * @param b - The second vector.
221
- * @returns The dot product of the two vectors.
222
- * @since 1.0.0
223
- */
224
- (a: Vector2, b: Vector2): number;
225
- /**
226
- * Calculates the dot product of two `Vector2` instances.
227
- *
228
- * @param b - The second vector.
229
- * @returns A function that takes the first vector and returns the dot product.
230
- * @since 1.0.0
231
- */
232
- (b: Vector2): (a: Vector2) => number;
233
- };
234
- declare const cross: {
235
- /**
236
- * Calculates the cross product of two `Vector2` instances.
237
- *
238
- * @param a - The first vector.
239
- * @param b - The second vector.
240
- * @returns The cross product of the two vectors.
241
- * @since 1.0.0
242
- */
243
- (a: Vector2, b: Vector2): number;
244
- /**
245
- * Calculates the cross product of two `Vector2` instances.
246
- *
247
- * @param b - The second vector.
248
- * @returns A function that takes the first vector and returns the cross product.
249
- * @since 1.0.0
250
- */
251
- (b: Vector2): (a: Vector2) => number;
252
- };
253
- /**
254
- * Returns the components of a `Vector2` as an array.
255
- *
256
- * @param r - The radius.
257
- * @param theta - The angle, in radians.
258
- * @returns A new `Vector2` instance.
259
- * @since 1.0.0
260
- */
261
- declare const components: (v: Vector2) => [number, number];
262
- /**
263
- * Applies the softmax function to a `Vector2`.
264
- *
265
- * @param v - The vector to apply the softmax function to.
266
- * @returns A new `Vector2` instance with the softmax applied.
267
- * @since 1.0.0
268
- */
269
- declare const softmax: (v: Vector2) => Vector2;
270
- /**
271
- * Creates a zero vector.
272
- *
273
- * @returns A new `Vector2` instance with both components set to 0.
274
- * @since 1.0.0
275
- */
276
- declare const zero: Vector2;
277
- /**
278
- * Creates a unit vector.
279
- *
280
- * @returns A new `Vector2` instance with both components set to 1.
281
- * @since 1.0.0
282
- */
283
- declare const unit: Vector2;
284
- declare const add: {
285
- /**
286
- * Adds two `Vector2` instances together.
287
- *
288
- * @param a - The first vector.
289
- * @param b - The second vector.
290
- * @returns A new `Vector2` instance representing the sum of the two vectors.
291
- * @since 1.0.0
292
- */
293
- (a: Vector2, b: Vector2): Vector2;
294
- /**
295
- * Adds two `Vector2` instances together.
296
- *
297
- * @param b - The second vector.
298
- * @returns A function that takes the first vector and returns the sum.
299
- * @since 1.0.0
300
- */
301
- (b: Vector2): (a: Vector2) => Vector2;
302
- };
303
- declare const subtract: {
304
- /**
305
- * Subtracts one `Vector2` instance from another.
306
- *
307
- * @param a - The first vector.
308
- * @param b - The second vector.
309
- * @returns A new `Vector2` instance representing the difference of the two vectors.
310
- * @since 1.0.0
311
- */
312
- (a: Vector2, b: Vector2): Vector2;
313
- /**
314
- * Subtracts one `Vector2` instance from another.
315
- *
316
- * @param b - The second vector.
317
- * @returns A function that takes the first vector and returns the difference.
318
- * @since 1.0.0
319
- */
320
- (b: Vector2): (a: Vector2) => Vector2;
321
- };
322
- declare const hadamard: {
323
- /**
324
- * Performs the Hadamard product of two `Vector2` instances.
325
- *
326
- * @param a - The first vector.
327
- * @param b - The second vector.
328
- * @returns A new `Vector2` instance representing the Hadamard product of the two vectors.
329
- * @since 1.0.0
330
- */
331
- (a: Vector2, b: Vector2): Vector2;
332
- /**
333
- * Performs the Hadamard product of two `Vector2` instances.
334
- *
335
- * @param b - The second vector.
336
- * @returns A function that takes the first vector and returns the Hadamard product.
337
- * @since 1.0.0
338
- */
339
- (b: Vector2): (a: Vector2) => Vector2;
340
- };
341
- declare const scale: {
342
- /**
343
- * Scales a `Vector2` by a scalar value.
344
- *
345
- * @param s - The scalar value to scale by.
346
- * @returns A function that takes a vector and returns the scaled vector.
347
- * @since 1.0.0
348
- */
349
- (s: number): (v: Vector2) => Vector2;
350
- /**
351
- * Scales a `Vector2` by a scalar value.
352
- *
353
- * @param v - The vector to scale.
354
- * @param s - The scalar value to scale by.
355
- * @returns A new `Vector2` instance representing the scaled vector.
356
- * @since 1.0.0
357
- */
358
- (v: Vector2, s: number): Vector2;
359
- };
360
- /**
361
- * Gets the x component of a `Vector2`.
362
- *
363
- * @param v - The vector to get the x component from.
364
- * @returns The x component of the vector.
365
- * @since 1.0.0
366
- */
367
- declare const getX: (v: Vector2) => number;
368
- declare const setX: {
369
- /**
370
- * Sets the x component of a `Vector2`.
371
- *
372
- * @param v - The vector to set the x component of.
373
- * @param x - The new x component.
374
- * @returns A new `Vector2` instance with the updated x component.
375
- * @since 1.0.0
376
- */
377
- (v: Vector2, x: number): Vector2;
378
- /**
379
- * Sets the x component of a `Vector2`.
380
- *
381
- * @param x - The new x component.
382
- * @returns A function that takes a vector and returns the updated vector.
383
- * @since 1.0.0
384
- */
385
- (x: number): (v: Vector2) => Vector2;
386
- };
387
- /**
388
- * Gets the y component of a `Vector2`.
389
- *
390
- * @param v - The vector to get the y component from.
391
- * @returns The y component of the vector.
392
- * @since 1.0.0
393
- */
394
- declare const getY: (v: Vector2) => number;
395
- declare const setY: {
396
- /**
397
- * Sets the y component of a `Vector2`.
398
- *
399
- * @param v - The vector to set the y component of.
400
- * @param y - The new y component.
401
- * @returns A new `Vector2` instance with the updated y component.
402
- * @since 1.0.0
403
- */
404
- (v: Vector2, y: number): Vector2;
405
- /**
406
- * Sets the y component of a `Vector2`.
407
- *
408
- * @param y - The new y component.
409
- * @returns A function that takes a vector and returns the updated vector.
410
- * @since 1.0.0
411
- */
412
- (y: number): (v: Vector2) => Vector2;
413
- };
414
- /**
415
- * Gets the radius of a `Vector2`.
416
- *
417
- * @param v - The vector to get the radius from.
418
- * @returns The radius of the vector.
419
- * @since 1.0.0
420
- */
421
- declare const getR: (v: Vector2) => number;
422
- declare const setR: {
423
- /**
424
- * Sets the radius of a `Vector2`.
425
- *
426
- * @param v - The vector to set the radius of.
427
- * @param r - The new radius.
428
- * @returns A new `Vector2` instance with the updated radius.
429
- * @since 1.0.0
430
- */
431
- (v: Vector2, r: number): Vector2;
432
- /**
433
- * Sets the radius of a `Vector2`.
434
- *
435
- * @param r - The new radius.
436
- * @returns A function that takes a vector and returns the updated vector.
437
- * @since 1.0.0
438
- */
439
- (r: number): (v: Vector2) => Vector2;
440
- };
441
- /**
442
- * Gets the angle of a `Vector2`.
443
- *
444
- * @param v - The vector to get the angle from.
445
- * @returns The angle of the vector in radians.
446
- * @since 1.0.0
447
- */
448
- declare const getTheta: (v: Vector2) => number;
449
- declare const setTheta: {
450
- /**
451
- * Sets the angle of a `Vector2`.
452
- *
453
- * @param v - The vector to set the angle of.
454
- * @param theta - The new angle, in radians.
455
- * @returns A new `Vector2` instance with the updated angle.
456
- * @since 1.0.0
457
- */
458
- (v: Vector2, theta: number): Vector2;
459
- /**
460
- * Sets the angle of a `Vector2`.
461
- *
462
- * @param theta - The new angle, in radians.
463
- * @returns A function that takes a vector and returns the updated vector.
464
- * @since 1.0.0
465
- */
466
- (theta: number): (v: Vector2) => Vector2;
467
- };
468
- //#endregion
469
- export { FourDimensionalComponent as a, ThreeDimensionalComponent as c, TwoDimensionalComponent as d, TwoDimensionalIndex as f, FourDimensional as i, ThreeDimensionalIndex as l, Weighted as n, FourDimensionalIndex as o, vector2_d_exports as r, ThreeDimensional as s, Vector2 as t, TwoDimensional as u };
470
- //# sourceMappingURL=vector2-DPUY3_eA.d.mts.map