plotboilerplate 1.21.0 → 1.23.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 (325) hide show
  1. package/README.md +2 -0
  2. package/dist/index.esm.js +252 -77
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.esm.min.js +1 -1
  5. package/dist/index.esm.min.js.map +1 -1
  6. package/dist/plotboilerplate.browser.min.js +1 -1
  7. package/dist/plotboilerplate.browser.min.js.map +1 -1
  8. package/dist/plotboilerplate.js +522 -338
  9. package/dist/plotboilerplate.min.js +1 -1
  10. package/package.json +7 -5
  11. package/src/cjs/BezierPath.js.map +1 -1
  12. package/src/cjs/Bounds.js +1 -1
  13. package/src/cjs/Bounds.js.map +1 -1
  14. package/src/cjs/Circle.js.map +1 -1
  15. package/src/cjs/CircleSector.d.ts +64 -1
  16. package/src/cjs/CircleSector.js +121 -1
  17. package/src/cjs/CircleSector.js.map +1 -1
  18. package/src/cjs/CubicBezierCurve.js +2 -2
  19. package/src/cjs/CubicBezierCurve.js.map +1 -1
  20. package/src/cjs/Grid.js.map +1 -1
  21. package/src/cjs/KeyHandler.d.ts +1 -1
  22. package/src/cjs/KeyHandler.js +13 -13
  23. package/src/cjs/KeyHandler.js.map +1 -1
  24. package/src/cjs/Line.js +2 -0
  25. package/src/cjs/Line.js.map +1 -1
  26. package/src/cjs/MouseHandler.d.ts +2 -2
  27. package/src/cjs/MouseHandler.js +7 -5
  28. package/src/cjs/MouseHandler.js.map +1 -1
  29. package/src/cjs/PlotBoilerplate.d.ts +1 -1
  30. package/src/cjs/PlotBoilerplate.js +77 -63
  31. package/src/cjs/PlotBoilerplate.js.map +1 -1
  32. package/src/cjs/Polygon.d.ts +13 -1
  33. package/src/cjs/Polygon.js +30 -1
  34. package/src/cjs/Polygon.js.map +1 -1
  35. package/src/cjs/Triangle.js +1 -1
  36. package/src/cjs/Triangle.js.map +1 -1
  37. package/src/cjs/UIDGenerator.js +1 -1
  38. package/src/cjs/UIDGenerator.js.map +1 -1
  39. package/src/cjs/VEllipse.js.map +1 -1
  40. package/src/cjs/VEllipseSector.js +1 -1
  41. package/src/cjs/VEllipseSector.js.map +1 -1
  42. package/src/cjs/Vector.js +2 -0
  43. package/src/cjs/Vector.js.map +1 -1
  44. package/src/cjs/VertTuple.js.map +1 -1
  45. package/src/cjs/Vertex.d.ts +3 -2
  46. package/src/cjs/Vertex.js +13 -7
  47. package/src/cjs/Vertex.js.map +1 -1
  48. package/src/cjs/VertexAttr.d.ts +2 -1
  49. package/src/cjs/VertexAttr.js +2 -1
  50. package/src/cjs/VertexAttr.js.map +1 -1
  51. package/src/cjs/VertexListeners.d.ts +1 -1
  52. package/src/cjs/VertexListeners.js.map +1 -1
  53. package/src/cjs/draw.js +1 -1
  54. package/src/cjs/draw.js.map +1 -1
  55. package/src/cjs/drawgl.js.map +1 -1
  56. package/src/cjs/drawutilssvg.d.ts +17 -3
  57. package/src/cjs/drawutilssvg.js +97 -91
  58. package/src/cjs/drawutilssvg.js.map +1 -1
  59. package/src/cjs/geomutils.js +2 -2
  60. package/src/cjs/geomutils.js.map +1 -1
  61. package/src/cjs/index.js +5 -1
  62. package/src/cjs/index.js.map +1 -1
  63. package/src/cjs/interfaces/DrawLib.d.ts +2 -2
  64. package/src/cjs/interfaces/core.d.ts +3 -3
  65. package/src/cjs/interfaces/index.js +5 -1
  66. package/src/cjs/interfaces/index.js.map +1 -1
  67. package/src/cjs/utils/NGons.d.ts +13 -0
  68. package/src/cjs/utils/NGons.js +36 -0
  69. package/src/cjs/utils/NGons.js.map +1 -0
  70. package/src/cjs/utils/Params.d.ts +15 -0
  71. package/src/cjs/utils/Params.js +49 -0
  72. package/src/cjs/utils/Params.js.map +1 -0
  73. package/src/cjs/utils/WebColors.js.map +1 -1
  74. package/src/cjs/utils/WebColorsContrast.js +1 -1
  75. package/src/cjs/utils/WebColorsContrast.js.map +1 -1
  76. package/src/cjs/utils/algorithms/CatmullRomPath.js.map +1 -1
  77. package/src/cjs/utils/algorithms/CircleIntersections.d.ts +3 -2
  78. package/src/cjs/utils/algorithms/CircleIntersections.js +12 -20
  79. package/src/cjs/utils/algorithms/CircleIntersections.js.map +1 -1
  80. package/src/cjs/utils/algorithms/ContourLineDetection.d.ts +150 -0
  81. package/src/cjs/utils/algorithms/ContourLineDetection.js +367 -0
  82. package/src/cjs/utils/algorithms/ContourLineDetection.js.map +1 -0
  83. package/src/cjs/utils/algorithms/CubicSplinePath.js.map +1 -1
  84. package/src/cjs/utils/algorithms/HobbyPath.js.map +1 -1
  85. package/src/cjs/utils/algorithms/Metaballs.d.ts +30 -0
  86. package/src/cjs/utils/algorithms/Metaballs.js +114 -0
  87. package/src/cjs/utils/algorithms/Metaballs.js.map +1 -0
  88. package/src/cjs/utils/algorithms/arrayResize.d.ts +8 -0
  89. package/src/cjs/utils/algorithms/arrayResize.js +24 -0
  90. package/src/cjs/utils/algorithms/arrayResize.js.map +1 -0
  91. package/src/cjs/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  92. package/src/cjs/utils/algorithms/clearDuplicateVertices.js +48 -0
  93. package/src/cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  94. package/src/cjs/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -1
  95. package/src/cjs/utils/algorithms/convexHull.js.map +1 -1
  96. package/src/cjs/utils/algorithms/convexPolygonIncircle.js.map +1 -1
  97. package/src/cjs/utils/algorithms/delaunay.js.map +1 -1
  98. package/src/cjs/utils/algorithms/delaunay2voronoi.js.map +1 -1
  99. package/src/cjs/utils/algorithms/detectPaths.js.map +1 -1
  100. package/src/cjs/utils/algorithms/findPolygonSelfIntersections.js.map +1 -1
  101. package/src/cjs/utils/algorithms/matrixFill.js +1 -1
  102. package/src/cjs/utils/algorithms/matrixFill.js.map +1 -1
  103. package/src/cjs/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -1
  104. package/src/cjs/utils/algorithms/sutherlandHodgman.js.map +1 -1
  105. package/src/cjs/utils/cloneVertexArray.js.map +1 -1
  106. package/src/cjs/utils/creategui.js +20 -12
  107. package/src/cjs/utils/datastructures/CircularIntervalSet.js.map +1 -1
  108. package/src/cjs/utils/datastructures/Color.d.ts +2 -1
  109. package/src/cjs/utils/datastructures/Color.js +35 -16
  110. package/src/cjs/utils/datastructures/Color.js.map +1 -1
  111. package/src/cjs/utils/datastructures/DataGrid2d.d.ts +47 -0
  112. package/src/cjs/utils/datastructures/DataGrid2d.js +20 -0
  113. package/src/cjs/utils/datastructures/DataGrid2d.js.map +1 -0
  114. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  115. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +84 -0
  116. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  117. package/src/cjs/utils/datastructures/GenericPath.d.ts +14 -3
  118. package/src/cjs/utils/datastructures/GenericPath.js +20 -3
  119. package/src/cjs/utils/datastructures/GenericPath.js.map +1 -1
  120. package/src/cjs/utils/datastructures/Girih.d.ts +3 -2
  121. package/src/cjs/utils/datastructures/Girih.js +2 -1
  122. package/src/cjs/utils/datastructures/Girih.js.map +1 -1
  123. package/src/cjs/utils/datastructures/GirihBowtie.js +2 -0
  124. package/src/cjs/utils/datastructures/GirihBowtie.js.map +1 -1
  125. package/src/cjs/utils/datastructures/GirihDecagon.js +2 -0
  126. package/src/cjs/utils/datastructures/GirihDecagon.js.map +1 -1
  127. package/src/cjs/utils/datastructures/GirihHexagon.js +2 -0
  128. package/src/cjs/utils/datastructures/GirihHexagon.js.map +1 -1
  129. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js +3 -1
  130. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  131. package/src/cjs/utils/datastructures/GirihPentagon.js +2 -0
  132. package/src/cjs/utils/datastructures/GirihPentagon.js.map +1 -1
  133. package/src/cjs/utils/datastructures/GirihRhombus.js +2 -0
  134. package/src/cjs/utils/datastructures/GirihRhombus.js.map +1 -1
  135. package/src/cjs/utils/datastructures/GirihTile.js +4 -2
  136. package/src/cjs/utils/datastructures/GirihTile.js.map +1 -1
  137. package/src/cjs/utils/datastructures/Matrix4x4.js.map +1 -1
  138. package/src/cjs/utils/datastructures/VoronoiCell.js.map +1 -1
  139. package/src/cjs/utils/datastructures/interfaces.d.ts +3 -3
  140. package/src/cjs/utils/detectDarkMode.js.map +1 -1
  141. package/src/cjs/utils/dom/getAvailableContainerSpace.js +1 -1
  142. package/src/cjs/utils/dom/getAvailableContainerSpace.js.map +1 -1
  143. package/src/cjs/utils/findInVertexArray.js.map +1 -1
  144. package/src/cjs/utils/gup.d.ts +8 -0
  145. package/src/cjs/utils/gup.js +8 -0
  146. package/src/cjs/utils/gup.js.map +1 -1
  147. package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +6 -5
  148. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +3 -2
  149. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  150. package/src/cjs/utils/helpers/CircleHelper.d.ts +38 -3
  151. package/src/cjs/utils/helpers/CircleHelper.js +51 -11
  152. package/src/cjs/utils/helpers/CircleHelper.js.map +1 -1
  153. package/src/cjs/utils/helpers/CircleSectorHelper.d.ts +47 -1
  154. package/src/cjs/utils/helpers/CircleSectorHelper.js +85 -14
  155. package/src/cjs/utils/helpers/CircleSectorHelper.js.map +1 -1
  156. package/src/cjs/utils/io/FileDrop.d.ts +3 -3
  157. package/src/cjs/utils/io/FileDrop.js.map +1 -1
  158. package/src/cjs/utils/parsers/OBJParser.d.ts +2 -2
  159. package/src/cjs/utils/parsers/OBJParser.js.map +1 -1
  160. package/src/cjs/utils/parsers/STLParser.d.ts +4 -3
  161. package/src/cjs/utils/parsers/STLParser.js +62 -12
  162. package/src/cjs/utils/parsers/STLParser.js.map +1 -1
  163. package/src/cjs/utils/parsers/svg/parseSVGPathData.js +1 -1
  164. package/src/cjs/utils/parsers/svg/parseSVGPathData.js.map +1 -1
  165. package/src/cjs/utils/parsers/svg/splitSVGPathData.js.map +1 -1
  166. package/src/cjs/utils/parsers/svg/types.d.ts +13 -13
  167. package/src/createDemoDrawables.js +48 -3
  168. package/src/esm/BezierPath.js.map +1 -1
  169. package/src/esm/Bounds.js.map +1 -1
  170. package/src/esm/Circle.js.map +1 -1
  171. package/src/esm/CircleSector.d.ts +64 -1
  172. package/src/esm/CircleSector.js +121 -1
  173. package/src/esm/CircleSector.js.map +1 -1
  174. package/src/esm/CubicBezierCurve.js.map +1 -1
  175. package/src/esm/Grid.js.map +1 -1
  176. package/src/esm/KeyHandler.d.ts +1 -1
  177. package/src/esm/KeyHandler.js +13 -13
  178. package/src/esm/KeyHandler.js.map +1 -1
  179. package/src/esm/Line.js.map +1 -1
  180. package/src/esm/MouseHandler.d.ts +2 -2
  181. package/src/esm/MouseHandler.js +4 -4
  182. package/src/esm/MouseHandler.js.map +1 -1
  183. package/src/esm/PlotBoilerplate.d.ts +1 -1
  184. package/src/esm/PlotBoilerplate.js +43 -29
  185. package/src/esm/PlotBoilerplate.js.map +1 -1
  186. package/src/esm/Polygon.d.ts +13 -1
  187. package/src/esm/Polygon.js +30 -1
  188. package/src/esm/Polygon.js.map +1 -1
  189. package/src/esm/Triangle.js.map +1 -1
  190. package/src/esm/VEllipse.js.map +1 -1
  191. package/src/esm/VEllipseSector.js +1 -1
  192. package/src/esm/VEllipseSector.js.map +1 -1
  193. package/src/esm/Vector.js.map +1 -1
  194. package/src/esm/VertTuple.js.map +1 -1
  195. package/src/esm/Vertex.d.ts +3 -2
  196. package/src/esm/Vertex.js +9 -3
  197. package/src/esm/Vertex.js.map +1 -1
  198. package/src/esm/VertexAttr.d.ts +2 -1
  199. package/src/esm/VertexAttr.js +2 -1
  200. package/src/esm/VertexAttr.js.map +1 -1
  201. package/src/esm/VertexListeners.d.ts +1 -1
  202. package/src/esm/VertexListeners.js.map +1 -1
  203. package/src/esm/draw.js.map +1 -1
  204. package/src/esm/drawgl.js.map +1 -1
  205. package/src/esm/drawutilssvg.d.ts +17 -3
  206. package/src/esm/drawutilssvg.js +28 -22
  207. package/src/esm/drawutilssvg.js.map +1 -1
  208. package/src/esm/geomutils.js +2 -2
  209. package/src/esm/geomutils.js.map +1 -1
  210. package/src/esm/interfaces/DrawLib.d.ts +2 -2
  211. package/src/esm/interfaces/core.d.ts +3 -3
  212. package/src/esm/utils/NGons.d.ts +13 -0
  213. package/src/esm/utils/NGons.js +33 -0
  214. package/src/esm/utils/NGons.js.map +1 -0
  215. package/src/esm/utils/Params.d.ts +15 -0
  216. package/src/esm/utils/Params.js +44 -0
  217. package/src/esm/utils/Params.js.map +1 -0
  218. package/src/esm/utils/WebColors.js.map +1 -1
  219. package/src/esm/utils/algorithms/CatmullRomPath.js.map +1 -1
  220. package/src/esm/utils/algorithms/CircleIntersections.d.ts +3 -2
  221. package/src/esm/utils/algorithms/CircleIntersections.js +11 -19
  222. package/src/esm/utils/algorithms/CircleIntersections.js.map +1 -1
  223. package/src/esm/utils/algorithms/ContourLineDetection.d.ts +150 -0
  224. package/src/esm/utils/algorithms/ContourLineDetection.js +362 -0
  225. package/src/esm/utils/algorithms/ContourLineDetection.js.map +1 -0
  226. package/src/esm/utils/algorithms/CubicSplinePath.js.map +1 -1
  227. package/src/esm/utils/algorithms/HobbyPath.js.map +1 -1
  228. package/src/esm/utils/algorithms/Metaballs.d.ts +30 -0
  229. package/src/esm/utils/algorithms/Metaballs.js +109 -0
  230. package/src/esm/utils/algorithms/Metaballs.js.map +1 -0
  231. package/src/esm/utils/algorithms/arrayResize.d.ts +8 -0
  232. package/src/esm/utils/algorithms/arrayResize.js +20 -0
  233. package/src/esm/utils/algorithms/arrayResize.js.map +1 -0
  234. package/src/esm/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  235. package/src/esm/utils/algorithms/clearDuplicateVertices.js +44 -0
  236. package/src/esm/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  237. package/src/esm/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -1
  238. package/src/esm/utils/algorithms/convexHull.js.map +1 -1
  239. package/src/esm/utils/algorithms/convexPolygonIncircle.js.map +1 -1
  240. package/src/esm/utils/algorithms/delaunay.js.map +1 -1
  241. package/src/esm/utils/algorithms/delaunay2voronoi.js.map +1 -1
  242. package/src/esm/utils/algorithms/detectPaths.js.map +1 -1
  243. package/src/esm/utils/algorithms/findPolygonSelfIntersections.js.map +1 -1
  244. package/src/esm/utils/algorithms/matrixFill.js.map +1 -1
  245. package/src/esm/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -1
  246. package/src/esm/utils/algorithms/sutherlandHodgman.js.map +1 -1
  247. package/src/esm/utils/cloneVertexArray.js.map +1 -1
  248. package/src/esm/utils/datastructures/CircularIntervalSet.js.map +1 -1
  249. package/src/esm/utils/datastructures/Color.d.ts +2 -1
  250. package/src/esm/utils/datastructures/Color.js +33 -14
  251. package/src/esm/utils/datastructures/Color.js.map +1 -1
  252. package/src/esm/utils/datastructures/DataGrid2d.d.ts +47 -0
  253. package/src/esm/utils/datastructures/DataGrid2d.js +19 -0
  254. package/src/esm/utils/datastructures/DataGrid2d.js.map +1 -0
  255. package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  256. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +79 -0
  257. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  258. package/src/esm/utils/datastructures/GenericPath.d.ts +14 -3
  259. package/src/esm/utils/datastructures/GenericPath.js +20 -3
  260. package/src/esm/utils/datastructures/GenericPath.js.map +1 -1
  261. package/src/esm/utils/datastructures/Girih.d.ts +3 -2
  262. package/src/esm/utils/datastructures/Girih.js +2 -1
  263. package/src/esm/utils/datastructures/Girih.js.map +1 -1
  264. package/src/esm/utils/datastructures/GirihBowtie.js.map +1 -1
  265. package/src/esm/utils/datastructures/GirihDecagon.js.map +1 -1
  266. package/src/esm/utils/datastructures/GirihHexagon.js.map +1 -1
  267. package/src/esm/utils/datastructures/GirihPenroseRhombus.js +1 -1
  268. package/src/esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  269. package/src/esm/utils/datastructures/GirihPentagon.js.map +1 -1
  270. package/src/esm/utils/datastructures/GirihRhombus.js.map +1 -1
  271. package/src/esm/utils/datastructures/GirihTile.js.map +1 -1
  272. package/src/esm/utils/datastructures/Matrix4x4.js.map +1 -1
  273. package/src/esm/utils/datastructures/VoronoiCell.js.map +1 -1
  274. package/src/esm/utils/datastructures/interfaces.d.ts +3 -3
  275. package/src/esm/utils/detectDarkMode.js.map +1 -1
  276. package/src/esm/utils/findInVertexArray.js.map +1 -1
  277. package/src/esm/utils/gup.d.ts +8 -0
  278. package/src/esm/utils/gup.js +8 -0
  279. package/src/esm/utils/gup.js.map +1 -1
  280. package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +6 -5
  281. package/src/esm/utils/helpers/BezierPathInteractionHelper.js +3 -2
  282. package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  283. package/src/esm/utils/helpers/CircleHelper.d.ts +38 -3
  284. package/src/esm/utils/helpers/CircleHelper.js +51 -11
  285. package/src/esm/utils/helpers/CircleHelper.js.map +1 -1
  286. package/src/esm/utils/helpers/CircleSectorHelper.d.ts +47 -1
  287. package/src/esm/utils/helpers/CircleSectorHelper.js +85 -14
  288. package/src/esm/utils/helpers/CircleSectorHelper.js.map +1 -1
  289. package/src/esm/utils/io/FileDrop.d.ts +3 -3
  290. package/src/esm/utils/io/FileDrop.js.map +1 -1
  291. package/src/esm/utils/parsers/OBJParser.d.ts +2 -2
  292. package/src/esm/utils/parsers/OBJParser.js.map +1 -1
  293. package/src/esm/utils/parsers/STLParser.d.ts +4 -3
  294. package/src/esm/utils/parsers/STLParser.js +63 -13
  295. package/src/esm/utils/parsers/STLParser.js.map +1 -1
  296. package/src/esm/utils/parsers/svg/parseSVGPathData.js.map +1 -1
  297. package/src/esm/utils/parsers/svg/splitSVGPathData.js.map +1 -1
  298. package/src/esm/utils/parsers/svg/types.d.ts +13 -13
  299. package/src/index-gl.js +77 -85
  300. package/src/index.js +124 -129
  301. package/src/ts/CircleSector.ts +134 -3
  302. package/src/ts/PlotBoilerplate.ts +20 -11
  303. package/src/ts/Polygon.ts +31 -1
  304. package/src/ts/Vertex.ts +8 -3
  305. package/src/ts/VertexAttr.ts +3 -2
  306. package/src/ts/drawutilssvg.ts +38 -25
  307. package/src/ts/geomutils.ts +60 -64
  308. package/src/ts/interfaces/DrawLib.ts +0 -15
  309. package/src/ts/utils/NGons.ts +35 -0
  310. package/src/ts/utils/Params.ts +47 -0
  311. package/src/ts/utils/algorithms/CircleIntersections.ts +280 -288
  312. package/src/ts/utils/algorithms/ContourLineDetection.ts +485 -0
  313. package/src/ts/utils/algorithms/Metaballs.ts +144 -0
  314. package/src/ts/utils/algorithms/arrayResize.ts +22 -0
  315. package/src/ts/utils/algorithms/clearDuplicateVertices.ts +49 -0
  316. package/src/ts/utils/datastructures/Color.ts +39 -15
  317. package/src/ts/utils/datastructures/DataGrid2d.ts +54 -0
  318. package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +121 -0
  319. package/src/ts/utils/datastructures/GenericPath.ts +21 -3
  320. package/src/ts/utils/datastructures/Girih.ts +9 -8
  321. package/src/ts/utils/gup.ts +10 -2
  322. package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +9 -8
  323. package/src/ts/utils/helpers/CircleHelper.ts +70 -22
  324. package/src/ts/utils/helpers/CircleSectorHelper.ts +101 -17
  325. package/src/ts/utils/parsers/STLParser.ts +50 -16
@@ -2,7 +2,8 @@
2
2
  * @author Ikaros Kappler
3
3
  * @date 2020-10-05
4
4
  * @modified 2021-02-08 Fixed a lot of es2015 compatibility issues.
5
- * @version 1.0.1
5
+ * @modified 2024-02-23 Fixed some null-type conflicts.
6
+ * @version 1.0.2
6
7
  * @file CircleIntersections
7
8
  * @public
8
9
  **/
@@ -15,9 +16,8 @@ import { Line } from "../../Line";
15
16
  import { CircularIntervalSet } from "../datastructures/CircularIntervalSet";
16
17
  import { Interval, IndexPair, Matrix } from "../datastructures/interfaces";
17
18
 
18
-
19
19
  /**
20
- * @classdesc A script for finding the intersection points of two or
20
+ * @classdesc A script for finding the intersection points of two or
21
21
  * multiple circles (the 'radical lines').
22
22
  *
23
23
  * Based on the C++ implementation by Robert King
@@ -35,303 +35,295 @@ import { Interval, IndexPair, Matrix } from "../datastructures/interfaces";
35
35
  * @requires CirularIntervalSet
36
36
  */
37
37
  export class CircleIntersections {
38
+ /**
39
+ * Find all connected outer path partitions.
40
+ *
41
+ * @method findOuterPartitions
42
+ * @static
43
+ * @memberof CircleIntersections
44
+ * @param {Array<Circle>} circles - The circles to find intersections for.
45
+ * @param {Array<CircularIntervalSet>} intervalSets - The determined interval sets (see `findOuterCircleIntervals`).
46
+ * @return {Array<Array<IndexPair>>} An array of paths, each defined by a sequence of IndexPairs adressing circle i and interval j.
47
+ **/
48
+ static findOuterPartitions(circles: Array<Circle>, intervalSets: Array<CircularIntervalSet>): Array<Array<IndexPair>> {
49
+ // For tracking which interval we already used for detecting the partition
50
+ // we need a matrix; find the maximal interval length.
51
+ let maxSetLength: number = 0;
52
+ for (var i = 0; i < intervalSets.length; i++) {
53
+ maxSetLength = Math.max(maxSetLength, intervalSets[i].intervals.length);
54
+ }
55
+ const usedIntervals: Matrix<boolean> = matrixFill<boolean>(intervalSets.length, maxSetLength, false);
38
56
 
39
- /**
40
- * Find all connected outer path partitions.
41
- *
42
- * @method findOuterPartitions
43
- * @static
44
- * @memberof CircleIntersections
45
- * @param {Array<Circle>} circles - The circles to find intersections for.
46
- * @param {Array<CircularIntervalSet>} intervalSets - The determined interval sets (see `findOuterCircleIntervals`).
47
- * @return {Array<Array<IndexPair>>} An array of paths, each defined by a sequence of IndexPairs adressing circle i and interval j.
48
- **/
49
- static findOuterPartitions( circles:Array<Circle>,
50
- intervalSets:Array<CircularIntervalSet>
51
- ) : Array<Array<IndexPair>> {
52
-
53
- // For tracking which interval we already used for detecting the partition
54
- // we need a matrix; find the maximal interval length.
55
- let maxSetLength : number = 0;
56
- for( var i = 0; i < intervalSets.length; i++ ) {
57
- maxSetLength = Math.max( maxSetLength, intervalSets[i].intervals.length );
58
- }
59
- const usedIntervals : Matrix<boolean> = matrixFill<boolean>( intervalSets.length, maxSetLength, false );
60
-
61
- var path : Array<IndexPair>|null = null;
62
- var pathList : Array<Array<IndexPair>> = [];
63
- while( (path = CircleIntersections.findOuterPartition(circles,intervalSets,usedIntervals)) != null ) {
64
- pathList.push( path );
65
- }
57
+ var path: Array<IndexPair> | null = null;
58
+ var pathList: Array<Array<IndexPair>> = [];
59
+ while ((path = CircleIntersections.findOuterPartition(circles, intervalSets, usedIntervals)) != null) {
60
+ pathList.push(path);
61
+ }
66
62
 
67
- return pathList;
68
- };
63
+ return pathList;
64
+ }
69
65
 
70
- /**
71
- * Find all connected outer path partitions (as CircleSectors).
72
- *
73
- * @method findOuterPartitionsAsSectors
74
- * @static
75
- * @memberof CircleIntersections
76
- * @param {Array<Circle>} circles - The circles to find intersections for.
77
- * @param {Array<CircularIntervalSet>} intervalSets - The determined interval sets (see `findOuterCircleIntervals`).
78
- * @return {Array<Array<CircleSector>>} An array of paths, each defined by a sequence of SircleSectors.
79
- **/
80
- static findOuterPartitionsAsSectors( circles:Array<Circle>,
81
- intervalSets:Array<CircularIntervalSet>
82
- ) : Array<Array<CircleSector>> {
83
- const partitions : Array<Array<IndexPair>> = CircleIntersections.findOuterPartitions( circles, intervalSets );
66
+ /**
67
+ * Find all connected outer path partitions (as CircleSectors).
68
+ *
69
+ * @method findOuterPartitionsAsSectors
70
+ * @static
71
+ * @memberof CircleIntersections
72
+ * @param {Array<Circle>} circles - The circles to find intersections for.
73
+ * @param {Array<CircularIntervalSet>} intervalSets - The determined interval sets (see `findOuterCircleIntervals`).
74
+ * @return {Array<Array<CircleSector>>} An array of paths, each defined by a sequence of SircleSectors.
75
+ **/
76
+ static findOuterPartitionsAsSectors(
77
+ circles: Array<Circle>,
78
+ intervalSets: Array<CircularIntervalSet>
79
+ ): Array<Array<CircleSector>> {
80
+ const partitions: Array<Array<IndexPair>> = CircleIntersections.findOuterPartitions(circles, intervalSets);
84
81
 
85
- const partitionsAsArcs : Array<Array<CircleSector>> = [];
86
- for( var p = 0; p < partitions.length; p++ ) {
87
- const path : Array<IndexPair> = partitions[p];
88
- const pathAsArcs : Array<CircleSector> = [];
89
- for( var i = 0; i < path.length; i++ ) {
90
- const circleIndex : number = path[i].i;
91
- const circle : Circle = circles[ circleIndex ];
92
- var interval = intervalSets[ path[i].i ].intervals[ path[i].j ];
93
- // Params: circle, startAngle, endAngle
94
- pathAsArcs.push( new CircleSector( circle, interval[0], interval[1] ) );
95
- } // END for
96
- partitionsAsArcs.push( pathAsArcs );
97
- } // END for
98
- return partitionsAsArcs;
99
- };
100
-
101
- /**
102
- * Build the n*n intersection matrix: contains the radical line at (i,j) if circle i and circle j do intersect;
103
- * conatins null at (i,j) otherwise.
104
- *
105
- * Note that this matrix is symmetrical: if circles (i,j) intersect with line (A,B), then also circles (j,i) intersect
106
- * with line (B,A).
107
- *
108
- * The returned two-dimensional matrix (array) has exactly as many entries as the passed circle array.
109
- *
110
- * @method buildRadicalLineMatrix
111
- * @static
112
- * @memberof CircleIntersections
113
- * @param {Array<Circle>} circles - The circles to find intersections for.
114
- * @return {Array<Array<Line>>} A 2d-matrix containing the radical lines where circles intersect.
115
- **/
116
- static buildRadicalLineMatrix( circles:Array<Circle> ) : Matrix<Line> {
117
- var radicalLines:Array<Array<Line>> = [];
118
- for( var i = 0; i < circles.length; i++ ) {
119
- if( !radicalLines[i] )
120
- radicalLines[i] = arrayFill<Line>( circles.length, null ); // Array<Line>( circles.length );
121
- for( var j = 0; j < circles.length; j++ ) {
122
- if( i == j )
123
- continue;
124
- if( radicalLines[i][j] )
125
- continue;
126
- radicalLines[i][j] = circles[i].circleIntersection( circles[j] );
127
- // Build symmetrical matrix
128
- if( radicalLines[i][j] ) {
129
- if( !radicalLines[j] )
130
- radicalLines[j] = arrayFill<Line>( circles.length, null ); // Array<Line>( circles.length );
131
- // Use reverse line
132
- radicalLines[j][i] = new Line( radicalLines[i][j].b, radicalLines[i][j].a );
133
- }
134
- }
135
- }
136
- return radicalLines;
137
- };
82
+ const partitionsAsArcs: Array<Array<CircleSector>> = [];
83
+ for (var p = 0; p < partitions.length; p++) {
84
+ const path: Array<IndexPair> = partitions[p];
85
+ const pathAsArcs: Array<CircleSector> = [];
86
+ for (var i = 0; i < path.length; i++) {
87
+ const circleIndex: number = path[i].i;
88
+ const circle: Circle = circles[circleIndex];
89
+ var interval = intervalSets[path[i].i].intervals[path[i].j];
90
+ // Params: circle, startAngle, endAngle
91
+ pathAsArcs.push(new CircleSector(circle, interval[0], interval[1]));
92
+ } // END for
93
+ partitionsAsArcs.push(pathAsArcs);
94
+ } // END for
95
+ return partitionsAsArcs;
96
+ }
138
97
 
98
+ /**
99
+ * Build the n*n intersection matrix: contains the radical line at (i,j) if circle i and circle j do intersect;
100
+ * conatins null at (i,j) otherwise.
101
+ *
102
+ * Note that this matrix is symmetrical: if circles (i,j) intersect with line (A,B), then also circles (j,i) intersect
103
+ * with line (B,A).
104
+ *
105
+ * The returned two-dimensional matrix (array) has exactly as many entries as the passed circle array.
106
+ *
107
+ * @method buildRadicalLineMatrix
108
+ * @static
109
+ * @memberof CircleIntersections
110
+ * @param {Array<Circle>} circles - The circles to find intersections for.
111
+ * @return {Array<Array<Line>>} A 2d-matrix containing the radical lines where circles intersect.
112
+ **/
113
+ static buildRadicalLineMatrix(circles: Array<Circle>): Matrix<Line | null> {
114
+ var radicalLines: Array<Array<Line | null>> = [];
115
+ for (var i = 0; i < circles.length; i++) {
116
+ if (!radicalLines[i]) {
117
+ radicalLines[i] = arrayFill<Line | null>(circles.length, null);
118
+ }
119
+ for (var j = 0; j < circles.length; j++) {
120
+ if (i == j) continue;
121
+ if (radicalLines[i][j]) continue;
122
+ radicalLines[i][j] = circles[i].circleIntersection(circles[j]);
123
+ // Build symmetrical matrix
124
+ var tmpRadLine = radicalLines[i][j];
125
+ if (tmpRadLine) {
126
+ if (!radicalLines[j]) {
127
+ radicalLines[j] = arrayFill<Line | null>(circles.length, null);
128
+ }
129
+ // Use reverse line
130
+ radicalLines[j][i] = new Line(tmpRadLine.b, tmpRadLine.a);
131
+ }
132
+ }
133
+ }
134
+ return radicalLines;
135
+ }
139
136
 
140
- /**
141
- * Find all circles (indices) which are completely located inside another circle.
142
- *
143
- * The returned array conatins the array indices.
144
- *
145
- * @method findInnerCircles
146
- * @static
147
- * @memberof CircleIntersections
148
- * @param {Array<Circle>} circles - The circles to find intersections for.
149
- * @return {Array<number>}
150
- **/
151
- static findInnerCircles( circles : Array<Circle> ) : Array<number> {
152
- const innerCircleIndices : Array<number> = [];
153
- for( var i = 0; i < circles.length; i++ ) {
154
- for( var j = 0; j < circles.length; j++ ) {
155
- if( i == j )
156
- continue;
157
- if( circles[j].containsCircle(circles[i]) ) {
158
- innerCircleIndices.push( i );
159
- }
160
- }
161
- }
162
- return innerCircleIndices;
163
- };
137
+ /**
138
+ * Find all circles (indices) which are completely located inside another circle.
139
+ *
140
+ * The returned array conatins the array indices.
141
+ *
142
+ * @method findInnerCircles
143
+ * @static
144
+ * @memberof CircleIntersections
145
+ * @param {Array<Circle>} circles - The circles to find intersections for.
146
+ * @return {Array<number>}
147
+ **/
148
+ static findInnerCircles(circles: Array<Circle>): Array<number> {
149
+ const innerCircleIndices: Array<number> = [];
150
+ for (var i = 0; i < circles.length; i++) {
151
+ for (var j = 0; j < circles.length; j++) {
152
+ if (i == j) continue;
153
+ if (circles[j].containsCircle(circles[i])) {
154
+ innerCircleIndices.push(i);
155
+ }
156
+ }
157
+ }
158
+ return innerCircleIndices;
159
+ }
164
160
 
165
-
166
- /**
167
- * Calculate all outer circle intervals (sections that belong to the outermost line), dermined by the given
168
- * circles and their radical lines.
169
- *
170
- * The returned array contains IntervalSets - one for each circle - indicating the remaining circle sections.
171
- *
172
- * @method findOuterCircleIntervals
173
- * @static
174
- * @memberof CircleIntersections
175
- * @param {Array<Circle>} circles - The circles to find intersections for.
176
- * @param {Array<Line>} intersectionMatrix
177
- * @return {Array<number>}
178
- **/
179
- static findOuterCircleIntervals( circles:Array<Circle>, intersectionMatrix: Matrix<Line> ) : Array<CircularIntervalSet> {
180
- const intervalSets : Array<CircularIntervalSet> = [];
181
- for( var i = 0; i < circles.length; i++ ) {
182
- intervalSets[i] = new CircularIntervalSet( 0, 2*Math.PI );
183
- for( var j = 0; j < circles.length; j++ ) {
184
- if( i == j )
185
- continue;
186
- if( intersectionMatrix[i][j] !== null ) {
187
- // const interval : Interval = CircleIntersections.radicalLineToInterval( circle, radicalLine );
188
- CircleIntersections.handleCircleInterval( circles[i], intersectionMatrix[i][j], intervalSets[i] );
189
- } else if( circles[j].containsCircle(circles[i]) ) {
190
- intervalSets[i].clear();
191
- }
192
- }
193
- }
194
- return intervalSets;
195
- };
196
-
197
-
198
- /**
199
- * Calculate the next connected partition from the given set of circles and outer path intervals. The function
200
- * will pick a random unused circle interval and detect all adjacent intervals until a closed partition
201
- * was found.
202
- *
203
- * If an interval (circle section) was already visited will be stored in the `usedIntervalSetRecords` matrix (thus
204
- * is must be large enough to map all sections).
205
- *
206
- * The returned array contains IndexPairs (i,j) - one for each circle i - indicating the used circle section j.
207
- *
208
- * @method findOuterPartition
209
- * @static
210
- * @memberof CircleIntersections
211
- * @param {Array<Circle>} circles - The circles to find intersections for.
212
- * @param {Array<CircularIntervalSet>} intervalSets - The circle intervals that form the intersection outline.
213
- * @param {Matrix<boolean>} usedIntervals - A matrix for remembering which circle intervals were always used.
214
- * @return {Array<Indexpair>|null} The next partition or `null` if no more can be found.
215
- **/
216
- static findOuterPartition( circles:Array<Circle>,
217
- intervalSets:Array<CircularIntervalSet>,
218
- usedIntervals:Matrix<boolean>
219
- ) : Array<IndexPair>|null {
220
- let intLocation : IndexPair = CircleIntersections.randomUnusedInterval( intervalSets, usedIntervals );
221
- const path : Array<IndexPair> = [];
222
- while( intLocation != null ) {
223
- path.push( intLocation );
224
- usedIntervals[ intLocation.i ][ intLocation.j ] = true;
225
- intLocation = CircleIntersections.findAdjacentInterval( circles, intLocation, intervalSets, usedIntervals, 0.001 );
226
- };
227
- return path.length == 0 ? null : path;
228
- };
229
-
161
+ /**
162
+ * Calculate all outer circle intervals (sections that belong to the outermost line), dermined by the given
163
+ * circles and their radical lines.
164
+ *
165
+ * The returned array contains IntervalSets - one for each circle - indicating the remaining circle sections.
166
+ *
167
+ * @method findOuterCircleIntervals
168
+ * @static
169
+ * @memberof CircleIntersections
170
+ * @param {Array<Circle>} circles - The circles to find intersections for.
171
+ * @param {Array<Line>} intersectionMatrix
172
+ * @return {Array<number>}
173
+ **/
174
+ static findOuterCircleIntervals(circles: Array<Circle>, intersectionMatrix: Matrix<Line>): Array<CircularIntervalSet> {
175
+ const intervalSets: Array<CircularIntervalSet> = [];
176
+ for (var i = 0; i < circles.length; i++) {
177
+ intervalSets[i] = new CircularIntervalSet(0, 2 * Math.PI);
178
+ for (var j = 0; j < circles.length; j++) {
179
+ if (i == j) continue;
180
+ if (intersectionMatrix[i][j] !== null) {
181
+ // const interval : Interval = CircleIntersections.radicalLineToInterval( circle, radicalLine );
182
+ CircleIntersections.handleCircleInterval(circles[i], intersectionMatrix[i][j], intervalSets[i]);
183
+ } else if (circles[j].containsCircle(circles[i])) {
184
+ intervalSets[i].clear();
185
+ }
186
+ }
187
+ }
188
+ return intervalSets;
189
+ }
230
190
 
231
- /**
232
- * Convert a radical line (belonging to a circle) into an interval: start angle and end angle.
233
- *
234
- * @method radicalLineToInterval
235
- * @static
236
- * @private
237
- * @memberof CircleIntersections
238
- * @param {Circle} circle - The circle itself.
239
- * @param {Line} radicaLine - The radical line to convert (must have two intersection points on the circle).
240
- * @return {Interval} The interval `[startAngle,endAngle]` determined by the radical line.
241
- **/
242
- private static radicalLineToInterval( circle:Circle, radicalLine:Line ) : Interval {
243
- // Get angle sections in the circles
244
- const lineA : Line = new Line( circle.center, radicalLine.a );
245
- const lineB : Line = new Line( circle.center, radicalLine.b );
191
+ /**
192
+ * Calculate the next connected partition from the given set of circles and outer path intervals. The function
193
+ * will pick a random unused circle interval and detect all adjacent intervals until a closed partition
194
+ * was found.
195
+ *
196
+ * If an interval (circle section) was already visited will be stored in the `usedIntervalSetRecords` matrix (thus
197
+ * is must be large enough to map all sections).
198
+ *
199
+ * The returned array contains IndexPairs (i,j) - one for each circle i - indicating the used circle section j.
200
+ *
201
+ * @method findOuterPartition
202
+ * @static
203
+ * @memberof CircleIntersections
204
+ * @param {Array<Circle>} circles - The circles to find intersections for.
205
+ * @param {Array<CircularIntervalSet>} intervalSets - The circle intervals that form the intersection outline.
206
+ * @param {Matrix<boolean>} usedIntervals - A matrix for remembering which circle intervals were always used.
207
+ * @return {Array<Indexpair>|null} The next partition or `null` if no more can be found.
208
+ **/
209
+ static findOuterPartition(
210
+ circles: Array<Circle>,
211
+ intervalSets: Array<CircularIntervalSet>,
212
+ usedIntervals: Matrix<boolean>
213
+ ): Array<IndexPair> | null {
214
+ let intLocation: IndexPair | null = CircleIntersections.randomUnusedInterval(intervalSets, usedIntervals);
215
+ const path: Array<IndexPair> = [];
216
+ while (intLocation != null) {
217
+ path.push(intLocation);
218
+ usedIntervals[intLocation.i][intLocation.j] = true;
219
+ intLocation = CircleIntersections.findAdjacentInterval(circles, intLocation, intervalSets, usedIntervals, 0.001);
220
+ }
221
+ return path.length == 0 ? null : path;
222
+ }
246
223
 
247
- let angleA : number = lineA.angle();
248
- let angleB : number = lineB.angle();
224
+ /**
225
+ * Convert a radical line (belonging to a circle) into an interval: start angle and end angle.
226
+ *
227
+ * @method radicalLineToInterval
228
+ * @static
229
+ * @private
230
+ * @memberof CircleIntersections
231
+ * @param {Circle} circle - The circle itself.
232
+ * @param {Line} radicaLine - The radical line to convert (must have two intersection points on the circle).
233
+ * @return {Interval} The interval `[startAngle,endAngle]` determined by the radical line.
234
+ **/
235
+ private static radicalLineToInterval(circle: Circle, radicalLine: Line): Interval {
236
+ // Get angle sections in the circles
237
+ const lineA: Line = new Line(circle.center, radicalLine.a);
238
+ const lineB: Line = new Line(circle.center, radicalLine.b);
249
239
 
250
- // Map angles to [0 ... 2*PI]
251
- // (the angle() function might return negative angles in [-PI .. 0 .. PI])
252
- if( angleA < 0 ) angleA = Math.PI*2 + angleA;
253
- if( angleB < 0 ) angleB = Math.PI*2 + angleB;
240
+ let angleA: number = lineA.angle();
241
+ let angleB: number = lineB.angle();
254
242
 
255
- return [angleA, angleB];
256
- };
257
-
243
+ // Map angles to [0 ... 2*PI]
244
+ // (the angle() function might return negative angles in [-PI .. 0 .. PI])
245
+ if (angleA < 0) angleA = Math.PI * 2 + angleA;
246
+ if (angleB < 0) angleB = Math.PI * 2 + angleB;
258
247
 
259
- /**
260
- * This is a helper fuction used by `findOuterCircleIntervals`.
261
- *
262
- * It applies the passed radical line by intersecting the remaining circle sections with the new section.
263
- *
264
- * @method handleCircleInterval
265
- * @static
266
- * @private
267
- * @memberof CircleIntersections
268
- * @param {Circle} circle - The circles to find intersections for.
269
- * @param {Line} radicalLine - The radical line to apply.
270
- * @param {CircularIntervalSet} intervalSet - The CircularIntervalSet to use (must have left and right border: 0 and 2*PI).
271
- * @return {void}
272
- **/
273
- private static handleCircleInterval( circle : Circle, radicalLine : Line, intervalSet : CircularIntervalSet ) : void {
274
- const interval : Interval = CircleIntersections.radicalLineToInterval( circle, radicalLine );
275
- intervalSet.intersect( interval[1], interval[0] );
276
- };
277
-
248
+ return [angleA, angleB];
249
+ }
278
250
 
279
- /**
280
- * Pick a random unused circle interval. This function is used by the `findOuterPartition` function, which
281
- * starts the detection with any random section.
282
- *
283
- * @method randomUnusedInterval
284
- * @static
285
- * @private
286
- * @memberof CircleIntersections
287
- * @param {Array<CircularIntervalSet>} intervalSets - An array of all available interval sets/intervals.
288
- * @param {Matrix<boolean>} usedIntervals - A matrix indicating which intervals have already been used/visited by the algorithm
289
- * @return {IndexPair|null}
290
- **/
291
- private static randomUnusedInterval( intervalSets:Array<CircularIntervalSet>,
292
- usedIntervals:Matrix<boolean> ) : IndexPair|null {
293
- for( var i = 0; i < intervalSets.length; i++ ) {
294
- for( var j = 0; j < intervalSets[i].intervals.length; j++ ) {
295
- if( !usedIntervals[i][j] ) {
296
- return { i : i, j : j };
297
- }
298
- }
299
- }
300
- return null;
301
- };
251
+ /**
252
+ * This is a helper fuction used by `findOuterCircleIntervals`.
253
+ *
254
+ * It applies the passed radical line by intersecting the remaining circle sections with the new section.
255
+ *
256
+ * @method handleCircleInterval
257
+ * @static
258
+ * @private
259
+ * @memberof CircleIntersections
260
+ * @param {Circle} circle - The circles to find intersections for.
261
+ * @param {Line} radicalLine - The radical line to apply.
262
+ * @param {CircularIntervalSet} intervalSet - The CircularIntervalSet to use (must have left and right border: 0 and 2*PI).
263
+ * @return {void}
264
+ **/
265
+ private static handleCircleInterval(circle: Circle, radicalLine: Line, intervalSet: CircularIntervalSet): void {
266
+ const interval: Interval = CircleIntersections.radicalLineToInterval(circle, radicalLine);
267
+ intervalSet.intersect(interval[1], interval[0]);
268
+ }
302
269
 
270
+ /**
271
+ * Pick a random unused circle interval. This function is used by the `findOuterPartition` function, which
272
+ * starts the detection with any random section.
273
+ *
274
+ * @method randomUnusedInterval
275
+ * @static
276
+ * @private
277
+ * @memberof CircleIntersections
278
+ * @param {Array<CircularIntervalSet>} intervalSets - An array of all available interval sets/intervals.
279
+ * @param {Matrix<boolean>} usedIntervals - A matrix indicating which intervals have already been used/visited by the algorithm
280
+ * @return {IndexPair|null}
281
+ **/
282
+ private static randomUnusedInterval(
283
+ intervalSets: Array<CircularIntervalSet>,
284
+ usedIntervals: Matrix<boolean>
285
+ ): IndexPair | null {
286
+ for (var i = 0; i < intervalSets.length; i++) {
287
+ for (var j = 0; j < intervalSets[i].intervals.length; j++) {
288
+ if (!usedIntervals[i][j]) {
289
+ return { i: i, j: j };
290
+ }
291
+ }
292
+ }
293
+ return null;
294
+ }
303
295
 
304
- /**
305
- * Find the next adjacent circle interval for the given interval.
306
- * starts the detection with any random section.
307
- *
308
- * @method randomUnusedInterval
309
- * @static
310
- * @private
311
- * @memberof CircleIntersections
312
- * @param {Array<CircularIntervalSet>} intervalSets - An array of all available interval sets/intervals.
313
- * @param {Matrix<boolean>} usedIntervals - A matrix indicating which intervals have already been used/visited by the algorithm
314
- * @return {IndexPair|null}
315
- **/
316
- private static findAdjacentInterval( circles:Array<Circle>,
317
- intLocation:IndexPair,
318
- intervalSets:Array<CircularIntervalSet>,
319
- usedIntervalSetRecords:Matrix<boolean>,
320
- epsilon:number
321
- ) {
322
- var curInterval = intervalSets[ intLocation.i ].intervals[ intLocation.j ];
323
- var curEndPoint = circles[ intLocation.i ].vertAt( curInterval[1] );
324
- for( var i = 0; i < intervalSets.length; i++ ) {
325
- for( var j = 0; j < intervalSets[i].intervals.length; j++ ) {
326
- if( usedIntervalSetRecords[i][j] ) {
327
- continue;
328
- }
329
- var interval = intervalSets[i].intervals[j];
330
- var startPoint = circles[i].vertAt( interval[0] );
331
- if( curEndPoint.distance(startPoint) < epsilon )
332
- return { i : i, j : j };
333
- }
334
- }
335
- return null;
336
- };
337
- };
296
+ /**
297
+ * Find the next adjacent circle interval for the given interval.
298
+ * starts the detection with any random section.
299
+ *
300
+ * @method randomUnusedInterval
301
+ * @static
302
+ * @private
303
+ * @memberof CircleIntersections
304
+ * @param {Array<CircularIntervalSet>} intervalSets - An array of all available interval sets/intervals.
305
+ * @param {Matrix<boolean>} usedIntervals - A matrix indicating which intervals have already been used/visited by the algorithm
306
+ * @return {IndexPair|null}
307
+ **/
308
+ private static findAdjacentInterval(
309
+ circles: Array<Circle>,
310
+ intLocation: IndexPair,
311
+ intervalSets: Array<CircularIntervalSet>,
312
+ usedIntervalSetRecords: Matrix<boolean>,
313
+ epsilon: number
314
+ ) {
315
+ var curInterval = intervalSets[intLocation.i].intervals[intLocation.j];
316
+ var curEndPoint = circles[intLocation.i].vertAt(curInterval[1]);
317
+ for (var i = 0; i < intervalSets.length; i++) {
318
+ for (var j = 0; j < intervalSets[i].intervals.length; j++) {
319
+ if (usedIntervalSetRecords[i][j]) {
320
+ continue;
321
+ }
322
+ var interval = intervalSets[i].intervals[j];
323
+ var startPoint = circles[i].vertAt(interval[0]);
324
+ if (curEndPoint.distance(startPoint) < epsilon) return { i: i, j: j };
325
+ }
326
+ }
327
+ return null;
328
+ }
329
+ }