@itwin/core-geometry 4.4.0-dev.8 → 4.5.0-dev.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 (299) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Geometry.d.ts +17 -0
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +14 -0
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/core-geometry.d.ts +3 -2
  7. package/lib/cjs/core-geometry.d.ts.map +1 -1
  8. package/lib/cjs/core-geometry.js +3 -2
  9. package/lib/cjs/core-geometry.js.map +1 -1
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +2 -2
  11. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +3 -3
  12. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  13. package/lib/cjs/curve/CurveExtendMode.d.ts +7 -6
  14. package/lib/cjs/curve/CurveExtendMode.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurveExtendMode.js +7 -6
  16. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  17. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  18. package/lib/cjs/curve/CurveLocationDetail.js +23 -18
  19. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  20. package/lib/cjs/curve/LineSegment3d.d.ts +14 -4
  21. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  22. package/lib/cjs/curve/LineSegment3d.js +107 -2
  23. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  24. package/lib/cjs/curve/LineString3d.d.ts +41 -8
  25. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  26. package/lib/cjs/curve/LineString3d.js +53 -15
  27. package/lib/cjs/curve/LineString3d.js.map +1 -1
  28. package/lib/cjs/curve/Loop.js +1 -1
  29. package/lib/cjs/curve/Loop.js.map +1 -1
  30. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -2
  31. package/lib/cjs/curve/Query/PlanarSubdivision.js +2 -2
  32. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  33. package/lib/cjs/curve/RegionOps.d.ts +1 -2
  34. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  35. package/lib/cjs/curve/RegionOps.js.map +1 -1
  36. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +5 -8
  37. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  38. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +12 -12
  39. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  40. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +2 -2
  41. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  42. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  43. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  44. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +2 -3
  45. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  46. package/lib/cjs/geometry3d/GrowableXYZArray.js +1 -1
  47. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  48. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +18 -1
  49. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  50. package/lib/cjs/geometry3d/IndexedXYZCollection.js +13 -0
  51. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  52. package/lib/cjs/geometry3d/PointHelpers.d.ts +1 -2
  53. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  54. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  55. package/lib/cjs/geometry3d/PointStreaming.d.ts +1 -1
  56. package/lib/cjs/geometry3d/PointStreaming.d.ts.map +1 -1
  57. package/lib/cjs/geometry3d/PointStreaming.js +3 -1
  58. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  59. package/lib/cjs/geometry3d/PolygonOps.d.ts +68 -1
  60. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/PolygonOps.js +152 -4
  62. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  63. package/lib/cjs/geometry3d/PolylineOps.d.ts +23 -1
  64. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  65. package/lib/cjs/geometry3d/PolylineOps.js +73 -1
  66. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  67. package/lib/cjs/geometry3d/Range.d.ts +1 -1
  68. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  69. package/lib/cjs/geometry3d/Range.js.map +1 -1
  70. package/lib/cjs/geometry3d/Transform.js +1 -1
  71. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  72. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts +7 -5
  73. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  74. package/lib/cjs/geometry3d/YawPitchRollAngles.js +8 -6
  75. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  76. package/lib/cjs/numerics/Polynomials.d.ts +13 -1
  77. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  78. package/lib/cjs/numerics/Polynomials.js +13 -1
  79. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  80. package/lib/cjs/polyface/FacetLocationDetail.d.ts +28 -5
  81. package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -1
  82. package/lib/cjs/polyface/FacetLocationDetail.js +50 -15
  83. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  84. package/lib/cjs/polyface/Polyface.d.ts +1 -1
  85. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  86. package/lib/cjs/polyface/Polyface.js.map +1 -1
  87. package/lib/cjs/polyface/PolyfaceQuery.d.ts +7 -3
  88. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  89. package/lib/cjs/polyface/PolyfaceQuery.js +23 -0
  90. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  91. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.d.ts +52 -0
  92. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -0
  93. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js +78 -0
  94. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -0
  95. package/lib/cjs/polyface/RangeTree/MinimumValueTester.d.ts +60 -0
  96. package/lib/cjs/polyface/RangeTree/MinimumValueTester.d.ts.map +1 -0
  97. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js +96 -0
  98. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -0
  99. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +57 -0
  100. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -0
  101. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +73 -0
  102. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -0
  103. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +57 -0
  104. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -0
  105. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +84 -0
  106. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -0
  107. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +274 -0
  108. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -0
  109. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +505 -0
  110. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -0
  111. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +204 -0
  112. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -0
  113. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +383 -0
  114. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -0
  115. package/lib/cjs/serialization/GeometrySamples.d.ts +36 -3
  116. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  117. package/lib/cjs/serialization/GeometrySamples.js +93 -4
  118. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  119. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  120. package/lib/cjs/solid/LinearSweep.js +1 -1
  121. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  122. package/lib/cjs/solid/SweepContour.d.ts +2 -2
  123. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  124. package/lib/cjs/solid/SweepContour.js.map +1 -1
  125. package/lib/cjs/topology/Graph.d.ts +5 -6
  126. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  127. package/lib/cjs/topology/Graph.js +7 -6
  128. package/lib/cjs/topology/Graph.js.map +1 -1
  129. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +4 -4
  130. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +5 -5
  131. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  132. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +108 -71
  133. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  134. package/lib/cjs/topology/HalfEdgeGraphSearch.js +223 -109
  135. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  136. package/lib/cjs/topology/Merging.d.ts +1 -1
  137. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  138. package/lib/cjs/topology/Merging.js.map +1 -1
  139. package/lib/cjs/topology/SignedDataSummary.d.ts +13 -13
  140. package/lib/cjs/topology/SignedDataSummary.d.ts.map +1 -1
  141. package/lib/cjs/topology/SignedDataSummary.js +3 -3
  142. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  143. package/lib/cjs/topology/Triangulation.d.ts +1 -12
  144. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  145. package/lib/cjs/topology/Triangulation.js.map +1 -1
  146. package/lib/cjs/topology/XYParitySearchContext.d.ts +27 -21
  147. package/lib/cjs/topology/XYParitySearchContext.d.ts.map +1 -1
  148. package/lib/cjs/topology/XYParitySearchContext.js +73 -71
  149. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  150. package/lib/esm/Geometry.d.ts +17 -0
  151. package/lib/esm/Geometry.d.ts.map +1 -1
  152. package/lib/esm/Geometry.js +14 -0
  153. package/lib/esm/Geometry.js.map +1 -1
  154. package/lib/esm/core-geometry.d.ts +3 -2
  155. package/lib/esm/core-geometry.d.ts.map +1 -1
  156. package/lib/esm/core-geometry.js +3 -2
  157. package/lib/esm/core-geometry.js.map +1 -1
  158. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +2 -2
  159. package/lib/esm/curve/CurveChainWithDistanceIndex.js +3 -3
  160. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  161. package/lib/esm/curve/CurveExtendMode.d.ts +7 -6
  162. package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
  163. package/lib/esm/curve/CurveExtendMode.js +7 -6
  164. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  165. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  166. package/lib/esm/curve/CurveLocationDetail.js +23 -18
  167. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  168. package/lib/esm/curve/LineSegment3d.d.ts +14 -4
  169. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  170. package/lib/esm/curve/LineSegment3d.js +108 -3
  171. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  172. package/lib/esm/curve/LineString3d.d.ts +41 -8
  173. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  174. package/lib/esm/curve/LineString3d.js +53 -15
  175. package/lib/esm/curve/LineString3d.js.map +1 -1
  176. package/lib/esm/curve/Loop.js +1 -1
  177. package/lib/esm/curve/Loop.js.map +1 -1
  178. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -2
  179. package/lib/esm/curve/Query/PlanarSubdivision.js +2 -2
  180. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  181. package/lib/esm/curve/RegionOps.d.ts +1 -2
  182. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  183. package/lib/esm/curve/RegionOps.js +1 -1
  184. package/lib/esm/curve/RegionOps.js.map +1 -1
  185. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +5 -8
  186. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  187. package/lib/esm/curve/RegionOpsClassificationSweeps.js +12 -12
  188. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  189. package/lib/esm/geometry3d/GrowableXYArray.d.ts +2 -2
  190. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  191. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  192. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  193. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +2 -3
  194. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  195. package/lib/esm/geometry3d/GrowableXYZArray.js +1 -1
  196. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  197. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +18 -1
  198. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  199. package/lib/esm/geometry3d/IndexedXYZCollection.js +13 -0
  200. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  201. package/lib/esm/geometry3d/PointHelpers.d.ts +1 -2
  202. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  203. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  204. package/lib/esm/geometry3d/PointStreaming.d.ts +1 -1
  205. package/lib/esm/geometry3d/PointStreaming.d.ts.map +1 -1
  206. package/lib/esm/geometry3d/PointStreaming.js +3 -1
  207. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  208. package/lib/esm/geometry3d/PolygonOps.d.ts +68 -1
  209. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  210. package/lib/esm/geometry3d/PolygonOps.js +150 -3
  211. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  212. package/lib/esm/geometry3d/PolylineOps.d.ts +23 -1
  213. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  214. package/lib/esm/geometry3d/PolylineOps.js +73 -1
  215. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  216. package/lib/esm/geometry3d/Range.d.ts +1 -1
  217. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  218. package/lib/esm/geometry3d/Range.js.map +1 -1
  219. package/lib/esm/geometry3d/Transform.js +1 -1
  220. package/lib/esm/geometry3d/Transform.js.map +1 -1
  221. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts +7 -5
  222. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  223. package/lib/esm/geometry3d/YawPitchRollAngles.js +8 -6
  224. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  225. package/lib/esm/numerics/Polynomials.d.ts +13 -1
  226. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  227. package/lib/esm/numerics/Polynomials.js +13 -1
  228. package/lib/esm/numerics/Polynomials.js.map +1 -1
  229. package/lib/esm/polyface/FacetLocationDetail.d.ts +28 -5
  230. package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -1
  231. package/lib/esm/polyface/FacetLocationDetail.js +48 -14
  232. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  233. package/lib/esm/polyface/Polyface.d.ts +1 -1
  234. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  235. package/lib/esm/polyface/Polyface.js.map +1 -1
  236. package/lib/esm/polyface/PolyfaceQuery.d.ts +7 -3
  237. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  238. package/lib/esm/polyface/PolyfaceQuery.js +23 -0
  239. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  240. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.d.ts +52 -0
  241. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -0
  242. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js +74 -0
  243. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -0
  244. package/lib/esm/polyface/RangeTree/MinimumValueTester.d.ts +60 -0
  245. package/lib/esm/polyface/RangeTree/MinimumValueTester.d.ts.map +1 -0
  246. package/lib/esm/polyface/RangeTree/MinimumValueTester.js +92 -0
  247. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -0
  248. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +57 -0
  249. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -0
  250. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +69 -0
  251. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -0
  252. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +57 -0
  253. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -0
  254. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +80 -0
  255. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -0
  256. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +274 -0
  257. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -0
  258. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +497 -0
  259. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -0
  260. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +204 -0
  261. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -0
  262. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +374 -0
  263. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -0
  264. package/lib/esm/serialization/GeometrySamples.d.ts +36 -3
  265. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  266. package/lib/esm/serialization/GeometrySamples.js +93 -4
  267. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  268. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  269. package/lib/esm/solid/LinearSweep.js +1 -1
  270. package/lib/esm/solid/LinearSweep.js.map +1 -1
  271. package/lib/esm/solid/SweepContour.d.ts +2 -2
  272. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  273. package/lib/esm/solid/SweepContour.js.map +1 -1
  274. package/lib/esm/topology/Graph.d.ts +5 -6
  275. package/lib/esm/topology/Graph.d.ts.map +1 -1
  276. package/lib/esm/topology/Graph.js +7 -6
  277. package/lib/esm/topology/Graph.js.map +1 -1
  278. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +4 -4
  279. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +5 -5
  280. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  281. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +108 -71
  282. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  283. package/lib/esm/topology/HalfEdgeGraphSearch.js +223 -109
  284. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  285. package/lib/esm/topology/Merging.d.ts +1 -1
  286. package/lib/esm/topology/Merging.d.ts.map +1 -1
  287. package/lib/esm/topology/Merging.js.map +1 -1
  288. package/lib/esm/topology/SignedDataSummary.d.ts +13 -13
  289. package/lib/esm/topology/SignedDataSummary.d.ts.map +1 -1
  290. package/lib/esm/topology/SignedDataSummary.js +3 -3
  291. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  292. package/lib/esm/topology/Triangulation.d.ts +1 -12
  293. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  294. package/lib/esm/topology/Triangulation.js.map +1 -1
  295. package/lib/esm/topology/XYParitySearchContext.d.ts +27 -21
  296. package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
  297. package/lib/esm/topology/XYParitySearchContext.js +73 -71
  298. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  299. package/package.json +3 -3
@@ -0,0 +1,497 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module RangeSearch
7
+ */
8
+ import { assert } from "@itwin/core-bentley";
9
+ import { Range3d } from "../../geometry3d/Range";
10
+ /**
11
+ * Map an (unchecked) integer to a parameterized type T, where the data argument can be either:
12
+ * * an array of type T
13
+ * * a function which takes an index and returns type T
14
+ * @internal
15
+ */
16
+ function evaluateIndexToType(data, index) {
17
+ if (Array.isArray(data))
18
+ return data[index];
19
+ return data(index);
20
+ }
21
+ /**
22
+ * Get data by index from a source that may be undefined, an array of item of type T, or a singleton of the item type.
23
+ * @internal
24
+ */
25
+ function getByIndex(index, data) {
26
+ if (data !== undefined) {
27
+ if (Array.isArray(data)) {
28
+ if (index < data.length)
29
+ return data[index];
30
+ }
31
+ else {
32
+ return data;
33
+ }
34
+ }
35
+ return undefined;
36
+ }
37
+ /**
38
+ * Return the number of items in an object that can be undefined, an array of item of type T, or a singleton of the item type.
39
+ * @internal
40
+ */
41
+ function getFlexDataCount(data) {
42
+ if (data !== undefined) {
43
+ if (Array.isArray(data)) {
44
+ return data.length;
45
+ }
46
+ else {
47
+ return 1;
48
+ }
49
+ }
50
+ return 0;
51
+ }
52
+ /**
53
+ * Abstract class for handler objects called during traversal of a single range tree.
54
+ * @internal
55
+ */
56
+ export class SingleTreeSearchHandler {
57
+ /**
58
+ * Query to see if the active search has been aborted.
59
+ * * Default implementation returns false so query runs to completion.
60
+ * * Search processes check this after range tests and child processing.
61
+ */
62
+ // eslint-disable-next-line @itwin/prefer-get
63
+ isAborted() { return false; }
64
+ }
65
+ /**
66
+ * Abstract class for handler objects called during traversal of two range trees.
67
+ * @internal
68
+ */
69
+ export class TwoTreeSearchHandler {
70
+ /**
71
+ * Query to see if the active search has been aborted.
72
+ * * Default implementation returns false so query runs to completion.
73
+ * * Search processes check this after range tests and child processing.
74
+ */
75
+ // eslint-disable-next-line @itwin/prefer-get
76
+ isAborted() { return false; }
77
+ }
78
+ /**
79
+ * This class refines the TwoTreeSearchHandler with an implementation of `isRangePairActive` appropriate for computing the minimum distance between trees.
80
+ * * The concrete class must implement `getCurrentDistance()` method to provide the best-so-far distance.
81
+ * * The implementation of `isRangePairActive` returns true if the distance between ranges is less than or equal to the `getCurrentDistance()` value.
82
+ * @internal
83
+ */
84
+ export class TwoTreeDistanceMinimizationSearchHandler extends TwoTreeSearchHandler {
85
+ /**
86
+ * Method called to decide whether to process subtrees and immediate child appData items from a left tree node and right tree node.
87
+ * @param leftRange range from a node in the left tree
88
+ * @param rightRange range from a node in the right tree.
89
+ * @returns true if the smallest distance from leftRange to rightRange is less than or equal to getCurrentDistance()
90
+ */
91
+ isRangePairActive(leftRange, rightRange) {
92
+ const currentDistance = this.getCurrentDistance();
93
+ const distanceBetweenRanges = leftRange.distanceToRange(rightRange);
94
+ if (distanceBetweenRanges <= currentDistance) {
95
+ return true;
96
+ }
97
+ return false;
98
+ }
99
+ }
100
+ let numNodeCreated = 0;
101
+ /**
102
+ * * TREE STRUCTURE
103
+ * * A RangeTreeNode is part of a range tree.
104
+ * * TREE is used here in a strictly _structural_ sense, which has no broad promises about data members.
105
+ * * Each RangeNode points to 0, 1 or many children.
106
+ * * Each child has (but does not point back to) a single parent.
107
+ * * The overall tree has a single root.
108
+ * * Each node is effectively the root of the tree of its children.
109
+ * * NON-TREE DATA MEMBERS
110
+ * * Data members in each node (in addition to children) are
111
+ * * _range = the union of ranges below in the heap
112
+ * * _appData = application data associated with the node.
113
+ * * Construction methods may place multiple _appData items in each node.
114
+ * * In common use, only the leaves will have _appData. However, the class definitions allow _appData at all nodes, and search algorithms must include them.
115
+ * * CONSTRUCTION
116
+ * * The RangeTreeNode.createByIndexSplits method constructs the tree with simple right-left splits within an array of input items.
117
+ * * The appData is placed entirely in the leaves.
118
+ * * caller can specify:
119
+ * * the number of _appData items per leaf
120
+ * * the number of children per node within the tree.
121
+ * * "deep" trees (2 children per node and one appData per leaf) may have (compared to shallow trees with many children per node and many appData per leaf)
122
+ * * faster search because lower nodes have smaller ranges that will be skipped by search algorithms.
123
+ * * larger memory use because of more nodes
124
+ * * For future construction methods:
125
+ * * _appData "above the leaves" may allow nodes below to have smaller ranges, but add complexity to search.
126
+ * @internal
127
+ */
128
+ export class RangeTreeNode {
129
+ /**
130
+ * CONSTRUCTOR
131
+ * CAPTURE (not copy)
132
+ * * range = range for search algorithms
133
+ * * appData = application data relevant to this node.
134
+ * * children = child node reference(s).
135
+ */
136
+ constructor(range, appData, children) {
137
+ this._range = range;
138
+ this._appData = appData;
139
+ this._children = children;
140
+ this._id = numNodeCreated++;
141
+ // const childIds: number[] = [];
142
+ // if (Array.isArray(this._children))
143
+ // for (const c of this._children) childIds.push(c._id);
144
+ // else if (this._children instanceof RangeTreeNode)
145
+ // childIds.push(this._children._id);
146
+ // const numAppData = getFlexDataCount(appData);
147
+ // console.log({ id: this._id, childIds, numAppData });
148
+ }
149
+ /** Simplest public create: capture the range, appData, and children. */
150
+ static createCapture(range, appData, children) {
151
+ return new RangeTreeNode(range, appData, children);
152
+ }
153
+ /** copy (not capture) from given data into the range in this RangeEntry */
154
+ setRange(data) {
155
+ this._range.setFrom(data);
156
+ }
157
+ /** return (a copy of) the range in this RangeEntry */
158
+ getRange(data) {
159
+ return this._range.clone(data);
160
+ }
161
+ /** return (a reference to) the range in this RangeEntry */
162
+ getRangeRef() {
163
+ return this._range;
164
+ }
165
+ /**
166
+ * Access a child by index.
167
+ * * If the child data is an array, this dereferences the array.
168
+ * * If the child data is a singleton, treat it as index 0.
169
+ * * return undefined if there are no children.
170
+ * @param index index of item to access.
171
+ */
172
+ getChildByIndex(index) {
173
+ return getByIndex(index, this._children);
174
+ }
175
+ /**
176
+ * * Access an appData by index.
177
+ * * If the appData data is an array, this dereferences the array.
178
+ * * If the appData data is a singleton, treat it as if it is at index 0 in an array
179
+ * * return undefined if there are no appData or for any index out of range.
180
+ * @param index index of item to access.
181
+ */
182
+ getAppDataByIndex(index) {
183
+ return getByIndex(index, this._appData);
184
+ }
185
+ /** Access the children or child (does not clone). */
186
+ getAllChildren() {
187
+ return this._children;
188
+ }
189
+ /** Access the appData array or singleton (does not clone). */
190
+ getAllAppData() {
191
+ return this._appData;
192
+ }
193
+ /**
194
+ * Count the direct children in this node of the tree.
195
+ * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveNodeCount`.
196
+ */
197
+ getNumChildren() {
198
+ return getFlexDataCount(this._children);
199
+ }
200
+ /**
201
+ * Count the appData items in this node of the tree.
202
+ * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveAppDataCount`.
203
+ */
204
+ getNumAppData() {
205
+ return getFlexDataCount(this._appData);
206
+ }
207
+ /**
208
+ * Depth-first tree iteration, calling `announceNode` on each node.
209
+ * @param announceNode callback that returns true to recurse into children
210
+ */
211
+ recurseIntoTree(announceNode) {
212
+ const doChildren = announceNode(this);
213
+ if (doChildren) {
214
+ if (Array.isArray(this._children)) {
215
+ for (const child of this._children)
216
+ child.recurseIntoTree(announceNode);
217
+ }
218
+ else if (this._children !== undefined) {
219
+ this._children.recurseIntoTree(announceNode);
220
+ }
221
+ }
222
+ }
223
+ /**
224
+ * Depth-first tree iteration via handler.
225
+ * * if handler decides the instance range is active, process appData, then recurse on children
226
+ * * if handler decides to abort after processing an appData, skip processing rest of appData and children
227
+ */
228
+ searchTopDown(handler) {
229
+ if (handler.isRangeActive(this._range)) {
230
+ let itemToProcess;
231
+ for (let i = 0; undefined !== (itemToProcess = this.getAppDataByIndex(i)); i++) {
232
+ // console.log(itemToProcess);
233
+ handler.processAppData(itemToProcess);
234
+ if (handler.isAborted())
235
+ return;
236
+ }
237
+ let child;
238
+ for (let i = 0; undefined !== (child = this.getChildByIndex(i)); i++) {
239
+ child.searchTopDown(handler);
240
+ }
241
+ }
242
+ }
243
+ /**
244
+ * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightStack.
245
+ * @param leftAppData singleton or array with data "from left"
246
+ * @param rightStack stack of nodes to process from right path.
247
+ * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.
248
+ * @param handler search handler
249
+ */
250
+ static processAppDataAndAppDataStack(leftAppData, rightStack, reverseArgs, handler) {
251
+ if (leftAppData !== undefined) {
252
+ let leftItem;
253
+ let rightItem;
254
+ // hmm.. we ASSUME that if the tip ranges passed, then all parent ranges would pass without further test.
255
+ for (let rangeIndex = rightStack.length; rangeIndex-- > 0;) {
256
+ const rightAppData = rightStack[rangeIndex]._appData;
257
+ for (let rightIndex = 0; undefined !== (rightItem = getByIndex(rightIndex, rightAppData)); rightIndex++) {
258
+ for (let leftIndex = 0; undefined !== (leftItem = getByIndex(leftIndex, leftAppData)); leftIndex++) {
259
+ if (!reverseArgs)
260
+ handler.processAppDataPair(leftItem, rightItem);
261
+ else
262
+ handler.processAppDataPair(rightItem, leftItem);
263
+ if (handler.isAborted())
264
+ return;
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
270
+ /**
271
+ * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightAppData.
272
+ * @param leftAppData singleton or array with data "from left"
273
+ * @param rightAppData singleton or array with data "from right"
274
+ * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.
275
+ * @param handler search handler
276
+ */
277
+ static processAppDataAndAppData(leftAppData, rightAppData, reverseArgs, handler) {
278
+ if (leftAppData !== undefined && rightAppData !== undefined) {
279
+ let leftItem;
280
+ let rightItem;
281
+ for (let rightIndex = 0; undefined !== (rightItem = getByIndex(rightIndex, rightAppData)); rightIndex++) {
282
+ for (let leftIndex = 0; undefined !== (leftItem = getByIndex(leftIndex, leftAppData)); leftIndex++) {
283
+ if (!reverseArgs)
284
+ handler.processAppDataPair(leftItem, rightItem);
285
+ else
286
+ handler.processAppDataPair(rightItem, leftItem);
287
+ if (handler.isAborted())
288
+ return;
289
+ }
290
+ }
291
+ }
292
+ }
293
+ /**
294
+ * Push the tip node to stack(s).
295
+ * @param tip new node (to be pushed)
296
+ * @param fullPath complete path, which is always extended
297
+ * @param partialPath partial path, which is only extended if the tip has _appData.
298
+ */
299
+ static pushPaths(tip, fullPath, partialPath) {
300
+ fullPath.push(tip);
301
+ if (tip._appData !== undefined) {
302
+ partialPath.push(tip);
303
+ }
304
+ }
305
+ /**
306
+ * Pop the tip node from stack(s).
307
+ * @param tip should match the fullPath tip.
308
+ * @param fullPath complete path, which is always popped
309
+ * @param partialPath partial path, which is only popped if the tip has _appData.
310
+ */
311
+ static popPaths(tip, fullPath, partialPath) {
312
+ assert(fullPath[fullPath.length - 1] === tip);
313
+ fullPath.pop();
314
+ if (tip._appData !== undefined) {
315
+ partialPath.pop();
316
+ }
317
+ }
318
+ /**
319
+ * Process nodes from left and right trees of dual search.
320
+ * * The separate stacks for nodes that have appData is for efficiency.
321
+ * * If data is entirely in the leaves (or just in a few nodes), the stacks will all be empty (or very small) and no time will be wasted looking up the stacks for appData to process with the other tip.
322
+ * @param leftTip tip node being explored on left
323
+ * @param leftStack stack of prior left nodes
324
+ * @param leftStackWithAppData stack of prior left nodes which have appData.
325
+ * @param rightTip tip node being explored on right.
326
+ * @param rightStack stack of prior right nodes.
327
+ * @param rightStackWithAppData stack of prior right nodes which have appData.
328
+ * @param handler search handler
329
+ */
330
+ static recursivePairSearch(leftTip, leftStack, leftStackWithAppData, rightTip, rightStack, rightStackWithAppData, handler) {
331
+ // console.log({ leftId: leftTip._id, rightId: rightTip._id });
332
+ const leftTipHasAppData = leftTip._appData !== undefined;
333
+ const rightTipHasAppData = rightTip._appData !== undefined;
334
+ let leftChild;
335
+ let rightChild;
336
+ // process immediate appData from each tip node with the entire prior path of the other side (each stack currently lacks the tip).
337
+ if (leftTipHasAppData && rightStackWithAppData.length > 0) {
338
+ this.processAppDataAndAppDataStack(leftTip._appData, rightStackWithAppData, false, handler);
339
+ }
340
+ if (leftStackWithAppData.length > 0 && rightTipHasAppData) {
341
+ this.processAppDataAndAppDataStack(rightTip._appData, leftStackWithAppData, true, handler);
342
+ }
343
+ if (handler.isRangePairActive(leftTip._range, rightTip._range)) {
344
+ this.processAppDataAndAppData(leftTip._appData, rightTip._appData, false, handler);
345
+ if (leftTip._children !== undefined && rightTip._children !== undefined) {
346
+ this.pushPaths(leftTip, leftStack, leftStackWithAppData);
347
+ this.pushPaths(rightTip, rightStack, rightStackWithAppData);
348
+ for (let leftIndex = 0; undefined !== (leftChild = getByIndex(leftIndex, leftTip._children)); leftIndex++) {
349
+ for (let rightIndex = 0; undefined !== (rightChild = getByIndex(rightIndex, rightTip._children)); rightIndex++) {
350
+ this.recursivePairSearch(leftChild, leftStack, leftStackWithAppData, rightChild, rightStack, rightStackWithAppData, handler);
351
+ }
352
+ }
353
+ this.popPaths(leftTip, leftStack, leftStackWithAppData);
354
+ this.popPaths(rightTip, rightStack, rightStackWithAppData);
355
+ }
356
+ else if (leftTip._children !== undefined) {
357
+ this.leftRecursivePairSearch(leftTip, rightTip, rightStackWithAppData, false, handler);
358
+ }
359
+ else if (rightTip._children !== undefined) {
360
+ this.leftRecursivePairSearch(rightTip, leftTip, leftStackWithAppData, true, handler);
361
+ }
362
+ }
363
+ }
364
+ /**
365
+ * Recurse below the tip of leftTip, offering each level's appData to the appData of rightTip and rightStackWithAppData.
366
+ * @param leftTip tip node being explored on left. Its appData is not processed.
367
+ * @param rightTip tip node being explored on right. It has no children.
368
+ * @param rightStackWithAppData stack of prior right nodes which have appData.
369
+ * @param reverseArgs true if the caller is exchanging the sense of left and right
370
+ * @param handler search handler
371
+ */
372
+ static leftRecursivePairSearch(leftTip, rightTip, rightStackWithAppData, reverseArgs, handler) {
373
+ assert(rightTip._children === undefined);
374
+ // The (possibly deep) left children appData needs to be offered to the right path (including tip)
375
+ // Note that there are no stack push/pop operations -- the right stack is already reaching to leaf level, so there are no range or appData nodes to add.
376
+ let leftChild;
377
+ for (let leftIndex = 0; undefined !== (leftChild = getByIndex(leftIndex, leftTip._children)); leftIndex++) {
378
+ if (handler.isRangePairActive(leftChild._range, rightTip._range)) {
379
+ this.processAppDataAndAppData(leftChild._appData, rightTip._appData, reverseArgs, handler);
380
+ this.processAppDataAndAppDataStack(leftChild._appData, rightStackWithAppData, reverseArgs, handler);
381
+ this.leftRecursivePairSearch(leftChild, rightTip, rightStackWithAppData, reverseArgs, handler);
382
+ }
383
+ }
384
+ }
385
+ /**
386
+ * Recursive search down two trees, with range tests and child processing under control of a handler.
387
+ * @param leftRoot root of left tree
388
+ * @param rightRoot root of right tree
389
+ * @param handler handler for range tests and child process
390
+ */
391
+ static searchTwoTreesTopDown(leftRoot, rightRoot, handler) {
392
+ this.recursivePairSearch(leftRoot, [], [], rightRoot, [], [], handler);
393
+ }
394
+ }
395
+ /**
396
+ * Utilities for various operations on RangeTree
397
+ * @internal
398
+ */
399
+ export class RangeTreeOps {
400
+ /** Count nodes in this tree. */
401
+ static getRecursiveNodeCount(root) {
402
+ let count = 0;
403
+ root.recurseIntoTree((_node) => { count++; return true; });
404
+ return count;
405
+ }
406
+ /** Count appData in this tree. */
407
+ static getRecursiveAppDataCount(root) {
408
+ let count = 0;
409
+ root.recurseIntoTree((node) => { count += node.getNumAppData(); return true; });
410
+ return count;
411
+ }
412
+ /**
413
+ * Create a leaf referencing appData items indexed index0<=index<index1 and with combined range of the same indices
414
+ * @param ranges access to ranges
415
+ * @param appData access to AppDataType items
416
+ * @param index0 first index for block of items
417
+ * @param index1 upper limit index for block of items.
418
+ * @param arrayLength one more than the largest range/appData index
419
+ * @returns newly created node.
420
+ */
421
+ static createLeafInIndexRange(ranges, appData, index0, index1, arrayLength) {
422
+ const appDataBlock = [];
423
+ const range = Range3d.createNull();
424
+ index1 = Math.min(index1, arrayLength);
425
+ // console.log({ case: "LEAF", index0, index1 });
426
+ for (let i = index0; i < index1; i++) {
427
+ appDataBlock.push(evaluateIndexToType(appData, i));
428
+ range.extendRange(evaluateIndexToType(ranges, i));
429
+ }
430
+ return RangeTreeNode.createCapture(range, appDataBlock, undefined);
431
+ }
432
+ /**
433
+ * Split the array entries appData[index0 <= i < index1] into blocks of at most maxChildPerNode * maxAppDataPerLeaf and assemble into a tree structure.
434
+ * @param ranges access to ranges
435
+ * @param appData access to AppDataType items
436
+ * @param index0 start index of the block to access
437
+ * @param index1 terminal index for the block (one after final)
438
+ * @param arrayLength one more than the largest range/appData index
439
+ * @param maxChildPerNode max number of child nodes in each interior node
440
+ * @param maxAppDataPerLeaf max number of appData items in each leaf.
441
+ * @returns
442
+ */
443
+ static createRecursiveByIndexSplits(ranges, appData, index0, index1, arrayLength, maxChildPerNode, maxAppDataPerLeaf) {
444
+ if (index1 > arrayLength)
445
+ index1 = arrayLength;
446
+ const range = Range3d.createNull();
447
+ const children = [];
448
+ const maxChildrenAppData = maxChildPerNode * maxAppDataPerLeaf;
449
+ // console.log({ name: "createRecursive", index0, index1, maxChildrenAppData });
450
+ if (index1 <= index0 + maxChildrenAppData) { // index range is small enough to hold the appData in leaf children
451
+ // console.log({ case: "LEAF GROUP", index0, index1 });
452
+ for (let indexA = index0 + maxAppDataPerLeaf; index0 < index1; index0 = indexA, indexA = Math.min(indexA + maxAppDataPerLeaf, index1)) {
453
+ const leaf = RangeTreeOps.createLeafInIndexRange(ranges, appData, index0, indexA, arrayLength);
454
+ if (leaf !== undefined) {
455
+ range.extendRange(leaf.getRangeRef());
456
+ children.push(leaf);
457
+ }
458
+ }
459
+ }
460
+ else { // split the appData among interior and leaf children
461
+ // console.log({ case: "INTERIOR", index0, index1 });
462
+ const numPerGulp = Math.ceil((index1 - index0) / maxChildPerNode);
463
+ for (let indexA = index0 + numPerGulp; index0 < index1; index0 = indexA, indexA = Math.min(indexA + numPerGulp, index1)) {
464
+ const child = this.createRecursiveByIndexSplits(ranges, appData, index0, indexA, arrayLength, maxChildPerNode, maxAppDataPerLeaf);
465
+ if (child !== undefined) {
466
+ range.extendRange(child.getRangeRef());
467
+ children.push(child);
468
+ }
469
+ }
470
+ }
471
+ return (children.length > 0) ? RangeTreeNode.createCapture(range, undefined, children) : undefined;
472
+ }
473
+ /**
474
+ * Create a range tree by simple left-right split of given ranges.
475
+ * * Leaves carry the inputs in left-to-right order.
476
+ * * Each leaf range is labeled by its corresponding object(s) in the appData array.
477
+ * @param ranges access to ranges.
478
+ * @param appData access to AppDataType items (for leaves).
479
+ * @param arrayLength one more than the largest range/appData index
480
+ * @param maxChildrenPerNode max number of child nodes allowed for each interior node.
481
+ * @param maxAppDataPerLeaf max number of appData items allowed in each leaf.
482
+ * @returns the root of the new tree, or undefined if array lengths differ or are zero.
483
+ */
484
+ static createByIndexSplits(ranges, appData, arrayLength, maxChildrenPerNode = 2, maxAppDataPerLeaf = 2) {
485
+ // console.log();
486
+ // const numData = getFlexDataCount(appData);
487
+ // console.log({ numData });
488
+ if (arrayLength <= 0
489
+ || (Array.isArray(ranges) && ranges.length !== arrayLength)
490
+ || (Array.isArray(appData) && appData.length !== arrayLength))
491
+ return undefined;
492
+ if (maxChildrenPerNode < 2)
493
+ maxChildrenPerNode = 2;
494
+ return RangeTreeOps.createRecursiveByIndexSplits(ranges, appData, 0, arrayLength, arrayLength, maxChildrenPerNode, maxAppDataPerLeaf);
495
+ }
496
+ }
497
+ //# sourceMappingURL=RangeTreeNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangeTreeNode.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeNode.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAejD;;;;;GAKG;AACH,SAAS,mBAAmB,CAAI,IAAoB,EAAE,KAAa;IACjE,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AACD;;;GAGG;AACH,SAAS,UAAU,CAAI,KAAa,EAAE,IAAiB;IACrD,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM;gBACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;SACtB;aAAM;YACL,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD;;;GAGG;AACH,SAAS,gBAAgB,CAAI,IAAiB;IAC5C,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC;SACpB;aAAM;YACL,OAAO,CAAC,CAAC;SACV;KACF;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AACD;;;GAGG;AACH,MAAM,OAAgB,uBAAuB;IAS3C;;;;OAIG;IACH,6CAA6C;IACtC,SAAS,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;CAC9C;AACD;;;GAGG;AACH,MAAM,OAAgB,oBAAoB;IAUxC;;;;OAIG;IACH,6CAA6C;IACtC,SAAS,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;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AC,CAAC,CAAC,SAAS,CAAC;IACrG,CAAC;IACD;;;;;;;;;;OAUG;IACI,MAAM,CAAC,mBAAmB,CAC/B,MAA4B,EAC5B,OAAiC,EACjC,WAAmB,EACnB,qBAA6B,CAAC,EAC9B,oBAA4B,CAAC;QAE7B,iBAAiB;QACjB,6CAA6C;QAC7C,4BAA4B;QAC5B,IAAI,WAAW,IAAI,CAAC;eACf,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;eACxD,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,CAAC;YAC7D,OAAO,SAAS,CAAC;QACnB,IAAI,kBAAkB,GAAG,CAAC;YACxB,kBAAkB,GAAG,CAAC,CAAC;QACzB,OAAO,YAAY,CAAC,4BAA4B,CAAc,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;IACrJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RangeSearch\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Range3d } from \"../../geometry3d/Range\";\n\n/** Type name FlexData is shorthand for a member or parameter which can be:\n * * undefined\n * * an array of values of type T\n * * a singleton of type T\n */\ntype FlexData<T> = undefined | T[] | T;\n/**\n * Type name IndexToType is shorthand for a member or parameter which can be:\n * * an array of values of type T\n * * a function from integers to type T.\n */\ntype IndexToType<T> = T[] | ((index: number) => T);\n\n/**\n * Map an (unchecked) integer to a parameterized type T, where the data argument can be either:\n * * an array of type T\n * * a function which takes an index and returns type T\n * @internal\n */\nfunction evaluateIndexToType<T>(data: IndexToType<T>, index: number): T {\n if (Array.isArray(data))\n return data[index];\n return data(index);\n}\n/**\n * Get data by index from a source that may be undefined, an array of item of type T, or a singleton of the item type.\n * @internal\n */\nfunction getByIndex<T>(index: number, data: FlexData<T>): T | undefined {\n if (data !== undefined) {\n if (Array.isArray(data)) {\n if (index < data.length)\n return data[index];\n } else {\n return data;\n }\n }\n return undefined;\n}\n/**\n * Return the number of items in an object that can be undefined, an array of item of type T, or a singleton of the item type.\n * @internal\n */\nfunction getFlexDataCount<T>(data: FlexData<T>): number {\n if (data !== undefined) {\n if (Array.isArray(data)) {\n return data.length;\n } else {\n return 1;\n }\n }\n return 0;\n}\n/**\n * Abstract class for handler objects called during traversal of a single range tree.\n * @internal\n */\nexport abstract class SingleTreeSearchHandler<AppDataType> {\n /** Return true if appData within the range should be offered to `processAppData`. */\n public abstract isRangeActive(range: Range3d): boolean;\n /**\n * Called for a (single) child referenced by a tree.\n * * This is only called when range checks on the path from root have been passed.\n * @param item child (of type AppDataType) in the tree.\n */\n public abstract processAppData(item: AppDataType): void;\n /**\n * Query to see if the active search has been aborted.\n * * Default implementation returns false so query runs to completion.\n * * Search processes check this after range tests and child processing.\n */\n // eslint-disable-next-line @itwin/prefer-get\n public isAborted(): boolean { return false; }\n}\n/**\n * Abstract class for handler objects called during traversal of two range trees.\n * @internal\n */\nexport abstract class TwoTreeSearchHandler<AppDataType> {\n /** Return true if appData within the ranges should be offered to `processAppDataPair`. */\n public abstract isRangePairActive(leftRange: Range3d, rightRange: Range3d): boolean;\n /**\n * Called with AppDataType items from left tree and right tree.\n * * This is only called when range tests have been passed.\n * @param leftItem\n * @param rightItem\n */\n public abstract processAppDataPair(leftItem: AppDataType, rightItem: AppDataType): void;\n /**\n * Query to see if the active search has been aborted.\n * * Default implementation returns false so query runs to completion.\n * * Search processes check this after range tests and child processing.\n */\n // eslint-disable-next-line @itwin/prefer-get\n public isAborted(): boolean { return false; }\n}\n/**\n * This class refines the TwoTreeSearchHandler with an implementation of `isRangePairActive` appropriate for computing the minimum distance between trees.\n * * The concrete class must implement `getCurrentDistance()` method to provide the best-so-far distance.\n * * The implementation of `isRangePairActive` returns true if the distance between ranges is less than or equal to the `getCurrentDistance()` value.\n * @internal\n */\nexport abstract class TwoTreeDistanceMinimizationSearchHandler<AppDataType> extends TwoTreeSearchHandler<AppDataType>{\n /**\n * Provides the allowable distance between ranges.\n * * Range pairs with more than this distance separation are rejected.\n * * The implementation may alter (probably reduce) the getCurrentDistance() value as the search progresses.\n */\n public abstract getCurrentDistance(): number;\n /**\n * Method called to decide whether to process subtrees and immediate child appData items from a left tree node and right tree node.\n * @param leftRange range from a node in the left tree\n * @param rightRange range from a node in the right tree.\n * @returns true if the smallest distance from leftRange to rightRange is less than or equal to getCurrentDistance()\n */\n public override isRangePairActive(leftRange: Range3d, rightRange: Range3d): boolean {\n const currentDistance = this.getCurrentDistance();\n const distanceBetweenRanges = leftRange.distanceToRange(rightRange);\n if (distanceBetweenRanges <= currentDistance) {\n return true;\n }\n return false;\n }\n}\nlet numNodeCreated = 0;\n/**\n * * TREE STRUCTURE\n * * A RangeTreeNode is part of a range tree.\n * * TREE is used here in a strictly _structural_ sense, which has no broad promises about data members.\n * * Each RangeNode points to 0, 1 or many children.\n * * Each child has (but does not point back to) a single parent.\n * * The overall tree has a single root.\n * * Each node is effectively the root of the tree of its children.\n * * NON-TREE DATA MEMBERS\n * * Data members in each node (in addition to children) are\n * * _range = the union of ranges below in the heap\n * * _appData = application data associated with the node.\n * * Construction methods may place multiple _appData items in each node.\n * * In common use, only the leaves will have _appData. However, the class definitions allow _appData at all nodes, and search algorithms must include them.\n * * CONSTRUCTION\n * * The RangeTreeNode.createByIndexSplits method constructs the tree with simple right-left splits within an array of input items.\n * * The appData is placed entirely in the leaves.\n * * caller can specify:\n * * the number of _appData items per leaf\n * * the number of children per node within the tree.\n * * \"deep\" trees (2 children per node and one appData per leaf) may have (compared to shallow trees with many children per node and many appData per leaf)\n * * faster search because lower nodes have smaller ranges that will be skipped by search algorithms.\n * * larger memory use because of more nodes\n * * For future construction methods:\n * * _appData \"above the leaves\" may allow nodes below to have smaller ranges, but add complexity to search.\n * @internal\n */\nexport class RangeTreeNode<AppDataType> {\n private _range: Range3d;\n private _appData: FlexData<AppDataType>;\n private _children: FlexData<RangeTreeNode<AppDataType>>;\n /** an id assigned sequentially as nodes are created. For debugging use only. */\n private _id: number;\n /**\n * CONSTRUCTOR\n * CAPTURE (not copy)\n * * range = range for search algorithms\n * * appData = application data relevant to this node.\n * * children = child node reference(s).\n */\n private constructor(range: Range3d, appData: FlexData<AppDataType>, children: FlexData<RangeTreeNode<AppDataType>>) {\n this._range = range;\n this._appData = appData;\n this._children = children;\n this._id = numNodeCreated++;\n // const childIds: number[] = [];\n // if (Array.isArray(this._children))\n // for (const c of this._children) childIds.push(c._id);\n // else if (this._children instanceof RangeTreeNode)\n // childIds.push(this._children._id);\n // const numAppData = getFlexDataCount(appData);\n // console.log({ id: this._id, childIds, numAppData });\n }\n /** Simplest public create: capture the range, appData, and children. */\n public static createCapture<AppDataType>(\n range: Range3d,\n appData: FlexData<AppDataType>,\n children: FlexData<RangeTreeNode<AppDataType>>): RangeTreeNode<AppDataType> {\n return new RangeTreeNode<AppDataType>(range, appData, children);\n }\n /** copy (not capture) from given data into the range in this RangeEntry */\n public setRange(data: Range3d) {\n this._range.setFrom(data);\n }\n /** return (a copy of) the range in this RangeEntry */\n public getRange(data?: Range3d): Range3d {\n return this._range.clone(data);\n }\n /** return (a reference to) the range in this RangeEntry */\n public getRangeRef(): Range3d {\n return this._range;\n }\n /**\n * Access a child by index.\n * * If the child data is an array, this dereferences the array.\n * * If the child data is a singleton, treat it as index 0.\n * * return undefined if there are no children.\n * @param index index of item to access.\n */\n public getChildByIndex(index: number): RangeTreeNode<AppDataType> | undefined {\n return getByIndex<RangeTreeNode<AppDataType>>(index, this._children);\n }\n /**\n * * Access an appData by index.\n * * If the appData data is an array, this dereferences the array.\n * * If the appData data is a singleton, treat it as if it is at index 0 in an array\n * * return undefined if there are no appData or for any index out of range.\n * @param index index of item to access.\n */\n public getAppDataByIndex(index: number): AppDataType | undefined {\n return getByIndex<AppDataType>(index, this._appData);\n }\n /** Access the children or child (does not clone). */\n public getAllChildren(): FlexData<RangeTreeNode<AppDataType>> {\n return this._children;\n }\n /** Access the appData array or singleton (does not clone). */\n public getAllAppData(): FlexData<AppDataType> {\n return this._appData;\n }\n /**\n * Count the direct children in this node of the tree.\n * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveNodeCount`.\n */\n public getNumChildren(): number {\n return getFlexDataCount(this._children);\n }\n /**\n * Count the appData items in this node of the tree.\n * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveAppDataCount`.\n */\n public getNumAppData(): number {\n return getFlexDataCount(this._appData);\n }\n /**\n * Depth-first tree iteration, calling `announceNode` on each node.\n * @param announceNode callback that returns true to recurse into children\n */\n public recurseIntoTree(announceNode: (node: RangeTreeNode<AppDataType>) => boolean) {\n const doChildren = announceNode(this);\n if (doChildren) {\n if (Array.isArray(this._children)) {\n for (const child of this._children)\n child.recurseIntoTree(announceNode);\n } else if (this._children !== undefined) {\n this._children.recurseIntoTree(announceNode);\n }\n }\n }\n /**\n * Depth-first tree iteration via handler.\n * * if handler decides the instance range is active, process appData, then recurse on children\n * * if handler decides to abort after processing an appData, skip processing rest of appData and children\n */\n public searchTopDown(handler: SingleTreeSearchHandler<AppDataType>) {\n if (handler.isRangeActive(this._range)) {\n let itemToProcess: AppDataType | undefined;\n for (let i = 0; undefined !== (itemToProcess = this.getAppDataByIndex(i)); i++) {\n // console.log(itemToProcess);\n handler.processAppData(itemToProcess);\n if (handler.isAborted())\n return;\n }\n let child: RangeTreeNode<AppDataType> | undefined;\n for (let i = 0; undefined !== (child = this.getChildByIndex(i)); i++) {\n child.searchTopDown(handler);\n }\n }\n }\n\n /**\n * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightStack.\n * @param leftAppData singleton or array with data \"from left\"\n * @param rightStack stack of nodes to process from right path.\n * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.\n * @param handler search handler\n */\n private static processAppDataAndAppDataStack<AppDataType>(\n leftAppData: FlexData<AppDataType>,\n rightStack: RangeTreeNode<AppDataType>[],\n reverseArgs: boolean,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n if (leftAppData !== undefined) {\n let leftItem: AppDataType | undefined;\n let rightItem: AppDataType | undefined;\n // hmm.. we ASSUME that if the tip ranges passed, then all parent ranges would pass without further test.\n for (let rangeIndex = rightStack.length; rangeIndex-- > 0;) {\n const rightAppData = rightStack[rangeIndex]._appData;\n for (let rightIndex = 0; undefined !== (rightItem = getByIndex<AppDataType>(rightIndex, rightAppData)); rightIndex++) {\n for (let leftIndex = 0; undefined !== (leftItem = getByIndex<AppDataType>(leftIndex, leftAppData)); leftIndex++) {\n if (!reverseArgs)\n handler.processAppDataPair(leftItem, rightItem);\n else\n handler.processAppDataPair(rightItem, leftItem);\n if (handler.isAborted())\n return;\n }\n }\n }\n }\n }\n\n /**\n * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightAppData.\n * @param leftAppData singleton or array with data \"from left\"\n * @param rightAppData singleton or array with data \"from right\"\n * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.\n * @param handler search handler\n */\n private static processAppDataAndAppData<AppDataType>(\n leftAppData: FlexData<AppDataType>,\n rightAppData: FlexData<AppDataType>,\n reverseArgs: boolean,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n if (leftAppData !== undefined && rightAppData !== undefined) {\n let leftItem: AppDataType | undefined;\n let rightItem: AppDataType | undefined;\n for (let rightIndex = 0; undefined !== (rightItem = getByIndex<AppDataType>(rightIndex, rightAppData)); rightIndex++) {\n for (let leftIndex = 0; undefined !== (leftItem = getByIndex<AppDataType>(leftIndex, leftAppData)); leftIndex++) {\n if (!reverseArgs)\n handler.processAppDataPair(leftItem, rightItem);\n else\n handler.processAppDataPair(rightItem, leftItem);\n if (handler.isAborted())\n return;\n }\n }\n }\n }\n /**\n * Push the tip node to stack(s).\n * @param tip new node (to be pushed)\n * @param fullPath complete path, which is always extended\n * @param partialPath partial path, which is only extended if the tip has _appData.\n */\n private static pushPaths<AppDataType>(\n tip: RangeTreeNode<AppDataType>,\n fullPath: RangeTreeNode<AppDataType>[],\n partialPath: RangeTreeNode<AppDataType>[],\n ) {\n fullPath.push(tip);\n if (tip._appData !== undefined) {\n partialPath.push(tip);\n }\n }\n /**\n * Pop the tip node from stack(s).\n * @param tip should match the fullPath tip.\n * @param fullPath complete path, which is always popped\n * @param partialPath partial path, which is only popped if the tip has _appData.\n */\n private static popPaths<AppDataType>(\n tip: RangeTreeNode<AppDataType>,\n fullPath: RangeTreeNode<AppDataType>[],\n partialPath: RangeTreeNode<AppDataType>[],\n ) {\n assert(fullPath[fullPath.length - 1] === tip);\n fullPath.pop();\n if (tip._appData !== undefined) {\n partialPath.pop();\n }\n }\n /**\n * Process nodes from left and right trees of dual search.\n * * The separate stacks for nodes that have appData is for efficiency.\n * * If data is entirely in the leaves (or just in a few nodes), the stacks will all be empty (or very small) and no time will be wasted looking up the stacks for appData to process with the other tip.\n * @param leftTip tip node being explored on left\n * @param leftStack stack of prior left nodes\n * @param leftStackWithAppData stack of prior left nodes which have appData.\n * @param rightTip tip node being explored on right.\n * @param rightStack stack of prior right nodes.\n * @param rightStackWithAppData stack of prior right nodes which have appData.\n * @param handler search handler\n */\n private static recursivePairSearch<AppDataType>(\n leftTip: RangeTreeNode<AppDataType>,\n leftStack: RangeTreeNode<AppDataType>[],\n leftStackWithAppData: RangeTreeNode<AppDataType>[],\n rightTip: RangeTreeNode<AppDataType>,\n rightStack: RangeTreeNode<AppDataType>[],\n rightStackWithAppData: RangeTreeNode<AppDataType>[],\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n // console.log({ leftId: leftTip._id, rightId: rightTip._id });\n const leftTipHasAppData = leftTip._appData !== undefined;\n const rightTipHasAppData = rightTip._appData !== undefined;\n let leftChild: RangeTreeNode<AppDataType> | undefined;\n let rightChild: RangeTreeNode<AppDataType> | undefined;\n\n // process immediate appData from each tip node with the entire prior path of the other side (each stack currently lacks the tip).\n if (leftTipHasAppData && rightStackWithAppData.length > 0) {\n this.processAppDataAndAppDataStack<AppDataType>(leftTip._appData, rightStackWithAppData, false, handler);\n }\n if (leftStackWithAppData.length > 0 && rightTipHasAppData) {\n this.processAppDataAndAppDataStack<AppDataType>(rightTip._appData, leftStackWithAppData, true, handler);\n }\n\n if (handler.isRangePairActive(leftTip._range, rightTip._range)) {\n this.processAppDataAndAppData<AppDataType>(leftTip._appData, rightTip._appData, false, handler);\n\n if (leftTip._children !== undefined && rightTip._children !== undefined) {\n this.pushPaths<AppDataType>(leftTip, leftStack, leftStackWithAppData);\n this.pushPaths<AppDataType>(rightTip, rightStack, rightStackWithAppData);\n for (let leftIndex = 0; undefined !== (leftChild = getByIndex<RangeTreeNode<AppDataType>>(leftIndex, leftTip._children)); leftIndex++) {\n for (let rightIndex = 0; undefined !== (rightChild = getByIndex<RangeTreeNode<AppDataType>>(rightIndex, rightTip._children)); rightIndex++) {\n this.recursivePairSearch(\n leftChild, leftStack, leftStackWithAppData,\n rightChild, rightStack, rightStackWithAppData,\n handler);\n }\n }\n this.popPaths<AppDataType>(leftTip, leftStack, leftStackWithAppData);\n this.popPaths<AppDataType>(rightTip, rightStack, rightStackWithAppData);\n } else if (leftTip._children !== undefined) {\n this.leftRecursivePairSearch<AppDataType>(leftTip, rightTip, rightStackWithAppData, false, handler);\n } else if (rightTip._children !== undefined) {\n this.leftRecursivePairSearch<AppDataType>(rightTip, leftTip, leftStackWithAppData, true, handler);\n }\n }\n }\n /**\n * Recurse below the tip of leftTip, offering each level's appData to the appData of rightTip and rightStackWithAppData.\n * @param leftTip tip node being explored on left. Its appData is not processed.\n * @param rightTip tip node being explored on right. It has no children.\n * @param rightStackWithAppData stack of prior right nodes which have appData.\n * @param reverseArgs true if the caller is exchanging the sense of left and right\n * @param handler search handler\n */\n private static leftRecursivePairSearch<AppDataType>(\n leftTip: RangeTreeNode<AppDataType>,\n rightTip: RangeTreeNode<AppDataType>,\n rightStackWithAppData: RangeTreeNode<AppDataType>[],\n reverseArgs: boolean,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n assert(rightTip._children === undefined);\n // The (possibly deep) left children appData needs to be offered to the right path (including tip)\n // Note that there are no stack push/pop operations -- the right stack is already reaching to leaf level, so there are no range or appData nodes to add.\n let leftChild: RangeTreeNode<AppDataType> | undefined;\n for (let leftIndex = 0; undefined !== (leftChild = getByIndex<RangeTreeNode<AppDataType>>(leftIndex, leftTip._children)); leftIndex++) {\n if (handler.isRangePairActive(leftChild._range, rightTip._range)) {\n this.processAppDataAndAppData<AppDataType>(leftChild._appData, rightTip._appData, reverseArgs, handler);\n this.processAppDataAndAppDataStack<AppDataType>(leftChild._appData, rightStackWithAppData, reverseArgs, handler);\n this.leftRecursivePairSearch<AppDataType>(leftChild, rightTip, rightStackWithAppData, reverseArgs, handler);\n }\n }\n }\n /**\n * Recursive search down two trees, with range tests and child processing under control of a handler.\n * @param leftRoot root of left tree\n * @param rightRoot root of right tree\n * @param handler handler for range tests and child process\n */\n public static searchTwoTreesTopDown<AppDataType>(\n leftRoot: RangeTreeNode<AppDataType>,\n rightRoot: RangeTreeNode<AppDataType>,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n this.recursivePairSearch(leftRoot, [], [], rightRoot, [], [], handler);\n }\n}\n/**\n * Utilities for various operations on RangeTree\n * @internal\n */\nexport class RangeTreeOps {\n /** Count nodes in this tree. */\n public static getRecursiveNodeCount<AppDataType>(root: RangeTreeNode<AppDataType>): number {\n let count = 0;\n root.recurseIntoTree((_node: RangeTreeNode<AppDataType>): boolean => { count++; return true; });\n return count;\n }\n /** Count appData in this tree. */\n public static getRecursiveAppDataCount<AppDataType>(root: RangeTreeNode<AppDataType>): number {\n let count = 0;\n root.recurseIntoTree(\n (node: RangeTreeNode<AppDataType>): boolean => { count += node.getNumAppData(); return true; });\n return count;\n }\n /**\n * Create a leaf referencing appData items indexed index0<=index<index1 and with combined range of the same indices\n * @param ranges access to ranges\n * @param appData access to AppDataType items\n * @param index0 first index for block of items\n * @param index1 upper limit index for block of items.\n * @param arrayLength one more than the largest range/appData index\n * @returns newly created node.\n */\n private static createLeafInIndexRange<AppDataType>(\n ranges: IndexToType<Range3d>,\n appData: IndexToType<AppDataType>,\n index0: number,\n index1: number,\n arrayLength: number): RangeTreeNode<AppDataType> {\n const appDataBlock: AppDataType[] = [];\n const range = Range3d.createNull();\n index1 = Math.min(index1, arrayLength);\n // console.log({ case: \"LEAF\", index0, index1 });\n for (let i = index0; i < index1; i++) {\n appDataBlock.push(evaluateIndexToType(appData, i));\n range.extendRange(evaluateIndexToType(ranges, i));\n }\n return RangeTreeNode.createCapture(range, appDataBlock, undefined);\n }\n /**\n * Split the array entries appData[index0 <= i < index1] into blocks of at most maxChildPerNode * maxAppDataPerLeaf and assemble into a tree structure.\n * @param ranges access to ranges\n * @param appData access to AppDataType items\n * @param index0 start index of the block to access\n * @param index1 terminal index for the block (one after final)\n * @param arrayLength one more than the largest range/appData index\n * @param maxChildPerNode max number of child nodes in each interior node\n * @param maxAppDataPerLeaf max number of appData items in each leaf.\n * @returns\n */\n private static createRecursiveByIndexSplits<AppDataType>(\n ranges: IndexToType<Range3d>,\n appData: IndexToType<AppDataType>,\n index0: number,\n index1: number,\n arrayLength: number,\n maxChildPerNode: number,\n maxAppDataPerLeaf: number,\n ): RangeTreeNode<AppDataType> | undefined {\n if (index1 > arrayLength)\n index1 = arrayLength;\n\n const range = Range3d.createNull();\n const children: RangeTreeNode<AppDataType>[] = [];\n const maxChildrenAppData = maxChildPerNode * maxAppDataPerLeaf;\n // console.log({ name: \"createRecursive\", index0, index1, maxChildrenAppData });\n\n if (index1 <= index0 + maxChildrenAppData) { // index range is small enough to hold the appData in leaf children\n // console.log({ case: \"LEAF GROUP\", index0, index1 });\n for (let indexA = index0 + maxAppDataPerLeaf; index0 < index1; index0 = indexA, indexA = Math.min(indexA + maxAppDataPerLeaf, index1)) {\n const leaf = RangeTreeOps.createLeafInIndexRange(ranges, appData, index0, indexA, arrayLength);\n if (leaf !== undefined) {\n range.extendRange(leaf.getRangeRef());\n children.push(leaf);\n }\n }\n } else { // split the appData among interior and leaf children\n // console.log({ case: \"INTERIOR\", index0, index1 });\n const numPerGulp = Math.ceil((index1 - index0) / maxChildPerNode);\n for (let indexA = index0 + numPerGulp; index0 < index1; index0 = indexA, indexA = Math.min(indexA + numPerGulp, index1)) {\n const child = this.createRecursiveByIndexSplits(ranges, appData, index0, indexA, arrayLength, maxChildPerNode, maxAppDataPerLeaf);\n if (child !== undefined) {\n range.extendRange(child.getRangeRef());\n children.push(child);\n }\n }\n }\n return (children.length > 0) ? RangeTreeNode.createCapture(range, undefined, children) : undefined;\n }\n /**\n * Create a range tree by simple left-right split of given ranges.\n * * Leaves carry the inputs in left-to-right order.\n * * Each leaf range is labeled by its corresponding object(s) in the appData array.\n * @param ranges access to ranges.\n * @param appData access to AppDataType items (for leaves).\n * @param arrayLength one more than the largest range/appData index\n * @param maxChildrenPerNode max number of child nodes allowed for each interior node.\n * @param maxAppDataPerLeaf max number of appData items allowed in each leaf.\n * @returns the root of the new tree, or undefined if array lengths differ or are zero.\n */\n public static createByIndexSplits<AppDataType>(\n ranges: IndexToType<Range3d>,\n appData: IndexToType<AppDataType>,\n arrayLength: number,\n maxChildrenPerNode: number = 2,\n maxAppDataPerLeaf: number = 2,\n ): RangeTreeNode<AppDataType> | undefined {\n // console.log();\n // const numData = getFlexDataCount(appData);\n // console.log({ numData });\n if (arrayLength <= 0\n || (Array.isArray(ranges) && ranges.length !== arrayLength)\n || (Array.isArray(appData) && appData.length !== arrayLength))\n return undefined;\n if (maxChildrenPerNode < 2)\n maxChildrenPerNode = 2;\n return RangeTreeOps.createRecursiveByIndexSplits<AppDataType>(ranges, appData, 0, arrayLength, arrayLength, maxChildrenPerNode, maxAppDataPerLeaf);\n }\n}\n\n"]}