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":"vec4.js","sources":["../../src/core/vec4.ts"],"sourcesContent":["import type { MutableArrayLike } from './arrays';\nimport type { Mat4 } from './mat4';\nimport type { Quat } from './quat';\nimport * as scalar from './scalar';\n\n/** A 4D vector */\nexport type Vec4 = [x: number, y: number, z: number, w: number];\n\n/**\n * Creates a new, empty vec4\n *\n * @returns a new 4D vector\n */\nexport function create(): Vec4 {\n return [0, 0, 0, 0];\n}\n\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param a vector to clone\n * @returns a new 4D vector\n */\nexport function clone(a: Vec4): Vec4 {\n return [a[0], a[1], a[2], a[3]];\n}\n\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param x X component\n * @param y Y component\n * @param z Z component\n * @param w W component\n * @returns a new 4D vector\n */\nexport function fromValues(x: number, y: number, z: number, w: number): Vec4 {\n return [x, y, z, w];\n}\n\n/**\n * Copy the values from one vec4 to another\n *\n * @param out the receiving vector\n * @param a the source vector\n * @returns out\n */\nexport function copy(out: Vec4, a: Vec4): Vec4 {\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 * Set the components of a vec4 to the given values\n *\n * @param out the receiving vector\n * @param x X component\n * @param y Y component\n * @param z Z component\n * @param w W component\n * @returns out\n */\nexport function set(out: Vec4, x: number, y: number, z: number, w: number): Vec4 {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n\n/**\n * Sets the components of a vec4 from a buffer\n * @param out the receiving vector\n * @param buffer the source buffer\n * @param startIndex the starting index in the buffer\n * @returns out\n */\nexport function fromBuffer(out: Vec4, buffer: ArrayLike<number>, startIndex: number): Vec4 {\n out[0] = buffer[startIndex];\n out[1] = buffer[startIndex + 1];\n out[2] = buffer[startIndex + 2];\n out[3] = buffer[startIndex + 3];\n return out;\n}\n\n/**\n * Writes the components of a vec4 to a buffer\n * @param outBuffer The output buffer\n * @param vec The source vector\n * @param startIndex The starting index in the buffer\n * @returns The output buffer\n */\nexport function toBuffer(outBuffer: MutableArrayLike<number>, vec: Vec4, startIndex: number): MutableArrayLike<number> {\n outBuffer[startIndex] = vec[0];\n outBuffer[startIndex + 1] = vec[1];\n outBuffer[startIndex + 2] = vec[2];\n outBuffer[startIndex + 3] = vec[3];\n return outBuffer;\n}\n\n/**\n * Adds two vec4's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function add(out: Vec4, a: Vec4, b: Vec4): Vec4 {\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 return out;\n}\n\n/**\n * Subtracts vector b from vector a\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function subtract(out: Vec4, a: Vec4, b: Vec4): Vec4 {\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 return out;\n}\n\n/**\n * Multiplies two vec4's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function multiply(out: Vec4, a: Vec4, b: Vec4): Vec4 {\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 return out;\n}\n\n/**\n * Divides two vec4's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function divide(out: Vec4, a: Vec4, b: Vec4): Vec4 {\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 return out;\n}\n\n/**\n * Math.ceil the components of a vec4\n *\n * @param out the receiving vector\n * @param a vector to ceil\n * @returns out\n */\nexport function ceil(out: Vec4, a: Vec4): Vec4 {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n\n/**\n * Math.floor the components of a vec4\n *\n * @param out the receiving vector\n * @param a vector to floor\n * @returns out\n */\nexport function floor(out: Vec4, a: Vec4): Vec4 {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n\n/**\n * Returns the minimum of two vec4's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function min(out: Vec4, a: Vec4, b: Vec4): Vec4 {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n\n/**\n * Returns the maximum of two vec4's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function max(out: Vec4, a: Vec4, b: Vec4): Vec4 {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n\n/**\n * symmetric round the components of a vec4\n *\n * @param out the receiving vector\n * @param a vector to round\n * @returns out\n */\nexport function round(out: Vec4, a: Vec4): Vec4 {\n out[0] = scalar.round(a[0]);\n out[1] = scalar.round(a[1]);\n out[2] = scalar.round(a[2]);\n out[3] = scalar.round(a[3]);\n return out;\n}\n\n/**\n * Scales a vec4 by a scalar number\n *\n * @param out the receiving vector\n * @param a the vector to scale\n * @param b amount to scale the vector by\n * @returns out\n */\nexport function scale(out: Vec4, a: Vec4, b: number): Vec4 {\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 return out;\n}\n\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param scale the amount to scale b by before adding\n * @returns out\n */\nexport function scaleAndAdd(out: Vec4, a: Vec4, b: Vec4, scale: number): Vec4 {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns distance between a and b\n */\nexport function distance(a: Vec4, b: Vec4): number {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n}\n\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns squared distance between a and b\n */\nexport function squaredDistance(a: Vec4, b: Vec4): number {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n\n/**\n * Calculates the length of a vec4\n *\n * @param a vector to calculate length of\n * @returns length of a\n */\nexport function length(a: Vec4): 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 * Calculates the squared length of a vec4\n *\n * @param a vector to calculate squared length of\n * @returns squared length of a\n */\nexport function squaredLength(a: Vec4): 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 * Negates the components of a vec4\n *\n * @param out the receiving vector\n * @param a vector to negate\n * @returns out\n */\nexport function negate(out: Vec4, a: Vec4): Vec4 {\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 * Returns the inverse of the components of a vec4\n *\n * @param out the receiving vector\n * @param a vector to invert\n * @returns out\n */\nexport function inverse(out: Vec4, a: Vec4): Vec4 {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n\n/**\n * Normalize a vec4\n *\n * @param out the receiving vector\n * @param a vector to normalize\n * @returns out\n */\nexport function normalize(out: Vec4, a: Vec4): Vec4 {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n let len = x * x + y * y + z * z + w * w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n\n/**\n * Calculates the dot product of two vec4's\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: Vec4, b: Vec4): number {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n\n/**\n * Returns the cross-product of three vectors in a 4-dimensional space\n *\n * @param out the receiving vector\n * @param u the first vector\n * @param v the second vector\n * @param w the third vector\n * @returns result\n */\nexport function cross(out: Vec4, u: Vec4, v: Vec4, w: Vec4): Vec4 {\n const A = v[0] * w[1] - v[1] * w[0];\n const B = v[0] * w[2] - v[2] * w[0];\n const C = v[0] * w[3] - v[3] * w[0];\n const D = v[1] * w[2] - v[2] * w[1];\n const E = v[1] * w[3] - v[3] * w[1];\n const F = v[2] * w[3] - v[3] * w[2];\n const G = u[0];\n const H = u[1];\n const I = u[2];\n const J = u[3];\n\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n\n return out;\n}\n\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param out the receiving vector\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: Vec4, a: Vec4, b: Vec4, t: number): Vec4 {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n\n/**\n * Quadratic interpolation through three vectors using Lagrange interpolation.\n * Passes through a at t=0, b at t=0.5, and c at t=1.\n *\n * @param out the receiving vector\n * @param a vector at t=0\n * @param b vector at t=0.5\n * @param c vector at t=1\n * @param t interpolation amount\n * @returns out\n */\nexport function lagrange(out: Vec4, a: Vec4, b: Vec4, c: Vec4, t: number): Vec4 {\n const c0 = 2 * (t - 1) * (t - 0.5);\n const c1 = -4 * (t - 1) * t;\n const c2 = 2 * (t - 0.5) * t;\n out[0] = c0 * a[0] + c1 * b[0] + c2 * c[0];\n out[1] = c0 * a[1] + c1 * b[1] + c2 * c[1];\n out[2] = c0 * a[2] + c1 * b[2] + c2 * c[2];\n out[3] = c0 * a[3] + c1 * b[3] + c2 * c[3];\n return out;\n}\n\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param m matrix to transform with\n * @returns out\n */\nexport function transformMat4(out: Vec4, a: Vec4, m: Mat4): Vec4 {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n\n/**\n * Transforms the vec4 with a quat\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param q quaternion to transform with\n * @returns out\n */\nexport function transformQuat(out: Vec4, a: Vec4, q: Quat): Vec4 {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n // calculate quat * vec\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n\n/**\n * Set the components of a vec4 to zero\n *\n * @param out the receiving vector\n * @returns out\n */\nexport function zero(out: Vec4): Vec4 {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n\n/**\n * Returns a string representation of a vector\n *\n * @param a vector to represent as a string\n * @returns string representation of the vector\n */\nexport function str(a: Vec4): string {\n return `vec4(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;\n}\n\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param a The first vector.\n * @param b The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\nexport function exactEquals(a: Vec4, b: Vec4): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param a The first vector.\n * @param b The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\nexport function equals(a: Vec4, b: Vec4): boolean {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return (\n Math.abs(a0 - b0) <= scalar.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= scalar.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= scalar.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= scalar.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\n );\n}\n\n/**\n * Returns whether or not the vector is finite\n * @param a vector to test\n * @returns whether or not the vector is finite\n */\nexport function finite(a: Vec4): boolean {\n return Number.isFinite(a[0]) && Number.isFinite(a[1]) && Number.isFinite(a[2]) && Number.isFinite(a[3]);\n}\n\n/**\n * Alias for {@link subtract}\n */\nexport const sub = subtract;\n\n/**\n * Alias for {@link multiply}\n */\nexport const mul = multiply;\n\n/**\n * Alias for {@link divide}\n */\nexport const div = divide;\n\n/**\n * Alias for {@link distance}\n */\nexport const dist = distance;\n\n/**\n * Alias for {@link squaredDistance}\n */\nexport const sqrDist = squaredDistance;\n\n/**\n * Alias for {@link length}\n */\nexport const len = length;\n\n/**\n * Alias for {@link squaredLength}\n */\nexport const sqrLen = squaredLength;\n"],"names":["scalar.round","scalar.EPSILON"],"mappings":";;AAQA;;;;AAIG;SACa,MAAM,GAAA;IAClB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACvB;AAEA;;;;;AAKG;AACG,SAAU,KAAK,CAAC,CAAO,EAAA;IACzB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC;AAEA;;;;;;;;AAQG;AACG,SAAU,UAAU,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;IACjE,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACvB;AAEA;;;;;;AAMG;AACG,SAAU,IAAI,CAAC,GAAS,EAAE,CAAO,EAAA;IACnC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACb,IAAA,OAAO,GAAG;AACd;AAEA;;;;;;;;;AASG;AACG,SAAU,GAAG,CAAC,GAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;AACrE,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,GAAG,CAAC,CAAC,CAA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;;AAEG;AACI,MAAM,OAAO,GAAG;AAEvB;;AAEG;AACI,MAAM,GAAG,GAAG;AAEnB;;AAEG;AACI,MAAM,MAAM,GAAG;;;;"}
@@ -0,0 +1,39 @@
1
+ import { EPSILON } from '../core/scalar.js';
2
+
3
+ /**
4
+ * Calculates the circumcircle of three points and stores the center in the output parameter.
5
+ * @param out The circle to store the result in
6
+ * @param triangle The triangle defined by three points
7
+ * @returns
8
+ */
9
+ function circumcircle(out, a, b, c) {
10
+ // work relative to `a` at the origin, which collapses the circumcenter formula
11
+ const ax = a[0];
12
+ const ay = a[1];
13
+ const bx = b[0] - ax;
14
+ const by = b[1] - ay;
15
+ const cx = c[0] - ax;
16
+ const cy = c[1] - ay;
17
+ // cross product of the edge vectors (twice the signed triangle area)
18
+ const cp = bx * cy - by * cx;
19
+ if (Math.abs(cp) > EPSILON) {
20
+ const bSq = bx * bx + by * by;
21
+ const cSq = cx * cx + cy * cy;
22
+ const d = 0.5 / cp;
23
+ // circumcenter relative to `a`
24
+ const ux = (cy * bSq - by * cSq) * d;
25
+ const uy = (bx * cSq - cx * bSq) * d;
26
+ out.center[0] = ux + ax;
27
+ out.center[1] = uy + ay;
28
+ out.radius = Math.sqrt(ux * ux + uy * uy);
29
+ return out;
30
+ }
31
+ // degenerate (collinear) — no unique circumcircle
32
+ out.center[0] = ax;
33
+ out.center[1] = ay;
34
+ out.radius = 0;
35
+ return out;
36
+ }
37
+
38
+ export { circumcircle };
39
+ //# sourceMappingURL=circumcircle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circumcircle.js","sources":["../../src/geometry/circumcircle.ts"],"sourcesContent":["import { EPSILON } from '../core/scalar';\nimport type { Vec2 } from '../core/vec2';\nimport type { Circle } from '../shapes/circle';\n\n/**\n * Calculates the circumcircle of three points and stores the center in the output parameter.\n * @param out The circle to store the result in\n * @param triangle The triangle defined by three points\n * @returns\n */\nexport function circumcircle(out: Circle, a: Vec2, b: Vec2, c: Vec2): Circle {\n // work relative to `a` at the origin, which collapses the circumcenter formula\n const ax = a[0];\n const ay = a[1];\n const bx = b[0] - ax;\n const by = b[1] - ay;\n const cx = c[0] - ax;\n const cy = c[1] - ay;\n\n // cross product of the edge vectors (twice the signed triangle area)\n const cp = bx * cy - by * cx;\n\n if (Math.abs(cp) > EPSILON) {\n const bSq = bx * bx + by * by;\n const cSq = cx * cx + cy * cy;\n const d = 0.5 / cp;\n\n // circumcenter relative to `a`\n const ux = (cy * bSq - by * cSq) * d;\n const uy = (bx * cSq - cx * bSq) * d;\n\n out.center[0] = ux + ax;\n out.center[1] = uy + ay;\n out.radius = Math.sqrt(ux * ux + uy * uy);\n\n return out;\n }\n\n // degenerate (collinear) — no unique circumcircle\n out.center[0] = ax;\n out.center[1] = ay;\n out.radius = 0;\n\n return out;\n}\n"],"names":[],"mappings":";;AAIA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,GAAW,EAAE,CAAO,EAAE,CAAO,EAAE,CAAO,EAAA;;AAE/D,IAAA,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACf,IAAA,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACf,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;IACpB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;IACpB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;IACpB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;;IAGpB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAE5B,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE;QACxB,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;QAC7B,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;AAC7B,QAAA,MAAM,CAAC,GAAG,GAAG,GAAG,EAAE;;AAGlB,QAAA,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;AACpC,QAAA,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;QAEpC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE;QACvB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE;AACvB,QAAA,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEzC,QAAA,OAAO,GAAG;IACd;;AAGA,IAAA,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE;AAClB,IAAA,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE;AAClB,IAAA,GAAG,CAAC,MAAM,GAAG,CAAC;AAEd,IAAA,OAAO,GAAG;AACd;;;;"}
@@ -0,0 +1,6 @@
1
+ export { circumcircle } from './circumcircle.js';
2
+ export { decomposePolygon2Quality, decomposePolygon2Quick } from './polygon2-decompose.js';
3
+ export { triangulatePolygon2 } from './polygon2-triangulate.js';
4
+ export { quickhull2 } from './quickhull2.js';
5
+ export { quickhull3 } from './quickhull3.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,411 @@
1
+ import { isReflexVertex, signedArea, reverse } from '../shapes/polygon2.js';
2
+
3
+ /*
4
+ * Convex decomposition
5
+ *
6
+ * Splits a simple (non-self-intersecting) polygon into convex sub-polygons.
7
+ * Polygons use the flat `[x0, y0, x1, y1, ...]` representation from math/shapes
8
+ * (polygon2), with an explicit vertex count `n`.
9
+ *
10
+ * Ported to the flat representation from poly-decomp-es
11
+ * (https://github.com/pmndrs/poly-decomp-es), MIT licensed, which itself is
12
+ * based on Mark Bayazit's algorithm. Each returned sub-polygon is a fresh flat
13
+ * `[x0, y0, ...]` array, wound counter-clockwise.
14
+ */
15
+ const _decompIsect = [0, 0];
16
+ /**
17
+ * Twice the signed area of the triangle (a, b, c); positive when
18
+ * counter-clockwise. This is the inlined, coordinate-form counterpart of
19
+ * `triangle2.signedArea` — kept local (and undivided) to avoid Vec2 allocations
20
+ * in the hot decomposition loops, where only the sign and relative magnitude
21
+ * matter.
22
+ */
23
+ function triArea(ax, ay, bx, by, cx, cy) {
24
+ return (bx - ax) * (cy - ay) - (cx - ax) * (by - ay);
25
+ }
26
+ /** True if vertex `i` is reflex; delegates to the shared polygon2 primitive. */
27
+ function isReflex(poly, i) {
28
+ return isReflexVertex(poly, poly.length >> 1, i);
29
+ }
30
+ function sqDist(ax, ay, bx, by) {
31
+ const dx = bx - ax;
32
+ const dy = by - ay;
33
+ return dx * dx + dy * dy;
34
+ }
35
+ /** Intersection point of the two infinite lines (p1,p2) and (q1,q2); writes [0,0] if parallel. */
36
+ function lineIntersection(out, p1x, p1y, p2x, p2y, q1x, q1y, q2x, q2y) {
37
+ const a1 = p2y - p1y;
38
+ const b1 = p1x - p2x;
39
+ const c1 = a1 * p1x + b1 * p1y;
40
+ const a2 = q2y - q1y;
41
+ const b2 = q1x - q2x;
42
+ const c2 = a2 * q1x + b2 * q1y;
43
+ const det = a1 * b2 - a2 * b1;
44
+ if (det !== 0) {
45
+ out[0] = (b2 * c1 - b1 * c2) / det;
46
+ out[1] = (a1 * c2 - a2 * c1) / det;
47
+ }
48
+ else {
49
+ out[0] = 0;
50
+ out[1] = 0;
51
+ }
52
+ return out;
53
+ }
54
+ /**
55
+ * True if the closed segments (p1,p2) and (q1,q2) intersect. Inlined,
56
+ * coordinate-form counterpart of `segment2.intersects`, kept local to avoid
57
+ * Vec2 allocations in the visibility loops. Division-free: instead of computing
58
+ * the parameters `u = numU/denom` and `v = numV/denom`, it normalises the sign
59
+ * of `denom` and range-checks the numerators, which avoids two divisions per
60
+ * call in the hot visibility loop.
61
+ */
62
+ function segmentsIntersect(p1x, p1y, p2x, p2y, q1x, q1y, q2x, q2y) {
63
+ const rx = p2x - p1x;
64
+ const ry = p2y - p1y;
65
+ const ex = q2x - q1x;
66
+ const ey = q2y - q1y;
67
+ let denom = rx * ey - ry * ex;
68
+ if (denom === 0)
69
+ return false; // parallel or collinear
70
+ const wx = q1x - p1x;
71
+ const wy = q1y - p1y;
72
+ let numU = wx * ey - wy * ex; // u = numU / denom
73
+ let numV = wx * ry - wy * rx; // v = numV / denom
74
+ // Make denom positive so the [0,1] range test is a plain comparison.
75
+ if (denom < 0) {
76
+ denom = -denom;
77
+ numU = -numU;
78
+ numV = -numV;
79
+ }
80
+ return numU >= 0 && numU <= denom && numV >= 0 && numV <= denom;
81
+ }
82
+ /** Appends vertices `from..to-1` of `src` onto `dst` (both flat arrays). */
83
+ function appendRange(dst, src, from, to) {
84
+ for (let k = from; k < to; k++) {
85
+ dst.push(src[k * 2], src[k * 2 + 1]);
86
+ }
87
+ }
88
+ /** Copies vertices `i..j` (cyclic) of `poly` into a new flat polygon. */
89
+ function polygonCopy(poly, i, j) {
90
+ const s = poly.length >> 1;
91
+ const out = [];
92
+ if (i < j) {
93
+ for (let k = i; k <= j; k++)
94
+ out.push(poly[k * 2], poly[k * 2 + 1]);
95
+ }
96
+ else {
97
+ for (let k = 0; k <= j; k++)
98
+ out.push(poly[k * 2], poly[k * 2 + 1]);
99
+ for (let k = i; k < s; k++)
100
+ out.push(poly[k * 2], poly[k * 2 + 1]);
101
+ }
102
+ return out;
103
+ }
104
+ /** Writes a CCW copy of the first `n` vertices of `vertices` into `out`, reversing if needed. */
105
+ function toCCW(out, vertices, n) {
106
+ for (let k = 0; k < n * 2; k++)
107
+ out[k] = vertices[k];
108
+ if (signedArea(out, n) < 0)
109
+ reverse(out, out, n);
110
+ return out;
111
+ }
112
+ const QUICK_DECOMP_MAX_LEVEL = 100;
113
+ /** True if vertices `a` and `b` can see each other without any edge blocking (segment test). */
114
+ function canSeeSegment(poly, a, b) {
115
+ const s = poly.length >> 1;
116
+ const ax = poly[a * 2];
117
+ const ay = poly[a * 2 + 1];
118
+ const bx = poly[b * 2];
119
+ const by = poly[b * 2 + 1];
120
+ for (let i = 0; i < s; i++) {
121
+ const i1 = i + 1 === s ? 0 : i + 1;
122
+ if (i === a || i === b || i1 === a || i1 === b)
123
+ continue;
124
+ if (segmentsIntersect(ax, ay, bx, by, poly[i * 2], poly[i * 2 + 1], poly[i1 * 2], poly[i1 * 2 + 1])) {
125
+ return false;
126
+ }
127
+ }
128
+ return true;
129
+ }
130
+ /**
131
+ * Decomposes a simple polygon into convex sub-polygons using Bayazit's fast
132
+ * approximate algorithm. Fast (~O(n²)) but may use more pieces than the
133
+ * minimum; may introduce new (Steiner) vertices. Input winding is normalised
134
+ * internally, so either winding is accepted.
135
+ *
136
+ * Implemented iteratively with an explicit worklist of sub-polygons rather than
137
+ * recursion.
138
+ *
139
+ * @param vertices polygon vertices as a flat array `[x0, y0, x1, y1, ...]`
140
+ * @param n number of vertices to read from `vertices`
141
+ * @returns an array of convex sub-polygons, each a flat `[x0, y0, ...]` array (CCW)
142
+ */
143
+ function decomposePolygon2Quick(vertices, n) {
144
+ if (n < 3)
145
+ return [];
146
+ const out = [];
147
+ // Sub-polygons still to decompose, each paired with its depth in `levels`
148
+ // (a runaway guard for pathological input). Both stacks stay in lockstep.
149
+ const stack = [toCCW([], vertices, n)];
150
+ const levels = [0];
151
+ while (stack.length > 0) {
152
+ const poly = stack.pop();
153
+ const level = levels.pop();
154
+ const s = poly.length >> 1;
155
+ if (s < 3)
156
+ continue;
157
+ if (level > QUICK_DECOMP_MAX_LEVEL) {
158
+ out.push(poly);
159
+ continue;
160
+ }
161
+ // Find the first reflex vertex and split there; a poly with none is convex.
162
+ let handled = false;
163
+ for (let i = 0; i < s; i++) {
164
+ if (!isReflexVertex(poly, s, i))
165
+ continue;
166
+ const ip = i === 0 ? s - 1 : i - 1;
167
+ const iN = i + 1 === s ? 0 : i + 1;
168
+ const iPrevX = poly[ip * 2];
169
+ const iPrevY = poly[ip * 2 + 1];
170
+ const iCurX = poly[i * 2];
171
+ const iCurY = poly[i * 2 + 1];
172
+ const iNextX = poly[iN * 2];
173
+ const iNextY = poly[iN * 2 + 1];
174
+ let lowerDist = Number.MAX_VALUE;
175
+ let upperDist = Number.MAX_VALUE;
176
+ let lowerIntX = 0;
177
+ let lowerIntY = 0;
178
+ let upperIntX = 0;
179
+ let upperIntY = 0;
180
+ let lowerIndex = 0;
181
+ let upperIndex = 0;
182
+ for (let j = 0; j < s; j++) {
183
+ const jx = poly[j * 2];
184
+ const jy = poly[j * 2 + 1];
185
+ // Lower: edge (j-1, j) crossing the ray from i-1 through i. Read the
186
+ // (j-1) neighbour only once the cheaper j-side test has passed.
187
+ if (triArea(iPrevX, iPrevY, iCurX, iCurY, jx, jy) > 0) {
188
+ const jm = j === 0 ? s - 1 : j - 1;
189
+ const jmx = poly[jm * 2];
190
+ const jmy = poly[jm * 2 + 1];
191
+ if (triArea(iPrevX, iPrevY, iCurX, iCurY, jmx, jmy) <= 0) {
192
+ lineIntersection(_decompIsect, iPrevX, iPrevY, iCurX, iCurY, jx, jy, jmx, jmy);
193
+ const px = _decompIsect[0];
194
+ const py = _decompIsect[1];
195
+ if (triArea(iNextX, iNextY, iCurX, iCurY, px, py) < 0) {
196
+ const d = sqDist(iCurX, iCurY, px, py);
197
+ if (d < lowerDist) {
198
+ lowerDist = d;
199
+ lowerIntX = px;
200
+ lowerIntY = py;
201
+ lowerIndex = j;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ // Upper: edge (j, j+1) crossing the ray from i+1 through i. Read the
207
+ // (j+1) neighbour only once the cheaper j-side test has passed.
208
+ if (triArea(iNextX, iNextY, iCurX, iCurY, jx, jy) <= 0) {
209
+ const jp = j + 1 === s ? 0 : j + 1;
210
+ const jpx = poly[jp * 2];
211
+ const jpy = poly[jp * 2 + 1];
212
+ if (triArea(iNextX, iNextY, iCurX, iCurY, jpx, jpy) > 0) {
213
+ lineIntersection(_decompIsect, iNextX, iNextY, iCurX, iCurY, jx, jy, jpx, jpy);
214
+ const px = _decompIsect[0];
215
+ const py = _decompIsect[1];
216
+ if (triArea(iPrevX, iPrevY, iCurX, iCurY, px, py) > 0) {
217
+ const d = sqDist(iCurX, iCurY, px, py);
218
+ if (d < upperDist) {
219
+ upperDist = d;
220
+ upperIntX = px;
221
+ upperIntY = py;
222
+ upperIndex = j;
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ const lowerPoly = [];
229
+ const upperPoly = [];
230
+ if (lowerIndex === (upperIndex + 1) % s) {
231
+ // No vertex to connect to: add a Steiner point between the two intersections.
232
+ const px = (lowerIntX + upperIntX) / 2;
233
+ const py = (lowerIntY + upperIntY) / 2;
234
+ if (i < upperIndex) {
235
+ appendRange(lowerPoly, poly, i, upperIndex + 1);
236
+ lowerPoly.push(px, py);
237
+ upperPoly.push(px, py);
238
+ if (lowerIndex !== 0)
239
+ appendRange(upperPoly, poly, lowerIndex, s);
240
+ appendRange(upperPoly, poly, 0, i + 1);
241
+ }
242
+ else {
243
+ if (i !== 0)
244
+ appendRange(lowerPoly, poly, i, s);
245
+ appendRange(lowerPoly, poly, 0, upperIndex + 1);
246
+ lowerPoly.push(px, py);
247
+ upperPoly.push(px, py);
248
+ appendRange(upperPoly, poly, lowerIndex, i + 1);
249
+ }
250
+ }
251
+ else {
252
+ // Connect to the closest visible vertex within the cone.
253
+ if (lowerIndex > upperIndex)
254
+ upperIndex += s;
255
+ // Degenerate split: drop this sub-polygon.
256
+ if (upperIndex < lowerIndex) {
257
+ handled = true;
258
+ break;
259
+ }
260
+ let closestDist = Number.MAX_VALUE;
261
+ let closestIndex = 0;
262
+ for (let j = lowerIndex; j <= upperIndex; j++) {
263
+ const jj = j >= s ? j - s : j;
264
+ const jx = poly[jj * 2];
265
+ const jy = poly[jj * 2 + 1];
266
+ if (triArea(iPrevX, iPrevY, iCurX, iCurY, jx, jy) >= 0 &&
267
+ triArea(iNextX, iNextY, iCurX, iCurY, jx, jy) <= 0) {
268
+ const d = sqDist(iCurX, iCurY, jx, jy);
269
+ if (d < closestDist && canSeeSegment(poly, i, jj)) {
270
+ closestDist = d;
271
+ closestIndex = jj;
272
+ }
273
+ }
274
+ }
275
+ if (i < closestIndex) {
276
+ appendRange(lowerPoly, poly, i, closestIndex + 1);
277
+ if (closestIndex !== 0)
278
+ appendRange(upperPoly, poly, closestIndex, s);
279
+ appendRange(upperPoly, poly, 0, i + 1);
280
+ }
281
+ else {
282
+ if (i !== 0)
283
+ appendRange(lowerPoly, poly, i, s);
284
+ appendRange(lowerPoly, poly, 0, closestIndex + 1);
285
+ appendRange(upperPoly, poly, closestIndex, i + 1);
286
+ }
287
+ }
288
+ // Queue both sub-polygons, smaller first: push the larger, then the
289
+ // smaller, so the smaller is popped and processed next.
290
+ if (lowerPoly.length < upperPoly.length) {
291
+ stack.push(upperPoly, lowerPoly);
292
+ }
293
+ else {
294
+ stack.push(lowerPoly, upperPoly);
295
+ }
296
+ levels.push(level + 1, level + 1);
297
+ handled = true;
298
+ break;
299
+ }
300
+ if (!handled)
301
+ out.push(poly);
302
+ }
303
+ return out;
304
+ }
305
+ /** True if vertices `a` and `b` can see each other (visibility test, used by the quality decomposition). */
306
+ function canSeeVisibility(poly, a, b) {
307
+ const s = poly.length >> 1;
308
+ const ax = poly[a * 2];
309
+ const ay = poly[a * 2 + 1];
310
+ const bx = poly[b * 2];
311
+ const by = poly[b * 2 + 1];
312
+ const an = a + 1 === s ? 0 : a + 1;
313
+ const ap = a === 0 ? s - 1 : a - 1;
314
+ // Reject `b` if it lies outside the cone at vertex `a`.
315
+ if (triArea(poly[an * 2], poly[an * 2 + 1], ax, ay, bx, by) >= 0 &&
316
+ triArea(poly[ap * 2], poly[ap * 2 + 1], ax, ay, bx, by) <= 0) {
317
+ return false;
318
+ }
319
+ const dist = sqDist(ax, ay, bx, by);
320
+ for (let i = 0; i < s; i++) {
321
+ const i1 = i + 1 === s ? 0 : i + 1;
322
+ if (i1 === a || i === a)
323
+ continue;
324
+ const e0x = poly[i * 2];
325
+ const e0y = poly[i * 2 + 1];
326
+ const e1x = poly[i1 * 2];
327
+ const e1y = poly[i1 * 2 + 1];
328
+ if (triArea(ax, ay, bx, by, e1x, e1y) >= 0 && triArea(ax, ay, bx, by, e0x, e0y) <= 0) {
329
+ lineIntersection(_decompIsect, ax, ay, bx, by, e0x, e0y, e1x, e1y);
330
+ if (sqDist(ax, ay, _decompIsect[0], _decompIsect[1]) < dist) {
331
+ return false;
332
+ }
333
+ }
334
+ }
335
+ return true;
336
+ }
337
+ /** Finds the minimal set of cut edges (as [ax, ay, bx, by]) that convex-partition the polygon. */
338
+ function getCutEdges(poly) {
339
+ const s = poly.length >> 1;
340
+ let min = [];
341
+ let nDiags = Number.MAX_VALUE;
342
+ for (let i = 0; i < s; i++) {
343
+ if (!isReflex(poly, i))
344
+ continue;
345
+ for (let j = 0; j < s; j++) {
346
+ if (!canSeeVisibility(poly, i, j))
347
+ continue;
348
+ const tmp1 = getCutEdges(polygonCopy(poly, i, j));
349
+ const tmp2 = getCutEdges(polygonCopy(poly, j, i));
350
+ for (let k = 0; k < tmp2.length; k++)
351
+ tmp1.push(tmp2[k]);
352
+ if (tmp1.length < nDiags) {
353
+ min = tmp1;
354
+ nDiags = tmp1.length;
355
+ min.push([poly[i * 2], poly[i * 2 + 1], poly[j * 2], poly[j * 2 + 1]]);
356
+ }
357
+ }
358
+ }
359
+ return min;
360
+ }
361
+ /** Index of the vertex in `poly` with the exact coordinates (x, y), or -1. */
362
+ function indexOfVertex(poly, x, y) {
363
+ const s = poly.length >> 1;
364
+ for (let k = 0; k < s; k++) {
365
+ if (poly[k * 2] === x && poly[k * 2 + 1] === y)
366
+ return k;
367
+ }
368
+ return -1;
369
+ }
370
+ /** Splits `poly` along all `cutEdges`, returning the resulting pieces. */
371
+ function sliceByEdges(poly, cutEdges) {
372
+ if (cutEdges.length === 0)
373
+ return [poly];
374
+ const polys = [poly];
375
+ for (let e = 0; e < cutEdges.length; e++) {
376
+ const edge = cutEdges[e];
377
+ for (let p = 0; p < polys.length; p++) {
378
+ const sub = polys[p];
379
+ const i = indexOfVertex(sub, edge[0], edge[1]);
380
+ const j = indexOfVertex(sub, edge[2], edge[3]);
381
+ if (i !== -1 && j !== -1) {
382
+ polys.splice(p, 1);
383
+ polys.push(polygonCopy(sub, i, j), polygonCopy(sub, j, i));
384
+ break;
385
+ }
386
+ }
387
+ }
388
+ return polys;
389
+ }
390
+ /**
391
+ * Decomposes a simple polygon into the (near-)minimum number of convex
392
+ * sub-polygons. Produces fewer pieces than {@link decomposePolygon2Quick} but
393
+ * is much slower (~O(n⁴)) — use only for small polygons. Input winding is
394
+ * normalised internally, so either winding is accepted.
395
+ *
396
+ * @param vertices polygon vertices as a flat array `[x0, y0, x1, y1, ...]`
397
+ * @param n number of vertices to read from `vertices`
398
+ * @returns an array of convex sub-polygons, each a flat `[x0, y0, ...]` array (CCW)
399
+ */
400
+ function decomposePolygon2Quality(vertices, n) {
401
+ if (n < 3)
402
+ return [];
403
+ const poly = toCCW([], vertices, n);
404
+ const edges = getCutEdges(poly);
405
+ if (edges.length > 0)
406
+ return sliceByEdges(poly, edges);
407
+ return [poly];
408
+ }
409
+
410
+ export { decomposePolygon2Quality, decomposePolygon2Quick };
411
+ //# sourceMappingURL=polygon2-decompose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon2-decompose.js","sources":["../../src/geometry/polygon2-decompose.ts"],"sourcesContent":["import { isReflexVertex, reverse, signedArea } from '../shapes/polygon2';\n\n/*\n * Convex decomposition\n *\n * Splits a simple (non-self-intersecting) polygon into convex sub-polygons.\n * Polygons use the flat `[x0, y0, x1, y1, ...]` representation from math/shapes\n * (polygon2), with an explicit vertex count `n`.\n *\n * Ported to the flat representation from poly-decomp-es\n * (https://github.com/pmndrs/poly-decomp-es), MIT licensed, which itself is\n * based on Mark Bayazit's algorithm. Each returned sub-polygon is a fresh flat\n * `[x0, y0, ...]` array, wound counter-clockwise.\n */\n\nconst _decompIsect: [number, number] = [0, 0];\n\n/**\n * Twice the signed area of the triangle (a, b, c); positive when\n * counter-clockwise. This is the inlined, coordinate-form counterpart of\n * `triangle2.signedArea` — kept local (and undivided) to avoid Vec2 allocations\n * in the hot decomposition loops, where only the sign and relative magnitude\n * matter.\n */\nfunction triArea(ax: number, ay: number, bx: number, by: number, cx: number, cy: number): number {\n return (bx - ax) * (cy - ay) - (cx - ax) * (by - ay);\n}\n\n/** True if vertex `i` is reflex; delegates to the shared polygon2 primitive. */\nfunction isReflex(poly: number[], i: number): boolean {\n return isReflexVertex(poly, poly.length >> 1, i);\n}\n\nfunction sqDist(ax: number, ay: number, bx: number, by: number): number {\n const dx = bx - ax;\n const dy = by - ay;\n return dx * dx + dy * dy;\n}\n\n/** Intersection point of the two infinite lines (p1,p2) and (q1,q2); writes [0,0] if parallel. */\nfunction lineIntersection(\n out: [number, number],\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n q1x: number,\n q1y: number,\n q2x: number,\n q2y: number,\n): [number, number] {\n const a1 = p2y - p1y;\n const b1 = p1x - p2x;\n const c1 = a1 * p1x + b1 * p1y;\n const a2 = q2y - q1y;\n const b2 = q1x - q2x;\n const c2 = a2 * q1x + b2 * q1y;\n const det = a1 * b2 - a2 * b1;\n if (det !== 0) {\n out[0] = (b2 * c1 - b1 * c2) / det;\n out[1] = (a1 * c2 - a2 * c1) / det;\n } else {\n out[0] = 0;\n out[1] = 0;\n }\n return out;\n}\n\n/**\n * True if the closed segments (p1,p2) and (q1,q2) intersect. Inlined,\n * coordinate-form counterpart of `segment2.intersects`, kept local to avoid\n * Vec2 allocations in the visibility loops. Division-free: instead of computing\n * the parameters `u = numU/denom` and `v = numV/denom`, it normalises the sign\n * of `denom` and range-checks the numerators, which avoids two divisions per\n * call in the hot visibility loop.\n */\nfunction segmentsIntersect(\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n q1x: number,\n q1y: number,\n q2x: number,\n q2y: number,\n): boolean {\n const rx = p2x - p1x;\n const ry = p2y - p1y;\n const ex = q2x - q1x;\n const ey = q2y - q1y;\n\n let denom = rx * ey - ry * ex;\n if (denom === 0) return false; // parallel or collinear\n\n const wx = q1x - p1x;\n const wy = q1y - p1y;\n let numU = wx * ey - wy * ex; // u = numU / denom\n let numV = wx * ry - wy * rx; // v = numV / denom\n\n // Make denom positive so the [0,1] range test is a plain comparison.\n if (denom < 0) {\n denom = -denom;\n numU = -numU;\n numV = -numV;\n }\n\n return numU >= 0 && numU <= denom && numV >= 0 && numV <= denom;\n}\n\n/** Appends vertices `from..to-1` of `src` onto `dst` (both flat arrays). */\nfunction appendRange(dst: number[], src: number[], from: number, to: number): void {\n for (let k = from; k < to; k++) {\n dst.push(src[k * 2], src[k * 2 + 1]);\n }\n}\n\n/** Copies vertices `i..j` (cyclic) of `poly` into a new flat polygon. */\nfunction polygonCopy(poly: number[], i: number, j: number): number[] {\n const s = poly.length >> 1;\n const out: number[] = [];\n if (i < j) {\n for (let k = i; k <= j; k++) out.push(poly[k * 2], poly[k * 2 + 1]);\n } else {\n for (let k = 0; k <= j; k++) out.push(poly[k * 2], poly[k * 2 + 1]);\n for (let k = i; k < s; k++) out.push(poly[k * 2], poly[k * 2 + 1]);\n }\n return out;\n}\n\n/** Writes a CCW copy of the first `n` vertices of `vertices` into `out`, reversing if needed. */\nfunction toCCW(out: number[], vertices: number[], n: number): number[] {\n for (let k = 0; k < n * 2; k++) out[k] = vertices[k];\n if (signedArea(out, n) < 0) reverse(out, out, n);\n return out;\n}\n\nconst QUICK_DECOMP_MAX_LEVEL = 100;\n\n/** True if vertices `a` and `b` can see each other without any edge blocking (segment test). */\nfunction canSeeSegment(poly: number[], a: number, b: number): boolean {\n const s = poly.length >> 1;\n const ax = poly[a * 2];\n const ay = poly[a * 2 + 1];\n const bx = poly[b * 2];\n const by = poly[b * 2 + 1];\n\n for (let i = 0; i < s; i++) {\n const i1 = i + 1 === s ? 0 : i + 1;\n if (i === a || i === b || i1 === a || i1 === b) continue;\n if (segmentsIntersect(ax, ay, bx, by, poly[i * 2], poly[i * 2 + 1], poly[i1 * 2], poly[i1 * 2 + 1])) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Decomposes a simple polygon into convex sub-polygons using Bayazit's fast\n * approximate algorithm. Fast (~O(n²)) but may use more pieces than the\n * minimum; may introduce new (Steiner) vertices. Input winding is normalised\n * internally, so either winding is accepted.\n *\n * Implemented iteratively with an explicit worklist of sub-polygons rather than\n * recursion.\n *\n * @param vertices polygon vertices as a flat array `[x0, y0, x1, y1, ...]`\n * @param n number of vertices to read from `vertices`\n * @returns an array of convex sub-polygons, each a flat `[x0, y0, ...]` array (CCW)\n */\nexport function decomposePolygon2Quick(vertices: number[], n: number): number[][] {\n if (n < 3) return [];\n\n const out: number[][] = [];\n // Sub-polygons still to decompose, each paired with its depth in `levels`\n // (a runaway guard for pathological input). Both stacks stay in lockstep.\n const stack: number[][] = [toCCW([], vertices, n)];\n const levels: number[] = [0];\n\n while (stack.length > 0) {\n const poly = stack.pop() as number[];\n const level = levels.pop() as number;\n const s = poly.length >> 1;\n\n if (s < 3) continue;\n if (level > QUICK_DECOMP_MAX_LEVEL) {\n out.push(poly);\n continue;\n }\n\n // Find the first reflex vertex and split there; a poly with none is convex.\n let handled = false;\n for (let i = 0; i < s; i++) {\n if (!isReflexVertex(poly, s, i)) continue;\n\n const ip = i === 0 ? s - 1 : i - 1;\n const iN = i + 1 === s ? 0 : i + 1;\n const iPrevX = poly[ip * 2];\n const iPrevY = poly[ip * 2 + 1];\n const iCurX = poly[i * 2];\n const iCurY = poly[i * 2 + 1];\n const iNextX = poly[iN * 2];\n const iNextY = poly[iN * 2 + 1];\n\n let lowerDist = Number.MAX_VALUE;\n let upperDist = Number.MAX_VALUE;\n let lowerIntX = 0;\n let lowerIntY = 0;\n let upperIntX = 0;\n let upperIntY = 0;\n let lowerIndex = 0;\n let upperIndex = 0;\n\n for (let j = 0; j < s; j++) {\n const jx = poly[j * 2];\n const jy = poly[j * 2 + 1];\n\n // Lower: edge (j-1, j) crossing the ray from i-1 through i. Read the\n // (j-1) neighbour only once the cheaper j-side test has passed.\n if (triArea(iPrevX, iPrevY, iCurX, iCurY, jx, jy) > 0) {\n const jm = j === 0 ? s - 1 : j - 1;\n const jmx = poly[jm * 2];\n const jmy = poly[jm * 2 + 1];\n if (triArea(iPrevX, iPrevY, iCurX, iCurY, jmx, jmy) <= 0) {\n lineIntersection(_decompIsect, iPrevX, iPrevY, iCurX, iCurY, jx, jy, jmx, jmy);\n const px = _decompIsect[0];\n const py = _decompIsect[1];\n if (triArea(iNextX, iNextY, iCurX, iCurY, px, py) < 0) {\n const d = sqDist(iCurX, iCurY, px, py);\n if (d < lowerDist) {\n lowerDist = d;\n lowerIntX = px;\n lowerIntY = py;\n lowerIndex = j;\n }\n }\n }\n }\n\n // Upper: edge (j, j+1) crossing the ray from i+1 through i. Read the\n // (j+1) neighbour only once the cheaper j-side test has passed.\n if (triArea(iNextX, iNextY, iCurX, iCurY, jx, jy) <= 0) {\n const jp = j + 1 === s ? 0 : j + 1;\n const jpx = poly[jp * 2];\n const jpy = poly[jp * 2 + 1];\n if (triArea(iNextX, iNextY, iCurX, iCurY, jpx, jpy) > 0) {\n lineIntersection(_decompIsect, iNextX, iNextY, iCurX, iCurY, jx, jy, jpx, jpy);\n const px = _decompIsect[0];\n const py = _decompIsect[1];\n if (triArea(iPrevX, iPrevY, iCurX, iCurY, px, py) > 0) {\n const d = sqDist(iCurX, iCurY, px, py);\n if (d < upperDist) {\n upperDist = d;\n upperIntX = px;\n upperIntY = py;\n upperIndex = j;\n }\n }\n }\n }\n }\n\n const lowerPoly: number[] = [];\n const upperPoly: number[] = [];\n\n if (lowerIndex === (upperIndex + 1) % s) {\n // No vertex to connect to: add a Steiner point between the two intersections.\n const px = (lowerIntX + upperIntX) / 2;\n const py = (lowerIntY + upperIntY) / 2;\n\n if (i < upperIndex) {\n appendRange(lowerPoly, poly, i, upperIndex + 1);\n lowerPoly.push(px, py);\n upperPoly.push(px, py);\n if (lowerIndex !== 0) appendRange(upperPoly, poly, lowerIndex, s);\n appendRange(upperPoly, poly, 0, i + 1);\n } else {\n if (i !== 0) appendRange(lowerPoly, poly, i, s);\n appendRange(lowerPoly, poly, 0, upperIndex + 1);\n lowerPoly.push(px, py);\n upperPoly.push(px, py);\n appendRange(upperPoly, poly, lowerIndex, i + 1);\n }\n } else {\n // Connect to the closest visible vertex within the cone.\n if (lowerIndex > upperIndex) upperIndex += s;\n\n // Degenerate split: drop this sub-polygon.\n if (upperIndex < lowerIndex) {\n handled = true;\n break;\n }\n\n let closestDist = Number.MAX_VALUE;\n let closestIndex = 0;\n for (let j = lowerIndex; j <= upperIndex; j++) {\n const jj = j >= s ? j - s : j;\n const jx = poly[jj * 2];\n const jy = poly[jj * 2 + 1];\n if (\n triArea(iPrevX, iPrevY, iCurX, iCurY, jx, jy) >= 0 &&\n triArea(iNextX, iNextY, iCurX, iCurY, jx, jy) <= 0\n ) {\n const d = sqDist(iCurX, iCurY, jx, jy);\n if (d < closestDist && canSeeSegment(poly, i, jj)) {\n closestDist = d;\n closestIndex = jj;\n }\n }\n }\n\n if (i < closestIndex) {\n appendRange(lowerPoly, poly, i, closestIndex + 1);\n if (closestIndex !== 0) appendRange(upperPoly, poly, closestIndex, s);\n appendRange(upperPoly, poly, 0, i + 1);\n } else {\n if (i !== 0) appendRange(lowerPoly, poly, i, s);\n appendRange(lowerPoly, poly, 0, closestIndex + 1);\n appendRange(upperPoly, poly, closestIndex, i + 1);\n }\n }\n\n // Queue both sub-polygons, smaller first: push the larger, then the\n // smaller, so the smaller is popped and processed next.\n if (lowerPoly.length < upperPoly.length) {\n stack.push(upperPoly, lowerPoly);\n } else {\n stack.push(lowerPoly, upperPoly);\n }\n levels.push(level + 1, level + 1);\n handled = true;\n break;\n }\n\n if (!handled) out.push(poly);\n }\n\n return out;\n}\n\n/** True if vertices `a` and `b` can see each other (visibility test, used by the quality decomposition). */\nfunction canSeeVisibility(poly: number[], a: number, b: number): boolean {\n const s = poly.length >> 1;\n const ax = poly[a * 2];\n const ay = poly[a * 2 + 1];\n const bx = poly[b * 2];\n const by = poly[b * 2 + 1];\n\n const an = a + 1 === s ? 0 : a + 1;\n const ap = a === 0 ? s - 1 : a - 1;\n // Reject `b` if it lies outside the cone at vertex `a`.\n if (\n triArea(poly[an * 2], poly[an * 2 + 1], ax, ay, bx, by) >= 0 &&\n triArea(poly[ap * 2], poly[ap * 2 + 1], ax, ay, bx, by) <= 0\n ) {\n return false;\n }\n\n const dist = sqDist(ax, ay, bx, by);\n for (let i = 0; i < s; i++) {\n const i1 = i + 1 === s ? 0 : i + 1;\n if (i1 === a || i === a) continue;\n\n const e0x = poly[i * 2];\n const e0y = poly[i * 2 + 1];\n const e1x = poly[i1 * 2];\n const e1y = poly[i1 * 2 + 1];\n\n if (triArea(ax, ay, bx, by, e1x, e1y) >= 0 && triArea(ax, ay, bx, by, e0x, e0y) <= 0) {\n lineIntersection(_decompIsect, ax, ay, bx, by, e0x, e0y, e1x, e1y);\n if (sqDist(ax, ay, _decompIsect[0], _decompIsect[1]) < dist) {\n return false;\n }\n }\n }\n\n return true;\n}\n\n/** Finds the minimal set of cut edges (as [ax, ay, bx, by]) that convex-partition the polygon. */\nfunction getCutEdges(poly: number[]): number[][] {\n const s = poly.length >> 1;\n let min: number[][] = [];\n let nDiags = Number.MAX_VALUE;\n\n for (let i = 0; i < s; i++) {\n if (!isReflex(poly, i)) continue;\n for (let j = 0; j < s; j++) {\n if (!canSeeVisibility(poly, i, j)) continue;\n\n const tmp1 = getCutEdges(polygonCopy(poly, i, j));\n const tmp2 = getCutEdges(polygonCopy(poly, j, i));\n for (let k = 0; k < tmp2.length; k++) tmp1.push(tmp2[k]);\n\n if (tmp1.length < nDiags) {\n min = tmp1;\n nDiags = tmp1.length;\n min.push([poly[i * 2], poly[i * 2 + 1], poly[j * 2], poly[j * 2 + 1]]);\n }\n }\n }\n\n return min;\n}\n\n/** Index of the vertex in `poly` with the exact coordinates (x, y), or -1. */\nfunction indexOfVertex(poly: number[], x: number, y: number): number {\n const s = poly.length >> 1;\n for (let k = 0; k < s; k++) {\n if (poly[k * 2] === x && poly[k * 2 + 1] === y) return k;\n }\n return -1;\n}\n\n/** Splits `poly` along all `cutEdges`, returning the resulting pieces. */\nfunction sliceByEdges(poly: number[], cutEdges: number[][]): number[][] {\n if (cutEdges.length === 0) return [poly];\n\n const polys: number[][] = [poly];\n for (let e = 0; e < cutEdges.length; e++) {\n const edge = cutEdges[e];\n for (let p = 0; p < polys.length; p++) {\n const sub = polys[p];\n const i = indexOfVertex(sub, edge[0], edge[1]);\n const j = indexOfVertex(sub, edge[2], edge[3]);\n if (i !== -1 && j !== -1) {\n polys.splice(p, 1);\n polys.push(polygonCopy(sub, i, j), polygonCopy(sub, j, i));\n break;\n }\n }\n }\n\n return polys;\n}\n\n/**\n * Decomposes a simple polygon into the (near-)minimum number of convex\n * sub-polygons. Produces fewer pieces than {@link decomposePolygon2Quick} but\n * is much slower (~O(n⁴)) — use only for small polygons. Input winding is\n * normalised internally, so either winding is accepted.\n *\n * @param vertices polygon vertices as a flat array `[x0, y0, x1, y1, ...]`\n * @param n number of vertices to read from `vertices`\n * @returns an array of convex sub-polygons, each a flat `[x0, y0, ...]` array (CCW)\n */\nexport function decomposePolygon2Quality(vertices: number[], n: number): number[][] {\n if (n < 3) return [];\n const poly = toCCW([], vertices, n);\n const edges = getCutEdges(poly);\n if (edges.length > 0) return sliceByEdges(poly, edges);\n return [poly];\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;AAWG;AAEH,MAAM,YAAY,GAAqB,CAAC,CAAC,EAAE,CAAC,CAAC;AAE7C;;;;;;AAMG;AACH,SAAS,OAAO,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAA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