math 0.0.3 → 0.1.0

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 (203) hide show
  1. package/API.md +1605 -0
  2. package/LICENSE +21 -0
  3. package/README.md +197 -0
  4. package/dist/color/color.js +136 -0
  5. package/dist/color/color.js.map +1 -0
  6. package/dist/color/colorspace.js +43 -0
  7. package/dist/color/colorspace.js.map +1 -0
  8. package/dist/color/hsl.js +123 -0
  9. package/dist/color/hsl.js.map +1 -0
  10. package/dist/color/index.js +7 -0
  11. package/dist/color/index.js.map +1 -0
  12. package/dist/color/parse.js +276 -0
  13. package/dist/color/parse.js.map +1 -0
  14. package/dist/core/angle.js +43 -0
  15. package/dist/core/angle.js.map +1 -0
  16. package/dist/core/euler.js +212 -0
  17. package/dist/core/euler.js.map +1 -0
  18. package/dist/core/mat2.js +385 -0
  19. package/dist/core/mat2.js.map +1 -0
  20. package/dist/core/mat2d.js +422 -0
  21. package/dist/core/mat2d.js.map +1 -0
  22. package/dist/core/mat3.js +749 -0
  23. package/dist/core/mat3.js.map +1 -0
  24. package/dist/core/mat4.js +2197 -0
  25. package/dist/core/mat4.js.map +1 -0
  26. package/dist/core/polar.js +200 -0
  27. package/dist/core/polar.js.map +1 -0
  28. package/dist/core/quat.js +730 -0
  29. package/dist/core/quat.js.map +1 -0
  30. package/dist/core/quat2.js +883 -0
  31. package/dist/core/quat2.js.map +1 -0
  32. package/dist/core/scalar.js +112 -0
  33. package/dist/core/scalar.js.map +1 -0
  34. package/dist/core/spherical.js +248 -0
  35. package/dist/core/spherical.js.map +1 -0
  36. package/dist/core/vec2.js +597 -0
  37. package/dist/core/vec2.js.map +1 -0
  38. package/dist/core/vec3.js +916 -0
  39. package/dist/core/vec3.js.map +1 -0
  40. package/dist/core/vec4.js +573 -0
  41. package/dist/core/vec4.js.map +1 -0
  42. package/dist/geometry/circumcircle.js +39 -0
  43. package/dist/geometry/circumcircle.js.map +1 -0
  44. package/dist/geometry/index.js +6 -0
  45. package/dist/geometry/index.js.map +1 -0
  46. package/dist/geometry/polygon2-decompose.js +411 -0
  47. package/dist/geometry/polygon2-decompose.js.map +1 -0
  48. package/dist/geometry/polygon2-triangulate.js +222 -0
  49. package/dist/geometry/polygon2-triangulate.js.map +1 -0
  50. package/dist/geometry/quickhull2.js +123 -0
  51. package/dist/geometry/quickhull2.js.map +1 -0
  52. package/dist/geometry/quickhull3.js +605 -0
  53. package/dist/geometry/quickhull3.js.map +1 -0
  54. package/dist/ik/fabrik2.js +675 -0
  55. package/dist/ik/fabrik2.js.map +1 -0
  56. package/dist/ik/fabrik3.js +912 -0
  57. package/dist/ik/fabrik3.js.map +1 -0
  58. package/dist/ik/index.js +5 -0
  59. package/dist/ik/index.js.map +1 -0
  60. package/dist/index.js +27 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/noise/fractal.js +185 -0
  63. package/dist/noise/fractal.js.map +1 -0
  64. package/dist/noise/index.js +16 -0
  65. package/dist/noise/index.js.map +1 -0
  66. package/dist/noise/perlin2d.js +50 -0
  67. package/dist/noise/perlin2d.js.map +1 -0
  68. package/dist/noise/perlin3d.js +72 -0
  69. package/dist/noise/perlin3d.js.map +1 -0
  70. package/dist/noise/permutation.js +120 -0
  71. package/dist/noise/permutation.js.map +1 -0
  72. package/dist/noise/simplex2d.js +84 -0
  73. package/dist/noise/simplex2d.js.map +1 -0
  74. package/dist/noise/simplex3d.js +147 -0
  75. package/dist/noise/simplex3d.js.map +1 -0
  76. package/dist/noise/simplex4d.js +149 -0
  77. package/dist/noise/simplex4d.js.map +1 -0
  78. package/dist/noise/worley2d.js +50 -0
  79. package/dist/noise/worley2d.js.map +1 -0
  80. package/dist/noise/worley3d.js +61 -0
  81. package/dist/noise/worley3d.js.map +1 -0
  82. package/dist/random/index.js +9 -0
  83. package/dist/random/index.js.map +1 -0
  84. package/dist/random/isaac32.js +164 -0
  85. package/dist/random/isaac32.js.map +1 -0
  86. package/dist/random/isaac64.js +215 -0
  87. package/dist/random/isaac64.js.map +1 -0
  88. package/dist/random/mulberry32.js +48 -0
  89. package/dist/random/mulberry32.js.map +1 -0
  90. package/dist/random/random.js +120 -0
  91. package/dist/random/random.js.map +1 -0
  92. package/dist/shapes/box2.js +300 -0
  93. package/dist/shapes/box2.js.map +1 -0
  94. package/dist/shapes/box3.js +550 -0
  95. package/dist/shapes/box3.js.map +1 -0
  96. package/dist/shapes/circle.js +6 -0
  97. package/dist/shapes/circle.js.map +1 -0
  98. package/dist/shapes/frustum.js +662 -0
  99. package/dist/shapes/frustum.js.map +1 -0
  100. package/dist/shapes/index.js +25 -0
  101. package/dist/shapes/index.js.map +1 -0
  102. package/dist/shapes/obb3.js +557 -0
  103. package/dist/shapes/obb3.js.map +1 -0
  104. package/dist/shapes/plane3.js +267 -0
  105. package/dist/shapes/plane3.js.map +1 -0
  106. package/dist/shapes/polygon2.js +451 -0
  107. package/dist/shapes/polygon2.js.map +1 -0
  108. package/dist/shapes/raycast3.js +164 -0
  109. package/dist/shapes/raycast3.js.map +1 -0
  110. package/dist/shapes/segment2.js +82 -0
  111. package/dist/shapes/segment2.js.map +1 -0
  112. package/dist/shapes/sphere.js +23 -0
  113. package/dist/shapes/sphere.js.map +1 -0
  114. package/dist/shapes/triangle2.js +79 -0
  115. package/dist/shapes/triangle2.js.map +1 -0
  116. package/dist/shapes/triangle3.js +60 -0
  117. package/dist/shapes/triangle3.js.map +1 -0
  118. package/dist/src/color/color.d.ts +50 -0
  119. package/dist/src/color/colorspace.d.ts +15 -0
  120. package/dist/src/color/hsl.d.ts +28 -0
  121. package/dist/src/color/index.d.ts +5 -0
  122. package/dist/src/color/parse.d.ts +15 -0
  123. package/dist/src/core/angle.d.ts +29 -0
  124. package/dist/src/core/arrays.d.ts +4 -0
  125. package/dist/src/core/euler.d.ts +78 -0
  126. package/dist/src/core/index.d.ts +27 -0
  127. package/dist/src/core/mat2.d.ts +217 -0
  128. package/dist/src/core/mat2d.d.ts +218 -0
  129. package/dist/src/core/mat3.d.ts +295 -0
  130. package/dist/src/core/mat4.d.ts +667 -0
  131. package/dist/src/core/polar.d.ts +151 -0
  132. package/dist/src/core/quat.d.ts +370 -0
  133. package/dist/src/core/quat2.d.ts +344 -0
  134. package/dist/src/core/scalar.d.ts +75 -0
  135. package/dist/src/core/spherical.d.ts +165 -0
  136. package/dist/src/core/vec2.d.ts +403 -0
  137. package/dist/src/core/vec3.d.ts +493 -0
  138. package/dist/src/core/vec4.d.ts +336 -0
  139. package/dist/src/geometry/circumcircle.d.ts +9 -0
  140. package/dist/src/geometry/index.d.ts +5 -0
  141. package/dist/src/geometry/polygon2-decompose.d.ts +25 -0
  142. package/dist/src/geometry/polygon2-triangulate.d.ts +15 -0
  143. package/dist/src/geometry/quickhull2.d.ts +10 -0
  144. package/dist/src/geometry/quickhull3.d.ts +27 -0
  145. package/dist/src/ik/fabrik2.d.ts +314 -0
  146. package/dist/src/ik/fabrik3.d.ts +371 -0
  147. package/dist/src/ik/index.d.ts +2 -0
  148. package/dist/src/index.d.ts +1 -0
  149. package/dist/src/noise/fractal.d.ts +95 -0
  150. package/dist/src/noise/index.d.ts +9 -0
  151. package/dist/src/noise/perlin2d.d.ts +19 -0
  152. package/dist/src/noise/perlin3d.d.ts +20 -0
  153. package/dist/src/noise/permutation.d.ts +22 -0
  154. package/dist/src/noise/simplex2d.d.ts +19 -0
  155. package/dist/src/noise/simplex3d.d.ts +20 -0
  156. package/dist/src/noise/simplex4d.d.ts +24 -0
  157. package/dist/src/noise/worley2d.d.ts +22 -0
  158. package/dist/src/noise/worley3d.d.ts +23 -0
  159. package/dist/src/random/index.d.ts +8 -0
  160. package/dist/src/random/isaac32.d.ts +62 -0
  161. package/dist/src/random/isaac64.d.ts +75 -0
  162. package/dist/src/random/mulberry32.d.ts +43 -0
  163. package/dist/src/random/random.d.ts +67 -0
  164. package/dist/src/shapes/box2.d.ts +174 -0
  165. package/dist/src/shapes/box3.d.ts +213 -0
  166. package/dist/src/shapes/circle.d.ts +7 -0
  167. package/dist/src/shapes/frustum.d.ts +147 -0
  168. package/dist/src/shapes/index.d.ts +20 -0
  169. package/dist/src/shapes/obb3.d.ts +105 -0
  170. package/dist/src/shapes/plane3.d.ts +130 -0
  171. package/dist/src/shapes/polygon2.d.ts +155 -0
  172. package/dist/src/shapes/raycast3.d.ts +42 -0
  173. package/dist/src/shapes/segment2.d.ts +34 -0
  174. package/dist/src/shapes/sphere.d.ts +19 -0
  175. package/dist/src/shapes/triangle2.d.ts +53 -0
  176. package/dist/src/shapes/triangle3.d.ts +29 -0
  177. package/dist/src/time/easing.d.ts +21 -0
  178. package/dist/src/time/index.d.ts +6 -0
  179. package/dist/src/time/spring-core.d.ts +15 -0
  180. package/dist/src/time/spring.d.ts +36 -0
  181. package/dist/src/time/spring2.d.ts +11 -0
  182. package/dist/src/time/spring3.d.ts +11 -0
  183. package/dist/src/time/spring4.d.ts +11 -0
  184. package/dist/time/easing.js +24 -0
  185. package/dist/time/easing.js.map +1 -0
  186. package/dist/time/index.js +11 -0
  187. package/dist/time/index.js.map +1 -0
  188. package/dist/time/spring-core.js +48 -0
  189. package/dist/time/spring-core.js.map +1 -0
  190. package/dist/time/spring.js +62 -0
  191. package/dist/time/spring.js.map +1 -0
  192. package/dist/time/spring2.js +31 -0
  193. package/dist/time/spring2.js.map +1 -0
  194. package/dist/time/spring3.js +32 -0
  195. package/dist/time/spring3.js.map +1 -0
  196. package/dist/time/spring4.js +32 -0
  197. package/dist/time/spring4.js.map +1 -0
  198. package/package.json +90 -16
  199. package/skills/math/SKILL.md +140 -0
  200. package/AUTHORS +0 -1
  201. package/Cakefile +0 -28
  202. package/math.coffee +0 -112
  203. package/math.js +0 -141
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quat2.js","sources":["../../src/core/quat2.ts"],"sourcesContent":["import type { Mat4 } from './mat4';\nimport type { Quat } from './quat';\nimport { EPSILON } from './scalar';\nimport type { Vec3 } from './vec3';\n\n/** A dual quaternion that represents both rotation and translation */\nexport type Quat2 = [x: number, y: number, z: number, w: number, x2: number, y2: number, z2: number, w2: number];\n\n/**\n * Creates a new identity dual quat\n *\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\n */\nexport function create(): Quat2 {\n // biome-ignore format:skip\n return [\n 0, 0, 0, 1, // real part\n 0, 0, 0, 0, // dual part\n ];\n}\n\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param a dual quaternion to clone\n * @returns new dual quaternion\n * @function\n */\nexport function clone(a: Quat2): Quat2 {\n return [a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]];\n}\n\n/**\n * Creates a new dual quat initialized with the given values\n *\n * @param x1 X component\n * @param y1 Y component\n * @param z1 Z component\n * @param w1 W component\n * @param x2 X component\n * @param y2 Y component\n * @param z2 Z component\n * @param w2 W component\n * @returns new dual quaternion\n * @function\n */\nexport function fromValues(\n x1: number,\n y1: number,\n z1: number,\n w1: number,\n x2: number,\n y2: number,\n z2: number,\n w2: number,\n): Quat2 {\n return [x1, y1, z1, w1, x2, y2, z2, w2];\n}\n\n/**\n * Creates a new dual quat from the given values (quat and translation)\n *\n * @param x1 X component\n * @param y1 Y component\n * @param z1 Z component\n * @param w1 W component\n * @param x2 X component (translation)\n * @param y2 Y component (translation)\n * @param z2 Z component (translation)\n * @returns new dual quaternion\n * @function\n */\nexport function fromRotationTranslationValues(\n x1: number,\n y1: number,\n z1: number,\n w1: number,\n x2: number,\n y2: number,\n z2: number,\n): Quat2 {\n const ax = x2 * 0.5;\n const ay = y2 * 0.5;\n const az = z2 * 0.5;\n return [\n x1,\n y1,\n z1,\n w1,\n ax * w1 + ay * z1 - az * y1,\n ay * w1 + az * x1 - ax * z1,\n az * w1 + ax * y1 - ay * x1,\n -ax * x1 - ay * y1 - az * z1,\n ];\n}\n\n/**\n * Creates a dual quat from a quaternion and a translation\n *\n * @param out dual quaternion receiving operation result\n * @param q a normalized quaternion\n * @param t translation vector\n * @returns dual quaternion receiving operation result\n * @function\n */\nexport function fromRotationTranslation(out: Quat2, q: Quat, t: Vec3): Quat2 {\n const ax = t[0] * 0.5;\n const ay = t[1] * 0.5;\n const az = t[2] * 0.5;\n const bx = q[0];\n const by = q[1];\n const bz = q[2];\n const bw = q[3];\n out[0] = bx;\n out[1] = by;\n out[2] = bz;\n out[3] = bw;\n out[4] = ax * bw + ay * bz - az * by;\n out[5] = ay * bw + az * bx - ax * bz;\n out[6] = az * bw + ax * by - ay * bx;\n out[7] = -ax * bx - ay * by - az * bz;\n return out;\n}\n\n/**\n * Creates a dual quat from a translation\n *\n * @param out dual quaternion receiving operation result\n * @param t translation vector\n * @returns dual quaternion receiving operation result\n * @function\n */\nexport function fromTranslation(out: Quat2, t: Vec3): Quat2 {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = t[0] * 0.5;\n out[5] = t[1] * 0.5;\n out[6] = t[2] * 0.5;\n out[7] = 0;\n return out;\n}\n\n/**\n * Creates a dual quat from a quaternion\n *\n * @param out dual quaternion receiving operation result\n * @param q the quaternion\n * @returns dual quaternion receiving operation result\n * @function\n */\nexport function fromRotation(out: Quat2, q: Quat): Quat2 {\n out[0] = q[0];\n out[1] = q[1];\n out[2] = q[2];\n out[3] = q[3];\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n}\n\n/**\n * Creates a new dual quat from a matrix (4x4)\n *\n * @param out the dual quaternion\n * @param a the matrix\n * @returns dual quat receiving operation result\n */\nexport function fromMat4(out: Quat2, a: Mat4): Quat2 {\n // Rotation: extract the quaternion from the (possibly scaled) upper-3x3.\n // Inlined from mat4.getRotation/getScaling so no scratch quat or Vec3 is allocated.\n const is1 = 1 / Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);\n const is2 = 1 / Math.sqrt(a[4] * a[4] + a[5] * a[5] + a[6] * a[6]);\n const is3 = 1 / Math.sqrt(a[8] * a[8] + a[9] * a[9] + a[10] * a[10]);\n\n const sm11 = a[0] * is1;\n const sm12 = a[1] * is2;\n const sm13 = a[2] * is3;\n const sm21 = a[4] * is1;\n const sm22 = a[5] * is2;\n const sm23 = a[6] * is3;\n const sm31 = a[8] * is1;\n const sm32 = a[9] * is2;\n const sm33 = a[10] * is3;\n\n const trace = sm11 + sm22 + sm33;\n let bx: number;\n let by: number;\n let bz: number;\n let bw: number;\n\n if (trace > 0) {\n const S = Math.sqrt(trace + 1.0) * 2;\n bw = 0.25 * S;\n bx = (sm23 - sm32) / S;\n by = (sm31 - sm13) / S;\n bz = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n const S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n bw = (sm23 - sm32) / S;\n bx = 0.25 * S;\n by = (sm12 + sm21) / S;\n bz = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n const S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n bw = (sm31 - sm13) / S;\n bx = (sm12 + sm21) / S;\n by = 0.25 * S;\n bz = (sm23 + sm32) / S;\n } else {\n const S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n bw = (sm12 - sm21) / S;\n bx = (sm31 + sm13) / S;\n by = (sm23 + sm32) / S;\n bz = 0.25 * S;\n }\n\n out[0] = bx;\n out[1] = by;\n out[2] = bz;\n out[3] = bw;\n\n // Dual part from the translation (last column), inlined from fromRotationTranslation.\n const ax = a[12] * 0.5;\n const ay = a[13] * 0.5;\n const az = a[14] * 0.5;\n out[4] = ax * bw + ay * bz - az * by;\n out[5] = ay * bw + az * bx - ax * bz;\n out[6] = az * bw + ax * by - ay * bx;\n out[7] = -ax * bx - ay * by - az * bz;\n return out;\n}\n\n/**\n * Copy the values from one dual quat to another\n *\n * @param out the receiving dual quaternion\n * @param a the source dual quaternion\n * @returns out\n * @function\n */\nexport function copy(out: Quat2, a: Quat2): Quat2 {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n return out;\n}\n\n/**\n * Set a dual quat to the identity dual quaternion\n *\n * @param out the receiving quaternion\n * @returns out\n */\nexport function identity(out: Quat2): Quat2 {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n}\n\n/**\n * Set the components of a dual quat to the given values\n *\n * @param out the receiving quaternion\n * @param x1 X component\n * @param y1 Y component\n * @param z1 Z component\n * @param w1 W component\n * @param x2 X component\n * @param y2 Y component\n * @param z2 Z component\n * @param w2 W component\n * @returns out\n * @function\n */\nexport function set(\n out: Quat2,\n x1: number,\n y1: number,\n z1: number,\n w1: number,\n x2: number,\n y2: number,\n z2: number,\n w2: number,\n): Quat2 {\n out[0] = x1;\n out[1] = y1;\n out[2] = z1;\n out[3] = w1;\n\n out[4] = x2;\n out[5] = y2;\n out[6] = z2;\n out[7] = w2;\n return out;\n}\n\n/**\n * Gets the real part of a dual quat\n * @param out real part\n * @param a Dual Quaternion\n * @return real part\n */\nexport function getReal(out: Quat, a: Quat2): Quat {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n\n/**\n * Gets the dual part of a dual quat\n * @param out dual part\n * @param a Dual Quaternion\n * @return dual part\n */\nexport function getDual(out: Quat, a: Quat2): Quat {\n out[0] = a[4];\n out[1] = a[5];\n out[2] = a[6];\n out[3] = a[7];\n return out;\n}\n\n/**\n * Set the real component of a dual quat to the given quaternion\n *\n * @param out the receiving dual quaternion\n * @param q a quaternion representing the real part\n * @returns out\n */\nexport function setReal(out: Quat2, q: Quat): Quat2 {\n out[0] = q[0];\n out[1] = q[1];\n out[2] = q[2];\n out[3] = q[3];\n return out;\n}\n\n/**\n * Set the dual component of a dual quat to the given quaternion\n *\n * @param out the receiving quaternion\n * @param q a quaternion representing the dual part\n * @returns out\n * @function\n */\nexport function setDual(out: Quat2, q: Quat): Quat2 {\n out[4] = q[0];\n out[5] = q[1];\n out[6] = q[2];\n out[7] = q[3];\n return out;\n}\n\n/**\n * Gets the translation of a normalized dual quat\n * @param out translation\n * @param a Dual Quaternion to be decomposed\n * @return translation\n */\nexport function getTranslation(out: Vec3, a: Quat2): Vec3 {\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n return out;\n}\n\n/**\n * Translates a dual quat by the given vector\n *\n * @param out the receiving dual quaternion\n * @param a the dual quaternion to translate\n * @param v vector to translate by\n * @returns out\n */\nexport function translate(out: Quat2, a: Quat2, v: Vec3): Quat2 {\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n const bx1 = v[0] * 0.5;\n const by1 = v[1] * 0.5;\n const bz1 = v[2] * 0.5;\n const ax2 = a[4];\n const ay2 = a[5];\n const az2 = a[6];\n const aw2 = a[7];\n out[0] = ax1;\n out[1] = ay1;\n out[2] = az1;\n out[3] = aw1;\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\n return out;\n}\n\n/**\n * Rotates a dual quat around the X axis\n *\n * @param out the receiving dual quaternion\n * @param a the dual quaternion to rotate\n * @param rad how far should the rotation be\n * @returns out\n */\nexport function rotateX(out: Quat2, a: Quat2, rad: number): Quat2 {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n // rotate the real (rotation) part about X — inlined quat.rotateX on out[0..3]\n const half = rad * 0.5;\n const s = Math.sin(half);\n const c = Math.cos(half);\n const rx = a[0];\n const ry = a[1];\n const rz = a[2];\n const rw = a[3];\n out[0] = rx * c + rw * s;\n out[1] = ry * c + rz * s;\n out[2] = rz * c - ry * s;\n out[3] = rw * c - rx * s;\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n\n/**\n * Rotates a dual quat around the Y axis\n *\n * @param out the receiving dual quaternion\n * @param a the dual quaternion to rotate\n * @param rad how far should the rotation be\n * @returns out\n */\nexport function rotateY(out: Quat2, a: Quat2, rad: number): Quat2 {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n // rotate the real (rotation) part about Y — inlined quat.rotateY on out[0..3]\n const half = rad * 0.5;\n const s = Math.sin(half);\n const c = Math.cos(half);\n const rx = a[0];\n const ry = a[1];\n const rz = a[2];\n const rw = a[3];\n out[0] = rx * c - rz * s;\n out[1] = ry * c + rw * s;\n out[2] = rz * c + rx * s;\n out[3] = rw * c - ry * s;\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n\n/**\n * Rotates a dual quat around the Z axis\n *\n * @param out the receiving dual quaternion\n * @param a the dual quaternion to rotate\n * @param rad how far should the rotation be\n * @returns out\n */\nexport function rotateZ(out: Quat2, a: Quat2, rad: number): Quat2 {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n // rotate the real (rotation) part about Z — inlined quat.rotateZ on out[0..3]\n const half = rad * 0.5;\n const s = Math.sin(half);\n const c = Math.cos(half);\n const rx = a[0];\n const ry = a[1];\n const rz = a[2];\n const rw = a[3];\n out[0] = rx * c + ry * s;\n out[1] = ry * c - rx * s;\n out[2] = rz * c + rw * s;\n out[3] = rw * c - rz * s;\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n\n/**\n * Rotates a dual quat by a given quaternion (a * q)\n *\n * @param out the receiving dual quaternion\n * @param a the dual quaternion to rotate\n * @param q quaternion to rotate by\n * @returns out\n */\nexport function rotateByQuatAppend(out: Quat2, a: Quat2, q: Quat): Quat2 {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let ax = a[0];\n let ay = a[1];\n let az = a[2];\n let aw = a[3];\n\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\n ax = a[4];\n ay = a[5];\n az = a[6];\n aw = a[7];\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\n return out;\n}\n\n/**\n * Rotates a dual quat by a given quaternion (q * a)\n *\n * @param out the receiving dual quaternion\n * @param q quaternion to rotate by\n * @param a the dual quaternion to rotate\n * @returns out\n */\nexport function rotateByQuatPrepend(out: Quat2, q: Quat, a: Quat2): Quat2 {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let bx = a[0];\n let by = a[1];\n let bz = a[2];\n let bw = a[3];\n\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\n bx = a[4];\n by = a[5];\n bz = a[6];\n bw = a[7];\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\n return out;\n}\n\n/**\n * Rotates a dual quat around a given axis. Does the normalisation automatically\n *\n * @param out the receiving dual quaternion\n * @param a the dual quaternion to rotate\n * @param axis the axis to rotate around\n * @param rad how far the rotation should be\n * @returns out\n */\nexport function rotateAroundAxis(out: Quat2, a: Quat2, axis: Vec3, rad: number): Quat2 {\n //Special case for rad = 0\n if (Math.abs(rad) < EPSILON) {\n return copy(out, a);\n }\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\n\n rad = rad * 0.5;\n const s = Math.sin(rad);\n const bx = (s * axis[0]) / axisLength;\n const by = (s * axis[1]) / axisLength;\n const bz = (s * axis[2]) / axisLength;\n const bw = Math.cos(rad);\n\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\n\n return out;\n}\n\n/**\n * Adds two dual quat's\n *\n * @param out the receiving dual quaternion\n * @param a the first operand\n * @param b the second operand\n * @returns out\n * @function\n */\nexport function add(out: Quat2, a: Quat2, b: Quat2): Quat2 {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n return out;\n}\n\n/**\n * Multiplies two dual quat's\n *\n * @param out the receiving dual quaternion\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function multiply(out: Quat2, a: Quat2, b: Quat2): Quat2 {\n const ax0 = a[0];\n const ay0 = a[1];\n const az0 = a[2];\n const aw0 = a[3];\n const bx1 = b[4];\n const by1 = b[5];\n const bz1 = b[6];\n const bw1 = b[7];\n const ax1 = a[4];\n const ay1 = a[5];\n const az1 = a[6];\n const aw1 = a[7];\n const bx0 = b[0];\n const by0 = b[1];\n const bz0 = b[2];\n const bw0 = b[3];\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\n out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0;\n out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0;\n out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0;\n out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0;\n return out;\n}\n\n/**\n * Alias for {@link quat2.multiply}\n * @function\n */\nexport const mul = multiply;\n\n/**\n * Scales a dual quat by a scalar number\n *\n * @param out the receiving dual quat\n * @param a the dual quat to scale\n * @param b amount to scale the dual quat by\n * @returns out\n * @function\n */\nexport function scale(out: Quat2, a: Quat2, b: number): Quat2 {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n return out;\n}\n\n/**\n * Calculates the dot product of two dual quat's (The dot product of the real parts)\n *\n * @param a the first operand\n * @param b the second operand\n * @returns dot product of a and b\n */\nexport function dot(a: Quat2, b: Quat2): number {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n\n/**\n * Performs a linear interpolation between two dual quats's\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when t = 0.5)\n *\n * @param out the receiving dual quat\n * @param a the first operand\n * @param b the second operand\n * @param t interpolation amount, in the range [0-1], between the two inputs\n * @returns out\n */\nexport function lerp(out: Quat2, a: Quat2, b: Quat2, t: number): Quat2 {\n const mt = 1 - t;\n // dot of the real (rotation) parts, matching quat2.dot\n if (a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] < 0) t = -t;\n\n out[0] = a[0] * mt + b[0] * t;\n out[1] = a[1] * mt + b[1] * t;\n out[2] = a[2] * mt + b[2] * t;\n out[3] = a[3] * mt + b[3] * t;\n out[4] = a[4] * mt + b[4] * t;\n out[5] = a[5] * mt + b[5] * t;\n out[6] = a[6] * mt + b[6] * t;\n out[7] = a[7] * mt + b[7] * t;\n\n return out;\n}\n\n/**\n * Calculates the inverse of a dual quat. If they are normalized, conjugate is cheaper\n *\n * @param out the receiving dual quaternion\n * @param a dual quat to calculate inverse of\n * @returns out\n */\nexport function invert(out: Quat2, a: Quat2): Quat2 {\n const sqlen = a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];\n out[0] = -a[0] / sqlen;\n out[1] = -a[1] / sqlen;\n out[2] = -a[2] / sqlen;\n out[3] = a[3] / sqlen;\n out[4] = -a[4] / sqlen;\n out[5] = -a[5] / sqlen;\n out[6] = -a[6] / sqlen;\n out[7] = a[7] / sqlen;\n return out;\n}\n\n/**\n * Calculates the conjugate of a dual quat\n * If the dual quaternion is normalized, this function is faster than quat2.inverse and produces the same result.\n *\n * @param out the receiving quaternion\n * @param a quat to calculate conjugate of\n * @returns out\n */\nexport function conjugate(out: Quat2, a: Quat2): Quat2 {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n out[4] = -a[4];\n out[5] = -a[5];\n out[6] = -a[6];\n out[7] = a[7];\n return out;\n}\n\n/**\n * Calculates the length of a dual quat (the length of its real/rotation part)\n *\n * @param a dual quat to calculate length of\n * @returns length of a\n */\nexport function length(a: Quat2): number {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n}\n\n/**\n * Alias for {@link quat2.length}\n * @function\n */\nexport const len = length;\n\n/**\n * Calculates the squared length of a dual quat (the squared length of its real/rotation part)\n *\n * @param a dual quat to calculate squared length of\n * @returns squared length of a\n */\nexport function squaredLength(a: Quat2): number {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n\n/**\n * Alias for {@link quat2.squaredLength}\n * @function\n */\nexport const sqrLen = squaredLength;\n\n/**\n * Normalize a dual quat\n *\n * @param out the receiving dual quaternion\n * @param a dual quaternion to normalize\n * @returns out\n * @function\n */\nexport function normalize(out: Quat2, a: Quat2): Quat2 {\n let magnitude = a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];\n if (magnitude > 0) {\n magnitude = Math.sqrt(magnitude);\n\n const a0 = a[0] / magnitude;\n const a1 = a[1] / magnitude;\n const a2 = a[2] / magnitude;\n const a3 = a[3] / magnitude;\n\n const b0 = a[4];\n const b1 = a[5];\n const b2 = a[6];\n const b3 = a[7];\n\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\n\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\n }\n return out;\n}\n\n/**\n * Returns a string representation of a dual quaternion\n *\n * @param a dual quaternion to represent as a string\n * @returns string representation of the dual quat\n */\nexport function str(a: Quat2): string {\n return `quat2(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]})`;\n}\n\n/**\n * Returns whether or not the dual quaternions have exactly the same elements in the same position (when compared with ===)\n *\n * @param a the first dual quaternion.\n * @param b the second dual quaternion.\n * @returns true if the dual quaternions are equal, false otherwise.\n */\nexport function exactEquals(a: Quat2, b: Quat2): boolean {\n return (\n a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5] &&\n a[6] === b[6] &&\n a[7] === b[7]\n );\n}\n\n/**\n * Returns whether or not the dual quaternions have approximately the same elements in the same position.\n *\n * @param a the first dual quat.\n * @param b the second dual quat.\n * @returns true if the dual quats are equal, false otherwise.\n */\nexport function equals(a: Quat2, b: Quat2): boolean {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n return (\n Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\n Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\n Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\n );\n}\n"],"names":[],"mappings":";;AAQA;;;;AAIG;SACa,MAAM,GAAA;;IAElB,OAAO;AACH,QAAA,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACV,QAAA,CAAC,EAAE,CAAC,EAAE,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AAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACxE,QAAA,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACxE,QAAA,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACxE,QAAA,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACxE,QAAA,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAEhF;;;;"}
@@ -0,0 +1,112 @@
1
+ const EPSILON = 0.000001;
2
+ /**
3
+ * Symmetric round
4
+ * see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background
5
+ *
6
+ * @param a value to round
7
+ */
8
+ function round(a) {
9
+ if (a >= 0)
10
+ return Math.round(a);
11
+ return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);
12
+ }
13
+ /**
14
+ * Tests whether or not the arguments have approximately the same value, within an absolute
15
+ * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
16
+ * than or equal to 1.0, and a relative tolerance is used for larger values)
17
+ *
18
+ * @param a The first number to test.
19
+ * @param b The second number to test.
20
+ * @returns True if the numbers are approximately equal, false otherwise.
21
+ */
22
+ function equals(a, b, epsilon = EPSILON) {
23
+ return Math.abs(a - b) <= epsilon * Math.max(1.0, Math.abs(a), Math.abs(b));
24
+ }
25
+ /**
26
+ * Ease-in-out, goes to -Infinite before 0 and Infinite after 1
27
+ *
28
+ * https://www.desmos.com/calculator/vsnmlaljdu
29
+ *
30
+ * @param t
31
+ * @returns
32
+ */
33
+ function fade(t) {
34
+ return t * t * t * (t * (t * 6 - 15) + 10);
35
+ }
36
+ /**
37
+ *
38
+ * Returns the result of linearly interpolating between input A and input B by input T.
39
+ *
40
+ * @param v0
41
+ * @param v1
42
+ * @param t
43
+ * @returns
44
+ */
45
+ function lerp(v0, v1, t) {
46
+ return v0 * (1 - t) + v1 * t;
47
+ }
48
+ /**
49
+ *
50
+ * Quadratic interpolation through three values using Lagrange interpolation.
51
+ * Passes through v0 at t=0, v1 at t=0.5, and v2 at t=1.
52
+ *
53
+ * @param v0 value at t=0
54
+ * @param v1 value at t=0.5
55
+ * @param v2 value at t=1
56
+ * @param t
57
+ * @returns
58
+ */
59
+ function lagrange(v0, v1, v2, t) {
60
+ return 2 * (t - 1) * (t - 0.5) * v0 - 4 * (t - 1) * t * v1 + 2 * (t - 0.5) * t * v2;
61
+ }
62
+ /**
63
+ *
64
+ * Binomial coefficient, "n choose k": the number of ways to choose k items
65
+ * from a set of n without order or repetition.
66
+ *
67
+ * @param n total number of items
68
+ * @param k number of items to choose
69
+ * @returns the binomial coefficient, or 0 when k is out of range
70
+ */
71
+ function binomial(n, k) {
72
+ if (k < 0 || k > n)
73
+ return 0;
74
+ // C(n, k) === C(n, n - k), so iterate over the smaller of the two
75
+ const j = Math.min(k, n - k);
76
+ let coeff = 1;
77
+ // interleave multiply/divide to keep intermediates small and integer-exact
78
+ for (let i = 0; i < j; i++) {
79
+ coeff = (coeff * (n - i)) / (i + 1);
80
+ }
81
+ return Math.round(coeff);
82
+ }
83
+ /**
84
+ * Clamp a value between min and max
85
+ */
86
+ const clamp = (value, min, max) => {
87
+ return Math.max(min, Math.min(max, value));
88
+ };
89
+ /**
90
+ * Loops `t` so that it is never larger than `length` and never smaller than 0.
91
+ */
92
+ function repeat(t, length) {
93
+ return clamp(t - Math.floor(t / length) * length, 0, length);
94
+ }
95
+ /**
96
+ * Remaps a number from one range to another.
97
+ */
98
+ function remap(number, inLow, inHigh, outLow, outHigh) {
99
+ const scale = (number - inLow) / (inHigh - inLow);
100
+ return outLow + scale * (outHigh - outLow);
101
+ }
102
+ /**
103
+ * Remaps a number from one range to another, clamping the result to the output range.
104
+ */
105
+ function remapClamp(value, inLow, inHigh, outLow, outHigh) {
106
+ const scale = (value - inLow) / (inHigh - inLow);
107
+ const remapped = outLow + scale * (outHigh - outLow);
108
+ return Math.max(outLow, Math.min(outHigh, remapped));
109
+ }
110
+
111
+ export { EPSILON, binomial, clamp, equals, fade, lagrange, lerp, remap, remapClamp, repeat, round };
112
+ //# sourceMappingURL=scalar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar.js","sources":["../../src/core/scalar.ts"],"sourcesContent":["export const EPSILON = 0.000001;\n\n/**\n * Symmetric round\n * see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background\n *\n * @param a value to round\n */\nexport function round(a: number): number {\n if (a >= 0) return Math.round(a);\n\n return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);\n}\n\n/**\n * Tests whether or not the arguments have approximately the same value, within an absolute\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\n * than or equal to 1.0, and a relative tolerance is used for larger values)\n *\n * @param a The first number to test.\n * @param b The second number to test.\n * @returns True if the numbers are approximately equal, false otherwise.\n */\nexport function equals(a: number, b: number, epsilon = EPSILON): boolean {\n return Math.abs(a - b) <= epsilon * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\n\n/**\n * Ease-in-out, goes to -Infinite before 0 and Infinite after 1\n *\n * https://www.desmos.com/calculator/vsnmlaljdu\n *\n * @param t\n * @returns\n */\nexport function fade(t: number) {\n return t * t * t * (t * (t * 6 - 15) + 10);\n}\n\n/**\n *\n * Returns the result of linearly interpolating between input A and input B by input T.\n *\n * @param v0\n * @param v1\n * @param t\n * @returns\n */\nexport function lerp(v0: number, v1: number, t: number) {\n return v0 * (1 - t) + v1 * t;\n}\n\n/**\n *\n * Quadratic interpolation through three values using Lagrange interpolation.\n * Passes through v0 at t=0, v1 at t=0.5, and v2 at t=1.\n *\n * @param v0 value at t=0\n * @param v1 value at t=0.5\n * @param v2 value at t=1\n * @param t\n * @returns\n */\nexport function lagrange(v0: number, v1: number, v2: number, t: number) {\n return 2 * (t - 1) * (t - 0.5) * v0 - 4 * (t - 1) * t * v1 + 2 * (t - 0.5) * t * v2;\n}\n\n/**\n *\n * Binomial coefficient, \"n choose k\": the number of ways to choose k items\n * from a set of n without order or repetition.\n *\n * @param n total number of items\n * @param k number of items to choose\n * @returns the binomial coefficient, or 0 when k is out of range\n */\nexport function binomial(n: number, k: number): number {\n if (k < 0 || k > n) return 0;\n // C(n, k) === C(n, n - k), so iterate over the smaller of the two\n const j = Math.min(k, n - k);\n let coeff = 1;\n // interleave multiply/divide to keep intermediates small and integer-exact\n for (let i = 0; i < j; i++) {\n coeff = (coeff * (n - i)) / (i + 1);\n }\n return Math.round(coeff);\n}\n\n/**\n * Clamp a value between min and max\n */\nexport const clamp = (value: number, min: number, max: number): number => {\n return Math.max(min, Math.min(max, value));\n};\n\n/**\n * Loops `t` so that it is never larger than `length` and never smaller than 0.\n */\nexport function repeat(t: number, length: number): number {\n return clamp(t - Math.floor(t / length) * length, 0, length);\n}\n\n/**\n * Remaps a number from one range to another.\n */\nexport function remap(number: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number {\n const scale = (number - inLow) / (inHigh - inLow);\n return outLow + scale * (outHigh - outLow);\n}\n\n/**\n * Remaps a number from one range to another, clamping the result to the output range.\n */\nexport function remapClamp(value: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number {\n const scale = (value - inLow) / (inHigh - inLow);\n const remapped = outLow + scale * (outHigh - outLow);\n return Math.max(outLow, Math.min(outHigh, remapped));\n}\n"],"names":[],"mappings":"AAAO,MAAM,OAAO,GAAG;AAEvB;;;;;AAKG;AACG,SAAU,KAAK,CAAC,CAAS,EAAA;IAC3B,IAAI,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAEhC,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACxD;AAEA;;;;;;;;AAQG;AACG,SAAU,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,OAAO,GAAG,OAAO,EAAA;AAC1D,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/E;AAEA;;;;;;;AAOG;AACG,SAAU,IAAI,CAAC,CAAS,EAAA;AAC1B,IAAA,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;AAC9C;AAEA;;;;;;;;AAQG;SACa,IAAI,CAAC,EAAU,EAAE,EAAU,EAAE,CAAS,EAAA;IAClD,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;AAChC;AAEA;;;;;;;;;;AAUG;AACG,SAAU,QAAQ,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,CAAS,EAAA;AAClE,IAAA,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,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AAG,CAAC,MAAM,GAAG,KAAK,KAAK,MAAM,GAAG,KAAK,CAAC;IACjD,OAAO,MAAM,GAAG,KAAK,IAAI,OAAO,GAAG,MAAM,CAAC;AAC9C;AAEA;;AAEG;AACG,SAAU,UAAU,CAAC,KAAa,EAAE,KAAa,EAAE,MAAc,EAAE,MAAc,EAAE,OAAe,EAAA;AACpG,IAAA,MAAM,KAAK,GAAG,CAAC,KAAK,GAAG,KAAK,KAAK,MAAM,GAAG,KAAK,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,IAAI,OAAO,GAAG,MAAM,CAAC;AACpD,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACxD;;;;"}
@@ -0,0 +1,248 @@
1
+ import { wrapAngle } from './angle.js';
2
+ import { equals as equals$1, lerp as lerp$1, EPSILON } from './scalar.js';
3
+
4
+ /**
5
+ * Creates a new spherical coordinate at r=1, theta=0, phi=0
6
+ *
7
+ * @returns a new Spherical
8
+ */
9
+ function create() {
10
+ return [1, 0, 0];
11
+ }
12
+ /**
13
+ * Creates a new Spherical initialized with the given values
14
+ *
15
+ * @param r radial distance
16
+ * @param theta azimuthal angle in the XZ plane from +Z (radians)
17
+ * @param phi polar angle from +Y axis (radians)
18
+ * @returns a new Spherical
19
+ */
20
+ function fromValues(r, theta, phi) {
21
+ return [r, theta, phi];
22
+ }
23
+ /**
24
+ * Creates a new Spherical initialized with values from an existing one
25
+ *
26
+ * @param a the source Spherical
27
+ * @returns a new Spherical
28
+ */
29
+ function clone(a) {
30
+ return [a[0], a[1], a[2]];
31
+ }
32
+ /**
33
+ * Copies values from one Spherical to another
34
+ *
35
+ * @param out the receiving Spherical
36
+ * @param a the source Spherical
37
+ * @returns out
38
+ */
39
+ function copy(out, a) {
40
+ out[0] = a[0];
41
+ out[1] = a[1];
42
+ out[2] = a[2];
43
+ return out;
44
+ }
45
+ /**
46
+ * Sets the components of a Spherical
47
+ *
48
+ * @param out the receiving Spherical
49
+ * @param r radial distance
50
+ * @param theta azimuthal angle in the XZ plane from +Z (radians)
51
+ * @param phi polar angle from +Y axis (radians)
52
+ * @returns out
53
+ */
54
+ function set(out, r, theta, phi) {
55
+ out[0] = r;
56
+ out[1] = theta;
57
+ out[2] = phi;
58
+ return out;
59
+ }
60
+ /**
61
+ * Sets r=1, preserving the angles. No-op if r is already zero.
62
+ *
63
+ * @param out the receiving Spherical
64
+ * @param a the source Spherical
65
+ * @returns out
66
+ */
67
+ function normalize(out, a) {
68
+ out[0] = 1;
69
+ out[1] = a[1];
70
+ out[2] = a[2];
71
+ return out;
72
+ }
73
+ /**
74
+ * Scales the radial distance r by a scalar
75
+ *
76
+ * @param out the receiving Spherical
77
+ * @param a the source Spherical
78
+ * @param s scalar to multiply r by
79
+ * @returns out
80
+ */
81
+ function scale(out, a, s) {
82
+ out[0] = a[0] * s;
83
+ out[1] = a[1];
84
+ out[2] = a[2];
85
+ return out;
86
+ }
87
+ /**
88
+ * Linearly interpolates between two Spherical coordinates taking the shortest
89
+ * angular path for theta and phi.
90
+ *
91
+ * @param out the receiving Spherical
92
+ * @param a the first operand
93
+ * @param b the second operand
94
+ * @param t interpolation factor in [0, 1]
95
+ * @returns out
96
+ */
97
+ function lerp(out, a, b, t) {
98
+ out[0] = lerp$1(a[0], b[0], t);
99
+ out[1] = a[1] + wrapAngle(b[1] - a[1]) * t;
100
+ out[2] = a[2] + wrapAngle(b[2] - a[2]) * t;
101
+ return out;
102
+ }
103
+ /**
104
+ * Sets a Spherical from Cartesian Vec3 coordinates (Three.js / OpenGL convention):
105
+ * r = sqrt(x² + y² + z²)
106
+ * theta = atan2(x, z) (azimuthal angle in XZ plane from +Z)
107
+ * phi = acos(y / r) (polar angle from +Y)
108
+ *
109
+ * @param out the receiving Spherical
110
+ * @param v the source Vec3
111
+ * @returns out
112
+ */
113
+ function setFromVec3(out, v) {
114
+ const x = v[0];
115
+ const y = v[1];
116
+ const z = v[2];
117
+ const r = Math.sqrt(x * x + y * y + z * z);
118
+ out[0] = r;
119
+ out[1] = r === 0 ? 0 : Math.atan2(x, z);
120
+ out[2] = r === 0 ? 0 : Math.acos(Math.max(-1, Math.min(1, y / r)));
121
+ return out;
122
+ }
123
+ /** @alias setFromVec3 */
124
+ const fromVec3 = setFromVec3;
125
+ /**
126
+ * Clamps phi to the range [EPSILON, π - EPSILON] to avoid coordinate
127
+ * singularities at the poles (gimbal lock / division by zero).
128
+ * r and theta are left unchanged.
129
+ *
130
+ * @param out the receiving Spherical
131
+ * @param a the source Spherical
132
+ * @returns out
133
+ */
134
+ function makeSafe(out, a) {
135
+ const EPS = EPSILON;
136
+ out[0] = a[0];
137
+ out[1] = a[1];
138
+ out[2] = Math.max(EPS, Math.min(Math.PI - EPS, a[2]));
139
+ return out;
140
+ }
141
+ /**
142
+ * Converts spherical coordinates to a Cartesian Vec3 (Three.js / OpenGL convention):
143
+ * x = r * sin(phi) * sin(theta)
144
+ * y = r * cos(phi)
145
+ * z = r * sin(phi) * cos(theta)
146
+ *
147
+ * @param out the receiving Vec3
148
+ * @param a the source Spherical
149
+ * @returns out
150
+ */
151
+ function toVec3(out, a) {
152
+ const r = a[0];
153
+ const theta = a[1];
154
+ const phi = a[2];
155
+ const rSinPhi = r * Math.sin(phi);
156
+ out[0] = rSinPhi * Math.sin(theta);
157
+ out[1] = r * Math.cos(phi);
158
+ out[2] = rSinPhi * Math.cos(theta);
159
+ return out;
160
+ }
161
+ /**
162
+ * Converts a Vec2 (x, z) in the horizontal XZ plane to spherical coordinates.
163
+ * The point is treated as lying on the equator (phi = π/2, y = 0).
164
+ *
165
+ * @param out the receiving Spherical
166
+ * @param v the source Vec2 interpreted as (x, z)
167
+ * @returns out
168
+ */
169
+ function fromVec2(out, v) {
170
+ const x = v[0];
171
+ const z = v[1];
172
+ const r = Math.sqrt(x * x + z * z);
173
+ out[0] = r;
174
+ out[1] = r === 0 ? 0 : Math.atan2(x, z);
175
+ out[2] = Math.PI / 2;
176
+ return out;
177
+ }
178
+ /**
179
+ * Projects spherical coordinates onto the XZ plane, returning a Vec2 (x, z).
180
+ * Equivalent to taking the horizontal footprint of the 3D point.
181
+ *
182
+ * @param out the receiving Vec2
183
+ * @param a the source Spherical
184
+ * @returns out
185
+ */
186
+ function toVec2(out, a) {
187
+ const r = a[0];
188
+ const theta = a[1];
189
+ const phi = a[2];
190
+ const rSinPhi = r * Math.sin(phi);
191
+ out[0] = rSinPhi * Math.sin(theta);
192
+ out[1] = rSinPhi * Math.cos(theta);
193
+ return out;
194
+ }
195
+ /**
196
+ * Returns true if two Spherical coordinates are approximately equal,
197
+ * within an absolute/relative tolerance of EPSILON.
198
+ *
199
+ * @param a the first Spherical
200
+ * @param b the second Spherical
201
+ * @returns true if approximately equal
202
+ */
203
+ function equals(a, b) {
204
+ return equals$1(a[0], b[0]) && equals$1(a[1], b[1]) && equals$1(a[2], b[2]);
205
+ }
206
+ /**
207
+ * Returns true if two Spherical coordinates are exactly equal (===).
208
+ *
209
+ * @param a the first Spherical
210
+ * @param b the second Spherical
211
+ * @returns true if exactly equal
212
+ */
213
+ function exactEquals(a, b) {
214
+ return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
215
+ }
216
+ /**
217
+ * Returns a string representation of a Spherical
218
+ *
219
+ * @param a the source Spherical
220
+ * @returns string representation
221
+ */
222
+ function str(a) {
223
+ return `Spherical(${a[0]}, ${a[1]}, ${a[2]})`;
224
+ }
225
+ /**
226
+ * Returns the great-circle angle (in radians) between two spherical coordinates,
227
+ * ignoring r. Equivalent to the central angle between the two directions on a
228
+ * unit sphere.
229
+ *
230
+ * Uses the numerically stable haversine formula.
231
+ *
232
+ * @param a the first Spherical
233
+ * @param b the second Spherical
234
+ * @returns angle in radians in [0, π]
235
+ */
236
+ function angleTo(a, b) {
237
+ const phiA = a[2];
238
+ const phiB = b[2];
239
+ const dTheta = b[1] - a[1];
240
+ // hav(c) = hav(phiB - phiA) + sin(phiA) * sin(phiB) * hav(dTheta)
241
+ const sHalfPhi = Math.sin((phiB - phiA) / 2);
242
+ const sHalfTheta = Math.sin(dTheta / 2);
243
+ const hav = sHalfPhi * sHalfPhi + Math.sin(phiA) * Math.sin(phiB) * sHalfTheta * sHalfTheta;
244
+ return 2 * Math.asin(Math.sqrt(Math.max(0, Math.min(1, hav))));
245
+ }
246
+
247
+ export { angleTo, clone, copy, create, equals, exactEquals, fromValues, fromVec2, fromVec3, lerp, makeSafe, normalize, scale, set, setFromVec3, str, toVec2, toVec3 };
248
+ //# sourceMappingURL=spherical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spherical.js","sources":["../../src/core/spherical.ts"],"sourcesContent":["import { wrapAngle } from './angle';\nimport * as scalar from './scalar';\nimport type { Vec2 } from './vec2';\nimport type { Vec3 } from './vec3';\n\n/**\n * A point in spherical coordinates [r, theta, phi] (Three.js / OpenGL convention)\n * r - radial distance from the origin\n * theta - azimuthal angle in the XZ plane from the +Z axis (radians, range [-π, π])\n * phi - polar angle from the +Y axis (radians, range [0, π])\n */\nexport type Spherical = [r: number, theta: number, phi: number];\n\n/**\n * Creates a new spherical coordinate at r=1, theta=0, phi=0\n *\n * @returns a new Spherical\n */\nexport function create(): Spherical {\n return [1, 0, 0];\n}\n\n/**\n * Creates a new Spherical initialized with the given values\n *\n * @param r radial distance\n * @param theta azimuthal angle in the XZ plane from +Z (radians)\n * @param phi polar angle from +Y axis (radians)\n * @returns a new Spherical\n */\nexport function fromValues(r: number, theta: number, phi: number): Spherical {\n return [r, theta, phi];\n}\n\n/**\n * Creates a new Spherical initialized with values from an existing one\n *\n * @param a the source Spherical\n * @returns a new Spherical\n */\nexport function clone(a: Spherical): Spherical {\n return [a[0], a[1], a[2]];\n}\n\n/**\n * Copies values from one Spherical to another\n *\n * @param out the receiving Spherical\n * @param a the source Spherical\n * @returns out\n */\nexport function copy(out: Spherical, a: Spherical): Spherical {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n\n/**\n * Sets the components of a Spherical\n *\n * @param out the receiving Spherical\n * @param r radial distance\n * @param theta azimuthal angle in the XZ plane from +Z (radians)\n * @param phi polar angle from +Y axis (radians)\n * @returns out\n */\nexport function set(out: Spherical, r: number, theta: number, phi: number): Spherical {\n out[0] = r;\n out[1] = theta;\n out[2] = phi;\n return out;\n}\n\n/**\n * Sets r=1, preserving the angles. No-op if r is already zero.\n *\n * @param out the receiving Spherical\n * @param a the source Spherical\n * @returns out\n */\nexport function normalize(out: Spherical, a: Spherical): Spherical {\n out[0] = 1;\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n\n/**\n * Scales the radial distance r by a scalar\n *\n * @param out the receiving Spherical\n * @param a the source Spherical\n * @param s scalar to multiply r by\n * @returns out\n */\nexport function scale(out: Spherical, a: Spherical, s: number): Spherical {\n out[0] = a[0] * s;\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n\n/**\n * Linearly interpolates between two Spherical coordinates taking the shortest\n * angular path for theta and phi.\n *\n * @param out the receiving Spherical\n * @param a the first operand\n * @param b the second operand\n * @param t interpolation factor in [0, 1]\n * @returns out\n */\nexport function lerp(out: Spherical, a: Spherical, b: Spherical, t: number): Spherical {\n out[0] = scalar.lerp(a[0], b[0], t);\n out[1] = a[1] + wrapAngle(b[1] - a[1]) * t;\n out[2] = a[2] + wrapAngle(b[2] - a[2]) * t;\n return out;\n}\n\n/**\n * Sets a Spherical from Cartesian Vec3 coordinates (Three.js / OpenGL convention):\n * r = sqrt(x² + y² + z²)\n * theta = atan2(x, z) (azimuthal angle in XZ plane from +Z)\n * phi = acos(y / r) (polar angle from +Y)\n *\n * @param out the receiving Spherical\n * @param v the source Vec3\n * @returns out\n */\nexport function setFromVec3(out: Spherical, v: Vec3): Spherical {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const r = Math.sqrt(x * x + y * y + z * z);\n out[0] = r;\n out[1] = r === 0 ? 0 : Math.atan2(x, z);\n out[2] = r === 0 ? 0 : Math.acos(Math.max(-1, Math.min(1, y / r)));\n return out;\n}\n\n/** @alias setFromVec3 */\nexport const fromVec3 = setFromVec3;\n\n/**\n * Clamps phi to the range [EPSILON, π - EPSILON] to avoid coordinate\n * singularities at the poles (gimbal lock / division by zero).\n * r and theta are left unchanged.\n *\n * @param out the receiving Spherical\n * @param a the source Spherical\n * @returns out\n */\nexport function makeSafe(out: Spherical, a: Spherical): Spherical {\n const EPS = scalar.EPSILON;\n out[0] = a[0];\n out[1] = a[1];\n out[2] = Math.max(EPS, Math.min(Math.PI - EPS, a[2]));\n return out;\n}\n\n/**\n * Converts spherical coordinates to a Cartesian Vec3 (Three.js / OpenGL convention):\n * x = r * sin(phi) * sin(theta)\n * y = r * cos(phi)\n * z = r * sin(phi) * cos(theta)\n *\n * @param out the receiving Vec3\n * @param a the source Spherical\n * @returns out\n */\nexport function toVec3(out: Vec3, a: Spherical): Vec3 {\n const r = a[0];\n const theta = a[1];\n const phi = a[2];\n const rSinPhi = r * Math.sin(phi);\n out[0] = rSinPhi * Math.sin(theta);\n out[1] = r * Math.cos(phi);\n out[2] = rSinPhi * Math.cos(theta);\n return out;\n}\n\n/**\n * Converts a Vec2 (x, z) in the horizontal XZ plane to spherical coordinates.\n * The point is treated as lying on the equator (phi = π/2, y = 0).\n *\n * @param out the receiving Spherical\n * @param v the source Vec2 interpreted as (x, z)\n * @returns out\n */\nexport function fromVec2(out: Spherical, v: Vec2): Spherical {\n const x = v[0];\n const z = v[1];\n const r = Math.sqrt(x * x + z * z);\n out[0] = r;\n out[1] = r === 0 ? 0 : Math.atan2(x, z);\n out[2] = Math.PI / 2;\n return out;\n}\n\n/**\n * Projects spherical coordinates onto the XZ plane, returning a Vec2 (x, z).\n * Equivalent to taking the horizontal footprint of the 3D point.\n *\n * @param out the receiving Vec2\n * @param a the source Spherical\n * @returns out\n */\nexport function toVec2(out: Vec2, a: Spherical): Vec2 {\n const r = a[0];\n const theta = a[1];\n const phi = a[2];\n const rSinPhi = r * Math.sin(phi);\n out[0] = rSinPhi * Math.sin(theta);\n out[1] = rSinPhi * Math.cos(theta);\n return out;\n}\n\n/**\n * Returns true if two Spherical coordinates are approximately equal,\n * within an absolute/relative tolerance of EPSILON.\n *\n * @param a the first Spherical\n * @param b the second Spherical\n * @returns true if approximately equal\n */\nexport function equals(a: Spherical, b: Spherical): boolean {\n return scalar.equals(a[0], b[0]) && scalar.equals(a[1], b[1]) && scalar.equals(a[2], b[2]);\n}\n\n/**\n * Returns true if two Spherical coordinates are exactly equal (===).\n *\n * @param a the first Spherical\n * @param b the second Spherical\n * @returns true if exactly equal\n */\nexport function exactEquals(a: Spherical, b: Spherical): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Returns a string representation of a Spherical\n *\n * @param a the source Spherical\n * @returns string representation\n */\nexport function str(a: Spherical): string {\n return `Spherical(${a[0]}, ${a[1]}, ${a[2]})`;\n}\n\n/**\n * Returns the great-circle angle (in radians) between two spherical coordinates,\n * ignoring r. Equivalent to the central angle between the two directions on a\n * unit sphere.\n *\n * Uses the numerically stable haversine formula.\n *\n * @param a the first Spherical\n * @param b the second Spherical\n * @returns angle in radians in [0, π]\n */\nexport function angleTo(a: Spherical, b: Spherical): number {\n const phiA = a[2];\n const phiB = b[2];\n const dTheta = b[1] - a[1];\n // hav(c) = hav(phiB - phiA) + sin(phiA) * sin(phiB) * hav(dTheta)\n const sHalfPhi = Math.sin((phiB - phiA) / 2);\n const sHalfTheta = Math.sin(dTheta / 2);\n const hav = sHalfPhi * sHalfPhi + Math.sin(phiA) * Math.sin(phiB) * sHalfTheta * sHalfTheta;\n return 2 * Math.asin(Math.sqrt(Math.max(0, Math.min(1, hav))));\n}\n"],"names":["scalar.lerp","scalar.EPSILON","scalar.equals"],"mappings":";;;AAaA;;;;AAIG;SACa,MAAM,GAAA;AAClB,IAAA,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACpB;AAEA;;;;;;;AAOG;SACa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