curvy 2.0.0-alpha.7 → 2.0.0-alpha.9

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 (39) hide show
  1. package/dist/characteristic/index.mjs +1 -1
  2. package/dist/curve/index.mjs +1 -1
  3. package/dist/interval/index.mjs +1 -1
  4. package/dist/matrix/index.mjs +1 -1
  5. package/dist/path/index.mjs +4 -4
  6. package/dist/polynomial/index.mjs +2 -2
  7. package/dist/shared/{characteristic-D9yZWCym.mjs → characteristic-B0VEB_OA.mjs} +3 -3
  8. package/dist/shared/{characteristic-D9yZWCym.mjs.map → characteristic-B0VEB_OA.mjs.map} +1 -1
  9. package/dist/shared/{cubic-BK8xjSkd.mjs → cubic-NEn7E6V_.mjs} +2 -2
  10. package/dist/shared/{cubic-BK8xjSkd.mjs.map → cubic-NEn7E6V_.mjs.map} +1 -1
  11. package/dist/shared/{interval2d-BMDmeL1M.mjs → interval2d-C0eduE-V.mjs} +2 -2
  12. package/dist/shared/{interval2d-BMDmeL1M.mjs.map → interval2d-C0eduE-V.mjs.map} +1 -1
  13. package/dist/shared/{matrix4x4-qyRufxfs.mjs → matrix4x4-BWmf4lZM.mjs} +3 -3
  14. package/dist/shared/{matrix4x4-qyRufxfs.mjs.map → matrix4x4-BWmf4lZM.mjs.map} +1 -1
  15. package/dist/shared/{quadratic-CWXIRh42.mjs → quadratic-Dlxqo2V1.mjs} +2 -2
  16. package/dist/shared/{quadratic-CWXIRh42.mjs.map → quadratic-Dlxqo2V1.mjs.map} +1 -1
  17. package/dist/shared/{rationalCubic2d-DaFTrUXw.mjs → rationalCubic2d-3S5K69Jy.mjs} +7 -7
  18. package/dist/shared/{rationalCubic2d-DaFTrUXw.mjs.map → rationalCubic2d-3S5K69Jy.mjs.map} +1 -1
  19. package/dist/shared/{rationalCubic2d-BZvT9s5N.mjs → rationalCubic2d-CJY-feGw.mjs} +5 -5
  20. package/dist/shared/{rationalCubic2d-BZvT9s5N.mjs.map → rationalCubic2d-CJY-feGw.mjs.map} +1 -1
  21. package/dist/shared/{vector2-CWU3cPB2.mjs → vector2-CSkaMXvp.mjs} +10 -2
  22. package/dist/shared/vector2-CSkaMXvp.mjs.map +1 -0
  23. package/dist/shared/{vector2.internal-BL8hFl1c.mjs → vector2.internal-DP1nTBdS.mjs} +17 -2
  24. package/dist/shared/{vector2.internal-BL8hFl1c.mjs.map → vector2.internal-DP1nTBdS.mjs.map} +1 -1
  25. package/dist/shared/{vector3-DmMm6pX8.mjs → vector3-CR2LPV03.mjs} +14 -2
  26. package/dist/shared/vector3-CR2LPV03.mjs.map +1 -0
  27. package/dist/shared/{vector4-oqPPp45j.mjs → vector4-PO_7EYd-.mjs} +54 -2
  28. package/dist/shared/{vector4-oqPPp45j.mjs.map → vector4-PO_7EYd-.mjs.map} +1 -1
  29. package/dist/shared/{vector4.internal-BnnTjVIr.mjs → vector4.internal-BJ1QN2Ck.mjs} +55 -15
  30. package/dist/shared/vector4.internal-BJ1QN2Ck.mjs.map +1 -0
  31. package/dist/splines/index.mjs +7 -7
  32. package/dist/vector/index.mjs +3 -3
  33. package/dist/vector/vector2.d.ts +80 -0
  34. package/dist/vector/vector3.d.ts +120 -0
  35. package/dist/vector/vector4.d.ts +184 -0
  36. package/package.json +1 -1
  37. package/dist/shared/vector2-CWU3cPB2.mjs.map +0 -1
  38. package/dist/shared/vector3-DmMm6pX8.mjs.map +0 -1
  39. package/dist/shared/vector4.internal-BnnTjVIr.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"vector4-oqPPp45j.mjs","names":["internal.isVector4","internal.equals","internal.make","internal.fromTuple","internal.transpose","internal.magnitude","internal.normalize","internal.dot","internal.components","internal.softmax","internal.add","internal.subtract","internal.hadamard","internal.scale"],"sources":["../../src/vector/vector4.ts"],"sourcesContent":["import type { FourDimensional } from '../dimensions.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector4TypeId } from './vector4.internal.ts'\nimport * as internal from './vector4.internal.ts'\n\n/**\n * A 4D vector.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 1.0.0\n */\nexport interface Vector4 extends Pipeable, FourDimensional<number> {\n readonly [Vector4TypeId]: Vector4TypeId\n}\n\n/**\n * Checks if a value is a `Vector4`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `Vector4`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isVector4: (v: unknown) => v is Vector4 = internal.isVector4\n\nexport const equals: {\n /**\n * Checks if two `Vector4` instances are approximately equal within the\n * default absolute tolerance ({@link EPSILON}).\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` when each pair of components is within tolerance.\n * @since 1.1.0\n */\n (a: Vector4, b: Vector4): boolean\n /**\n * Checks if two `Vector4` instances are approximately equal within the\n * default absolute tolerance ({@link EPSILON}).\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the comparison result.\n * @since 1.1.0\n */\n (b: Vector4): (a: Vector4) => boolean\n} = internal.equals\n\nexport const make: {\n /**\n * Creates a new `Vector4` instance.\n *\n * @param xyzw - The x, y, z, and w components of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (xyzw: number): Vector4\n /**\n * Creates a new `Vector4` instance.\n *\n * @param x - The x component of the vector.\n * @param yzw - The y, z, and w components of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (x: number, yzw: number): Vector4\n /**\n * Creates a new `Vector4` instance.\n *\n * @param x - The x component of the vector.\n * @param y - The y component of the vector.\n * @param zw - The z and w components of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (x: number, y: number, zw: number): Vector4\n /**\n * Creates a new `Vector4` instance.\n *\n * @param x - The x component of the vector.\n * @param y - The y component of the vector.\n * @param z - The z component of the vector.\n * @param w - The w component of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (x: number, y: number, z: number, w: number): Vector4\n} = internal.make\n\n/**\n * Creates a new `Vector4` instance from a `[x, y, z, w]` tuple. Inverse of\n * {@link components}.\n *\n * @param t - The `[x, y, z, w]` tuple.\n * @returns A new `Vector4` instance.\n * @since 2.0.0\n */\nexport const fromTuple: (t: readonly [number, number, number, number]) => Vector4 =\n internal.fromTuple\n\n/**\n * Transposes a 4-tuple of items into one or more `Vector4`s, one per channel\n * extracted by the projection function.\n *\n * For each output channel, takes the corresponding number from each of the\n * four projected items and packs them into a `Vector4` — the data-layout\n * transformation NumPy calls a transpose, FP calls `unzip`, GPUs call a\n * gather, and DSP people inexplicably call deinterleaving.\n *\n * The projection's return-tuple arity determines the number of output\n * vectors, and that arity is preserved in the return type.\n *\n * @example\n * ```ts\n * // Pack the x and y coordinates of four control points into two Vector4s.\n * const [xs, ys] = Vector4.transpose(\n * [p0, p1, p2, p3],\n * (p) => [p.x, p.y],\n * )\n * ```\n *\n * @param inputs - Exactly four items of any type.\n * @param project - A function returning a fixed-arity tuple of numbers — one per output channel.\n * @returns A tuple of `Vector4`s with the same arity as the projection's return tuple.\n * @since 2.0.0\n */\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 } = internal.transpose\n\n/**\n * Gets the magnitude of a `Vector4`.\n *\n * @param vector - The vector to calculate the magnitude of.\n * @returns The magnitude of the vector.\n * @since 1.0.0\n */\nexport const magnitude: (vector: Vector4) => number = internal.magnitude\n\n/**\n * Normalizes a `Vector4`.\n *\n * @param vector - The vector to normalize.\n * @returns A new `Vector4` instance with the same direction as the input vector but with a magnitude of 1.\n * @since 1.0.0\n */\nexport const normalize: (vector: Vector4) => Vector4 = internal.normalize\n\nexport const dot: {\n /**\n * Computes the dot product of two `Vector4` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns The dot product of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): number\n /**\n * Computes the dot product of a `Vector4` instance and another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the dot product.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => number\n} = internal.dot\n\n/**\n * Returns the components of a `Vector4` as an array.\n *\n * @param v - The vector to get the components of.\n * @returns An array containing the x, y, z, and w components of the vector.\n * @since 1.0.0\n */\nexport const components: (v: Vector4) => [number, number, number, number] = internal.components\n\n/**\n * Applies the softmax function to a `Vector4`.\n *\n * @param v - The vector to calculate the softmax of.\n * @returns A new `Vector4` instance representing the softmax of the input vector.\n */\nexport const softmax: (v: Vector4) => Vector4 = internal.softmax\n\n/**\n * Creates a zero vector.\n *\n * @since 1.0.0\n */\nexport const zero = make(0)\n\n/**\n * Creates a unit vector.\n *\n * @since 1.0.0\n */\nexport const unit = make(1)\n\nexport const add: {\n /**\n * Adds two `Vector4` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector4` instance representing the sum of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): Vector4\n\n /**\n * Adds a `Vector4` instance to another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the sum.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => Vector4\n} = internal.add\n\nexport const subtract: {\n /**\n * Subtracts one `Vector4` instance from another.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector4` instance representing the difference of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): Vector4\n /**\n * Subtracts a `Vector4` instance from another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the difference.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => Vector4\n} = internal.subtract\n\nexport const hadamard: {\n /**\n * Computes the Hadamard product of two `Vector4` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector4` instance representing the Hadamard product of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): Vector4\n /**\n * Computes the Hadamard product of a `Vector4` instance and another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the Hadamard product.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => Vector4\n} = internal.hadamard\n\nexport const scale: {\n /**\n * Scales a `Vector4` by a scalar.\n *\n * @param s - The scalar to scale the vector by.\n * @returns A function that takes the vector and returns the scaled vector.\n * @since 1.0.0\n */\n (s: number): (v: Vector4) => Vector4\n /**\n * Scales a `Vector4` by a scalar.\n *\n * @param s - The scalar to scale the vector by.\n * @param v - The vector to scale.\n * @returns A new `Vector4` instance representing the scaled vector.\n * @since 1.0.0\n */\n (v: Vector4, s: number): Vector4\n} = internal.scale\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,YAA0CA;AAEvD,MAAa,SAoBTC;AAEJ,MAAa,OAuCTC;;;;;;;;;AAUJ,MAAa,YACXC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BF,MAAa,YAGsCC;;;;;;;;AASnD,MAAa,YAAyCC;;;;;;;;AAStD,MAAa,YAA0CC;AAEvD,MAAa,MAkBTC;;;;;;;;AASJ,MAAa,aAA+DC;;;;;;;AAQ5E,MAAa,UAAmCC;;;;;;AAOhD,MAAa,OAAO,KAAK,EAAE;;;;;;AAO3B,MAAa,OAAO,KAAK,EAAE;AAE3B,MAAa,MAmBTC;AAEJ,MAAa,WAkBTC;AAEJ,MAAa,WAkBTC;AAEJ,MAAa,QAkBTC"}
1
+ {"version":3,"file":"vector4-PO_7EYd-.mjs","names":["internal.isVector4","internal.equals","internal.make","internal.fromTuple","internal.transpose","internal.magnitude","internal.normalize","internal.dot","internal.components","internal.softmax","internal.add","internal.subtract","internal.hadamard","internal.scale","internal.getX","internal.setX","internal.mapX","internal.getY","internal.setY","internal.mapY","internal.getZ","internal.setZ","internal.mapZ","internal.getW","internal.setW","internal.mapW"],"sources":["../../src/vector/vector4.ts"],"sourcesContent":["import type { FourDimensional } from '../dimensions.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector4TypeId } from './vector4.internal.ts'\nimport * as internal from './vector4.internal.ts'\n\n/**\n * A 4D vector.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 1.0.0\n */\nexport interface Vector4 extends Pipeable, FourDimensional<number> {\n readonly [Vector4TypeId]: Vector4TypeId\n}\n\n/**\n * Checks if a value is a `Vector4`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `Vector4`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isVector4: (v: unknown) => v is Vector4 = internal.isVector4\n\nexport const equals: {\n /**\n * Checks if two `Vector4` instances are approximately equal within the\n * default absolute tolerance ({@link EPSILON}).\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` when each pair of components is within tolerance.\n * @since 1.1.0\n */\n (a: Vector4, b: Vector4): boolean\n /**\n * Checks if two `Vector4` instances are approximately equal within the\n * default absolute tolerance ({@link EPSILON}).\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the comparison result.\n * @since 1.1.0\n */\n (b: Vector4): (a: Vector4) => boolean\n} = internal.equals\n\nexport const make: {\n /**\n * Creates a new `Vector4` instance.\n *\n * @param xyzw - The x, y, z, and w components of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (xyzw: number): Vector4\n /**\n * Creates a new `Vector4` instance.\n *\n * @param x - The x component of the vector.\n * @param yzw - The y, z, and w components of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (x: number, yzw: number): Vector4\n /**\n * Creates a new `Vector4` instance.\n *\n * @param x - The x component of the vector.\n * @param y - The y component of the vector.\n * @param zw - The z and w components of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (x: number, y: number, zw: number): Vector4\n /**\n * Creates a new `Vector4` instance.\n *\n * @param x - The x component of the vector.\n * @param y - The y component of the vector.\n * @param z - The z component of the vector.\n * @param w - The w component of the vector.\n * @returns A new `Vector4` instance.\n * @since 1.0.0\n */\n (x: number, y: number, z: number, w: number): Vector4\n} = internal.make\n\n/**\n * Creates a new `Vector4` instance from a `[x, y, z, w]` tuple. Inverse of\n * {@link components}.\n *\n * @param t - The `[x, y, z, w]` tuple.\n * @returns A new `Vector4` instance.\n * @since 2.0.0\n */\nexport const fromTuple: (t: readonly [number, number, number, number]) => Vector4 =\n internal.fromTuple\n\n/**\n * Transposes a 4-tuple of items into one or more `Vector4`s, one per channel\n * extracted by the projection function.\n *\n * For each output channel, takes the corresponding number from each of the\n * four projected items and packs them into a `Vector4` — the data-layout\n * transformation NumPy calls a transpose, FP calls `unzip`, GPUs call a\n * gather, and DSP people inexplicably call deinterleaving.\n *\n * The projection's return-tuple arity determines the number of output\n * vectors, and that arity is preserved in the return type.\n *\n * @example\n * ```ts\n * // Pack the x and y coordinates of four control points into two Vector4s.\n * const [xs, ys] = Vector4.transpose(\n * [p0, p1, p2, p3],\n * (p) => [p.x, p.y],\n * )\n * ```\n *\n * @param inputs - Exactly four items of any type.\n * @param project - A function returning a fixed-arity tuple of numbers — one per output channel.\n * @returns A tuple of `Vector4`s with the same arity as the projection's return tuple.\n * @since 2.0.0\n */\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 } = internal.transpose\n\n/**\n * Gets the magnitude of a `Vector4`.\n *\n * @param vector - The vector to calculate the magnitude of.\n * @returns The magnitude of the vector.\n * @since 1.0.0\n */\nexport const magnitude: (vector: Vector4) => number = internal.magnitude\n\n/**\n * Normalizes a `Vector4`.\n *\n * @param vector - The vector to normalize.\n * @returns A new `Vector4` instance with the same direction as the input vector but with a magnitude of 1.\n * @since 1.0.0\n */\nexport const normalize: (vector: Vector4) => Vector4 = internal.normalize\n\nexport const dot: {\n /**\n * Computes the dot product of two `Vector4` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns The dot product of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): number\n /**\n * Computes the dot product of a `Vector4` instance and another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the dot product.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => number\n} = internal.dot\n\n/**\n * Returns the components of a `Vector4` as an array.\n *\n * @param v - The vector to get the components of.\n * @returns An array containing the x, y, z, and w components of the vector.\n * @since 1.0.0\n */\nexport const components: (v: Vector4) => [number, number, number, number] = internal.components\n\n/**\n * Applies the softmax function to a `Vector4`.\n *\n * @param v - The vector to calculate the softmax of.\n * @returns A new `Vector4` instance representing the softmax of the input vector.\n */\nexport const softmax: (v: Vector4) => Vector4 = internal.softmax\n\n/**\n * Creates a zero vector.\n *\n * @since 1.0.0\n */\nexport const zero = make(0)\n\n/**\n * Creates a unit vector.\n *\n * @since 1.0.0\n */\nexport const unit = make(1)\n\nexport const add: {\n /**\n * Adds two `Vector4` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector4` instance representing the sum of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): Vector4\n\n /**\n * Adds a `Vector4` instance to another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the sum.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => Vector4\n} = internal.add\n\nexport const subtract: {\n /**\n * Subtracts one `Vector4` instance from another.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector4` instance representing the difference of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): Vector4\n /**\n * Subtracts a `Vector4` instance from another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the difference.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => Vector4\n} = internal.subtract\n\nexport const hadamard: {\n /**\n * Computes the Hadamard product of two `Vector4` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector4` instance representing the Hadamard product of the two vectors.\n * @since 1.0.0\n */\n (a: Vector4, b: Vector4): Vector4\n /**\n * Computes the Hadamard product of a `Vector4` instance and another vector.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the Hadamard product.\n * @since 1.0.0\n */\n (b: Vector4): (a: Vector4) => Vector4\n} = internal.hadamard\n\nexport const scale: {\n /**\n * Scales a `Vector4` by a scalar.\n *\n * @param s - The scalar to scale the vector by.\n * @returns A function that takes the vector and returns the scaled vector.\n * @since 1.0.0\n */\n (s: number): (v: Vector4) => Vector4\n /**\n * Scales a `Vector4` by a scalar.\n *\n * @param s - The scalar to scale the vector by.\n * @param v - The vector to scale.\n * @returns A new `Vector4` instance representing the scaled vector.\n * @since 1.0.0\n */\n (v: Vector4, s: number): Vector4\n} = internal.scale\n\n/**\n * Gets the x component of a `Vector4`.\n *\n * @param v - The vector to get the x component of.\n * @returns The x component of the vector.\n * @since 2.0.0\n */\nexport const getX: (v: Vector4) => number = internal.getX\n\nexport const setX: {\n /**\n * Sets the x component of a `Vector4`.\n *\n * @param v - The vector to set the x component of.\n * @param x - The new x component.\n * @returns A new `Vector4` instance with the updated x component.\n * @since 2.0.0\n */\n (v: Vector4, x: number): Vector4\n /**\n * Sets the x component of a `Vector4`.\n *\n * @param x - The new x component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (x: number): (v: Vector4) => Vector4\n} = internal.setX\n\nexport const mapX: {\n /**\n * Returns a new `Vector4` with the x component replaced by `f(v.x)`.\n *\n * @param v - The vector to update.\n * @param f - The function to apply to the x component.\n * @returns A new `Vector4` with the updated x.\n * @since 2.0.0\n */\n (v: Vector4, f: (x: number) => number): Vector4\n /**\n * Returns a new `Vector4` with the x component replaced by `f(v.x)`.\n *\n * @param f - The function to apply to the x component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (f: (x: number) => number): (v: Vector4) => Vector4\n} = internal.mapX\n\n/**\n * Gets the y component of a `Vector4`.\n *\n * @param v - The vector to get the y component of.\n * @returns The y component of the vector.\n * @since 2.0.0\n */\nexport const getY: (v: Vector4) => number = internal.getY\n\nexport const setY: {\n /**\n * Sets the y component of a `Vector4`.\n *\n * @param v - The vector to set the y component of.\n * @param y - The new y component.\n * @returns A new `Vector4` instance with the updated y component.\n * @since 2.0.0\n */\n (v: Vector4, y: number): Vector4\n /**\n * Sets the y component of a `Vector4`.\n *\n * @param y - The new y component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (y: number): (v: Vector4) => Vector4\n} = internal.setY\n\nexport const mapY: {\n /**\n * Returns a new `Vector4` with the y component replaced by `f(v.y)`.\n *\n * @param v - The vector to update.\n * @param f - The function to apply to the y component.\n * @returns A new `Vector4` with the updated y.\n * @since 2.0.0\n */\n (v: Vector4, f: (y: number) => number): Vector4\n /**\n * Returns a new `Vector4` with the y component replaced by `f(v.y)`.\n *\n * @param f - The function to apply to the y component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (f: (y: number) => number): (v: Vector4) => Vector4\n} = internal.mapY\n\n/**\n * Gets the z component of a `Vector4`.\n *\n * @param v - The vector to get the z component of.\n * @returns The z component of the vector.\n * @since 2.0.0\n */\nexport const getZ: (v: Vector4) => number = internal.getZ\n\nexport const setZ: {\n /**\n * Sets the z component of a `Vector4`.\n *\n * @param v - The vector to set the z component of.\n * @param z - The new z component.\n * @returns A new `Vector4` instance with the updated z component.\n * @since 2.0.0\n */\n (v: Vector4, z: number): Vector4\n /**\n * Sets the z component of a `Vector4`.\n *\n * @param z - The new z component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (z: number): (v: Vector4) => Vector4\n} = internal.setZ\n\nexport const mapZ: {\n /**\n * Returns a new `Vector4` with the z component replaced by `f(v.z)`.\n *\n * @param v - The vector to update.\n * @param f - The function to apply to the z component.\n * @returns A new `Vector4` with the updated z.\n * @since 2.0.0\n */\n (v: Vector4, f: (z: number) => number): Vector4\n /**\n * Returns a new `Vector4` with the z component replaced by `f(v.z)`.\n *\n * @param f - The function to apply to the z component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (f: (z: number) => number): (v: Vector4) => Vector4\n} = internal.mapZ\n\n/**\n * Gets the w component of a `Vector4`.\n *\n * @param v - The vector to get the w component of.\n * @returns The w component of the vector.\n * @since 2.0.0\n */\nexport const getW: (v: Vector4) => number = internal.getW\n\nexport const setW: {\n /**\n * Sets the w component of a `Vector4`.\n *\n * @param v - The vector to set the w component of.\n * @param w - The new w component.\n * @returns A new `Vector4` instance with the updated w component.\n * @since 2.0.0\n */\n (v: Vector4, w: number): Vector4\n /**\n * Sets the w component of a `Vector4`.\n *\n * @param w - The new w component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (w: number): (v: Vector4) => Vector4\n} = internal.setW\n\nexport const mapW: {\n /**\n * Returns a new `Vector4` with the w component replaced by `f(v.w)`.\n *\n * @param v - The vector to update.\n * @param f - The function to apply to the w component.\n * @returns A new `Vector4` with the updated w.\n * @since 2.0.0\n */\n (v: Vector4, f: (w: number) => number): Vector4\n /**\n * Returns a new `Vector4` with the w component replaced by `f(v.w)`.\n *\n * @param f - The function to apply to the w component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 2.0.0\n */\n (f: (w: number) => number): (v: Vector4) => Vector4\n} = internal.mapW\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,YAA0CA;AAEvD,MAAa,SAoBTC;AAEJ,MAAa,OAuCTC;;;;;;;;;AAUJ,MAAa,YACXC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BF,MAAa,YAGsCC;;;;;;;;AASnD,MAAa,YAAyCC;;;;;;;;AAStD,MAAa,YAA0CC;AAEvD,MAAa,MAkBTC;;;;;;;;AASJ,MAAa,aAA+DC;;;;;;;AAQ5E,MAAa,UAAmCC;;;;;;AAOhD,MAAa,OAAO,KAAK,EAAE;;;;;;AAO3B,MAAa,OAAO,KAAK,EAAE;AAE3B,MAAa,MAmBTC;AAEJ,MAAa,WAkBTC;AAEJ,MAAa,WAkBTC;AAEJ,MAAa,QAkBTC;;;;;;;;AASJ,MAAa,OAA+BC;AAE5C,MAAa,OAkBTC;AAEJ,MAAa,OAkBTC;;;;;;;;AASJ,MAAa,OAA+BC;AAE5C,MAAa,OAkBTC;AAEJ,MAAa,OAkBTC;;;;;;;;AASJ,MAAa,OAA+BC;AAE5C,MAAa,OAkBTC;AAEJ,MAAa,OAkBTC;;;;;;;;AASJ,MAAa,OAA+BC;AAE5C,MAAa,OAkBTC;AAEJ,MAAa,OAkBTC"}
@@ -85,34 +85,50 @@ const hadamard$1 = dual(2, (a, b) => make$1(a.x * b.x, a.y * b.y, a.z * b.z));
85
85
  /** @internal */
86
86
  const scale$1 = dual(2, (v, s) => s === 1 ? v : make$1(v.x * s, v.y * s, v.z * s));
87
87
  /** @internal */
88
- const getX = (v) => v.x;
88
+ const getX$1 = (v) => v.x;
89
89
  /** @internal */
90
- const setX = dual(2, (v, x) => make$1(x, v.y, v.z));
90
+ const setX$1 = dual(2, (v, x) => make$1(x, v.y, v.z));
91
91
  /** @internal */
92
- const getY = (v) => v.y;
92
+ const mapX$1 = dual(2, (v, f) => make$1(f(v.x), v.y, v.z));
93
93
  /** @internal */
94
- const setY = dual(2, (v, y) => make$1(v.x, y, v.z));
94
+ const getY$1 = (v) => v.y;
95
95
  /** @internal */
96
- const getZ = (v) => v.z;
96
+ const setY$1 = dual(2, (v, y) => make$1(v.x, y, v.z));
97
+ /** @internal */
98
+ const mapY$1 = dual(2, (v, f) => make$1(v.x, f(v.y), v.z));
97
99
  /** @internal */
98
- const setZ = dual(2, (v, z) => make$1(v.x, v.y, z));
100
+ const getZ$1 = (v) => v.z;
101
+ /** @internal */
102
+ const setZ$1 = dual(2, (v, z) => make$1(v.x, v.y, z));
103
+ /** @internal */
104
+ const mapZ$1 = dual(2, (v, f) => make$1(v.x, v.y, f(v.z)));
99
105
  /** @internal */
100
106
  const setR = dual(2, (v, r) => scale$1(r / magnitude$1(v))(v));
101
107
  /** @internal */
108
+ const mapR = dual(2, (v, f) => {
109
+ const r = magnitude$1(v);
110
+ return scale$1(f(r) / r)(v);
111
+ });
112
+ /** @internal */
102
113
  const getTheta = (v) => Math.acos(v.z / magnitude$1(v));
103
114
  /** @internal */
104
- const setTheta = dual(2, (v, phi) => {
105
- const m = magnitude$1(v);
106
- const sinTheta = Math.sin(phi);
107
- return make$1(m * sinTheta * Math.cos(v.y), m * sinTheta * Math.sin(v.y), m * Math.cos(phi));
115
+ const setTheta = dual(2, (v, theta) => {
116
+ const r = magnitude$1(v);
117
+ const phi = Math.atan2(v.y, v.x);
118
+ const sinTheta = Math.sin(theta);
119
+ return make$1(r * sinTheta * Math.cos(phi), r * sinTheta * Math.sin(phi), r * Math.cos(theta));
108
120
  });
109
121
  /** @internal */
122
+ const mapTheta = dual(2, (v, f) => setTheta(v, f(getTheta(v))));
123
+ /** @internal */
110
124
  const getPhi = (v) => Math.atan2(v.y, v.x);
111
125
  /** @internal */
112
- const setPhi = dual(2, (v, theta) => {
113
- const m = magnitude$1(v);
114
- return make$1(m * Math.cos(theta), m * Math.sin(theta), v.z);
126
+ const setPhi = dual(2, (v, phi) => {
127
+ const rho = Math.hypot(v.x, v.y);
128
+ return make$1(rho * Math.cos(phi), rho * Math.sin(phi), v.z);
115
129
  });
130
+ /** @internal */
131
+ const mapPhi = dual(2, (v, f) => setPhi(v, f(getPhi(v))));
116
132
  //#endregion
117
133
  //#region src/vector/vector4.internal.ts
118
134
  const Vector4TypeId = Symbol.for("curvy/vector4");
@@ -200,7 +216,31 @@ const subtract = dual(2, (a, b) => make(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b
200
216
  const hadamard = dual(2, (a, b) => make(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w));
201
217
  /** @internal */
202
218
  const scale = dual(2, (v, s) => s === 1 ? v : make(v.x * s, v.y * s, v.z * s, v.w * s));
219
+ /** @internal */
220
+ const getX = (v) => v.x;
221
+ /** @internal */
222
+ const setX = dual(2, (v, x) => make(x, v.y, v.z, v.w));
223
+ /** @internal */
224
+ const mapX = dual(2, (v, f) => make(f(v.x), v.y, v.z, v.w));
225
+ /** @internal */
226
+ const getY = (v) => v.y;
227
+ /** @internal */
228
+ const setY = dual(2, (v, y) => make(v.x, y, v.z, v.w));
229
+ /** @internal */
230
+ const mapY = dual(2, (v, f) => make(v.x, f(v.y), v.z, v.w));
231
+ /** @internal */
232
+ const getZ = (v) => v.z;
233
+ /** @internal */
234
+ const setZ = dual(2, (v, z) => make(v.x, v.y, z, v.w));
235
+ /** @internal */
236
+ const mapZ = dual(2, (v, f) => make(v.x, v.y, f(v.z), v.w));
237
+ /** @internal */
238
+ const getW = (v) => v.w;
239
+ /** @internal */
240
+ const setW = dual(2, (v, w) => make(v.x, v.y, v.z, w));
241
+ /** @internal */
242
+ const mapW = dual(2, (v, f) => make(v.x, v.y, v.z, f(v.w)));
203
243
  //#endregion
204
- export { make$1 as A, subtract$1 as B, getTheta as C, hadamard$1 as D, getZ as E, setTheta as F, setX as I, setY as L, scale$1 as M, setPhi as N, isVector3 as O, setR as P, setZ as R, getPhi as S, getY as T, transpose$1 as V, cross as _, fromTuple as a, fromSpherical as b, magnitude as c, scale as d, softmax as f, components$1 as g, add$1 as h, equals as i, normalize$1 as j, magnitude$1 as k, make as l, transpose as m, components as n, hadamard as o, subtract as p, dot as r, isVector4 as s, add as t, normalize as u, dot$1 as v, getX as w, fromTuple$1 as x, equals$1 as y, softmax$1 as z };
244
+ export { setTheta as $, dot$1 as A, isVector3 as B, setZ as C, add$1 as D, transpose as E, getTheta as F, mapTheta as G, make$1 as H, getX$1 as I, mapZ$1 as J, mapX$1 as K, getY$1 as L, fromSpherical as M, fromTuple$1 as N, components$1 as O, getPhi as P, setR as Q, getZ$1 as R, setY as S, subtract as T, mapPhi as U, magnitude$1 as V, mapR as W, scale$1 as X, normalize$1 as Y, setPhi as Z, mapZ as _, fromTuple as a, transpose$1 as at, setW as b, getY as c, isVector4 as d, setX$1 as et, magnitude as f, mapY as g, mapX as h, equals as i, subtract$1 as it, equals$1 as j, cross as k, getZ as l, mapW as m, components as n, setZ$1 as nt, getW as o, make as p, mapY$1 as q, dot as r, softmax$1 as rt, getX as s, add as t, setY$1 as tt, hadamard as u, normalize as v, softmax as w, setX as x, scale as y, hadamard$1 as z };
205
245
 
206
- //# sourceMappingURL=vector4.internal-BnnTjVIr.mjs.map
246
+ //# sourceMappingURL=vector4.internal-BJ1QN2Ck.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector4.internal-BJ1QN2Ck.mjs","names":["equals","make","fromTuple","transpose","magnitude","normalize","dot","components","softmax","add","subtract","hadamard","scale","getX","setX","mapX","getY","setY","mapY","getZ","setZ","mapZ"],"sources":["../../src/vector/vector3.internal.ts","../../src/vector/vector4.internal.ts"],"sourcesContent":["import { dual, Pipeable } from '../utils.ts'\nimport { epsEquals } from '../number.ts'\nimport type { Vector3 } from './vector3.ts'\n\nexport const Vector3TypeId: unique symbol = Symbol.for('curvy/vector3')\nexport type Vector3TypeId = typeof Vector3TypeId\n\nclass Vector3Impl extends Pipeable implements Vector3 {\n readonly [Vector3TypeId]: Vector3TypeId = Vector3TypeId\n\n readonly x: number\n readonly y: number\n readonly z: number\n\n constructor(v0 = 0, v1 = 0, v2 = 0) {\n super()\n this.x = v0\n this.y = v1\n this.z = v2\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 [Symbol.toStringTag]() {\n return `Vector3(${this.x}, ${this.y}, ${this.z})`\n }\n\n get [Symbol.for('nodejs.util.inspect.custom')]() {\n return this[Symbol.toStringTag]\n }\n}\n\n/** @internal */\nexport const isVector3 = (v: unknown): v is Vector3 =>\n typeof v === 'object' && v !== null && Vector3TypeId in v\n\n/** @internal */\nexport const equals = dual<\n (b: Vector3) => (a: Vector3) => boolean,\n (a: Vector3, b: Vector3) => boolean\n>(2, (a: Vector3, b: Vector3) => epsEquals(a.x, b.x) && epsEquals(a.y, b.y) && epsEquals(a.z, b.z))\n\n/** @internal */\nexport const make = (v0: number, v1 = v0, v2 = v1): Vector3 => new Vector3Impl(v0, v1, v2)\n\n/** @internal */\nexport const fromTuple = (t: readonly [number, number, number]): Vector3 =>\n new Vector3Impl(t[0], t[1], t[2])\n\n/** @internal */\nexport const transpose = <T, const Channels extends ReadonlyArray<number>>(\n inputs: readonly [T, T, T],\n project: (item: T) => Channels,\n): { readonly [K in keyof Channels]: Vector3 } => {\n const a = project(inputs[0])\n const b = project(inputs[1])\n const c = project(inputs[2])\n const result: Array<Vector3> = []\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))\n }\n return result as never\n}\n\n/** @internal */\nexport const fromSpherical = (r: number, theta: number, phi: number) =>\n new Vector3Impl(\n r * Math.sin(theta) * Math.cos(phi),\n r * Math.sin(theta) * Math.sin(phi),\n r * Math.cos(theta),\n )\n\n/** @internal */\nexport const magnitude = (vector: Vector3) => Math.hypot(vector.x, vector.y, vector.z)\n\n/** @internal */\nexport const normalize = (vector: Vector3) => {\n const m = magnitude(vector)\n\n return make(vector.x / m, vector.y / m, vector.z / m)\n}\n\n/** @internal */\nexport const dot = dual<(b: Vector3) => (a: Vector3) => number, (a: Vector3, b: Vector3) => number>(\n 2,\n (a: Vector3, b: Vector3) => a.x * b.x + a.y * b.y + a.z * b.z,\n)\n\n/** @internal */\nexport const cross = dual<\n (b: Vector3) => (a: Vector3) => Vector3,\n (a: Vector3, b: Vector3) => Vector3\n>(2, (a: Vector3, b: Vector3) => {\n const x = a.y * b.z - a.z * b.y\n const y = a.z * b.x - a.x * b.z\n const z = a.x * b.y - a.y * b.x\n\n return make(x, y, z)\n})\n\n/** @internal */\nexport const components: (v: Vector3) => [number, number, number] = (v: Vector3) => [v.x, v.y, v.z]\n\n/** @internal */\nexport const softmax = (v: Vector3) => {\n const max = Math.max(v.x, v.y, v.z)\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\n const sum = v0 + v1 + v2\n\n return make(v0 / sum, v1 / sum, v2 / sum)\n}\n\n/** @internal */\nexport const add = dual<\n (b: Vector3) => (a: Vector3) => Vector3,\n (a: Vector3, b: Vector3) => Vector3\n>(2, (a: Vector3, b: Vector3) => make(a.x + b.x, a.y + b.y, a.z + b.z))\n\n/** @internal */\nexport const subtract = dual<\n (b: Vector3) => (a: Vector3) => Vector3,\n (a: Vector3, b: Vector3) => Vector3\n>(2, (a: Vector3, b: Vector3) => make(a.x - b.x, a.y - b.y, a.z - b.z))\n\n/** @internal */\nexport const hadamard = dual<\n (b: Vector3) => (a: Vector3) => Vector3,\n (a: Vector3, b: Vector3) => Vector3\n>(2, (a: Vector3, b: Vector3) => make(a.x * b.x, a.y * b.y, a.z * b.z))\n\n/** @internal */\nexport const scale = dual<\n (s: number) => (v: Vector3) => Vector3,\n (v: Vector3, s: number) => Vector3\n>(2, (v: Vector3, s: number) => (s === 1 ? v : make(v.x * s, v.y * s, v.z * s)))\n\n/** @internal */\nexport const getX: (v: Vector3) => number = (v: Vector3) => v.x\n/** @internal */\nexport const setX = dual<\n (x: number) => (v: Vector3) => Vector3,\n (v: Vector3, x: number) => Vector3\n>(2, (v: Vector3, x: number) => make(x, v.y, v.z))\n\n/** @internal */\nexport const mapX = dual<\n (f: (x: number) => number) => (v: Vector3) => Vector3,\n (v: Vector3, f: (x: number) => number) => Vector3\n>(2, (v: Vector3, f: (x: number) => number) => make(f(v.x), v.y, v.z))\n\n/** @internal */\nexport const getY: (v: Vector3) => number = (v: Vector3) => v.y\n/** @internal */\nexport const setY = dual<\n (y: number) => (v: Vector3) => Vector3,\n (v: Vector3, y: number) => Vector3\n>(2, (v: Vector3, y: number) => make(v.x, y, v.z))\n\n/** @internal */\nexport const mapY = dual<\n (f: (y: number) => number) => (v: Vector3) => Vector3,\n (v: Vector3, f: (y: number) => number) => Vector3\n>(2, (v: Vector3, f: (y: number) => number) => make(v.x, f(v.y), v.z))\n\n/** @internal */\nexport const getZ: (v: Vector3) => number = (v: Vector3) => v.z\n/** @internal */\nexport const setZ = dual<\n (z: number) => (v: Vector3) => Vector3,\n (v: Vector3, z: number) => Vector3\n>(2, (v: Vector3, z: number) => make(v.x, v.y, z))\n\n/** @internal */\nexport const mapZ = dual<\n (f: (z: number) => number) => (v: Vector3) => Vector3,\n (v: Vector3, f: (z: number) => number) => Vector3\n>(2, (v: Vector3, f: (z: number) => number) => make(v.x, v.y, f(v.z)))\n\n/** @internal */\nexport const setR = dual<\n (r: number) => (v: Vector3) => Vector3,\n (v: Vector3, r: number) => Vector3\n>(2, (v: Vector3, r: number) => scale(r / magnitude(v))(v))\n\n/** @internal */\nexport const mapR = dual<\n (f: (r: number) => number) => (v: Vector3) => Vector3,\n (v: Vector3, f: (r: number) => number) => Vector3\n>(2, (v: Vector3, f: (r: number) => number) => {\n const r = magnitude(v)\n return scale(f(r) / r)(v)\n})\n\n/** @internal */\nexport const getTheta = (v: Vector3) => Math.acos(v.z / magnitude(v))\n/** @internal */\nexport const setTheta = dual<\n (theta: number) => (v: Vector3) => Vector3,\n (v: Vector3, theta: number) => Vector3\n>(2, (v: Vector3, theta: number) => {\n const r = magnitude(v)\n const phi = Math.atan2(v.y, v.x)\n const sinTheta = Math.sin(theta)\n return make(r * sinTheta * Math.cos(phi), r * sinTheta * Math.sin(phi), r * Math.cos(theta))\n})\n\n/** @internal */\nexport const mapTheta = dual<\n (f: (theta: number) => number) => (v: Vector3) => Vector3,\n (v: Vector3, f: (theta: number) => number) => Vector3\n>(2, (v: Vector3, f: (theta: number) => number) => setTheta(v, f(getTheta(v))))\n\n/** @internal */\nexport const getPhi = (v: Vector3) => Math.atan2(v.y, v.x)\n// setPhi rotates only in the xy plane: preserve z and the xy-projection\n// length ρ = r·sin(θ) = hypot(v.x, v.y). That keeps both r and θ invariant.\n/** @internal */\nexport const setPhi = dual<\n (phi: number) => (v: Vector3) => Vector3,\n (v: Vector3, phi: number) => Vector3\n>(2, (v: Vector3, phi: number) => {\n const rho = Math.hypot(v.x, v.y)\n return make(rho * Math.cos(phi), rho * Math.sin(phi), v.z)\n})\n\n/** @internal */\nexport const mapPhi = dual<\n (f: (phi: number) => number) => (v: Vector3) => Vector3,\n (v: Vector3, f: (phi: number) => number) => Vector3\n>(2, (v: Vector3, f: (phi: number) => number) => setPhi(v, f(getPhi(v))))\n","import { dual, Pipeable } from '../utils.ts'\nimport { epsEquals } 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 epsEquals(a.x, b.x) && epsEquals(a.y, b.y) && epsEquals(a.z, b.z) && epsEquals(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;CAEA,YAAY,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAClC,OAAO;EACP,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,KAAK;;CAGd,KAAK,OAAO,eAAe;EACzB,OAAO,WAAW,KAAK,EAAE,IAAI,KAAK,EAAE,IAAI,KAAK,EAAE;;CAGjD,KAAK,OAAO,IAAI,6BAA6B,IAAI;EAC/C,OAAO,KAAK,OAAO;;;;AAKvB,MAAa,aAAa,MACxB,OAAO,MAAM,YAAY,MAAM,QAAQ,iBAAiB;;AAG1D,MAAaA,WAAS,KAGpB,IAAI,GAAY,MAAe,UAAU,EAAE,GAAG,EAAE,EAAE,IAAI,UAAU,EAAE,GAAG,EAAE,EAAE,IAAI,UAAU,EAAE,GAAG,EAAE,EAAE,CAAC;;AAGnG,MAAaC,UAAQ,IAAY,KAAK,IAAI,KAAK,OAAgB,IAAI,YAAY,IAAI,IAAI,GAAG;;AAG1F,MAAaC,eAAa,MACxB,IAAI,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG;;AAGnC,MAAaC,eACX,QACA,YACgD;CAChD,MAAM,IAAI,QAAQ,OAAO,GAAG;CAC5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,EAAE,CAAC;;AAEvD,MAAa,OAAO,KAGlB,IAAI,GAAY,MAA6B,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC"}
@@ -1,14 +1,14 @@
1
1
  import { t as __exportAll } from "../shared/chunk-25Hzd3z8.mjs";
2
2
  import { Pipeable, dual, invariant } from "../utils.mjs";
3
3
  import { epsEquals } from "../number.mjs";
4
- import { a as make$10, c as subtract, i as magnitude, o as makeWeighted, r as isVector2, s as scale, t as add } from "../shared/vector2-CWU3cPB2.mjs";
5
- import { t as make$11 } from "../shared/vector3-DmMm6pX8.mjs";
6
- import { n as transpose, t as make$12 } from "../shared/vector4-oqPPp45j.mjs";
7
- import { a as vectorProductLeft, i as multiply, t as inverse } from "../shared/matrix4x4-qyRufxfs.mjs";
4
+ import { a as make$10, c as subtract, i as magnitude, o as makeWeighted, r as isVector2, s as scale, t as add } from "../shared/vector2-CSkaMXvp.mjs";
5
+ import { t as make$11 } from "../shared/vector3-CR2LPV03.mjs";
6
+ import { n as transpose, t as make$12 } from "../shared/vector4-PO_7EYd-.mjs";
7
+ import { a as vectorProductLeft, i as multiply, t as inverse } from "../shared/matrix4x4-BWmf4lZM.mjs";
8
8
  import { o as none, s as one } from "../shared/solution-UKGK826h.mjs";
9
- import { c as fromPolynomials, n as fromBezierPoints, s as fromCoefficients } from "../shared/rationalCubic2d-DaFTrUXw.mjs";
10
- import { a as cubicHermite, i as cubicBezier, r as cubicBasisSpline, t as apply } from "../shared/characteristic-D9yZWCym.mjs";
11
- import { i as make$13, t as fromArray$10 } from "../shared/rationalCubic2d-BZvT9s5N.mjs";
9
+ import { c as fromPolynomials, n as fromBezierPoints, s as fromCoefficients } from "../shared/rationalCubic2d-3S5K69Jy.mjs";
10
+ import { a as cubicHermite, i as cubicBezier, r as cubicBasisSpline, t as apply } from "../shared/characteristic-B0VEB_OA.mjs";
11
+ import { i as make$13, t as fromArray$10 } from "../shared/rationalCubic2d-CJY-feGw.mjs";
12
12
  //#region src/splines/rationalBezier2d.internal.ts
13
13
  const RationalBezier2dTypeId = Symbol("curvy/splines/rationalBezier2d");
14
14
  var RationalBezier2dImpl = class extends Pipeable {
@@ -1,4 +1,4 @@
1
- import { l as vector2_exports } from "../shared/vector2-CWU3cPB2.mjs";
2
- import { n as vector3_exports } from "../shared/vector3-DmMm6pX8.mjs";
3
- import { r as vector4_exports } from "../shared/vector4-oqPPp45j.mjs";
1
+ import { l as vector2_exports } from "../shared/vector2-CSkaMXvp.mjs";
2
+ import { n as vector3_exports } from "../shared/vector3-CR2LPV03.mjs";
3
+ import { r as vector4_exports } from "../shared/vector4-PO_7EYd-.mjs";
4
4
  export { vector2_exports as Vector2, vector3_exports as Vector3, vector4_exports as Vector4 };
@@ -366,6 +366,25 @@ export declare const setX: {
366
366
  */
367
367
  (x: number): (v: Vector2) => Vector2;
368
368
  };
369
+ export declare const mapX: {
370
+ /**
371
+ * Returns a new `Vector2` with the x component replaced by `f(v.x)`.
372
+ *
373
+ * @param v - The vector to update.
374
+ * @param f - The function to apply to the x component.
375
+ * @returns A new `Vector2` with the updated x.
376
+ * @since 2.0.0
377
+ */
378
+ (v: Vector2, f: (x: number) => number): Vector2;
379
+ /**
380
+ * Returns a new `Vector2` with the x component replaced by `f(v.x)`.
381
+ *
382
+ * @param f - The function to apply to the x component.
383
+ * @returns A function that takes a vector and returns the updated vector.
384
+ * @since 2.0.0
385
+ */
386
+ (f: (x: number) => number): (v: Vector2) => Vector2;
387
+ };
369
388
  /**
370
389
  * Gets the y component of a `Vector2`.
371
390
  *
@@ -393,6 +412,25 @@ export declare const setY: {
393
412
  */
394
413
  (y: number): (v: Vector2) => Vector2;
395
414
  };
415
+ export declare const mapY: {
416
+ /**
417
+ * Returns a new `Vector2` with the y component replaced by `f(v.y)`.
418
+ *
419
+ * @param v - The vector to update.
420
+ * @param f - The function to apply to the y component.
421
+ * @returns A new `Vector2` with the updated y.
422
+ * @since 2.0.0
423
+ */
424
+ (v: Vector2, f: (y: number) => number): Vector2;
425
+ /**
426
+ * Returns a new `Vector2` with the y component replaced by `f(v.y)`.
427
+ *
428
+ * @param f - The function to apply to the y component.
429
+ * @returns A function that takes a vector and returns the updated vector.
430
+ * @since 2.0.0
431
+ */
432
+ (f: (y: number) => number): (v: Vector2) => Vector2;
433
+ };
396
434
  /**
397
435
  * Gets the radius of a `Vector2`.
398
436
  *
@@ -420,6 +458,27 @@ export declare const setR: {
420
458
  */
421
459
  (r: number): (v: Vector2) => Vector2;
422
460
  };
461
+ export declare const mapR: {
462
+ /**
463
+ * Returns a new `Vector2` with the radius replaced by `f(magnitude(v))`,
464
+ * preserving the angle.
465
+ *
466
+ * @param v - The vector to update.
467
+ * @param f - The function to apply to the radius.
468
+ * @returns A new `Vector2` with the updated radius.
469
+ * @since 2.0.0
470
+ */
471
+ (v: Vector2, f: (r: number) => number): Vector2;
472
+ /**
473
+ * Returns a new `Vector2` with the radius replaced by `f(magnitude(v))`,
474
+ * preserving the angle.
475
+ *
476
+ * @param f - The function to apply to the radius.
477
+ * @returns A function that takes a vector and returns the updated vector.
478
+ * @since 2.0.0
479
+ */
480
+ (f: (r: number) => number): (v: Vector2) => Vector2;
481
+ };
423
482
  /**
424
483
  * Gets the angle of a `Vector2`.
425
484
  *
@@ -447,3 +506,24 @@ export declare const setTheta: {
447
506
  */
448
507
  (theta: number): (v: Vector2) => Vector2;
449
508
  };
509
+ export declare const mapTheta: {
510
+ /**
511
+ * Returns a new `Vector2` with the angle replaced by `f(getTheta(v))`,
512
+ * preserving the radius.
513
+ *
514
+ * @param v - The vector to update.
515
+ * @param f - The function to apply to the angle (in radians).
516
+ * @returns A new `Vector2` with the updated angle.
517
+ * @since 2.0.0
518
+ */
519
+ (v: Vector2, f: (theta: number) => number): Vector2;
520
+ /**
521
+ * Returns a new `Vector2` with the angle replaced by `f(getTheta(v))`,
522
+ * preserving the radius.
523
+ *
524
+ * @param f - The function to apply to the angle (in radians).
525
+ * @returns A function that takes a vector and returns the updated vector.
526
+ * @since 2.0.0
527
+ */
528
+ (f: (theta: number) => number): (v: Vector2) => Vector2;
529
+ };
@@ -317,6 +317,25 @@ export declare const setX: {
317
317
  */
318
318
  (x: number): (v: Vector3) => Vector3;
319
319
  };
320
+ export declare const mapX: {
321
+ /**
322
+ * Returns a new `Vector3` with the x component replaced by `f(v.x)`.
323
+ *
324
+ * @param v - The vector to update.
325
+ * @param f - The function to apply to the x component.
326
+ * @returns A new `Vector3` with the updated x.
327
+ * @since 2.0.0
328
+ */
329
+ (v: Vector3, f: (x: number) => number): Vector3;
330
+ /**
331
+ * Returns a new `Vector3` with the x component replaced by `f(v.x)`.
332
+ *
333
+ * @param f - The function to apply to the x component.
334
+ * @returns A function that takes a vector and returns the updated vector.
335
+ * @since 2.0.0
336
+ */
337
+ (f: (x: number) => number): (v: Vector3) => Vector3;
338
+ };
320
339
  /**
321
340
  * Gets the y component of a `Vector3`.
322
341
  *
@@ -344,6 +363,25 @@ export declare const setY: {
344
363
  */
345
364
  (y: number): (v: Vector3) => Vector3;
346
365
  };
366
+ export declare const mapY: {
367
+ /**
368
+ * Returns a new `Vector3` with the y component replaced by `f(v.y)`.
369
+ *
370
+ * @param v - The vector to update.
371
+ * @param f - The function to apply to the y component.
372
+ * @returns A new `Vector3` with the updated y.
373
+ * @since 2.0.0
374
+ */
375
+ (v: Vector3, f: (y: number) => number): Vector3;
376
+ /**
377
+ * Returns a new `Vector3` with the y component replaced by `f(v.y)`.
378
+ *
379
+ * @param f - The function to apply to the y component.
380
+ * @returns A function that takes a vector and returns the updated vector.
381
+ * @since 2.0.0
382
+ */
383
+ (f: (y: number) => number): (v: Vector3) => Vector3;
384
+ };
347
385
  /**
348
386
  * Gets the z component of a `Vector3`.
349
387
  *
@@ -371,6 +409,25 @@ export declare const setZ: {
371
409
  */
372
410
  (z: number): (v: Vector3) => Vector3;
373
411
  };
412
+ export declare const mapZ: {
413
+ /**
414
+ * Returns a new `Vector3` with the z component replaced by `f(v.z)`.
415
+ *
416
+ * @param v - The vector to update.
417
+ * @param f - The function to apply to the z component.
418
+ * @returns A new `Vector3` with the updated z.
419
+ * @since 2.0.0
420
+ */
421
+ (v: Vector3, f: (z: number) => number): Vector3;
422
+ /**
423
+ * Returns a new `Vector3` with the z component replaced by `f(v.z)`.
424
+ *
425
+ * @param f - The function to apply to the z component.
426
+ * @returns A function that takes a vector and returns the updated vector.
427
+ * @since 2.0.0
428
+ */
429
+ (f: (z: number) => number): (v: Vector3) => Vector3;
430
+ };
374
431
  /**
375
432
  * Gets the radius of a `Vector3`.
376
433
  *
@@ -398,6 +455,27 @@ export declare const setR: {
398
455
  */
399
456
  (r: number): (v: Vector3) => Vector3;
400
457
  };
458
+ export declare const mapR: {
459
+ /**
460
+ * Returns a new `Vector3` with the radius replaced by `f(magnitude(v))`,
461
+ * preserving direction.
462
+ *
463
+ * @param v - The vector to update.
464
+ * @param f - The function to apply to the radius.
465
+ * @returns A new `Vector3` with the updated radius.
466
+ * @since 2.0.0
467
+ */
468
+ (v: Vector3, f: (r: number) => number): Vector3;
469
+ /**
470
+ * Returns a new `Vector3` with the radius replaced by `f(magnitude(v))`,
471
+ * preserving direction.
472
+ *
473
+ * @param f - The function to apply to the radius.
474
+ * @returns A function that takes a vector and returns the updated vector.
475
+ * @since 2.0.0
476
+ */
477
+ (f: (r: number) => number): (v: Vector3) => Vector3;
478
+ };
401
479
  /**
402
480
  * Gets the polar angle (theta) of a `Vector3`.
403
481
  *
@@ -425,6 +503,27 @@ export declare const setTheta: {
425
503
  */
426
504
  (theta: number): (v: Vector3) => Vector3;
427
505
  };
506
+ export declare const mapTheta: {
507
+ /**
508
+ * Returns a new `Vector3` with the polar angle replaced by
509
+ * `f(getTheta(v))`.
510
+ *
511
+ * @param v - The vector to update.
512
+ * @param f - The function to apply to the polar angle (in radians).
513
+ * @returns A new `Vector3` with the updated polar angle.
514
+ * @since 2.0.0
515
+ */
516
+ (v: Vector3, f: (theta: number) => number): Vector3;
517
+ /**
518
+ * Returns a new `Vector3` with the polar angle replaced by
519
+ * `f(getTheta(v))`.
520
+ *
521
+ * @param f - The function to apply to the polar angle (in radians).
522
+ * @returns A function that takes a vector and returns the updated vector.
523
+ * @since 2.0.0
524
+ */
525
+ (f: (theta: number) => number): (v: Vector3) => Vector3;
526
+ };
428
527
  /**
429
528
  * Gets the azimuthal angle (phi) of a `Vector3`.
430
529
  *
@@ -452,3 +551,24 @@ export declare const setPhi: {
452
551
  */
453
552
  (phi: number): (v: Vector3) => Vector3;
454
553
  };
554
+ export declare const mapPhi: {
555
+ /**
556
+ * Returns a new `Vector3` with the azimuthal angle replaced by
557
+ * `f(getPhi(v))`.
558
+ *
559
+ * @param v - The vector to update.
560
+ * @param f - The function to apply to the azimuthal angle (in radians).
561
+ * @returns A new `Vector3` with the updated azimuthal angle.
562
+ * @since 2.0.0
563
+ */
564
+ (v: Vector3, f: (phi: number) => number): Vector3;
565
+ /**
566
+ * Returns a new `Vector3` with the azimuthal angle replaced by
567
+ * `f(getPhi(v))`.
568
+ *
569
+ * @param f - The function to apply to the azimuthal angle (in radians).
570
+ * @returns A function that takes a vector and returns the updated vector.
571
+ * @since 2.0.0
572
+ */
573
+ (f: (phi: number) => number): (v: Vector3) => Vector3;
574
+ };