curvy 2.0.0-alpha.13 → 2.0.0-alpha.15

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 (93) hide show
  1. package/dist/characteristic/index.mjs +1 -1
  2. package/dist/curve/cubic2d.d.ts +92 -3
  3. package/dist/curve/curve2d.d.ts +81 -0
  4. package/dist/curve/index.mjs +1 -1
  5. package/dist/curve/linear2d.d.ts +113 -3
  6. package/dist/curve/quadratic2d.d.ts +92 -3
  7. package/dist/curve/rationalCubic2d.d.ts +100 -38
  8. package/dist/interval/index.mjs +2 -2
  9. package/dist/matrix/index.mjs +47 -1
  10. package/dist/matrix/index.mjs.map +1 -1
  11. package/dist/matrix/matrix3x3.d.ts +87 -1
  12. package/dist/matrix/matrix4x4.d.ts +57 -6
  13. package/dist/matrix/traits.d.ts +34 -0
  14. package/dist/monotonicity/index.mjs +1 -1
  15. package/dist/monotonicity/monotonicity.d.ts +25 -0
  16. package/dist/number.d.ts +53 -0
  17. package/dist/number.mjs +56 -1
  18. package/dist/number.mjs.map +1 -1
  19. package/dist/path/cubic2d.d.ts +22 -0
  20. package/dist/path/index.mjs +25 -149
  21. package/dist/path/index.mjs.map +1 -1
  22. package/dist/path/linear2d.d.ts +24 -0
  23. package/dist/path/path2d.d.ts +54 -0
  24. package/dist/path/quadratic2d.d.ts +22 -0
  25. package/dist/path/rationalCubic2d.d.ts +21 -0
  26. package/dist/polynomial/index.mjs +2 -2
  27. package/dist/shared/affine2d-Dvna84gc.mjs +332 -0
  28. package/dist/shared/affine2d-Dvna84gc.mjs.map +1 -0
  29. package/dist/shared/{characteristic-BkEr-rr8.mjs → characteristic--7nC4Q_a.mjs} +4 -5
  30. package/dist/shared/characteristic--7nC4Q_a.mjs.map +1 -0
  31. package/dist/shared/{cubic-BL6dpuHh.mjs → cubic-BiGuAnZ0.mjs} +56 -27
  32. package/dist/shared/cubic-BiGuAnZ0.mjs.map +1 -0
  33. package/dist/shared/{interval-Dm35Xhy4.mjs → interval-Dcqpo73t.mjs} +5 -5
  34. package/dist/shared/interval-Dcqpo73t.mjs.map +1 -0
  35. package/dist/shared/{interval2d-AtneyI45.mjs → interval2d-C2Pk66-2.mjs} +3 -3
  36. package/dist/shared/{interval2d-AtneyI45.mjs.map → interval2d-C2Pk66-2.mjs.map} +1 -1
  37. package/dist/shared/matrix3x3.internal-Cod-r7H3.mjs +233 -0
  38. package/dist/shared/matrix3x3.internal-Cod-r7H3.mjs.map +1 -0
  39. package/dist/shared/{matrix4x4-BWmf4lZM.mjs → matrix4x4-BrqgYZCD.mjs} +72 -223
  40. package/dist/shared/matrix4x4-BrqgYZCD.mjs.map +1 -0
  41. package/dist/shared/monotonicity-DNxBoC7F.mjs +64 -0
  42. package/dist/shared/monotonicity-DNxBoC7F.mjs.map +1 -0
  43. package/dist/shared/{quadratic-DPrUsFCp.mjs → quadratic-BmMqkvxx.mjs} +2 -2
  44. package/dist/shared/{quadratic-DPrUsFCp.mjs.map → quadratic-BmMqkvxx.mjs.map} +1 -1
  45. package/dist/shared/{rationalCubic2d-H1J2Fjyy.mjs → rationalCubic2d-CZiP8nIq.mjs} +282 -326
  46. package/dist/shared/rationalCubic2d-CZiP8nIq.mjs.map +1 -0
  47. package/dist/shared/{rationalCubic2d-CeHgpNht.mjs → rationalCubic2d-gM7VeiiT.mjs} +585 -125
  48. package/dist/shared/rationalCubic2d-gM7VeiiT.mjs.map +1 -0
  49. package/dist/shared/{solution-B2JdOZpe.mjs → solution-BW0BBMXI.mjs} +22 -6
  50. package/dist/shared/solution-BW0BBMXI.mjs.map +1 -0
  51. package/dist/shared/{vector2-CSkaMXvp.mjs → vector2-DuA3EmfL.mjs} +5 -3
  52. package/dist/shared/vector2-DuA3EmfL.mjs.map +1 -0
  53. package/dist/shared/{vector2.internal-DP1nTBdS.mjs → vector2.internal-rPnW0RCx.mjs} +10 -5
  54. package/dist/shared/vector2.internal-rPnW0RCx.mjs.map +1 -0
  55. package/dist/shared/{vector3-CR2LPV03.mjs → vector3-oxtggkDp.mjs} +2 -2
  56. package/dist/shared/{vector3-CR2LPV03.mjs.map → vector3-oxtggkDp.mjs.map} +1 -1
  57. package/dist/shared/vector3.internal-CfWHl9SG.mjs +135 -0
  58. package/dist/shared/vector3.internal-CfWHl9SG.mjs.map +1 -0
  59. package/dist/shared/{vector4-PO_7EYd-.mjs → vector4-DGHuCvTV.mjs} +2 -2
  60. package/dist/shared/{vector4-PO_7EYd-.mjs.map → vector4-DGHuCvTV.mjs.map} +1 -1
  61. package/dist/shared/vector4.internal-DH5DzNYO.mjs +116 -0
  62. package/dist/shared/vector4.internal-DH5DzNYO.mjs.map +1 -0
  63. package/dist/solution/index.mjs +1 -1
  64. package/dist/solution/solution.d.ts +16 -0
  65. package/dist/splines/basis2d.d.ts +64 -0
  66. package/dist/splines/bezier2d.d.ts +72 -0
  67. package/dist/splines/cardinal2d.d.ts +78 -0
  68. package/dist/splines/hermite2d.d.ts +76 -0
  69. package/dist/splines/index.mjs +109 -15
  70. package/dist/splines/index.mjs.map +1 -1
  71. package/dist/splines/linear2d.d.ts +65 -0
  72. package/dist/splines/rationalBezier2d.d.ts +76 -0
  73. package/dist/transform/affine2d.d.ts +339 -0
  74. package/dist/transform/affine2d.internal.d.ts +2 -0
  75. package/dist/transform/index.d.ts +3 -0
  76. package/dist/transform/index.mjs +2 -0
  77. package/dist/transform/traits.d.ts +19 -0
  78. package/dist/vector/index.mjs +3 -3
  79. package/dist/vector/vector2.d.ts +49 -0
  80. package/package.json +5 -1
  81. package/dist/shared/characteristic-BkEr-rr8.mjs.map +0 -1
  82. package/dist/shared/cubic-BL6dpuHh.mjs.map +0 -1
  83. package/dist/shared/interval-Dm35Xhy4.mjs.map +0 -1
  84. package/dist/shared/matrix4x4-BWmf4lZM.mjs.map +0 -1
  85. package/dist/shared/monotonicity-BdebFOtv.mjs +0 -34
  86. package/dist/shared/monotonicity-BdebFOtv.mjs.map +0 -1
  87. package/dist/shared/rationalCubic2d-CeHgpNht.mjs.map +0 -1
  88. package/dist/shared/rationalCubic2d-H1J2Fjyy.mjs.map +0 -1
  89. package/dist/shared/solution-B2JdOZpe.mjs.map +0 -1
  90. package/dist/shared/vector2-CSkaMXvp.mjs.map +0 -1
  91. package/dist/shared/vector2.internal-DP1nTBdS.mjs.map +0 -1
  92. package/dist/shared/vector4.internal-BJ1QN2Ck.mjs +0 -246
  93. package/dist/shared/vector4.internal-BJ1QN2Ck.mjs.map +0 -1
@@ -0,0 +1,116 @@
1
+ import { Pipeable, dual } from "../utils.mjs";
2
+ import { coincident } from "../number.mjs";
3
+ //#region src/vector/vector4.internal.ts
4
+ const Vector4TypeId = Symbol.for("curvy/vector4");
5
+ var Vector4Impl = class extends Pipeable {
6
+ [Vector4TypeId] = Vector4TypeId;
7
+ x;
8
+ y;
9
+ z;
10
+ w;
11
+ constructor(v0 = 0, v1 = 0, v2 = 0, v3 = 0) {
12
+ super();
13
+ this.x = v0;
14
+ this.y = v1;
15
+ this.z = v2;
16
+ this.w = v3;
17
+ }
18
+ get [0]() {
19
+ return this.x;
20
+ }
21
+ get [1]() {
22
+ return this.y;
23
+ }
24
+ get [2]() {
25
+ return this.z;
26
+ }
27
+ get [3]() {
28
+ return this.w;
29
+ }
30
+ get [Symbol.toStringTag]() {
31
+ return `Vector4(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
32
+ }
33
+ get [Symbol.for("nodejs.util.inspect.custom")]() {
34
+ return this[Symbol.toStringTag];
35
+ }
36
+ };
37
+ /** @internal */
38
+ const isVector4 = (v) => typeof v === "object" && v !== null && Vector4TypeId in v;
39
+ /** @internal */
40
+ const equals = dual(2, (a, b) => coincident(a.x, b.x) && coincident(a.y, b.y) && coincident(a.z, b.z) && coincident(a.w, b.w));
41
+ /** @internal */
42
+ const make = (v0, v1 = v0, v2 = v1, v3 = v2) => new Vector4Impl(v0, v1, v2, v3);
43
+ /** @internal */
44
+ const fromTuple = (t) => new Vector4Impl(t[0], t[1], t[2], t[3]);
45
+ /** @internal */
46
+ const transpose = (inputs, project) => {
47
+ const a = project(inputs[0]);
48
+ const b = project(inputs[1]);
49
+ const c = project(inputs[2]);
50
+ const d = project(inputs[3]);
51
+ const result = [];
52
+ for (let i = 0; i < a.length; i++) result.push(make(a[i], b[i], c[i], d[i]));
53
+ return result;
54
+ };
55
+ /** @internal */
56
+ const magnitude = (vector) => Math.hypot(vector.x, vector.y, vector.z, vector.w);
57
+ /** @internal */
58
+ const normalize = (vector) => {
59
+ const m = magnitude(vector);
60
+ return make(vector.x / m, vector.y / m, vector.z / m, vector.w / m);
61
+ };
62
+ /** @internal */
63
+ const dot = dual(2, (a, b) => a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w);
64
+ /** @internal */
65
+ const components = (v) => [
66
+ v.x,
67
+ v.y,
68
+ v.z,
69
+ v.w
70
+ ];
71
+ /** @internal */
72
+ const softmax = (v) => {
73
+ const max = Math.max(v.x, v.y, v.z, v.w);
74
+ const v0 = Math.exp(v.x - max);
75
+ const v1 = Math.exp(v.y - max);
76
+ const v2 = Math.exp(v.z - max);
77
+ const v3 = Math.exp(v.w - max);
78
+ const sum = v0 + v1 + v2 + v3;
79
+ return make(v0 / sum, v1 / sum, v2 / sum, v3 / sum);
80
+ };
81
+ /** @internal */
82
+ const add = dual(2, (a, b) => make(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w));
83
+ /** @internal */
84
+ const subtract = dual(2, (a, b) => make(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w));
85
+ /** @internal */
86
+ const hadamard = dual(2, (a, b) => make(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w));
87
+ /** @internal */
88
+ const scale = dual(2, (v, s) => s === 1 ? v : make(v.x * s, v.y * s, v.z * s, v.w * s));
89
+ /** @internal */
90
+ const getX = (v) => v.x;
91
+ /** @internal */
92
+ const setX = dual(2, (v, x) => make(x, v.y, v.z, v.w));
93
+ /** @internal */
94
+ const mapX = dual(2, (v, f) => make(f(v.x), v.y, v.z, v.w));
95
+ /** @internal */
96
+ const getY = (v) => v.y;
97
+ /** @internal */
98
+ const setY = dual(2, (v, y) => make(v.x, y, v.z, v.w));
99
+ /** @internal */
100
+ const mapY = dual(2, (v, f) => make(v.x, f(v.y), v.z, v.w));
101
+ /** @internal */
102
+ const getZ = (v) => v.z;
103
+ /** @internal */
104
+ const setZ = dual(2, (v, z) => make(v.x, v.y, z, v.w));
105
+ /** @internal */
106
+ const mapZ = dual(2, (v, f) => make(v.x, v.y, f(v.z), v.w));
107
+ /** @internal */
108
+ const getW = (v) => v.w;
109
+ /** @internal */
110
+ const setW = dual(2, (v, w) => make(v.x, v.y, v.z, w));
111
+ /** @internal */
112
+ const mapW = dual(2, (v, f) => make(v.x, v.y, v.z, f(v.w)));
113
+ //#endregion
114
+ export { setZ as C, transpose as E, setY as S, subtract as T, mapZ as _, fromTuple as a, setW as b, getY as c, isVector4 as d, magnitude as f, mapY as g, mapX as h, equals as i, getZ as l, mapW as m, components as n, getW as o, make as p, dot as r, getX as s, add as t, hadamard as u, normalize as v, softmax as w, setX as x, scale as y };
115
+
116
+ //# sourceMappingURL=vector4.internal-DH5DzNYO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector4.internal-DH5DzNYO.mjs","names":[],"sources":["../../src/vector/vector4.internal.ts"],"sourcesContent":["import { dual, Pipeable } from '../utils.ts'\nimport { coincident } from '../number.ts'\nimport type { Vector4 } from './vector4.ts'\n\nexport const Vector4TypeId: unique symbol = Symbol.for('curvy/vector4')\nexport type Vector4TypeId = typeof Vector4TypeId\n\nclass Vector4Impl extends Pipeable implements Vector4 {\n readonly [Vector4TypeId]: Vector4TypeId = Vector4TypeId\n\n readonly x: number\n readonly y: number\n readonly z: number\n readonly w: number\n\n constructor(v0 = 0, v1 = 0, v2 = 0, v3 = 0) {\n super()\n\n this.x = v0\n this.y = v1\n this.z = v2\n this.w = v3\n }\n\n get [0]() {\n return this.x\n }\n\n get [1]() {\n return this.y\n }\n\n get [2]() {\n return this.z\n }\n\n get [3]() {\n return this.w\n }\n\n get [Symbol.toStringTag]() {\n return `Vector4(${this.x}, ${this.y}, ${this.z}, ${this.w})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isVector4 = (v: unknown): v is Vector4 =>\n typeof v === 'object' && v !== null && Vector4TypeId in v\n\n/** @internal */\nexport const equals = dual<\n (b: Vector4) => (a: Vector4) => boolean,\n (a: Vector4, b: Vector4) => boolean\n>(\n 2,\n (a: Vector4, b: Vector4) =>\n coincident(a.x, b.x) && coincident(a.y, b.y) && coincident(a.z, b.z) && coincident(a.w, b.w),\n)\n\n/** @internal */\nexport const make = (v0: number, v1 = v0, v2 = v1, v3 = v2): Vector4 =>\n new Vector4Impl(v0, v1, v2, v3)\n\n/** @internal */\nexport const fromTuple = (t: readonly [number, number, number, number]): Vector4 =>\n new Vector4Impl(t[0], t[1], t[2], t[3])\n\n/** @internal */\nexport const transpose = <T, const Channels extends ReadonlyArray<number>>(\n inputs: readonly [T, T, T, T],\n project: (item: T) => Channels,\n): { readonly [K in keyof Channels]: Vector4 } => {\n const a = project(inputs[0])\n const b = project(inputs[1])\n const c = project(inputs[2])\n const d = project(inputs[3])\n const result: Array<Vector4> = []\n for (let i = 0; i < a.length; i++) {\n result.push(make(a[i] as number, b[i] as number, c[i] as number, d[i] as number))\n }\n return result as never\n}\n\n/** @internal */\nexport const magnitude: (vector: Vector4) => number = (vector: Vector4) =>\n Math.hypot(vector.x, vector.y, vector.z, vector.w)\n\n/** @internal */\nexport const normalize: (vector: Vector4) => Vector4 = (vector: Vector4) => {\n const m = magnitude(vector)\n\n return make(vector.x / m, vector.y / m, vector.z / m, vector.w / m)\n}\n\n/** @internal */\nexport const dot = dual<(b: Vector4) => (a: Vector4) => number, (a: Vector4, b: Vector4) => number>(\n 2,\n (a: Vector4, b: Vector4) => a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w,\n)\n\n/** @internal */\nexport const components: (v: Vector4) => [number, number, number, number] = (v: Vector4) => [\n v.x,\n v.y,\n v.z,\n v.w,\n]\n\n/** @internal */\nexport const softmax: (v: Vector4) => Vector4 = (v: Vector4) => {\n const max = Math.max(v.x, v.y, v.z, v.w)\n\n const v0 = Math.exp(v.x - max)\n const v1 = Math.exp(v.y - max)\n const v2 = Math.exp(v.z - max)\n const v3 = Math.exp(v.w - max)\n\n const sum = v0 + v1 + v2 + v3\n\n return make(v0 / sum, v1 / sum, v2 / sum, v3 / sum)\n}\n\n/** @internal */\nexport const add = dual<\n (b: Vector4) => (a: Vector4) => Vector4,\n (a: Vector4, b: Vector4) => Vector4\n>(2, (a: Vector4, b: Vector4) => make(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w))\n\n/** @internal */\nexport const subtract = dual<\n (b: Vector4) => (a: Vector4) => Vector4,\n (a: Vector4, b: Vector4) => Vector4\n>(2, (a: Vector4, b: Vector4) => make(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w))\n\n/** @internal */\nexport const hadamard = dual<\n (b: Vector4) => (a: Vector4) => Vector4,\n (a: Vector4, b: Vector4) => Vector4\n>(2, (a: Vector4, b: Vector4) => make(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w))\n/** @internal */\nexport const scale = dual<\n (s: number) => (v: Vector4) => Vector4,\n (v: Vector4, s: number) => Vector4\n>(2, (v: Vector4, s: number) => (s === 1 ? v : make(v.x * s, v.y * s, v.z * s, v.w * s)))\n\n/** @internal */\nexport const getX = (v: Vector4) => v.x\n/** @internal */\nexport const setX = dual<\n (x: number) => (v: Vector4) => Vector4,\n (v: Vector4, x: number) => Vector4\n>(2, (v: Vector4, x: number) => make(x, v.y, v.z, v.w))\n/** @internal */\nexport const mapX = dual<\n (f: (x: number) => number) => (v: Vector4) => Vector4,\n (v: Vector4, f: (x: number) => number) => Vector4\n>(2, (v: Vector4, f: (x: number) => number) => make(f(v.x), v.y, v.z, v.w))\n\n/** @internal */\nexport const getY = (v: Vector4) => v.y\n/** @internal */\nexport const setY = dual<\n (y: number) => (v: Vector4) => Vector4,\n (v: Vector4, y: number) => Vector4\n>(2, (v: Vector4, y: number) => make(v.x, y, v.z, v.w))\n/** @internal */\nexport const mapY = dual<\n (f: (y: number) => number) => (v: Vector4) => Vector4,\n (v: Vector4, f: (y: number) => number) => Vector4\n>(2, (v: Vector4, f: (y: number) => number) => make(v.x, f(v.y), v.z, v.w))\n\n/** @internal */\nexport const getZ = (v: Vector4) => v.z\n/** @internal */\nexport const setZ = dual<\n (z: number) => (v: Vector4) => Vector4,\n (v: Vector4, z: number) => Vector4\n>(2, (v: Vector4, z: number) => make(v.x, v.y, z, v.w))\n/** @internal */\nexport const mapZ = dual<\n (f: (z: number) => number) => (v: Vector4) => Vector4,\n (v: Vector4, f: (z: number) => number) => Vector4\n>(2, (v: Vector4, f: (z: number) => number) => make(v.x, v.y, f(v.z), v.w))\n\n/** @internal */\nexport const getW = (v: Vector4) => v.w\n/** @internal */\nexport const setW = dual<\n (w: number) => (v: Vector4) => Vector4,\n (v: Vector4, w: number) => Vector4\n>(2, (v: Vector4, w: number) => make(v.x, v.y, v.z, w))\n/** @internal */\nexport const mapW = dual<\n (f: (w: number) => number) => (v: Vector4) => Vector4,\n (v: Vector4, f: (w: number) => number) => Vector4\n>(2, (v: Vector4, f: (w: number) => number) => make(v.x, v.y, v.z, f(v.w)))\n"],"mappings":";;;AAIA,MAAa,gBAA+B,OAAO,IAAI,gBAAgB;AAGvE,IAAM,cAAN,cAA0B,SAA4B;CACpD,CAAU,iBAAgC;CAE1C;CACA;CACA;CACA;CAEA,YAAY,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC1C,OAAO;EAEP,KAAK,IAAI;EACT,KAAK,IAAI;EACT,KAAK,IAAI;EACT,KAAK,IAAI;;CAGX,KAAK,KAAK;EACR,OAAO,KAAK;;CAGd,KAAK,KAAK;EACR,OAAO,KAAK;;CAGd,KAAK,KAAK;EACR,OAAO,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AAE,IAAI,EAAE,CAAE;;AAGzF,MAAa,QAAQ,MAAe,EAAE;;AAEtC,MAAa,OAAO,KAGlB,IAAI,GAAY,MAAc,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;;AAEvD,MAAa,OAAO,KAGlB,IAAI,GAAY,MAA6B,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;;AAG3E,MAAa,QAAQ,MAAe,EAAE;;AAEtC,MAAa,OAAO,KAGlB,IAAI,GAAY,MAAc,KAAK,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;;AAEvD,MAAa,OAAO,KAGlB,IAAI,GAAY,MAA6B,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC;;AAG3E,MAAa,QAAQ,MAAe,EAAE;;AAEtC,MAAa,OAAO,KAGlB,IAAI,GAAY,MAAc,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,CAAC;;AAEvD,MAAa,OAAO,KAGlB,IAAI,GAAY,MAA6B,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;;AAG3E,MAAa,QAAQ,MAAe,EAAE;;AAEtC,MAAa,OAAO,KAGlB,IAAI,GAAY,MAAc,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;;AAEvD,MAAa,OAAO,KAGlB,IAAI,GAAY,MAA6B,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { c as solution_exports } from "../shared/solution-B2JdOZpe.mjs";
1
+ import { l as solution_exports } from "../shared/solution-BW0BBMXI.mjs";
2
2
  export { solution_exports as Solution };
@@ -221,6 +221,22 @@ export declare const clip: {
221
221
  (i: Interval): (s: Solution<number>) => Solution<number>;
222
222
  (s: Solution<number>, i: Interval): Solution<number>;
223
223
  };
224
+ /**
225
+ * Approximate-containment variant of {@link clip} for post-processing the
226
+ * output of a numerical solver. Retains values within a small absolute
227
+ * tolerance of either boundary even if formally outside — a valid root can
228
+ * land a few ULPs past the boundary due to coefficient roundoff in the
229
+ * solver, and strict {@link clip} would drop it. Endpoint inclusivity is
230
+ * ignored at the EPSILON scale.
231
+ *
232
+ * @param s - The solution to clip.
233
+ * @param i - The interval to retain values approximately within.
234
+ * @since 2.0.0
235
+ */
236
+ export declare const clipApprox: {
237
+ (i: Interval): (s: Solution<number>) => Solution<number>;
238
+ (s: Solution<number>, i: Interval): Solution<number>;
239
+ };
224
240
  /**
225
241
  * Maps every value in the solution to a new value. Result cardinality matches
226
242
  * the input.
@@ -1,4 +1,5 @@
1
1
  import type { CubicPath2d } from '../path/cubic2d.ts';
2
+ import type { Affine2d } from '../transform/affine2d.ts';
2
3
  import type { Pipeable } from '../utils.ts';
3
4
  import type { Vector2 } from '../vector/vector2.ts';
4
5
  import type { Basis2dTypeId } from './basis2d.internal.ts';
@@ -90,6 +91,69 @@ export declare const prepend: {
90
91
  */
91
92
  (p: Basis2d, ...points: ReadonlyArray<Vector2>): Basis2d;
92
93
  };
94
+ export declare const mapPoints: {
95
+ /**
96
+ * Applies a per-point transform to every control point in a `Basis2d`,
97
+ * preserving point count and spline identity.
98
+ *
99
+ * @param f - The point transform.
100
+ * @returns A function that takes a `Basis2d` and returns the mapped spline.
101
+ * @since 2.0.0
102
+ */
103
+ (f: (p: Vector2) => Vector2): (s: Basis2d) => Basis2d;
104
+ /**
105
+ * Applies a per-point transform to every control point in a `Basis2d`.
106
+ *
107
+ * @param s - The basis spline.
108
+ * @param f - The point transform.
109
+ * @returns A new `Basis2d` with the transform applied to each control point.
110
+ * @since 2.0.0
111
+ */
112
+ (s: Basis2d, f: (p: Vector2) => Vector2): Basis2d;
113
+ };
114
+ export declare const flatMap: {
115
+ /**
116
+ * Hands the spline's full control-point array to `f` and uses its returned
117
+ * `Basis2d` as the result. The returned spline goes through this module's
118
+ * builders, so the 4-or-more-points invariant is enforced at construction.
119
+ *
120
+ * @param f - The bulk transform.
121
+ * @returns A function that takes a `Basis2d` and returns the rebuilt spline.
122
+ * @since 2.0.0
123
+ */
124
+ (f: (points: ReadonlyArray<Vector2>) => Basis2d): (s: Basis2d) => Basis2d;
125
+ /**
126
+ * Hands the spline's full control-point array to `f` and uses its returned
127
+ * `Basis2d` as the result.
128
+ *
129
+ * @param s - The basis spline.
130
+ * @param f - The bulk transform.
131
+ * @returns The `Basis2d` returned by `f`.
132
+ * @since 2.0.0
133
+ */
134
+ (s: Basis2d, f: (points: ReadonlyArray<Vector2>) => Basis2d): Basis2d;
135
+ };
136
+ export declare const transform: {
137
+ /**
138
+ * Applies an `Affine2d` transform to every control point of a `Basis2d`.
139
+ * Affine maps commute with the B-spline basis, so the result exactly
140
+ * parameterizes the affine image of the original curve.
141
+ *
142
+ * @param s - The basis spline.
143
+ * @param a - The affine transform.
144
+ * @returns A new `Basis2d` whose control points are the affine images of the input's.
145
+ * @since 2.0.0
146
+ */
147
+ (s: Basis2d, a: Affine2d): Basis2d;
148
+ /**
149
+ * Applies an `Affine2d` transform to every control point of a `Basis2d`.
150
+ *
151
+ * @param a - The affine transform.
152
+ * @returns A function that takes a `Basis2d` and returns the transformed spline.
153
+ * @since 2.0.0
154
+ */
155
+ (a: Affine2d): (s: Basis2d) => Basis2d;
156
+ };
93
157
  /**
94
158
  * Triplicates the endpoints of a `Basis2d`.
95
159
  *
@@ -1,4 +1,5 @@
1
1
  import type { CubicPath2d } from '../path/cubic2d.ts';
2
+ import type { Affine2d } from '../transform/affine2d.ts';
2
3
  import type { Pipeable } from '../utils.ts';
3
4
  import type * as Solution from '../solution/solution.ts';
4
5
  import type { Vector2 } from '../vector/vector2.ts';
@@ -153,6 +154,77 @@ export declare const appendAccelerationAligned: {
153
154
  */
154
155
  (p: Bezier2d, p3: Vector2): Bezier2d;
155
156
  };
157
+ export declare const mapPoints: {
158
+ /**
159
+ * Applies a per-point transform to every control point in a `Bezier2d`,
160
+ * preserving point count and spline identity.
161
+ *
162
+ * Note that the transform is applied uniformly to all control points,
163
+ * including off-curve handles. Affine maps (translate, rotate, scale, shear)
164
+ * commute with cubic Bézier evaluation and preserve curve identity up to
165
+ * the affine map; nonlinear maps produce a geometrically reasonable result
166
+ * but no longer parameterize the affine image of the original curve.
167
+ *
168
+ * @param f - The point transform.
169
+ * @returns A function that takes a `Bezier2d` and returns the mapped spline.
170
+ * @since 2.0.0
171
+ */
172
+ (f: (p: Vector2) => Vector2): (s: Bezier2d) => Bezier2d;
173
+ /**
174
+ * Applies a per-point transform to every control point in a `Bezier2d`.
175
+ *
176
+ * @param s - The bezier.
177
+ * @param f - The point transform.
178
+ * @returns A new `Bezier2d` with the transform applied to each control point.
179
+ * @since 2.0.0
180
+ */
181
+ (s: Bezier2d, f: (p: Vector2) => Vector2): Bezier2d;
182
+ };
183
+ export declare const flatMap: {
184
+ /**
185
+ * Hands the bezier's full control-point array to `f` and uses its returned
186
+ * `Bezier2d` as the result. The returned bezier goes through this module's
187
+ * builders, so the `3n + 1` point-count invariant is enforced at
188
+ * construction.
189
+ *
190
+ * @param f - The bulk transform.
191
+ * @returns A function that takes a `Bezier2d` and returns the rebuilt spline.
192
+ * @since 2.0.0
193
+ */
194
+ (f: (points: ReadonlyArray<Vector2>) => Bezier2d): (s: Bezier2d) => Bezier2d;
195
+ /**
196
+ * Hands the bezier's full control-point array to `f` and uses its returned
197
+ * `Bezier2d` as the result.
198
+ *
199
+ * @param s - The bezier.
200
+ * @param f - The bulk transform.
201
+ * @returns The `Bezier2d` returned by `f`.
202
+ * @since 2.0.0
203
+ */
204
+ (s: Bezier2d, f: (points: ReadonlyArray<Vector2>) => Bezier2d): Bezier2d;
205
+ };
206
+ export declare const transform: {
207
+ /**
208
+ * Applies an `Affine2d` transform to every control point of a `Bezier2d`.
209
+ * Affine maps commute with Bézier evaluation, so the result exactly
210
+ * parameterizes the affine image of the original curve.
211
+ *
212
+ * @param s - The bezier.
213
+ * @param a - The affine transform.
214
+ * @returns A new `Bezier2d` whose control points are the affine images of
215
+ * the input's.
216
+ * @since 2.0.0
217
+ */
218
+ (s: Bezier2d, a: Affine2d): Bezier2d;
219
+ /**
220
+ * Applies an `Affine2d` transform to every control point of a `Bezier2d`.
221
+ *
222
+ * @param a - The affine transform.
223
+ * @returns A function that takes a `Bezier2d` and returns the transformed bezier.
224
+ * @since 2.0.0
225
+ */
226
+ (a: Affine2d): (s: Bezier2d) => Bezier2d;
227
+ };
156
228
  /**
157
229
  * Converts a `Bezier2d` to a `CubicPath2d`.
158
230
  *
@@ -1,4 +1,5 @@
1
1
  import type { CubicPath2d } from '../path/cubic2d.ts';
2
+ import type { Affine2d } from '../transform/affine2d.ts';
2
3
  import type { Pipeable } from '../utils.ts';
3
4
  import type { Vector2 } from '../vector/vector2.ts';
4
5
  import type { Bezier2d } from './bezier2d.ts';
@@ -244,6 +245,83 @@ export declare const withOptions: {
244
245
  */
245
246
  (c: Cardinal2d, options: Options): Cardinal2d;
246
247
  };
248
+ export declare const mapPoints: {
249
+ /**
250
+ * Applies a per-point transform to every control point in a `Cardinal2d`,
251
+ * preserving point count, tension, and alpha.
252
+ *
253
+ * @param f - The point transform.
254
+ * @returns A function that takes a `Cardinal2d` and returns the mapped spline.
255
+ * @since 2.0.0
256
+ */
257
+ (f: (p: Vector2) => Vector2): (s: Cardinal2d) => Cardinal2d;
258
+ /**
259
+ * Applies a per-point transform to every control point in a `Cardinal2d`.
260
+ *
261
+ * @param s - The cardinal spline.
262
+ * @param f - The point transform.
263
+ * @returns A new `Cardinal2d` with the transform applied to each control point.
264
+ * @since 2.0.0
265
+ */
266
+ (s: Cardinal2d, f: (p: Vector2) => Vector2): Cardinal2d;
267
+ };
268
+ export declare const flatMap: {
269
+ /**
270
+ * Hands the spline's full control-point array to `f` and uses its returned
271
+ * `Cardinal2d` as the result. The returned spline's tension and alpha come
272
+ * from the mapper's output, not the input — to preserve the input's
273
+ * parameterization, the mapper should re-supply it (e.g. by reading the
274
+ * original spline in the data-first form, or chaining `withOptions`
275
+ * afterward).
276
+ *
277
+ * @param f - The bulk transform.
278
+ * @returns A function that takes a `Cardinal2d` and returns the rebuilt spline.
279
+ * @since 2.0.0
280
+ */
281
+ (f: (points: ReadonlyArray<Vector2>) => Cardinal2d): (s: Cardinal2d) => Cardinal2d;
282
+ /**
283
+ * Hands the spline's full control-point array to `f` and uses its returned
284
+ * `Cardinal2d` as the result.
285
+ *
286
+ * @param s - The cardinal spline.
287
+ * @param f - The bulk transform.
288
+ * @returns The `Cardinal2d` returned by `f`.
289
+ * @since 2.0.0
290
+ */
291
+ (s: Cardinal2d, f: (points: ReadonlyArray<Vector2>) => Cardinal2d): Cardinal2d;
292
+ };
293
+ export declare const transform: {
294
+ /**
295
+ * Applies an `Affine2d` transform to every control point of a `Cardinal2d`,
296
+ * preserving the spline's `tension` and `alpha`.
297
+ *
298
+ * **Exactness depends on parameterization.** With `alpha = 0` (uniform
299
+ * Catmull-Rom) the affine basis commutes exactly with evaluation, so the
300
+ * result parameterizes the affine image of the original curve. With
301
+ * `alpha != 0` (centripetal / chordal), chord lengths between control points
302
+ * drive the parameterization and a non-uniform-scaling transform changes
303
+ * those chord lengths in axis-dependent ways. In that case the returned
304
+ * curve is still a sensible Cardinal spline on the transformed control
305
+ * points, but it no longer matches the affine image of the original
306
+ * pointwise. For pixel-exact transforms of centripetal splines, convert to
307
+ * `Bezier2d` via {@link toBezier} first, then transform.
308
+ *
309
+ * @param s - The cardinal spline.
310
+ * @param a - The affine transform.
311
+ * @returns A new `Cardinal2d` whose control points are the affine images of
312
+ * the input's, with the same parameterization.
313
+ * @since 2.0.0
314
+ */
315
+ (s: Cardinal2d, a: Affine2d): Cardinal2d;
316
+ /**
317
+ * Applies an `Affine2d` transform to every control point of a `Cardinal2d`.
318
+ *
319
+ * @param a - The affine transform.
320
+ * @returns A function that takes a `Cardinal2d` and returns the transformed spline.
321
+ * @since 2.0.0
322
+ */
323
+ (a: Affine2d): (s: Cardinal2d) => Cardinal2d;
324
+ };
247
325
  /**
248
326
  * Converts a `Cardinal2d` to a `CubicPath2d` using the spline's `tension` and
249
327
  * `alpha`. With the default options (`{ tension: 0.5, alpha: 0.5 }`) the
@@ -1,4 +1,5 @@
1
1
  import type { CubicPath2d } from '../path/cubic2d.ts';
2
+ import type { Affine2d } from '../transform/affine2d.ts';
2
3
  import type { Pipeable } from '../utils.ts';
3
4
  import type { Vector2 } from '../vector/vector2.ts';
4
5
  import type { Bezier2d } from './bezier2d.ts';
@@ -95,6 +96,81 @@ export declare const prepend: {
95
96
  */
96
97
  (p: Hermite2d, p0: Vector2, v0: Vector2): Hermite2d;
97
98
  };
99
+ export declare const mapPoints: {
100
+ /**
101
+ * Applies a per-point transform to every entry in a `Hermite2d`, preserving
102
+ * the alternating position/velocity layout and total point count.
103
+ *
104
+ * The transform receives both positions and velocity vectors as plain
105
+ * `Vector2`s — Hermite splines store them in interleaved slots without a
106
+ * structural distinction. Linear transforms (rotation, scaling) act
107
+ * correctly on both slot kinds, but a uniform translation will offset the
108
+ * velocity slots as well as the positions; to translate positions only,
109
+ * reach for {@link flatMap} and split the array yourself.
110
+ *
111
+ * @param f - The point transform.
112
+ * @returns A function that takes a `Hermite2d` and returns the mapped spline.
113
+ * @since 2.0.0
114
+ */
115
+ (f: (p: Vector2) => Vector2): (s: Hermite2d) => Hermite2d;
116
+ /**
117
+ * Applies a per-point transform to every entry in a `Hermite2d`.
118
+ *
119
+ * @param s - The hermite spline.
120
+ * @param f - The point transform.
121
+ * @returns A new `Hermite2d` with the transform applied to each entry.
122
+ * @since 2.0.0
123
+ */
124
+ (s: Hermite2d, f: (p: Vector2) => Vector2): Hermite2d;
125
+ };
126
+ export declare const flatMap: {
127
+ /**
128
+ * Hands the spline's full entry array to `f` (alternating positions and
129
+ * velocities) and uses its returned `Hermite2d` as the result. The returned
130
+ * spline goes through this module's builders, so the even-arity and
131
+ * minimum-4-entry invariants are enforced at construction.
132
+ *
133
+ * @param f - The bulk transform.
134
+ * @returns A function that takes a `Hermite2d` and returns the rebuilt spline.
135
+ * @since 2.0.0
136
+ */
137
+ (f: (points: ReadonlyArray<Vector2>) => Hermite2d): (s: Hermite2d) => Hermite2d;
138
+ /**
139
+ * Hands the spline's full entry array to `f` and uses its returned
140
+ * `Hermite2d` as the result.
141
+ *
142
+ * @param s - The hermite spline.
143
+ * @param f - The bulk transform.
144
+ * @returns The `Hermite2d` returned by `f`.
145
+ * @since 2.0.0
146
+ */
147
+ (s: Hermite2d, f: (points: ReadonlyArray<Vector2>) => Hermite2d): Hermite2d;
148
+ };
149
+ export declare const transform: {
150
+ /**
151
+ * Applies an `Affine2d` transform to a `Hermite2d`, treating the entries
152
+ * correctly by kind: positions (even indices) receive the full affine, and
153
+ * tangent vectors (odd indices) receive only the linear part — translation
154
+ * doesn't move tangents, only the linear map does.
155
+ *
156
+ * The result exactly parameterizes the affine image of the original curve.
157
+ *
158
+ * @param s - The hermite spline.
159
+ * @param a - The affine transform.
160
+ * @returns A new `Hermite2d` with positions and tangents transformed
161
+ * appropriately.
162
+ * @since 2.0.0
163
+ */
164
+ (s: Hermite2d, a: Affine2d): Hermite2d;
165
+ /**
166
+ * Applies an `Affine2d` transform to a `Hermite2d`.
167
+ *
168
+ * @param a - The affine transform.
169
+ * @returns A function that takes a `Hermite2d` and returns the transformed spline.
170
+ * @since 2.0.0
171
+ */
172
+ (a: Affine2d): (s: Hermite2d) => Hermite2d;
173
+ };
98
174
  /**
99
175
  * Creates a new `CubicPath2d` instance from a `Hermite2d`.
100
176
  *