curvy 2.0.0-alpha.18 → 2.0.0-alpha.19

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 (206) hide show
  1. package/dist/arc/arc.d.ts +239 -64
  2. package/dist/arc/index.d.ts +1 -0
  3. package/dist/arc/index.mjs +95 -26
  4. package/dist/arc/index.mjs.map +1 -1
  5. package/dist/characteristic/index.mjs +1 -1
  6. package/dist/coordinates/coordinateSystem.d.ts +92 -48
  7. package/dist/coordinates/dimension.d.ts +174 -22
  8. package/dist/coordinates/index.mjs +274 -85
  9. package/dist/coordinates/index.mjs.map +1 -1
  10. package/dist/curve/cubic2d.d.ts +6 -7
  11. package/dist/curve/index.mjs +2 -2
  12. package/dist/curve/internal/certified.d.ts +1 -0
  13. package/dist/curve/internal/cubic2d.d.ts +1 -0
  14. package/dist/curve/{curve2d.d.ts → internal/curve2d.d.ts} +5 -5
  15. package/dist/curve/internal/linear2d.d.ts +1 -0
  16. package/dist/curve/internal/quadratic2d.d.ts +1 -0
  17. package/dist/curve/internal/rationalCubic2d.d.ts +2 -0
  18. package/dist/curve/linear2d.d.ts +6 -7
  19. package/dist/curve/quadratic2d.d.ts +6 -7
  20. package/dist/curve/rationalCubic2d.d.ts +7 -7
  21. package/dist/interval/index.mjs +2 -2
  22. package/dist/interval/internal/interval.d.ts +1 -0
  23. package/dist/interval/internal/interval2d.d.ts +1 -0
  24. package/dist/interval/interval.d.ts +9 -5
  25. package/dist/interval/interval2d.d.ts +3 -4
  26. package/dist/matrix/index.mjs +2 -2
  27. package/dist/matrix/index.mjs.map +1 -1
  28. package/dist/matrix/internal/matrix2x2.d.ts +1 -0
  29. package/dist/matrix/internal/matrix3x3.d.ts +2 -0
  30. package/dist/matrix/internal/matrix4x4.d.ts +1 -0
  31. package/dist/matrix/matrix2x2.d.ts +4 -5
  32. package/dist/matrix/matrix3x3.d.ts +6 -7
  33. package/dist/matrix/matrix4x4.d.ts +6 -7
  34. package/dist/monotonicity/index.mjs +1 -1
  35. package/dist/number.mjs +1 -1
  36. package/dist/number.mjs.map +1 -1
  37. package/dist/path/cubic2d.d.ts +5 -6
  38. package/dist/path/index.mjs +4 -4
  39. package/dist/path/internal/cubic2d.d.ts +1 -0
  40. package/dist/path/internal/linear2d.d.ts +1 -0
  41. package/dist/path/{path2d.d.ts → internal/path2d.d.ts} +12 -10
  42. package/dist/path/internal/quadratic2d.d.ts +1 -0
  43. package/dist/path/internal/rationalCubic2d.d.ts +1 -0
  44. package/dist/path/linear2d.d.ts +5 -6
  45. package/dist/path/quadratic2d.d.ts +5 -6
  46. package/dist/path/rationalCubic2d.d.ts +3 -4
  47. package/dist/piecewise/index.mjs +16 -13
  48. package/dist/piecewise/index.mjs.map +1 -1
  49. package/dist/piecewise/internal/piecewise.d.ts +1 -0
  50. package/dist/piecewise/piecewise.d.ts +6 -7
  51. package/dist/polynomial/cubic.d.ts +5 -6
  52. package/dist/polynomial/index.mjs +2 -2
  53. package/dist/polynomial/internal/cubic.d.ts +1 -0
  54. package/dist/polynomial/internal/cubicImpl.d.ts +1 -0
  55. package/dist/polynomial/internal/linear.d.ts +1 -0
  56. package/dist/polynomial/{polynomial.d.ts → internal/polynomial.d.ts} +2 -2
  57. package/dist/polynomial/internal/quadratic.d.ts +1 -0
  58. package/dist/polynomial/internal/quadraticImpl.d.ts +1 -0
  59. package/dist/polynomial/linear.d.ts +5 -6
  60. package/dist/polynomial/quadratic.d.ts +5 -6
  61. package/dist/shared/{affine2d-DUqbI9RP.mjs → affine2d-DBrrscDK.mjs} +10 -13
  62. package/dist/shared/affine2d-DBrrscDK.mjs.map +1 -0
  63. package/dist/shared/arc-D4Q75qss.mjs +344 -0
  64. package/dist/shared/arc-D4Q75qss.mjs.map +1 -0
  65. package/dist/shared/{characteristic-OjEkAZBA.mjs → characteristic-BDz-BfjP.mjs} +3 -3
  66. package/dist/shared/{characteristic-OjEkAZBA.mjs.map → characteristic-BDz-BfjP.mjs.map} +1 -1
  67. package/dist/shared/{cubic-CddsJ7ek.mjs → cubic-Cfby-PoP.mjs} +44 -25
  68. package/dist/shared/cubic-Cfby-PoP.mjs.map +1 -0
  69. package/dist/shared/{cubic2d-CnREttj6.mjs → cubic2d-B9SkLTNj.mjs} +44 -24
  70. package/dist/shared/cubic2d-B9SkLTNj.mjs.map +1 -0
  71. package/dist/shared/{cubic2d-B6OVwHqs.mjs → cubic2d-Bg6DAceR.mjs} +32 -34
  72. package/dist/shared/cubic2d-Bg6DAceR.mjs.map +1 -0
  73. package/dist/{utils.mjs → shared/function-9StDYgP-.mjs} +3 -36
  74. package/dist/shared/function-9StDYgP-.mjs.map +1 -0
  75. package/dist/shared/{interval-8-erxD4h.mjs → interval-CVE7RB0r.mjs} +7 -10
  76. package/dist/shared/interval-CVE7RB0r.mjs.map +1 -0
  77. package/dist/shared/{interval2d-BCabpCmV.mjs → interval2d-JPEHgQSB.mjs} +20 -13
  78. package/dist/shared/interval2d-JPEHgQSB.mjs.map +1 -0
  79. package/dist/shared/{linear2d-B01Cuo06.mjs → linear2d-vSq0s0rv.mjs} +6 -6
  80. package/dist/shared/linear2d-vSq0s0rv.mjs.map +1 -0
  81. package/dist/shared/{matrix3x3.internal-BW6BMirB.mjs → matrix3x3-CkajJmjn.mjs} +15 -28
  82. package/dist/shared/matrix3x3-CkajJmjn.mjs.map +1 -0
  83. package/dist/shared/{matrix4x4-Cq_UJZNO.mjs → matrix4x4-YBpje9Xv.mjs} +10 -16
  84. package/dist/shared/matrix4x4-YBpje9Xv.mjs.map +1 -0
  85. package/dist/shared/{monotonicity-C-lodqfb.mjs → monotonicity-C2ANe23J.mjs} +1 -1
  86. package/dist/shared/{monotonicity-C-lodqfb.mjs.map → monotonicity-C2ANe23J.mjs.map} +1 -1
  87. package/dist/shared/{quadratic-CvvVVM5r.mjs → quadratic-Fygzcc14.mjs} +2 -2
  88. package/dist/shared/quadratic-Fygzcc14.mjs.map +1 -0
  89. package/dist/shared/{quadratic2d-CdwZ28Rg.mjs → quadratic2d-DVPLYmqX.mjs} +6 -6
  90. package/dist/shared/quadratic2d-DVPLYmqX.mjs.map +1 -0
  91. package/dist/shared/{rationalCubic2d-CXTogOPX.mjs → rationalCubic2d-CQdLNPrT.mjs} +125 -148
  92. package/dist/shared/rationalCubic2d-CQdLNPrT.mjs.map +1 -0
  93. package/dist/shared/{rationalCubic2d-A7ZkG9_r.mjs → rationalCubic2d-xGfQYkpL.mjs} +13 -10
  94. package/dist/shared/rationalCubic2d-xGfQYkpL.mjs.map +1 -0
  95. package/dist/shared/{solution-Bi6zCdQH.mjs → solution-DeWeVSi6.mjs} +22 -8
  96. package/dist/shared/solution-DeWeVSi6.mjs.map +1 -0
  97. package/dist/shared/value-D-cjWuxu.mjs +115 -0
  98. package/dist/shared/value-D-cjWuxu.mjs.map +1 -0
  99. package/dist/shared/{vector2-BzDphAEw.mjs → vector2-Df3kN-_g.mjs} +2 -2
  100. package/dist/shared/vector2-Df3kN-_g.mjs.map +1 -0
  101. package/dist/shared/{vector2.internal-B42hdbQr.mjs → vector2-Dtk5XT5b.mjs} +15 -19
  102. package/dist/shared/{vector2.internal-B42hdbQr.mjs.map → vector2-Dtk5XT5b.mjs.map} +1 -1
  103. package/dist/shared/{vector3--DNTuqZ-.mjs → vector3-CFxXUgGS.mjs} +2 -2
  104. package/dist/shared/vector3-CFxXUgGS.mjs.map +1 -0
  105. package/dist/shared/{vector3.internal-DRO121Di.mjs → vector3-mc97w7ef.mjs} +14 -10
  106. package/dist/shared/vector3-mc97w7ef.mjs.map +1 -0
  107. package/dist/shared/{vector4.internal-DH5DzNYO.mjs → vector4-C7pBKhVb.mjs} +15 -10
  108. package/dist/shared/vector4-C7pBKhVb.mjs.map +1 -0
  109. package/dist/shared/{vector4-syi93IOY.mjs → vector4-CqL8xajZ.mjs} +2 -2
  110. package/dist/shared/vector4-CqL8xajZ.mjs.map +1 -0
  111. package/dist/solution/index.mjs +1 -1
  112. package/dist/solution/{solution.internal.d.ts → internal/solution.d.ts} +1 -1
  113. package/dist/solution/solution.d.ts +9 -5
  114. package/dist/splines/basis2d.d.ts +3 -4
  115. package/dist/splines/bezier2d.d.ts +3 -4
  116. package/dist/splines/cardinal2d.d.ts +3 -4
  117. package/dist/splines/hermite2d.d.ts +3 -4
  118. package/dist/splines/index.mjs +51 -38
  119. package/dist/splines/index.mjs.map +1 -1
  120. package/dist/splines/internal/basis2d.d.ts +1 -0
  121. package/dist/splines/internal/bezier2d.d.ts +1 -0
  122. package/dist/splines/internal/cardinal2d.d.ts +1 -0
  123. package/dist/splines/internal/hermite2d.d.ts +1 -0
  124. package/dist/splines/internal/linear2d.d.ts +1 -0
  125. package/dist/splines/internal/rationalBezier2d.d.ts +1 -0
  126. package/dist/splines/{util.d.ts → internal/util.d.ts} +3 -3
  127. package/dist/splines/linear2d.d.ts +3 -4
  128. package/dist/splines/rationalBezier2d.d.ts +3 -4
  129. package/dist/transform/affine2d.d.ts +5 -6
  130. package/dist/transform/index.mjs +1 -1
  131. package/dist/transform/internal/affine2d.d.ts +1 -0
  132. package/dist/transform/{traits.d.ts → internal/traits.d.ts} +1 -1
  133. package/dist/{utils.d.ts → utils/function.d.ts} +2 -61
  134. package/dist/utils/index.d.ts +4 -0
  135. package/dist/utils/index.mjs +3 -0
  136. package/dist/utils/invariant.d.ts +17 -0
  137. package/dist/utils/pipeable.d.ts +44 -0
  138. package/dist/utils/value.d.ts +110 -0
  139. package/dist/vector/index.mjs +3 -3
  140. package/dist/vector/internal/vector2.d.ts +1 -0
  141. package/dist/vector/internal/vector3.d.ts +1 -0
  142. package/dist/vector/internal/vector4.d.ts +1 -0
  143. package/dist/vector/vector2.d.ts +11 -7
  144. package/dist/vector/vector3.d.ts +9 -5
  145. package/dist/vector/vector4.d.ts +9 -5
  146. package/package.json +3 -3
  147. package/dist/arc/arc.internal.d.ts +0 -2
  148. package/dist/coordinates/coordinateSystem.internal.d.ts +0 -2
  149. package/dist/coordinates/dimension.internal.d.ts +0 -2
  150. package/dist/curve/cubic2d.internal.d.ts +0 -2
  151. package/dist/curve/linear2d.internal.d.ts +0 -2
  152. package/dist/curve/quadratic2d.internal.d.ts +0 -2
  153. package/dist/curve/rationalCubic2d.internal.d.ts +0 -2
  154. package/dist/interval/interval2d.internal.d.ts +0 -2
  155. package/dist/matrix/matrix2x2.internal.d.ts +0 -2
  156. package/dist/matrix/matrix3x3.internal.d.ts +0 -4
  157. package/dist/matrix/matrix4x4.internal.d.ts +0 -2
  158. package/dist/path/cubic2d.internal.d.ts +0 -2
  159. package/dist/path/linear2d.internal.d.ts +0 -2
  160. package/dist/path/quadratic2d.internal.d.ts +0 -2
  161. package/dist/path/rationalCubic2d.internal.d.ts +0 -2
  162. package/dist/piecewise/piecewise.internal.d.ts +0 -2
  163. package/dist/polynomial/cubic.internal.circular.d.ts +0 -2
  164. package/dist/polynomial/linear.internal.d.ts +0 -2
  165. package/dist/polynomial/quadratic.internal.circular.d.ts +0 -2
  166. package/dist/shared/affine2d-DUqbI9RP.mjs.map +0 -1
  167. package/dist/shared/arc.internal-DBLPlj56.mjs +0 -138
  168. package/dist/shared/arc.internal-DBLPlj56.mjs.map +0 -1
  169. package/dist/shared/cubic-CddsJ7ek.mjs.map +0 -1
  170. package/dist/shared/cubic2d-B6OVwHqs.mjs.map +0 -1
  171. package/dist/shared/cubic2d-CnREttj6.mjs.map +0 -1
  172. package/dist/shared/interval-8-erxD4h.mjs.map +0 -1
  173. package/dist/shared/interval2d-BCabpCmV.mjs.map +0 -1
  174. package/dist/shared/linear2d-B01Cuo06.mjs.map +0 -1
  175. package/dist/shared/matrix3x3.internal-BW6BMirB.mjs.map +0 -1
  176. package/dist/shared/matrix4x4-Cq_UJZNO.mjs.map +0 -1
  177. package/dist/shared/quadratic-CvvVVM5r.mjs.map +0 -1
  178. package/dist/shared/quadratic2d-CdwZ28Rg.mjs.map +0 -1
  179. package/dist/shared/rationalCubic2d-A7ZkG9_r.mjs.map +0 -1
  180. package/dist/shared/rationalCubic2d-CXTogOPX.mjs.map +0 -1
  181. package/dist/shared/solution-Bi6zCdQH.mjs.map +0 -1
  182. package/dist/shared/vector2-BzDphAEw.mjs.map +0 -1
  183. package/dist/shared/vector3--DNTuqZ-.mjs.map +0 -1
  184. package/dist/shared/vector3.internal-DRO121Di.mjs.map +0 -1
  185. package/dist/shared/vector4-syi93IOY.mjs.map +0 -1
  186. package/dist/shared/vector4.internal-DH5DzNYO.mjs.map +0 -1
  187. package/dist/splines/basis2d.internal.d.ts +0 -2
  188. package/dist/splines/bezier2d.internal.d.ts +0 -2
  189. package/dist/splines/cardinal2d.internal.d.ts +0 -2
  190. package/dist/splines/hermite2d.internal.d.ts +0 -2
  191. package/dist/splines/linear2d.internal.d.ts +0 -2
  192. package/dist/splines/rationalBezier2d.internal.d.ts +0 -2
  193. package/dist/transform/affine2d.internal.d.ts +0 -2
  194. package/dist/utils.mjs.map +0 -1
  195. package/dist/vector/vector2.internal.d.ts +0 -4
  196. package/dist/vector/vector3.internal.d.ts +0 -2
  197. package/dist/vector/vector4.internal.d.ts +0 -2
  198. /package/dist/{interval/interval.internal.d.ts → arc/internal/arc.d.ts} +0 -0
  199. /package/dist/{polynomial/cubic.internal.d.ts → coordinates/internal/coordinateSystem.d.ts} +0 -0
  200. /package/dist/{polynomial/quadratic.internal.d.ts → coordinates/internal/dimension.d.ts} +0 -0
  201. /package/dist/{dimensions.d.ts → internal/dimensions.d.ts} +0 -0
  202. /package/dist/{length.d.ts → internal/length.d.ts} +0 -0
  203. /package/dist/matrix/{traits.d.ts → internal/traits.d.ts} +0 -0
  204. /package/dist/path/{traits.d.ts → internal/traits.d.ts} +0 -0
  205. /package/dist/piecewise/{traits.d.ts → internal/traits.d.ts} +0 -0
  206. /package/dist/polynomial/{traits.d.ts → internal/traits.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["internal.isCircular","internal.circular","internal.equals","internal.startPoint","internal.endPoint","internal.solve","internal.length","internal.reverse","internal.boundingBox","internal.toPath","internal.toPathData"],"sources":["../../src/arc/arc.ts"],"sourcesContent":["import type { Closed } from '../interval/interval.ts'\nimport type { Interval2d } from '../interval/interval2d.ts'\nimport type { RationalCubicPath2d } from '../path/rationalCubic2d.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport type { ArcTypeId } from './arc.internal.ts'\nimport * as internal from './arc.internal.ts'\n\n/**\n * A circular arc: the points `center + radius * (cos(a), sin(a))` for `a`\n * running from `startAngle` to `startAngle + sweep`.\n *\n * An authoring representation, like the spline modules: describe the arc\n * here, query its closed-form geometry (`solve`, `length`, `boundingBox`),\n * and lower it with `toPath` for curve math or `toPathData` for SVG. The\n * description keeps answers the lowered form loses — arc length and\n * point-at-parameter are exact one-liners here and numeric iterations\n * there.\n *\n * Angles are in radians, measured from the `+x` direction, positive\n * rotating `+x` toward `+y` — clockwise in an SVG viewport's y-down\n * coordinates. Direction and multiplicity live in the sweep's sign and\n * magnitude: a negative sweep runs the other way, and a magnitude past\n * `2 * pi` keeps going around the circle.\n *\n * All fields are readonly. No operation mutates an arc.\n *\n * @since 2.0.0\n */\nexport interface Circular extends Pipeable {\n readonly [ArcTypeId]: ArcTypeId\n readonly kind: 'circular'\n /**\n * The cartesian center of the circle the arc lies on.\n */\n readonly center: Vector2\n /**\n * The circle's radius. Non-negative; `0` is a valid degenerate arc that\n * never leaves `center`.\n */\n readonly radius: number\n /**\n * The angle where the arc starts, in radians from the `+x` direction,\n * positive rotating `+x` toward `+y`.\n */\n readonly startAngle: number\n /**\n * The signed angular extent, in radians. Positive rotates `+x` toward\n * `+y`; a magnitude past `2 * pi` traces the circle more than once.\n */\n readonly sweep: number\n}\n\n/**\n * Configuration for `circular`. Only `radius` is required; the defaults\n * give a full circle around the origin.\n *\n * @since 2.0.0\n */\nexport interface CircularConfig {\n /**\n * The cartesian center of the circle. Defaults to the origin.\n */\n readonly center?: Vector2\n /**\n * The circle's radius. Must be finite and non-negative.\n */\n readonly radius: number\n /**\n * The angle where the arc starts, in radians from the `+x` direction,\n * positive rotating `+x` toward `+y`. Defaults to `0` (3 o'clock on\n * screen).\n */\n readonly startAngle?: number\n /**\n * The signed angular extent, in radians. Defaults to `2 * pi`, a full\n * circle.\n */\n readonly sweep?: number\n}\n\n/**\n * Checks if a value is a `Circular` arc.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `Circular` arc, `false` otherwise.\n * @since 2.0.0\n */\nexport const isCircular: (v: unknown) => v is Circular = internal.isCircular\n\n/**\n * Creates a `Circular` arc.\n *\n * @param config - Center, radius, start angle, and sweep. Only `radius` is\n * required; see `CircularConfig` for the defaults.\n * @returns A new `Circular` arc.\n * @throws `Error` when `radius` is negative, or when `radius`,\n * `startAngle`, or `sweep` is not finite.\n * @since 2.0.0\n * @example\n * ```ts\n * // A quarter circle of radius 100 from 3 o'clock to 6 o'clock:\n * const quarter = Arc.circular({ radius: 100, sweep: Math.PI / 2 })\n *\n * // Omitting sweep gives the full circle:\n * const dial = Arc.circular({ center: Vector2.make(200, 200), radius: 80 })\n * ```\n */\nexport const circular: (config: CircularConfig) => Circular = internal.circular\n\nexport const equals: {\n /**\n * Checks two `Circular` arcs for equality, field by field. Numeric\n * fields compare within the tolerance of `coincident` from\n * `curvy/number`.\n *\n * Comparison is structural, not geometric: two arcs tracing the same\n * points from different descriptions — a start angle shifted by\n * `2 * pi`, or the reverse direction — compare unequal.\n *\n * @param a - The first arc.\n * @param b - The second arc.\n * @returns `true` if the arcs are equal, `false` otherwise.\n * @since 2.0.0\n */\n (a: Circular, b: Circular): boolean\n /**\n * Checks two `Circular` arcs for equality.\n *\n * @param b - The arc to compare against.\n * @returns A function that takes an arc and returns whether the two are\n * equal.\n * @since 2.0.0\n */\n (b: Circular): (a: Circular) => boolean\n} = internal.equals\n\n/**\n * Computes the point where the arc starts,\n * `center + radius * (cos(startAngle), sin(startAngle))`.\n *\n * @param a - The arc.\n * @returns The arc's first point.\n * @since 2.0.0\n */\nexport const startPoint: (a: Circular) => Vector2 = internal.startPoint\n\n/**\n * Computes the point where the arc ends, evaluated at\n * `startAngle + sweep`.\n *\n * On a full-turn arc the result lands within rounding of `startPoint`,\n * not bitwise on it — the trig re-evaluates a full period away. `toPathData`\n * closes full circles on the exact starting coordinates instead.\n *\n * @param a - The arc.\n * @returns The arc's last point.\n * @since 2.0.0\n */\nexport const endPoint: (a: Circular) => Vector2 = internal.endPoint\n\nexport const solve: {\n /**\n * Evaluates the arc at parameter `t`, the point at angle\n * `startAngle + t * sweep`.\n *\n * The uniform parameter is also the arc-length parameter: equal steps\n * in `t` cover equal distance along the arc, a property polynomial\n * curves lack. `t` is not clamped — values outside `[0, 1]` continue\n * around the circle.\n *\n * @param a - The arc to evaluate.\n * @param t - The parameter. `0` is the start of the arc, `1` the end.\n * @returns The point on the arc at parameter `t`.\n * @since 2.0.0\n * @example\n * ```ts\n * // The midpoint of a quarter arc sits at 45 degrees:\n * Arc.solve(Arc.circular({ radius: 1, sweep: Math.PI / 2 }), 0.5)\n * // (cos(pi / 4), sin(pi / 4))\n * ```\n */\n (a: Circular, t: number): Vector2\n /**\n * Evaluates the arc at parameter `t`.\n *\n * @param t - The parameter. `0` is the start of the arc, `1` the end.\n * @returns A function that takes an arc and returns the point at `t`.\n * @since 2.0.0\n */\n (t: number): (a: Circular) => Vector2\n} = internal.solve\n\n/**\n * Computes the arc's length, `radius * abs(sweep)`. Exact, in closed form\n * — no tolerance parameter and no iteration, unlike arc length on a\n * lowered path. A sweep past one full turn counts every traversal.\n *\n * @param a - The arc.\n * @returns The length of the arc.\n * @since 2.0.0\n */\nexport const length: (a: Circular) => number = internal.length\n\n/**\n * Reverses the arc's direction: the same points traced the other way.\n * The start angle moves to the far end and the sweep negates, so\n * `solve(reverse(a), t)` is `solve(a, 1 - t)`.\n *\n * @param a - The arc.\n * @returns A new `Circular` arc tracing the input backward.\n * @since 2.0.0\n */\nexport const reverse: (a: Circular) => Circular = internal.reverse\n\n/**\n * Computes the exact axis-aligned bounding box of the arc.\n *\n * Extremes occur only at the endpoints or where the arc crosses an axis\n * direction (a multiple of `pi / 2`), so every side is evaluated in\n * closed form — exact up to IEEE 754 rounding, with no tolerance\n * parameter. Contrast `RationalCubicPath2d.boundingBox`, which is tight\n * only to a tolerance you choose. A zero-radius arc's box collapses to\n * `center`.\n *\n * @param a - The arc.\n * @returns A closed `Interval2d` enclosing exactly the arc's points.\n * @since 2.0.0\n */\nexport const boundingBox: (a: Circular) => Interval2d<Closed, Closed> = internal.boundingBox\n\n/**\n * Constructs the arc as a `RationalCubicPath2d`, exact up to IEEE 754\n * rounding — the same construction `CoordinateSystem.arc` uses: rational\n * cubic segments of at most a quarter turn each, uniform in angle, with a\n * sweep past one full turn tracing the circle more than once.\n *\n * The path is the form to transform: circles are not closed under affine\n * maps, but rational cubics are, so lower first and apply\n * `RationalCubicPath2d.transform` to the result.\n *\n * @param a - The arc.\n * @returns The arc as a `RationalCubicPath2d`.\n * @since 2.0.0\n * @example\n * ```ts\n * // A quarter-turn fillet of radius 8 as one exact rational segment:\n * const path = Arc.toPath(\n * Arc.circular({\n * center: Vector2.make(50, 50),\n * radius: 8,\n * startAngle: -Math.PI / 2,\n * sweep: Math.PI / 2,\n * }),\n * )\n * ```\n */\nexport const toPath: (a: Circular) => RationalCubicPath2d = internal.toPath\n\n/**\n * Emits exact SVG path data for the arc, using `A` commands computed from\n * the arc's description rather than recovered from curve coefficients.\n * Pieces stay at or under a half turn, so the large-arc flag is always\n * `0`; the sweep flag is `1` for a positive sweep, which renders\n * clockwise in an SVG viewport's y-down coordinates.\n *\n * Degenerate contracts:\n * - zero sweep, or radius `0`: an `M` command alone, which renders\n * nothing\n * - a full-turn sweep: the circle as two half-turn `A` commands, closing\n * on the exact starting coordinates\n * - a sweep past one full turn: clamped to one circle, where `toPath`\n * keeps going around — SVG path data cannot express multiple laps\n *\n * @param a - The arc.\n * @returns The SVG path data string.\n * @since 2.0.0\n * @example\n * ```ts\n * // d attribute for a gauge tick at 12 o'clock, ready for <path d={...}>:\n * const d = Arc.toPathData(\n * Arc.circular({\n * center: Vector2.make(200, 200),\n * radius: 120,\n * startAngle: -Math.PI / 2,\n * sweep: Math.PI / 6,\n * }),\n * )\n * ```\n */\nexport const toPathData: (a: Circular) => string = internal.toPathData\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwFA,MAAa,aAA4CA;;;;;;;;;;;;;;;;;;;AAoBzD,MAAa,WAAiDC;AAE9D,MAAa,SAyBTC;;;;;;;;;AAUJ,MAAa,aAAuCC;;;;;;;;;;;;;AAcpD,MAAa,WAAqCC;AAElD,MAAa,QA8BTC;;;;;;;;;;AAWJ,MAAa,SAAkCC;;;;;;;;;;AAW/C,MAAa,UAAqCC;;;;;;;;;;;;;;;AAgBlD,MAAa,cAA2DC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BxE,MAAa,SAA+CC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiC5D,MAAa,aAAsCC"}
1
+ {"version":3,"file":"index.mjs","names":["internal.isArc","internal.isCircular","internal.circular","internal.isElliptical","internal.elliptical","internal.equals","internal.startPoint","internal.endPoint","internal.solve","internal.length","internal.reverse","internal.boundingBox","internal.toPath","internal.toPathData"],"sources":["../../src/arc/arc.ts"],"sourcesContent":["import type { Closed } from '../interval/interval.ts'\nimport type { Interval2d } from '../interval/interval2d.ts'\nimport type { RationalCubicPath2d } from '../path/rationalCubic2d.ts'\nimport type { Value } from '../utils/value.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport * as internal from './internal/arc.ts'\n\n/**\n * An arc described by its geometry rather than its curve coefficients:\n * `Circular` for a piece of a circle, `Elliptical` for a piece of a\n * possibly rotated ellipse.\n *\n * An authoring representation, like the spline modules: describe the arc\n * here, query its geometry (`solve`, `length`, `boundingBox`), and lower it\n * with `toPath` for curve math or `toPathData` for SVG. The description\n * keeps answers the lowered form loses. Point-at-parameter is one\n * `cos`/`sin` here and a rational evaluation there, and length is a closed\n * form or a fixed-cost elliptic integral rather than a tolerance-driven\n * iteration.\n *\n * Every operation in this module accepts both kinds. Angles are in\n * radians, positive rotating `+x` toward `+y` — clockwise in an SVG\n * viewport's y-down coordinates. Direction and multiplicity live in the\n * sweep's sign and magnitude: a negative sweep runs the other way, and a\n * magnitude past `2 * pi` keeps going around.\n *\n * All fields are readonly. No operation mutates an arc.\n *\n * @since 2.0.0\n */\nexport type Arc = Circular | Elliptical\n\n/**\n * A circular arc: the points `center + radius * (cos(a), sin(a))` for `a`\n * running from `startAngle` to `startAngle + sweep`.\n *\n * Angles are in radians, measured from the `+x` direction, positive\n * rotating `+x` toward `+y` — clockwise in an SVG viewport's y-down\n * coordinates.\n *\n * @since 2.0.0\n */\nexport interface Circular extends Value.Instance {\n readonly '~curvy/Arc': '~curvy/Arc'\n readonly kind: 'circular'\n /**\n * The cartesian center of the circle the arc lies on.\n */\n readonly center: Vector2\n /**\n * The circle's radius. Non-negative; `0` is a valid degenerate arc that\n * never leaves `center`.\n */\n readonly radius: number\n /**\n * The angle where the arc starts, in radians from the `+x` direction,\n * positive rotating `+x` toward `+y`.\n */\n readonly startAngle: number\n /**\n * The signed angular extent, in radians. Positive rotates `+x` toward\n * `+y`; a magnitude past `2 * pi` traces the circle more than once.\n */\n readonly sweep: number\n}\n\n/**\n * Configuration for `circular`. Only `radius` is required; the defaults\n * give a full circle around the origin.\n *\n * @since 2.0.0\n */\nexport interface CircularConfig {\n /**\n * The cartesian center of the circle. Defaults to the origin.\n */\n readonly center?: Vector2\n /**\n * The circle's radius. Must be finite and non-negative.\n */\n readonly radius: number\n /**\n * The angle where the arc starts, in radians from the `+x` direction,\n * positive rotating `+x` toward `+y`. Defaults to `0` (3 o'clock on\n * screen).\n */\n readonly startAngle?: number\n /**\n * The signed angular extent, in radians. Defaults to `2 * pi`, a full\n * circle.\n */\n readonly sweep?: number\n}\n\n/**\n * An elliptical arc: the points of an ellipse with semi-axes `radiusX` and\n * `radiusY`, rotated by `rotation` around `center`, for parametric angles\n * running from `startAngle` to `startAngle + sweep`.\n *\n * The point at parametric angle `a` is\n * `center + R(rotation) * (radiusX * cos(a), radiusY * sin(a))`, where\n * `R` rotates `+x` toward `+y`. This is SVG's own arc parametrization.\n *\n * The parametric angle is not the direction from the center to the\n * point. It is the angle on the circle that the radii stretch into the\n * ellipse, so the two agree only on the axes, or everywhere when the radii\n * are equal. Equal steps in it also cover unequal distances along the\n * curve, unlike a circle's.\n *\n * @since 2.0.0\n */\nexport interface Elliptical extends Value.Instance {\n readonly '~curvy/Arc': '~curvy/Arc'\n readonly kind: 'elliptical'\n /**\n * The cartesian center of the ellipse the arc lies on.\n */\n readonly center: Vector2\n /**\n * The semi-axis along the ellipse's own x axis, before rotation.\n * Non-negative. `0` flattens the ellipse to a segment along its y axis.\n */\n readonly radiusX: number\n /**\n * The semi-axis along the ellipse's own y axis, before rotation.\n * Non-negative. `0` flattens the ellipse to a segment along its x axis.\n */\n readonly radiusY: number\n /**\n * The angle from the `+x` direction to the ellipse's own x axis, in\n * radians, positive rotating `+x` toward `+y`.\n */\n readonly rotation: number\n /**\n * The parametric angle where the arc starts, in radians. `0` is the end\n * of the ellipse's own x axis.\n */\n readonly startAngle: number\n /**\n * The signed parametric extent, in radians. Positive runs `+x` toward\n * `+y` in the ellipse's own frame. A magnitude past `2 * pi` traces the\n * ellipse more than once.\n */\n readonly sweep: number\n}\n\n/**\n * Configuration for `elliptical`. Only the two radii are required. The\n * defaults give a full, unrotated ellipse around the origin.\n *\n * @since 2.0.0\n */\nexport interface EllipticalConfig {\n /**\n * The cartesian center of the ellipse. Defaults to the origin.\n */\n readonly center?: Vector2\n /**\n * The semi-axis along the ellipse's own x axis. Must be finite and\n * non-negative.\n */\n readonly radiusX: number\n /**\n * The semi-axis along the ellipse's own y axis. Must be finite and\n * non-negative.\n */\n readonly radiusY: number\n /**\n * The angle from `+x` to the ellipse's own x axis, in radians. Defaults\n * to `0`, an axis-aligned ellipse.\n */\n readonly rotation?: number\n /**\n * The parametric angle where the arc starts, in radians. Defaults to\n * `0`, the end of the ellipse's own x axis.\n */\n readonly startAngle?: number\n /**\n * The signed parametric extent, in radians. Defaults to `2 * pi`, the\n * whole ellipse.\n */\n readonly sweep?: number\n}\n\n/**\n * Checks if a value is an `Arc` of either kind.\n *\n * @param v - The value to check.\n * @returns `true` if the value is an `Arc`, `false` otherwise.\n * @since 2.0.0\n */\nexport const isArc: (v: unknown) => v is Arc = internal.isArc\n\n/**\n * Checks if a value is a `Circular` arc.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `Circular` arc, `false` otherwise.\n * @since 2.0.0\n */\nexport const isCircular: (v: unknown) => v is Circular = internal.isCircular\n\n/**\n * Creates a `Circular` arc.\n *\n * @param config - Center, radius, start angle, and sweep. Only `radius` is\n * required; see `CircularConfig` for the defaults.\n * @returns A new `Circular` arc.\n * @throws `Error` when `radius` is negative, or when `radius`,\n * `startAngle`, or `sweep` is not finite.\n * @since 2.0.0\n * @example\n * ```ts\n * // A quarter circle of radius 100 from 3 o'clock to 6 o'clock:\n * const quarter = Arc.circular({ radius: 100, sweep: Math.PI / 2 })\n *\n * // Omitting sweep gives the full circle:\n * const dial = Arc.circular({ center: Vector2.make(200, 200), radius: 80 })\n * ```\n */\nexport const circular: (config: CircularConfig) => Circular = internal.circular\n\n/**\n * Checks if a value is an `Elliptical` arc.\n *\n * @param v - The value to check.\n * @returns `true` if the value is an `Elliptical` arc, `false` otherwise.\n * @since 2.0.0\n */\nexport const isElliptical: (v: unknown) => v is Elliptical = internal.isElliptical\n\n/**\n * Creates an `Elliptical` arc.\n *\n * Equal radii give an ellipse that is geometrically a circle, but the\n * value stays `Elliptical`. Build a `Circular` arc with `circular` to get\n * its closed-form length.\n *\n * @param config - Center, radii, rotation, start angle, and sweep. Only\n * `radiusX` and `radiusY` are required. See `EllipticalConfig` for the\n * defaults.\n * @returns A new `Elliptical` arc.\n * @throws `Error` when either radius is negative, or when a radius,\n * `rotation`, `startAngle`, or `sweep` is not finite.\n * @since 2.0.0\n * @example\n * ```ts\n * // The ellipse inscribed in a 200 x 100 box at the origin:\n * const oval = Arc.elliptical({\n * center: Vector2.make(100, 50),\n * radiusX: 100,\n * radiusY: 50,\n * })\n *\n * // Its lower half, from 3 o'clock through 6 o'clock to 9 o'clock:\n * const lower = Arc.elliptical({ radiusX: 100, radiusY: 50, sweep: Math.PI })\n * ```\n */\nexport const elliptical: (config: EllipticalConfig) => Elliptical = internal.elliptical\n\nexport const equals: {\n /**\n * Checks two arcs for equality, field by field. Numeric fields compare\n * within the tolerance of `coincident` from `curvy/number`.\n *\n * Comparison is structural, not geometric. Arcs of different kinds\n * always compare unequal, even an `Elliptical` arc with equal radii\n * against the `Circular` arc it traces. So do two arcs tracing the same\n * points from different descriptions, like a start angle shifted by\n * `2 * pi` or the reverse direction.\n *\n * @param a - The first arc.\n * @param b - The second arc.\n * @returns `true` if the arcs are equal, `false` otherwise.\n * @since 2.0.0\n */\n (a: Arc, b: Arc): boolean\n /**\n * Checks two arcs for equality, field by field.\n *\n * @param b - The arc to compare against.\n * @returns A function that takes an arc and returns whether the two are\n * equal.\n * @since 2.0.0\n */\n (b: Arc): (a: Arc) => boolean\n} = internal.equals\n\n/**\n * Computes the point where the arc starts, at angle `startAngle`. For a\n * circular arc that is `center + radius * (cos(startAngle), sin(startAngle))`.\n *\n * @param a - The arc.\n * @returns The arc's first point.\n * @since 2.0.0\n */\nexport const startPoint: (a: Arc) => Vector2 = internal.startPoint\n\n/**\n * Computes the point where the arc ends, evaluated at\n * `startAngle + sweep`.\n *\n * On a full-turn arc the result lands within rounding of `startPoint`,\n * not bitwise on it — the trig re-evaluates a full period away. `toPathData`\n * closes full circles on the exact starting coordinates instead.\n *\n * @param a - The arc.\n * @returns The arc's last point.\n * @since 2.0.0\n */\nexport const endPoint: (a: Arc) => Vector2 = internal.endPoint\n\nexport const solve: {\n /**\n * Evaluates the arc at parameter `t`, the point at angle\n * `startAngle + t * sweep`.\n *\n * On a circular arc the uniform parameter is also the arc-length\n * parameter. Equal steps in `t` cover equal distance along the arc, a\n * property polynomial curves lack. An elliptical arc's angle is\n * parametric, so equal steps cover more distance near the ends of the\n * longer axis.\n *\n * `t` is not clamped. Values outside `[0, 1]` continue around the curve.\n *\n * @param a - The arc to evaluate.\n * @param t - The parameter. `0` is the start of the arc, `1` the end.\n * @returns The point on the arc at parameter `t`.\n * @since 2.0.0\n * @example\n * ```ts\n * // The midpoint of a quarter arc sits at 45 degrees:\n * Arc.solve(Arc.circular({ radius: 1, sweep: Math.PI / 2 }), 0.5)\n * // (cos(pi / 4), sin(pi / 4))\n *\n * // On an ellipse the same parameter lands at (100 * cos(pi / 4), 50 * sin(pi / 4)),\n * // which lies at about 26.6 degrees from the center, not 45:\n * Arc.solve(Arc.elliptical({ radiusX: 100, radiusY: 50, sweep: Math.PI / 2 }), 0.5)\n * ```\n */\n (a: Arc, t: number): Vector2\n /**\n * Evaluates the arc at parameter `t`, the point at angle\n * `startAngle + t * sweep`.\n *\n * @param t - The parameter. `0` is the start of the arc, `1` the end.\n * @returns A function that takes an arc and returns the point at `t`.\n * @since 2.0.0\n */\n (t: number): (a: Arc) => Vector2\n} = internal.solve\n\n/**\n * Computes the arc's length. A sweep past one full turn counts every\n * traversal.\n *\n * Neither kind takes a tolerance parameter or iterates to one, unlike arc\n * length on a lowered path:\n * - circular: `radius * abs(sweep)`, exact in closed form\n * - elliptical: an incomplete elliptic integral of the second kind,\n * evaluated through Carlson's symmetric forms in a fixed number of\n * steps. The relative error stays near `1e-15`. Equal radii take the\n * closed form, and so does a flat ellipse.\n *\n * @param a - The arc.\n * @returns The length of the arc.\n * @since 2.0.0\n * @example\n * ```ts\n * // The perimeter of a 2:1 ellipse:\n * Arc.length(Arc.elliptical({ radiusX: 2, radiusY: 1 })) // 9.688448220547677\n * ```\n */\nexport const length: (a: Arc) => number = internal.length\n\n/**\n * Reverses the arc's direction, tracing the same points the other way.\n * The start angle moves to the far end and the sweep negates, so\n * `solve(reverse(a), t)` is `solve(a, 1 - t)`.\n *\n * @param a - The arc.\n * @returns A new arc of the same kind, tracing the input backward.\n * @since 2.0.0\n */\nexport const reverse: <A extends Arc>(a: A) => A = internal.reverse\n\n/**\n * Computes the exact axis-aligned bounding box of the arc.\n *\n * Extremes occur only at the endpoints or at the angles where the curve\n * runs parallel to an axis, and both are known in closed form. Every side\n * is therefore exact up to IEEE 754 rounding, with no tolerance parameter.\n * Contrast `RationalCubicPath2d.boundingBox`, which is tight only to a\n * tolerance you choose. An arc whose radii are all `0` has a box that\n * collapses to `center`.\n *\n * @param a - The arc.\n * @returns A closed `Interval2d` enclosing exactly the arc's points.\n * @since 2.0.0\n */\nexport const boundingBox: (a: Arc) => Interval2d<Closed, Closed> = internal.boundingBox\n\n/**\n * Constructs the arc as a `RationalCubicPath2d`, exact up to IEEE 754\n * rounding. The path is made of rational cubic segments of at most a\n * quarter turn each, uniform in angle, and a sweep past one full turn\n * traces the curve more than once. Circular arcs use the same\n * construction as `CoordinateSystem.arc`, and elliptical arcs carry it\n * through the ellipse's stretch and rotation.\n *\n * The path is the form to transform, since circles and ellipses are not\n * closed under every affine map but rational cubics are. Lower first and\n * apply `RationalCubicPath2d.transform` to the result. It is also the form\n * `CoordinateSystem.image` takes, to carry an arc drawn in chart space\n * into a polar system.\n *\n * @param a - The arc.\n * @returns The arc as a `RationalCubicPath2d`.\n * @since 2.0.0\n * @example\n * ```ts\n * // A quarter-turn fillet of radius 8 as one exact rational segment:\n * const path = Arc.toPath(\n * Arc.circular({\n * center: Vector2.make(50, 50),\n * radius: 8,\n * startAngle: -Math.PI / 2,\n * sweep: Math.PI / 2,\n * }),\n * )\n * ```\n */\nexport const toPath: (a: Arc) => RationalCubicPath2d = internal.toPath\n\n/**\n * Emits exact SVG path data for the arc, using `A` commands computed from\n * the arc's description rather than recovered from curve coefficients.\n * An elliptical arc's commands carry both radii and its rotation in\n * degrees, which is how SVG draws ellipses natively.\n *\n * Pieces stay at or under a half turn, so the large-arc flag is always\n * `0`. The sweep flag is `1` for a positive sweep, which renders\n * clockwise in an SVG viewport's y-down coordinates.\n *\n * Degenerate contracts:\n * - zero sweep, or every radius `0`: an `M` command alone, which renders\n * nothing\n * - an elliptical arc with one radius `0`: `L` commands tracing the flat\n * ellipse back and forth, since SVG would draw an `A` with a zero radius\n * as a single line between its endpoints\n * - a full-turn sweep: two half-turn `A` commands, closing on the exact\n * starting coordinates\n * - a sweep past one full turn: clamped to one lap, where `toPath` keeps\n * going around. SVG path data cannot express multiple laps.\n *\n * @param a - The arc.\n * @returns The SVG path data string.\n * @since 2.0.0\n * @example\n * ```ts\n * // d attribute for a gauge tick at 12 o'clock, ready for <path d={...}>:\n * const d = Arc.toPathData(\n * Arc.circular({\n * center: Vector2.make(200, 200),\n * radius: 120,\n * startAngle: -Math.PI / 2,\n * sweep: Math.PI / 6,\n * }),\n * )\n * ```\n */\nexport const toPathData: (a: Arc) => string = internal.toPathData\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+LA,MAAa,QAAkCA;;;;;;;;AAS/C,MAAa,aAA4CC;;;;;;;;;;;;;;;;;;;AAoBzD,MAAa,WAAiDC;;;;;;;;AAS9D,MAAa,eAAgDC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6B7D,MAAa,aAAuDC;AAEpE,MAAa,SA0BTC;;;;;;;;;AAUJ,MAAa,aAAkCC;;;;;;;;;;;;;AAc/C,MAAa,WAAgCC;AAE7C,MAAa,QAsCTC;;;;;;;;;;;;;;;;;;;;;;AAuBJ,MAAa,SAA6BC;;;;;;;;;;AAW1C,MAAa,UAAsCC;;;;;;;;;;;;;;;AAgBnD,MAAa,cAAsDC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCnE,MAAa,SAA0CC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCvD,MAAa,aAAiCC"}
@@ -1,2 +1,2 @@
1
- import { n as characteristic_exports } from "../shared/characteristic-OjEkAZBA.mjs";
1
+ import { n as characteristic_exports } from "../shared/characteristic-BDz-BfjP.mjs";
2
2
  export { characteristic_exports as Characteristic };
@@ -1,9 +1,8 @@
1
1
  import type { Bounds } from '../interval/interval.ts';
2
2
  import type { CubicPath2d } from '../path/cubic2d.ts';
3
3
  import type { RationalCubicPath2d } from '../path/rationalCubic2d.ts';
4
- import type { Pipeable } from '../utils.ts';
4
+ import type { Value } from '../utils/value.ts';
5
5
  import type { Vector2 } from '../vector/vector2.ts';
6
- import type { CoordinateSystemTypeId } from './coordinateSystem.internal.ts';
7
6
  import type { Cyclical, Dimension } from './dimension.ts';
8
7
  /**
9
8
  * A chart map from a two-axis chart space onto the cartesian plane:
@@ -47,8 +46,8 @@ export type Winding = 'clockwise' | 'counterclockwise';
47
46
  *
48
47
  * @since 2.0.0
49
48
  */
50
- export interface Cartesian extends Pipeable {
51
- readonly [CoordinateSystemTypeId]: CoordinateSystemTypeId;
49
+ export interface Cartesian extends Value.Instance {
50
+ readonly '~curvy/CoordinateSystem': '~curvy/CoordinateSystem';
52
51
  readonly kind: 'cartesian';
53
52
  }
54
53
  /**
@@ -59,8 +58,8 @@ export interface Cartesian extends Pipeable {
59
58
  *
60
59
  * @since 2.0.0
61
60
  */
62
- export interface Polar extends Pipeable {
63
- readonly [CoordinateSystemTypeId]: CoordinateSystemTypeId;
61
+ export interface Polar extends Value.Instance {
62
+ readonly '~curvy/CoordinateSystem': '~curvy/CoordinateSystem';
64
63
  readonly kind: 'polar';
65
64
  /**
66
65
  * The cartesian point where mapped radius `0` sits.
@@ -77,14 +76,16 @@ export interface Polar extends Pipeable {
77
76
  */
78
77
  readonly winding: Winding;
79
78
  /**
80
- * The radial axis map. Today this is always a `Linear` dimension —
81
- * mapped radius is `r * scale + offset`, and an offset shifts chart
82
- * radius `0` outward, which puts an inner hole under a chart that
83
- * starts at `r = 0`.
79
+ * The radial axis map: any `Dimension` but `Cyclical`. Every kind
80
+ * carries an `offset`, which shifts the mapped radius outward and puts
81
+ * an inner hole under a chart that starts at its lowest value.
82
+ * - `Linear`: mapped radius is `r * scale + offset`
83
+ * - `Power`: a signed power of `r`, like a square-root radius that keeps
84
+ * sector area proportional to chart area
85
+ * - `Logarithmic`: `scale * log(r) + offset`, defined only for `r > 0`
84
86
  *
85
- * The field is typed as the full `Dimension` union so future radial-map
86
- * kinds can arrive without breaking readers. Apply the map with
87
- * `mapRadius` rather than reading `scale` and `offset` off the field.
87
+ * Apply the map with `mapRadius` rather than reading fields off the
88
+ * dimension.
88
89
  */
89
90
  readonly radius: Dimension;
90
91
  /**
@@ -118,10 +119,9 @@ export interface PolarConfig {
118
119
  */
119
120
  readonly winding?: Winding;
120
121
  /**
121
- * The radial axis map applied to chart radii. Must be a `Linear`
122
- * dimension — the union type reserves room for future radial-map
123
- * kinds, and `polar` rejects a `Cyclical` radius. Defaults to
124
- * `Dimension.identity`.
122
+ * The radial axis map applied to chart radii: `Linear`, `Power`, or
123
+ * `Logarithmic`. `polar` rejects a `Cyclical` radius, since a wrapping
124
+ * radius would tear shapes at its seam. Defaults to `Dimension.identity`.
125
125
  */
126
126
  readonly radius?: Dimension;
127
127
  /**
@@ -168,7 +168,7 @@ export declare const cartesian: Cartesian;
168
168
  * origin. All optional; see `PolarConfig` for the defaults.
169
169
  * @returns A new `Polar` system.
170
170
  * @throws `Error` when `thetaOrigin` is not finite, or when `radius` is
171
- * not a `Linear` dimension.
171
+ * a `Cyclical` dimension.
172
172
  * @since 2.0.0
173
173
  * @example
174
174
  * ```ts
@@ -215,12 +215,14 @@ export declare const toCartesian: {
215
215
  * radius reflects through the center, the standard polar convention. On
216
216
  * a cartesian system the point is returned unchanged.
217
217
  *
218
- * The arithmetic is exact IEEE 754 trig with no rounding or snapping;
219
- * see `PRECISION.md`.
218
+ * The arithmetic is exact IEEE 754 trig with no rounding or snapping.
219
+ * See `PRECISION.md`.
220
220
  *
221
221
  * @param s - The coordinate system.
222
222
  * @param point - The chart-space point.
223
223
  * @returns The cartesian image of the point.
224
+ * @throws `Error` when the system's radius is `Logarithmic` and
225
+ * `point.y` is not positive.
224
226
  * @since 2.0.0
225
227
  */
226
228
  (s: CoordinateSystem, point: Vector2): Vector2;
@@ -229,7 +231,8 @@ export declare const toCartesian: {
229
231
  *
230
232
  * @param point - The chart-space point.
231
233
  * @returns A function that takes a system and returns the cartesian
232
- * image.
234
+ * image. It throws when the system's radius is `Logarithmic` and
235
+ * `point.y` is not positive.
233
236
  * @since 2.0.0
234
237
  */
235
238
  (point: Vector2): (s: CoordinateSystem) => Vector2;
@@ -242,9 +245,12 @@ export declare const fromCartesian: {
242
245
  * exact center the angle is `0`. On a cartesian system the point is
243
246
  * returned unchanged.
244
247
  *
245
- * Round-trips with `toCartesian` up to angle wrapping: a chart angle
246
- * comes back as its canonical representative, and a negative chart
247
- * radius comes back positive with the angle turned half a period.
248
+ * Round-trips with `toCartesian` up to angle wrapping. A chart angle
249
+ * comes back as its canonical representative, and a point whose mapped
250
+ * radius was negative comes back on the reflected side, with a positive
251
+ * mapped radius and the angle turned half a period. Every cartesian
252
+ * point has a preimage, including under a `Logarithmic` radius, whose
253
+ * inverse returns a positive chart radius for any distance.
248
254
  *
249
255
  * @param s - The coordinate system.
250
256
  * @param point - The cartesian point.
@@ -306,12 +312,12 @@ export declare const mapAngle: {
306
312
  export declare const mapRadius: {
307
313
  /**
308
314
  * Maps a chart-space radial coordinate to its on-screen distance from
309
- * the center. This is the radial half of `toCartesian`:
310
- * `r * scale + offset` under today's always-linear radial axis.
315
+ * the center through the system's radial dimension. This is the radial
316
+ * half of `toCartesian`, and `r * scale + offset` on a `Linear` radius.
311
317
  *
312
318
  * The result can be negative when the map sends the chart radius below
313
319
  * zero. Point-mapping operations read a negative mapped radius as a
314
- * reflection through the center; shape constructors like `arc` and
320
+ * reflection through the center. Shape constructors like `arc` and
315
321
  * `sector` reject it.
316
322
  *
317
323
  * Only a polar system has a radial axis, so the parameter narrows to
@@ -320,6 +326,8 @@ export declare const mapRadius: {
320
326
  * @param s - The polar system whose radial map to apply.
321
327
  * @param r - The chart-space radial coordinate.
322
328
  * @returns The signed on-screen distance from the center.
329
+ * @throws `Error` when the system's radius is `Logarithmic` and `r` is
330
+ * not positive.
323
331
  * @since 2.0.0
324
332
  * @example
325
333
  * ```ts
@@ -337,7 +345,8 @@ export declare const mapRadius: {
337
345
  *
338
346
  * @param r - The chart-space radial coordinate.
339
347
  * @returns A function that takes a polar system and returns the signed
340
- * on-screen distance.
348
+ * on-screen distance. It throws when the system's radius is
349
+ * `Logarithmic` and `r` is not positive.
341
350
  * @since 2.0.0
342
351
  */
343
352
  (r: number): (s: Polar) => number;
@@ -358,8 +367,9 @@ export declare const arc: {
358
367
  * @param theta - The angular span, in either order.
359
368
  * @param r - The fixed radial coordinate.
360
369
  * @returns The image as a `RationalCubicPath2d`.
361
- * @throws `Error` when an input is not finite, or when the mapped radius
362
- * is negative.
370
+ * @throws `Error` when an input is not finite, when the mapped radius is
371
+ * negative, or when the system's radius is `Logarithmic` and a chart radius is not
372
+ * positive.
363
373
  * @since 2.0.0
364
374
  * @example
365
375
  * ```ts
@@ -386,9 +396,11 @@ export declare const ray: {
386
396
  /**
387
397
  * Constructs the exact cartesian image of the chart-space segment that
388
398
  * holds `theta` fixed and runs `r` from `r.start` to `r.end`. On a polar
389
- * system that image is a straight segment along the fixed direction —
390
- * the radial map is affine, so the image is exact, a single rational
391
- * line segment. On a cartesian system it is the vertical segment at
399
+ * system that image is a straight segment along the fixed direction.
400
+ * The radial map is monotone, so the image is exactly the single
401
+ * rational line segment between the mapped endpoints. Under a non-linear
402
+ * radius the segment's parameter runs uniformly in mapped distance, not
403
+ * in chart radius. On a cartesian system it is the vertical segment at
392
404
  * `x = theta`.
393
405
  *
394
406
  * Unlike `arc` and `sector`, negative mapped radii are allowed: a
@@ -402,7 +414,8 @@ export declare const ray: {
402
414
  * @param theta - The fixed angular coordinate.
403
415
  * @param r - The radial span, traced from `start` to `end`.
404
416
  * @returns The image as a `RationalCubicPath2d` of one segment.
405
- * @throws `Error` when an input is not finite.
417
+ * @throws `Error` when an input is not finite, or when the system's
418
+ * radius is `Logarithmic` and a chart radius is not positive.
406
419
  * @since 2.0.0
407
420
  * @example
408
421
  * ```ts
@@ -445,8 +458,9 @@ export declare const sector: {
445
458
  * @param theta - The angular span, in either order.
446
459
  * @param r - The radial span, in either order.
447
460
  * @returns The closed image as a `RationalCubicPath2d`.
448
- * @throws `Error` when an input is not finite, or when a mapped radius
449
- * is negative.
461
+ * @throws `Error` when an input is not finite, when a mapped radius is
462
+ * negative, or when the system's radius is `Logarithmic` and a chart radius is not
463
+ * positive.
450
464
  * @since 2.0.0
451
465
  * @example
452
466
  * ```ts
@@ -527,7 +541,12 @@ export declare const image: {
527
541
  * true image lies within `tolerance` of the output, and every point of
528
542
  * the output lies within `tolerance` of the true image, verified by
529
543
  * subdivision enclosures rather than point samples (see `PRECISION.md`).
530
- * On a cartesian system the path is returned unchanged.
544
+ *
545
+ * The path may be polynomial or rational. A rational path lets shapes
546
+ * with exact rational forms enter chart space, like an ellipse lowered
547
+ * with `Arc.toPath`. On a cartesian system a polynomial path comes back
548
+ * unchanged and a rational one is approximated to the same bound with
549
+ * `RationalCubicPath2d.approximateAsCubicPath`.
531
550
  *
532
551
  * The path is read pointwise like `toCartesian`: each point `(x, y)` as
533
552
  * `(theta, r)`, a negative mapped radius reflecting through the center.
@@ -538,6 +557,11 @@ export declare const image: {
538
557
  * junctions close; reassert the brand with `CubicPath2d.asContinuous`
539
558
  * where needed.
540
559
  *
560
+ * Every radial dimension kind is supported. A `Power` radius below
561
+ * exponent 1 has infinite slope at chart radius `0`, which costs extra
562
+ * segments near the center without loosening the bound. A `Logarithmic`
563
+ * radius requires the path to stay at positive chart radii.
564
+ *
541
565
  * For axis-aligned chart shapes prefer `arc` and `sector`, whose images
542
566
  * are exact. For SVG output pass the result to `CubicPath2d.toPathData`.
543
567
  * Certification cost grows roughly with the ratio of the image's size to
@@ -546,12 +570,18 @@ export declare const image: {
546
570
  * they get wrong.
547
571
  *
548
572
  * @param s - The coordinate system.
549
- * @param path - The chart-space path, each point read as `(theta, r)`.
573
+ * @param path - The chart-space path, polynomial or rational, each
574
+ * point read as `(theta, r)`. A rational path's Bernstein weights
575
+ * must all be positive, which every path `Arc.toPath` builds
576
+ * satisfies.
550
577
  * @param tolerance - Maximum allowed Hausdorff distance, in cartesian
551
578
  * output units. Must be positive.
552
579
  * @returns The image as a `CubicPath2d` within `tolerance` of the true
553
580
  * image.
554
- * @throws `Error` when `tolerance` is not a positive finite number.
581
+ * @throws `Error` when `tolerance` is not a positive finite number, when
582
+ * a rational path has a weight that is not positive, or when the
583
+ * system's radius is `Logarithmic` and the path reaches a chart radius
584
+ * that is not positive.
555
585
  * @since 2.0.0
556
586
  * @example
557
587
  * ```ts
@@ -567,19 +597,30 @@ export declare const image: {
567
597
  * const d = CubicPath2d.toPathData(
568
598
  * CoordinateSystem.image(system, chartPath, 0.25),
569
599
  * )
600
+ *
601
+ * // The ellipse inscribed in the chart rect theta in [0, 0.25], r in [80, 120]:
602
+ * const node = Arc.elliptical({
603
+ * center: Vector2.make(0.125, 100),
604
+ * radiusX: 0.125,
605
+ * radiusY: 20,
606
+ * })
607
+ * const blob = CoordinateSystem.image(system, Arc.toPath(node), 0.25)
570
608
  * ```
571
609
  */
572
- (s: CoordinateSystem, path: CubicPath2d, tolerance: number): CubicPath2d;
610
+ (s: CoordinateSystem, path: CubicPath2d | RationalCubicPath2d, tolerance: number): CubicPath2d;
573
611
  /**
574
612
  * Constructs the cartesian image of an arbitrary chart-space path.
575
613
  *
576
- * @param path - The chart-space path, each point read as `(theta, r)`.
614
+ * @param path - The chart-space path, polynomial or rational, each
615
+ * point read as `(theta, r)`. A rational path's Bernstein weights
616
+ * must all be positive.
577
617
  * @param tolerance - Maximum allowed Hausdorff distance, in cartesian
578
618
  * output units. Must be positive.
579
- * @returns A function that takes a system and returns the image path.
619
+ * @returns A function that takes a system and returns the image path,
620
+ * certified to `tolerance`.
580
621
  * @since 2.0.0
581
622
  */
582
- (path: CubicPath2d, tolerance: number): (s: CoordinateSystem) => CubicPath2d;
623
+ (path: CubicPath2d | RationalCubicPath2d, tolerance: number): (s: CoordinateSystem) => CubicPath2d;
583
624
  };
584
625
  export declare const arcPathData: {
585
626
  /**
@@ -600,8 +641,9 @@ export declare const arcPathData: {
600
641
  * @param theta - The angular span, in either order.
601
642
  * @param r - The fixed radial coordinate.
602
643
  * @returns The SVG path data string.
603
- * @throws `Error` when an input is not finite, or when the mapped radius
604
- * is negative.
644
+ * @throws `Error` when an input is not finite, when the mapped radius is
645
+ * negative, or when the system's radius is `Logarithmic` and a chart radius is not
646
+ * positive.
605
647
  * @since 2.0.0
606
648
  */
607
649
  (s: CoordinateSystem, theta: Bounds, r: number): string;
@@ -628,7 +670,8 @@ export declare const rayPathData: {
628
670
  * @param theta - The fixed angular coordinate.
629
671
  * @param r - The radial span, traced from `start` to `end`.
630
672
  * @returns The SVG path data string.
631
- * @throws `Error` when an input is not finite.
673
+ * @throws `Error` when an input is not finite, or when the system's
674
+ * radius is `Logarithmic` and a chart radius is not positive.
632
675
  * @since 2.0.0
633
676
  */
634
677
  (s: CoordinateSystem, theta: number, r: Bounds): string;
@@ -660,8 +703,9 @@ export declare const sectorPathData: {
660
703
  * @param theta - The angular span, in either order.
661
704
  * @param r - The radial span, in either order.
662
705
  * @returns The SVG path data string.
663
- * @throws `Error` when an input is not finite, or when a mapped radius
664
- * is negative.
706
+ * @throws `Error` when an input is not finite, when a mapped radius is
707
+ * negative, or when the system's radius is `Logarithmic` and a chart radius is not
708
+ * positive.
665
709
  * @since 2.0.0
666
710
  * @example
667
711
  * ```ts