@itwin/core-geometry 5.2.0-dev.7 → 5.3.0-dev.1

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 (438) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/lib/cjs/Geometry.d.ts +30 -10
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +74 -10
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/AkimaCurve3d.d.ts +19 -6
  7. package/lib/cjs/bspline/AkimaCurve3d.d.ts.map +1 -1
  8. package/lib/cjs/bspline/AkimaCurve3d.js +21 -5
  9. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurve.d.ts +3 -3
  11. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurve.js +6 -6
  13. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  14. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  15. package/lib/cjs/bspline/BSplineCurveOps.js +1 -1
  16. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  17. package/lib/cjs/bspline/BezierCurveBase.d.ts +2 -2
  18. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  19. package/lib/cjs/bspline/BezierCurveBase.js +4 -6
  20. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  21. package/lib/cjs/bspline/InterpolationCurve3d.d.ts +27 -17
  22. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  23. package/lib/cjs/bspline/InterpolationCurve3d.js +17 -7
  24. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  25. package/lib/cjs/clipping/ClipPlane.d.ts +19 -6
  26. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  27. package/lib/cjs/clipping/ClipPlane.js +17 -2
  28. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  29. package/lib/cjs/clipping/ClipUtils.d.ts +14 -1
  30. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  31. package/lib/cjs/clipping/ClipUtils.js +21 -3
  32. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  33. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +14 -11
  34. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  35. package/lib/cjs/clipping/ConvexClipPlaneSet.js +23 -16
  36. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  37. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  38. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  39. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  40. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  41. package/lib/cjs/curve/Arc3d.d.ts +27 -17
  42. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  43. package/lib/cjs/curve/Arc3d.js +61 -35
  44. package/lib/cjs/curve/Arc3d.js.map +1 -1
  45. package/lib/cjs/curve/CurveCollection.d.ts +1 -0
  46. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  47. package/lib/cjs/curve/CurveCollection.js +1 -0
  48. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  49. package/lib/cjs/curve/CurveLocationDetail.d.ts +8 -7
  50. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  51. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  52. package/lib/cjs/curve/CurveOps.d.ts +51 -1
  53. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  54. package/lib/cjs/curve/CurveOps.js +97 -3
  55. package/lib/cjs/curve/CurveOps.js.map +1 -1
  56. package/lib/cjs/curve/LineString3d.d.ts +4 -4
  57. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  58. package/lib/cjs/curve/LineString3d.js +8 -8
  59. package/lib/cjs/curve/LineString3d.js.map +1 -1
  60. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
  61. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  62. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +6 -2
  63. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  64. package/lib/cjs/curve/Query/PlanarSubdivision.js +12 -7
  65. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  66. package/lib/cjs/curve/RegionOps.d.ts +9 -4
  67. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  68. package/lib/cjs/curve/RegionOps.js +10 -5
  69. package/lib/cjs/curve/RegionOps.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  71. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
  72. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  73. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -4
  74. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  75. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +21 -18
  76. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  78. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +30 -50
  79. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  80. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  81. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  82. package/lib/cjs/curve/spiral/DirectSpiral3d.js +6 -2
  83. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  84. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  85. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  86. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +6 -2
  87. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  88. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +5 -1
  89. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  90. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +0 -3
  91. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  92. package/lib/cjs/geometry3d/AngleSweep.d.ts +6 -2
  93. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  94. package/lib/cjs/geometry3d/AngleSweep.js +12 -3
  95. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  96. package/lib/cjs/geometry3d/FrameBuilder.d.ts +2 -1
  97. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  98. package/lib/cjs/geometry3d/FrameBuilder.js +14 -18
  99. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  100. package/lib/cjs/geometry3d/Matrix3d.d.ts +1 -1
  101. package/lib/cjs/geometry3d/Matrix3d.js +1 -1
  102. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  103. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +18 -2
  104. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  105. package/lib/cjs/geometry3d/Point2dVector2d.js +37 -4
  106. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  107. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  108. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  109. package/lib/cjs/geometry3d/Point3dVector3d.js +1 -0
  110. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  111. package/lib/cjs/geometry3d/PointStreaming.d.ts +8 -0
  112. package/lib/cjs/geometry3d/PointStreaming.d.ts.map +1 -1
  113. package/lib/cjs/geometry3d/PointStreaming.js +18 -2
  114. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  115. package/lib/cjs/geometry3d/PolygonOps.d.ts +18 -9
  116. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  117. package/lib/cjs/geometry3d/PolygonOps.js +53 -26
  118. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  119. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
  120. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  121. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
  122. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  123. package/lib/cjs/geometry3d/PolylineOps.d.ts +14 -3
  124. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  125. package/lib/cjs/geometry3d/PolylineOps.js +20 -4
  126. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  127. package/lib/cjs/geometry3d/Range.d.ts +34 -32
  128. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  129. package/lib/cjs/geometry3d/Range.js +28 -21
  130. package/lib/cjs/geometry3d/Range.js.map +1 -1
  131. package/lib/cjs/geometry3d/Ray2d.d.ts +16 -6
  132. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  133. package/lib/cjs/geometry3d/Ray2d.js +28 -4
  134. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  135. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  136. package/lib/cjs/geometry3d/Ray3d.js +3 -4
  137. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  138. package/lib/cjs/geometry3d/Transform.d.ts +1 -1
  139. package/lib/cjs/geometry3d/Transform.js +1 -1
  140. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  141. package/lib/cjs/geometry3d/XYZProps.d.ts +12 -1
  142. package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
  143. package/lib/cjs/geometry3d/XYZProps.js +17 -2
  144. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  145. package/lib/cjs/geometry4d/Matrix4d.d.ts +16 -0
  146. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  147. package/lib/cjs/geometry4d/Matrix4d.js +26 -0
  148. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  149. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  150. package/lib/cjs/numerics/BezierPolynomials.js +5 -9
  151. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  152. package/lib/cjs/numerics/SmallSystem.d.ts +13 -7
  153. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  154. package/lib/cjs/numerics/SmallSystem.js +13 -7
  155. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  156. package/lib/cjs/polyface/Polyface.d.ts +1 -3
  157. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  158. package/lib/cjs/polyface/Polyface.js +2 -6
  159. package/lib/cjs/polyface/Polyface.js.map +1 -1
  160. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +25 -6
  161. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  162. package/lib/cjs/polyface/PolyfaceBuilder.js +59 -8
  163. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  164. package/lib/cjs/polyface/PolyfaceData.d.ts +2 -0
  165. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  166. package/lib/cjs/polyface/PolyfaceData.js +7 -3
  167. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  168. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  169. package/lib/cjs/polyface/PolyfaceQuery.js +8 -10
  170. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  171. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
  172. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
  173. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
  174. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  175. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
  176. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
  177. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
  178. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  179. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
  180. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  181. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +9 -12
  182. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  183. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
  184. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  185. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
  186. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  187. package/lib/cjs/serialization/DeepCompare.js +1 -1
  188. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  189. package/lib/cjs/serialization/GeometrySamples.d.ts +2 -1
  190. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  191. package/lib/cjs/serialization/GeometrySamples.js +2 -1
  192. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  193. package/lib/cjs/topology/Graph.d.ts +38 -12
  194. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  195. package/lib/cjs/topology/Graph.js +91 -23
  196. package/lib/cjs/topology/Graph.js.map +1 -1
  197. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
  198. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
  199. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
  200. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  201. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +20 -11
  202. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  203. package/lib/cjs/topology/HalfEdgeGraphSearch.js +43 -39
  204. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  205. package/lib/cjs/topology/Merging.d.ts +7 -4
  206. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  207. package/lib/cjs/topology/Merging.js +16 -11
  208. package/lib/cjs/topology/Merging.js.map +1 -1
  209. package/lib/cjs/topology/Triangulation.d.ts +13 -11
  210. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  211. package/lib/cjs/topology/Triangulation.js +40 -36
  212. package/lib/cjs/topology/Triangulation.js.map +1 -1
  213. package/lib/cjs/topology/Voronoi.d.ts +195 -0
  214. package/lib/cjs/topology/Voronoi.d.ts.map +1 -0
  215. package/lib/cjs/topology/Voronoi.js +700 -0
  216. package/lib/cjs/topology/Voronoi.js.map +1 -0
  217. package/lib/cjs/topology/XYParitySearchContext.d.ts +1 -1
  218. package/lib/cjs/topology/XYParitySearchContext.d.ts.map +1 -1
  219. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  220. package/lib/esm/Geometry.d.ts +30 -10
  221. package/lib/esm/Geometry.d.ts.map +1 -1
  222. package/lib/esm/Geometry.js +74 -10
  223. package/lib/esm/Geometry.js.map +1 -1
  224. package/lib/esm/bspline/AkimaCurve3d.d.ts +19 -6
  225. package/lib/esm/bspline/AkimaCurve3d.d.ts.map +1 -1
  226. package/lib/esm/bspline/AkimaCurve3d.js +21 -5
  227. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  228. package/lib/esm/bspline/BSplineCurve.d.ts +3 -3
  229. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  230. package/lib/esm/bspline/BSplineCurve.js +6 -6
  231. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  232. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  233. package/lib/esm/bspline/BSplineCurveOps.js +1 -1
  234. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  235. package/lib/esm/bspline/BezierCurveBase.d.ts +2 -2
  236. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  237. package/lib/esm/bspline/BezierCurveBase.js +4 -6
  238. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  239. package/lib/esm/bspline/InterpolationCurve3d.d.ts +27 -17
  240. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  241. package/lib/esm/bspline/InterpolationCurve3d.js +17 -7
  242. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  243. package/lib/esm/clipping/ClipPlane.d.ts +19 -6
  244. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  245. package/lib/esm/clipping/ClipPlane.js +17 -2
  246. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  247. package/lib/esm/clipping/ClipUtils.d.ts +14 -1
  248. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  249. package/lib/esm/clipping/ClipUtils.js +21 -3
  250. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  251. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +14 -11
  252. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  253. package/lib/esm/clipping/ConvexClipPlaneSet.js +23 -16
  254. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  255. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  256. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  257. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  258. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  259. package/lib/esm/curve/Arc3d.d.ts +27 -17
  260. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  261. package/lib/esm/curve/Arc3d.js +61 -35
  262. package/lib/esm/curve/Arc3d.js.map +1 -1
  263. package/lib/esm/curve/CurveCollection.d.ts +1 -0
  264. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  265. package/lib/esm/curve/CurveCollection.js +1 -0
  266. package/lib/esm/curve/CurveCollection.js.map +1 -1
  267. package/lib/esm/curve/CurveLocationDetail.d.ts +8 -7
  268. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  269. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  270. package/lib/esm/curve/CurveOps.d.ts +51 -1
  271. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  272. package/lib/esm/curve/CurveOps.js +98 -4
  273. package/lib/esm/curve/CurveOps.js.map +1 -1
  274. package/lib/esm/curve/LineString3d.d.ts +4 -4
  275. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  276. package/lib/esm/curve/LineString3d.js +8 -8
  277. package/lib/esm/curve/LineString3d.js.map +1 -1
  278. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
  279. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  280. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +6 -2
  281. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  282. package/lib/esm/curve/Query/PlanarSubdivision.js +12 -7
  283. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  284. package/lib/esm/curve/RegionOps.d.ts +9 -4
  285. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  286. package/lib/esm/curve/RegionOps.js +10 -5
  287. package/lib/esm/curve/RegionOps.js.map +1 -1
  288. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  289. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
  290. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  291. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -4
  292. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  293. package/lib/esm/curve/internalContexts/MultiChainCollector.js +21 -18
  294. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  295. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  296. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +30 -50
  297. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  298. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  299. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  300. package/lib/esm/curve/spiral/DirectSpiral3d.js +6 -2
  301. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  302. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  303. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  304. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +6 -2
  305. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  306. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +5 -1
  307. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  308. package/lib/esm/curve/spiral/TransitionSpiral3d.js +0 -3
  309. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  310. package/lib/esm/geometry3d/AngleSweep.d.ts +6 -2
  311. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  312. package/lib/esm/geometry3d/AngleSweep.js +12 -3
  313. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  314. package/lib/esm/geometry3d/FrameBuilder.d.ts +2 -1
  315. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  316. package/lib/esm/geometry3d/FrameBuilder.js +14 -18
  317. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  318. package/lib/esm/geometry3d/Matrix3d.d.ts +1 -1
  319. package/lib/esm/geometry3d/Matrix3d.js +1 -1
  320. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  321. package/lib/esm/geometry3d/Point2dVector2d.d.ts +18 -2
  322. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  323. package/lib/esm/geometry3d/Point2dVector2d.js +37 -4
  324. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  325. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  326. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  327. package/lib/esm/geometry3d/Point3dVector3d.js +1 -0
  328. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  329. package/lib/esm/geometry3d/PointStreaming.d.ts +8 -0
  330. package/lib/esm/geometry3d/PointStreaming.d.ts.map +1 -1
  331. package/lib/esm/geometry3d/PointStreaming.js +18 -2
  332. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  333. package/lib/esm/geometry3d/PolygonOps.d.ts +18 -9
  334. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  335. package/lib/esm/geometry3d/PolygonOps.js +53 -26
  336. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  337. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
  338. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  339. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
  340. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  341. package/lib/esm/geometry3d/PolylineOps.d.ts +14 -3
  342. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  343. package/lib/esm/geometry3d/PolylineOps.js +20 -4
  344. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  345. package/lib/esm/geometry3d/Range.d.ts +34 -32
  346. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  347. package/lib/esm/geometry3d/Range.js +28 -21
  348. package/lib/esm/geometry3d/Range.js.map +1 -1
  349. package/lib/esm/geometry3d/Ray2d.d.ts +16 -6
  350. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  351. package/lib/esm/geometry3d/Ray2d.js +28 -4
  352. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  353. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  354. package/lib/esm/geometry3d/Ray3d.js +3 -4
  355. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  356. package/lib/esm/geometry3d/Transform.d.ts +1 -1
  357. package/lib/esm/geometry3d/Transform.js +1 -1
  358. package/lib/esm/geometry3d/Transform.js.map +1 -1
  359. package/lib/esm/geometry3d/XYZProps.d.ts +12 -1
  360. package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
  361. package/lib/esm/geometry3d/XYZProps.js +16 -1
  362. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  363. package/lib/esm/geometry4d/Matrix4d.d.ts +16 -0
  364. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  365. package/lib/esm/geometry4d/Matrix4d.js +26 -0
  366. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  367. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  368. package/lib/esm/numerics/BezierPolynomials.js +5 -9
  369. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  370. package/lib/esm/numerics/SmallSystem.d.ts +13 -7
  371. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  372. package/lib/esm/numerics/SmallSystem.js +13 -7
  373. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  374. package/lib/esm/polyface/Polyface.d.ts +1 -3
  375. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  376. package/lib/esm/polyface/Polyface.js +2 -6
  377. package/lib/esm/polyface/Polyface.js.map +1 -1
  378. package/lib/esm/polyface/PolyfaceBuilder.d.ts +25 -6
  379. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  380. package/lib/esm/polyface/PolyfaceBuilder.js +59 -8
  381. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  382. package/lib/esm/polyface/PolyfaceData.d.ts +2 -0
  383. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  384. package/lib/esm/polyface/PolyfaceData.js +7 -3
  385. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  386. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  387. package/lib/esm/polyface/PolyfaceQuery.js +8 -10
  388. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  389. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
  390. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
  391. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
  392. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  393. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
  394. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
  395. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
  396. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  397. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
  398. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  399. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +9 -12
  400. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  401. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
  402. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  403. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
  404. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  405. package/lib/esm/serialization/DeepCompare.js +1 -1
  406. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  407. package/lib/esm/serialization/GeometrySamples.d.ts +2 -1
  408. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  409. package/lib/esm/serialization/GeometrySamples.js +2 -1
  410. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  411. package/lib/esm/topology/Graph.d.ts +38 -12
  412. package/lib/esm/topology/Graph.d.ts.map +1 -1
  413. package/lib/esm/topology/Graph.js +92 -24
  414. package/lib/esm/topology/Graph.js.map +1 -1
  415. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
  416. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
  417. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
  418. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  419. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +20 -11
  420. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  421. package/lib/esm/topology/HalfEdgeGraphSearch.js +43 -39
  422. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  423. package/lib/esm/topology/Merging.d.ts +7 -4
  424. package/lib/esm/topology/Merging.d.ts.map +1 -1
  425. package/lib/esm/topology/Merging.js +17 -12
  426. package/lib/esm/topology/Merging.js.map +1 -1
  427. package/lib/esm/topology/Triangulation.d.ts +13 -11
  428. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  429. package/lib/esm/topology/Triangulation.js +40 -36
  430. package/lib/esm/topology/Triangulation.js.map +1 -1
  431. package/lib/esm/topology/Voronoi.d.ts +195 -0
  432. package/lib/esm/topology/Voronoi.d.ts.map +1 -0
  433. package/lib/esm/topology/Voronoi.js +696 -0
  434. package/lib/esm/topology/Voronoi.js.map +1 -0
  435. package/lib/esm/topology/XYParitySearchContext.d.ts +1 -1
  436. package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
  437. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  438. package/package.json +3 -3
@@ -2,7 +2,7 @@
2
2
  * @module RangeSearch
3
3
  */
4
4
  import { CurveLocationDetail, CurveLocationDetailPair } from "../../curve/CurveLocationDetail";
5
- import { Point3d } from "../../geometry3d/Point3dVector3d";
5
+ import { XAndY, XYAndZ } from "../../geometry3d/XYZProps";
6
6
  /**
7
7
  * Handler class for searching a range tree containing unordered Point3d data.
8
8
  * * Facilitates multiple searches for closest point and close approach calculations.
@@ -10,7 +10,7 @@ import { Point3d } from "../../geometry3d/Point3dVector3d";
10
10
  */
11
11
  export declare class Point3dArrayRangeTreeContext {
12
12
  /** Array of points being searched, indexed by the range tree */
13
- points: Point3d[];
13
+ points: XYAndZ[];
14
14
  /** Diagnostic: number of range tests returned true */
15
15
  numRangeTestTrue: number;
16
16
  /** Diagnostic: number of range tests returned false */
@@ -19,6 +19,8 @@ export declare class Point3dArrayRangeTreeContext {
19
19
  numPointTest: number;
20
20
  /** Diagnostic: number of searches */
21
21
  numSearch: number;
22
+ /** Whether to compute xy-distances, ignoring z-coordinates of points. */
23
+ xyOnly?: boolean;
22
24
  /** range tree, whose appData are indices into the points array */
23
25
  private _rangeTreeRoot;
24
26
  /** Constructor: capture inputs, initialize debug counters */
@@ -27,11 +29,12 @@ export declare class Point3dArrayRangeTreeContext {
27
29
  * Create a range tree context with given points:
28
30
  * * initialize with single-point ranges
29
31
  * * appData are point indices
30
- * @param points captured
32
+ * @param points reference captured
31
33
  * @param maxChildPerNode maximum children per range tree node (default 4)
32
34
  * @param maxAppDataPerLeaf maximum point indices per leaf node (default 4)
35
+ * @param xyOnly whether to compute xy-distances, ignoring z-coordinates of points
33
36
  */
34
- static createCapture(points: Point3d[], maxChildPerNode?: number, maxAppDataPerLeaf?: number): Point3dArrayRangeTreeContext | undefined;
37
+ static createCapture(points: XYAndZ[], maxChildPerNode?: number, maxAppDataPerLeaf?: number, xyOnly?: boolean): Point3dArrayRangeTreeContext | undefined;
35
38
  /**
36
39
  * Search the range tree for closest point(s) to spacePoint.
37
40
  * @param spacePoint point to test
@@ -41,7 +44,7 @@ export declare class Point3dArrayRangeTreeContext {
41
44
  * * detail.fraction = the index of the closest point in the points array
42
45
  * * detail.a = distance from spacePoint to closest point
43
46
  */
44
- searchForClosestPoint(spacePoint: Point3d, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined;
47
+ searchForClosestPoint(spacePoint: XAndY | XYAndZ, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined;
45
48
  /**
46
49
  * Search the range trees for closest approach(es) between the point arrays.
47
50
  * @param contextA first point array context
@@ -1 +1 @@
1
- {"version":3,"file":"Point3dArrayRangeTreeContext.d.ts","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/Point3dArrayRangeTreeContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAO3D;;;;GAIG;AACH,qBAAa,4BAA4B;IACvC,gEAAgE;IACzD,MAAM,EAAE,OAAO,EAAE,CAAC;IAEzB,sDAAsD;IAC/C,gBAAgB,EAAE,MAAM,CAAC;IAChC,uDAAuD;IAChD,iBAAiB,EAAE,MAAM,CAAC;IACjC,iDAAiD;IAC1C,YAAY,EAAE,MAAM,CAAC;IAC5B,qCAAqC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAEzB,kEAAkE;IAClE,OAAO,CAAC,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,OAAO;IAQP;;;;;;;OAOG;WACW,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,eAAe,GAAE,MAAU,EAAE,iBAAiB,GAAE,MAAU,GAAG,4BAA4B,GAAG,SAAS;IAUpJ;;;;;;;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B,GAAG,mBAAmB,EAAE,GAAG,SAAS;IAMnI;;;;;;;;;MASE;WACY,wBAAwB,CAAC,QAAQ,EAAE,4BAA4B,EAAE,QAAQ,EAAE,4BAA4B,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,uBAAuB,GAAG,uBAAuB,EAAE,GAAG,SAAS;CAK1M"}
@@ -27,28 +27,32 @@ class Point3dArrayRangeTreeContext {
27
27
  numPointTest;
28
28
  /** Diagnostic: number of searches */
29
29
  numSearch;
30
+ /** Whether to compute xy-distances, ignoring z-coordinates of points. */
31
+ xyOnly;
30
32
  /** range tree, whose appData are indices into the points array */
31
33
  _rangeTreeRoot;
32
34
  /** Constructor: capture inputs, initialize debug counters */
33
- constructor(rangeTreeRoot, points) {
35
+ constructor(rangeTreeRoot, points, xyOnly) {
34
36
  this.points = points;
35
37
  this._rangeTreeRoot = rangeTreeRoot;
36
38
  this.numRangeTestTrue = 0;
37
39
  this.numRangeTestFalse = 0;
38
40
  this.numPointTest = 0;
39
41
  this.numSearch = 0;
42
+ this.xyOnly = xyOnly;
40
43
  }
41
44
  /**
42
45
  * Create a range tree context with given points:
43
46
  * * initialize with single-point ranges
44
47
  * * appData are point indices
45
- * @param points captured
48
+ * @param points reference captured
46
49
  * @param maxChildPerNode maximum children per range tree node (default 4)
47
50
  * @param maxAppDataPerLeaf maximum point indices per leaf node (default 4)
51
+ * @param xyOnly whether to compute xy-distances, ignoring z-coordinates of points
48
52
  */
49
- static createCapture(points, maxChildPerNode = 4, maxAppDataPerLeaf = 4) {
53
+ static createCapture(points, maxChildPerNode = 4, maxAppDataPerLeaf = 4, xyOnly = false) {
50
54
  const rangeTreeRoot = RangeTreeNode_1.RangeTreeOps.createByIndexSplits(((index) => { return Range_1.Range3d.create(points[index]); }), ((index) => { return index; }), points.length, maxChildPerNode, maxAppDataPerLeaf);
51
- return rangeTreeRoot ? new Point3dArrayRangeTreeContext(rangeTreeRoot, points) : undefined;
55
+ return rangeTreeRoot ? new Point3dArrayRangeTreeContext(rangeTreeRoot, points, xyOnly) : undefined;
52
56
  }
53
57
  /**
54
58
  * Search the range tree for closest point(s) to spacePoint.
@@ -1 +1 @@
1
- {"version":3,"file":"Point3dArrayRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/Point3dArrayRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,kDAAiD;AACjD,mDAA8D;AAC9D,uEAEmC;AAEnC;;;;GAIG;AACH,MAAa,4BAA4B;IACvC,gEAAgE;IACzD,MAAM,CAAY;IAEzB,sDAAsD;IAC/C,gBAAgB,CAAS;IAChC,uDAAuD;IAChD,iBAAiB,CAAS;IACjC,iDAAiD;IAC1C,YAAY,CAAS;IAC5B,qCAAqC;IAC9B,SAAS,CAAS;IAEzB,kEAAkE;IAC1D,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,YAAoB,aAAoC,EAAE,MAAiB;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IACrB,CAAC;IACD;;;;;;;OAOG;IACI,MAAM,CAAC,aAAa,CAAC,MAAiB,EAAE,kBAA0B,CAAC,EAAE,oBAA4B,CAAC;QACvG,MAAM,aAAa,GAAG,4BAAY,CAAC,mBAAmB,CACpD,CAAC,CAAC,KAAa,EAAW,EAAE,GAAG,OAAO,eAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACvE,CAAC,CAAC,KAAa,EAAU,EAAE,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAC9C,MAAM,CAAC,MAAM,EACb,eAAe,EACf,iBAAiB,CAClB,CAAC;QACF,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,4BAA4B,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7F,CAAC;IACD;;;;;;;;OAQG;IACI,qBAAqB,CAAC,UAAmB,EAAE,OAAgB;QAChE,MAAM,OAAO,GAAG,IAAI,uEAA6C,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7F,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;IACD;;;;;;;;;MASE;IACK,MAAM,CAAC,wBAAwB,CAAC,QAAsC,EAAE,QAAsC,EAAE,OAAgB;QACrI,MAAM,OAAO,GAAG,IAAI,sFAA4D,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9G,6BAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AAzED,oEAyEC","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 { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\nimport {\n SingleTreeSearchHandlerForClosestPointInArray, TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach,\n} from \"./RangeTreeSearchHandlers\";\n\n/**\n * Handler class for searching a range tree containing unordered Point3d data.\n * * Facilitates multiple searches for closest point and close approach calculations.\n * @public\n */\nexport class Point3dArrayRangeTreeContext {\n /** Array of points being searched, indexed by the range tree */\n public points: Point3d[];\n\n /** Diagnostic: number of range tests returned true */\n public numRangeTestTrue: number;\n /** Diagnostic: number of range tests returned false */\n public numRangeTestFalse: number;\n /** Diagnostic: number of point distance tests */\n public numPointTest: number;\n /** Diagnostic: number of searches */\n public numSearch: number;\n\n /** range tree, whose appData are indices into the points array */\n private _rangeTreeRoot: RangeTreeNode<number>;\n\n /** Constructor: capture inputs, initialize debug counters */\n private constructor(rangeTreeRoot: RangeTreeNode<number>, points: Point3d[]) {\n this.points = points;\n this._rangeTreeRoot = rangeTreeRoot;\n this.numRangeTestTrue = 0;\n this.numRangeTestFalse = 0;\n this.numPointTest = 0;\n this.numSearch = 0;\n }\n /**\n * Create a range tree context with given points:\n * * initialize with single-point ranges\n * * appData are point indices\n * @param points captured\n * @param maxChildPerNode maximum children per range tree node (default 4)\n * @param maxAppDataPerLeaf maximum point indices per leaf node (default 4)\n */\n public static createCapture(points: Point3d[], maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4): Point3dArrayRangeTreeContext | undefined {\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\n ((index: number): Range3d => { return Range3d.create(points[index]); }),\n ((index: number): number => { return index; }),\n points.length,\n maxChildPerNode,\n maxAppDataPerLeaf,\n );\n return rangeTreeRoot ? new Point3dArrayRangeTreeContext(rangeTreeRoot, points) : undefined;\n }\n /**\n * Search the range tree for closest point(s) to spacePoint.\n * @param spacePoint point to test\n * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.\n * @return closest point detail(s) with following fields set:\n * * detail.point = the closest point\n * * detail.fraction = the index of the closest point in the points array\n * * detail.a = distance from spacePoint to closest point\n */\n public searchForClosestPoint(spacePoint: Point3d, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined {\n const handler = new SingleTreeSearchHandlerForClosestPointInArray(spacePoint, this, maxDist);\n this.numSearch++;\n this._rangeTreeRoot.searchTopDown(handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n /**\n * Search the range trees for closest approach(es) between the point arrays.\n * @param contextA first point array context\n * @param contextB second point array context\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\n * @return closest approach detail pair(s), one per context, each with the following fields set:\n * * detail.point = the point at closest approach\n * * detail.fraction = the index of detail.point in the points array\n * * detail.a = the closest approach distance\n */\n public static searchForClosestApproach(contextA: Point3dArrayRangeTreeContext, contextB: Point3dArrayRangeTreeContext, maxDist?: number): CurveLocationDetailPair | CurveLocationDetailPair[] | undefined {\n const handler = new TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach(contextA, contextB, maxDist);\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n}\n\n"]}
1
+ {"version":3,"file":"Point3dArrayRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/Point3dArrayRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,kDAAiD;AAEjD,mDAA8D;AAC9D,uEAEmC;AAEnC;;;;GAIG;AACH,MAAa,4BAA4B;IACvC,gEAAgE;IACzD,MAAM,CAAW;IAExB,sDAAsD;IAC/C,gBAAgB,CAAS;IAChC,uDAAuD;IAChD,iBAAiB,CAAS;IACjC,iDAAiD;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AAE,CAAC;QACjB,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;IACD;;;;;;;;;MASE;IACK,MAAM,CAAC,wBAAwB,CAAC,QAAsC,EAAE,QAAsC,EAAE,OAAgB;QACrI,MAAM,OAAO,GAAG,IAAI,sFAA4D,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9G,6BAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AA7ED,oEA6EC","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 { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\nimport {\n SingleTreeSearchHandlerForClosestPointInArray, TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach,\n} from \"./RangeTreeSearchHandlers\";\n\n/**\n * Handler class for searching a range tree containing unordered Point3d data.\n * * Facilitates multiple searches for closest point and close approach calculations.\n * @public\n */\nexport class Point3dArrayRangeTreeContext {\n /** Array of points being searched, indexed by the range tree */\n public points: XYAndZ[];\n\n /** Diagnostic: number of range tests returned true */\n public numRangeTestTrue: number;\n /** Diagnostic: number of range tests returned false */\n public numRangeTestFalse: number;\n /** Diagnostic: number of point distance tests */\n public numPointTest: number;\n /** Diagnostic: number of searches */\n public numSearch: number;\n /** Whether to compute xy-distances, ignoring z-coordinates of points. */\n public xyOnly?: boolean;\n\n /** range tree, whose appData are indices into the points array */\n private _rangeTreeRoot: RangeTreeNode<number>;\n\n /** Constructor: capture inputs, initialize debug counters */\n private constructor(rangeTreeRoot: RangeTreeNode<number>, points: XYAndZ[], xyOnly: boolean) {\n this.points = points;\n this._rangeTreeRoot = rangeTreeRoot;\n this.numRangeTestTrue = 0;\n this.numRangeTestFalse = 0;\n this.numPointTest = 0;\n this.numSearch = 0;\n this.xyOnly = xyOnly;\n }\n /**\n * Create a range tree context with given points:\n * * initialize with single-point ranges\n * * appData are point indices\n * @param points reference captured\n * @param maxChildPerNode maximum children per range tree node (default 4)\n * @param maxAppDataPerLeaf maximum point indices per leaf node (default 4)\n * @param xyOnly whether to compute xy-distances, ignoring z-coordinates of points\n */\n public static createCapture(points: XYAndZ[], maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4, xyOnly: boolean = false): Point3dArrayRangeTreeContext | undefined {\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\n ((index: number): Range3d => { return Range3d.create(points[index]); }),\n ((index: number): number => { return index; }),\n points.length,\n maxChildPerNode,\n maxAppDataPerLeaf,\n );\n return rangeTreeRoot ? new Point3dArrayRangeTreeContext(rangeTreeRoot, points, xyOnly) : undefined;\n }\n /**\n * Search the range tree for closest point(s) to spacePoint.\n * @param spacePoint point to test\n * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.\n * @return closest point detail(s) with following fields set:\n * * detail.point = the closest point\n * * detail.fraction = the index of the closest point in the points array\n * * detail.a = distance from spacePoint to closest point\n */\n public searchForClosestPoint(spacePoint: XAndY | XYAndZ, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined {\n const handler = new SingleTreeSearchHandlerForClosestPointInArray(spacePoint, this, maxDist);\n this.numSearch++;\n this._rangeTreeRoot.searchTopDown(handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n /**\n * Search the range trees for closest approach(es) between the point arrays.\n * @param contextA first point array context\n * @param contextB second point array context\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\n * @return closest approach detail pair(s), one per context, each with the following fields set:\n * * detail.point = the point at closest approach\n * * detail.fraction = the index of detail.point in the points array\n * * detail.a = the closest approach distance\n */\n public static searchForClosestApproach(contextA: Point3dArrayRangeTreeContext, contextB: Point3dArrayRangeTreeContext, maxDist?: number): CurveLocationDetailPair | CurveLocationDetailPair[] | undefined {\n const handler = new TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach(contextA, contextB, maxDist);\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n}\n\n"]}
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module RangeSearch
3
3
  */
4
- import { Point3d } from "../../geometry3d/Point3dVector3d";
4
+ import { XAndY, XYAndZ } from "../../geometry3d/XYZProps";
5
5
  import { FacetLocationDetail, FacetLocationDetailPair } from "../FacetLocationDetail";
6
6
  import { Polyface, PolyfaceVisitor } from "../Polyface";
7
7
  /**
@@ -39,11 +39,11 @@ export declare class PolyfaceRangeTreeContext {
39
39
  /**
40
40
  * Search the range tree for closest facet(s) to spacePoint.
41
41
  * @param spacePoint point to test
42
- * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.
42
+ * @param maxDist collect facet locations at no more than this distance from spacePoint. If undefined, return only the closest facet location.
43
43
  * @param searchFacetInterior whether to include facet interiors in search. Default is false: just consider facet boundaries.
44
44
  * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point
45
45
  */
46
- searchForClosestPoint(spacePoint: Point3d, maxDist?: number, searchFacetInterior?: boolean): FacetLocationDetail | FacetLocationDetail[] | undefined;
46
+ searchForClosestPoint(spacePoint: XYAndZ | XAndY, maxDist?: number, searchFacetInterior?: boolean): FacetLocationDetail | FacetLocationDetail[] | undefined;
47
47
  /**
48
48
  * Search the range trees for closest approach(es) between the polyfaces.
49
49
  * @param contextA first polyface context
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceRangeTreeContext.d.ts","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/PolyfaceRangeTreeContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKxD;;;;GAIG;AACH,qBAAa,wBAAwB;IACnC,8CAA8C;IACvC,OAAO,EAAE,eAAe,CAAC;IAChC,0DAA0D;IACnD,YAAY,EAAE,OAAO,CAAC;IAE7B,iEAAiE;IAC1D,gBAAgB,EAAE,MAAM,CAAC;IAChC,sEAAsE;IAC/D,iBAAiB,EAAE,MAAM,CAAC;IACjC,yCAAyC;IAClC,YAAY,EAAE,MAAM,CAAC;IAC5B,gDAAgD;IACzC,SAAS,EAAE,MAAM,CAAC;IAEzB,yDAAyD;IACzD,OAAO,CAAC,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,OAAO;IASP;;;;;;;;OAQG;WACW,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,eAAe,EAAE,eAAe,GAAE,MAAU,EAAE,iBAAiB,GAAE,MAAU,EAAE,YAAY,GAAE,OAAe,GAAG,wBAAwB,GAAG,SAAS;IAajM;;;;;;OAMG;IACI,qBAAqB,CAAC,UAAU,E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U,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,mBAAmB,GAAE,OAAe,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,GAAG,SAAS;IAczK;;;;;;;MAOE;WACY,wBAAwB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,QAAQ,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,mBAAmB,GAAE,OAAe,GAAG,uBAAuB,GAAG,uBAAuB,EAAE,GAAG,SAAS;CAKxO"}
@@ -62,7 +62,7 @@ class PolyfaceRangeTreeContext {
62
62
  /**
63
63
  * Search the range tree for closest facet(s) to spacePoint.
64
64
  * @param spacePoint point to test
65
- * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.
65
+ * @param maxDist collect facet locations at no more than this distance from spacePoint. If undefined, return only the closest facet location.
66
66
  * @param searchFacetInterior whether to include facet interiors in search. Default is false: just consider facet boundaries.
67
67
  * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point
68
68
  */
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/PolyfaceRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAI1C,0CAAwD;AACxD,oDAAiD;AACjD,mDAA8D;AAC9D,uEAA6I;AAE7I;;;;GAIG;AACH,MAAa,wBAAwB;IACnC,8CAA8C;IACvC,OAAO,CAAkB;IAChC,0DAA0D;IACnD,YAAY,CAAU;IAE7B,iEAAiE;IAC1D,gBAAgB,CAAS;IAChC,sEAAsE;IAC/D,iBAAiB,CAAS;IACjC,yCAAyC;IAClC,YAAY,CAAS;IAC5B,gDAAgD;IACzC,SAAS,CAAS;IAEzB,yDAAyD;IACjD,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,YAAoB,aAAoC,EAAE,OAAwB,EAAE,eAAwB,KAAK;QAC/G,IAA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,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AApFD,4DAoFC","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 { Geometry } from \"../../Geometry\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { FacetLocationDetail, FacetLocationDetailPair } from \"../FacetLocationDetail\";\nimport { Polyface, PolyfaceVisitor } from \"../Polyface\";\nimport { PolyfaceQuery } from \"../PolyfaceQuery\";\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\nimport { SingleTreeSearchHandlerForClosestPointOnPolyface, TwoTreeSearchHandlerForFacetFacetCloseApproach } from \"./RangeTreeSearchHandlers\";\n\n/**\n * Handler class for searching a range tree containing the facets of a polyface.\n * * Facilitates multiple searches for closest point and close approach calculations.\n * @public\n */\nexport class PolyfaceRangeTreeContext {\n /** Visitor for the polyface being searched */\n public visitor: PolyfaceVisitor;\n /** Whether all facets to visit are known to be convex. */\n public convexFacets: boolean;\n\n /** Diagnostic: number of range tests that have returned true. */\n public numRangeTestTrue: number;\n /** Diagnostic: number of range tests that have been returned false */\n public numRangeTestFalse: number;\n /** Diagnostic: number of facet tests. */\n public numFacetTest: number;\n /** Diagnostic: number of searches performed. */\n public numSearch: number;\n\n /** Range tree, whose appData are facet (read) indices */\n private _rangeTreeRoot: RangeTreeNode<number>;\n\n /** Constructor: capture inputs, initialize debug counters */\n private constructor(rangeTreeRoot: RangeTreeNode<number>, visitor: PolyfaceVisitor, convexFacets: boolean = false) {\n this.visitor = visitor;\n this.convexFacets = convexFacets;\n this._rangeTreeRoot = rangeTreeRoot;\n this.numRangeTestTrue = 0;\n this.numRangeTestFalse = 0;\n this.numFacetTest = 0;\n this.numSearch = 0;\n }\n /**\n * Create a range tree context for the Polyface facets.\n * * This is a very simple construction that splits \"right and left parts\" of the facet sequence.\n * * Facets with any recognizable \"left to right\" or \"top to bottom\" sequencing will have very effective search structures.\n * @param visitor access to facets, captured if PolyfaceVisitor\n * @param maxChildPerNode maximum children per range tree node (default 4)\n * @param maxAppDataPerLeaf maximum facet indices per leaf node (default 4)\n * @param convexFacets whether all facets are known to be convex (cf. [[PolyfaceQuery.areFacetsConvex]]) (default false)\n */\n public static createCapture(visitor: Polyface | PolyfaceVisitor, maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4, convexFacets: boolean = false): PolyfaceRangeTreeContext | undefined {\n if (visitor instanceof Polyface)\n return this.createCapture(visitor.createVisitor(0), maxChildPerNode, maxAppDataPerLeaf, convexFacets);\n const numFacet = PolyfaceQuery.visitorClientFacetCount(visitor);\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\n (index: number): Range3d => { visitor.moveToReadIndex(index); return visitor.range(); },\n (index: number): number => { return index; },\n numFacet,\n maxChildPerNode,\n maxAppDataPerLeaf,\n );\n return rangeTreeRoot ? new PolyfaceRangeTreeContext(rangeTreeRoot, visitor, convexFacets) : undefined;\n }\n /**\n * Search the range tree for closest facet(s) to spacePoint.\n * @param spacePoint point to test\n * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.\n * @param searchFacetInterior whether to include facet interiors in search. Default is false: just consider facet boundaries.\n * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point\n */\n public searchForClosestPoint(spacePoint: Point3d, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetail | FacetLocationDetail[] | undefined {\n const handler = new SingleTreeSearchHandlerForClosestPointOnPolyface(spacePoint, this, maxDist, searchFacetInterior);\n this.numSearch++;\n const numFacet = PolyfaceQuery.visitorClientFacetCount(this.visitor);\n // seed the search with a few points -- this reduces early trips deep into early ranges that are far from spacePoint.\n const numTest = Geometry.clamp(Math.floor(numFacet / 20), 2, 7);\n const testStep = Math.floor(numFacet / numTest);\n handler.processAppData(0);\n handler.processAppData(numFacet - 1);\n for (let i = testStep; i + 1 < numFacet; i += testStep)\n handler.processAppData(i);\n this._rangeTreeRoot.searchTopDown(handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n /**\n * Search the range trees for closest approach(es) between the polyfaces.\n * @param contextA first polyface context\n * @param contextB second polyface context\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\n * @param searchFacetInterior whether to include facet interiors in search (`context.convexFacets` must be true for both contexts). Default is false: just consider facet boundaries.\n * @return closest approach detail pair(s), one per context, with detail.a set to the approach distance\n */\n public static searchForClosestApproach(contextA: PolyfaceRangeTreeContext, contextB: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetailPair | FacetLocationDetailPair[] | undefined {\n const handler = new TwoTreeSearchHandlerForFacetFacetCloseApproach(contextA, contextB, maxDist, searchFacetInterior);\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n}\n"]}
1
+ {"version":3,"file":"PolyfaceRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/PolyfaceRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAI1C,0CAAwD;AACxD,oDAAiD;AACjD,mDAA8D;AAC9D,uEAA6I;AAE7I;;;;GAIG;AACH,MAAa,wBAAwB;IACnC,8CAA8C;IACvC,OAAO,CAAkB;IAChC,0DAA0D;IACnD,YAAY,CAAU;IAE7B,iEAAiE;IAC1D,gBAAgB,CAAS;IAChC,sEAAsE;IAC/D,iBAAiB,CAAS;IACjC,yCAAyC;IAClC,YAAY,CAAS;IAC5B,gDAAgD;IACzC,S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AAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AApFD,4DAoFC","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 { Geometry } from \"../../Geometry\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\nimport { FacetLocationDetail, FacetLocationDetailPair } from \"../FacetLocationDetail\";\nimport { Polyface, PolyfaceVisitor } from \"../Polyface\";\nimport { PolyfaceQuery } from \"../PolyfaceQuery\";\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\nimport { SingleTreeSearchHandlerForClosestPointOnPolyface, TwoTreeSearchHandlerForFacetFacetCloseApproach } from \"./RangeTreeSearchHandlers\";\n\n/**\n * Handler class for searching a range tree containing the facets of a polyface.\n * * Facilitates multiple searches for closest point and close approach calculations.\n * @public\n */\nexport class PolyfaceRangeTreeContext {\n /** Visitor for the polyface being searched */\n public visitor: PolyfaceVisitor;\n /** Whether all facets to visit are known to be convex. */\n public convexFacets: boolean;\n\n /** Diagnostic: number of range tests that have returned true. */\n public numRangeTestTrue: number;\n /** Diagnostic: number of range tests that have been returned false */\n public numRangeTestFalse: number;\n /** Diagnostic: number of facet tests. */\n public numFacetTest: number;\n /** Diagnostic: number of searches performed. */\n public numSearch: number;\n\n /** Range tree, whose appData are facet (read) indices */\n private _rangeTreeRoot: RangeTreeNode<number>;\n\n /** Constructor: capture inputs, initialize debug counters */\n private constructor(rangeTreeRoot: RangeTreeNode<number>, visitor: PolyfaceVisitor, convexFacets: boolean = false) {\n this.visitor = visitor;\n this.convexFacets = convexFacets;\n this._rangeTreeRoot = rangeTreeRoot;\n this.numRangeTestTrue = 0;\n this.numRangeTestFalse = 0;\n this.numFacetTest = 0;\n this.numSearch = 0;\n }\n /**\n * Create a range tree context for the Polyface facets.\n * * This is a very simple construction that splits \"right and left parts\" of the facet sequence.\n * * Facets with any recognizable \"left to right\" or \"top to bottom\" sequencing will have very effective search structures.\n * @param visitor access to facets, captured if PolyfaceVisitor\n * @param maxChildPerNode maximum children per range tree node (default 4)\n * @param maxAppDataPerLeaf maximum facet indices per leaf node (default 4)\n * @param convexFacets whether all facets are known to be convex (cf. [[PolyfaceQuery.areFacetsConvex]]) (default false)\n */\n public static createCapture(visitor: Polyface | PolyfaceVisitor, maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4, convexFacets: boolean = false): PolyfaceRangeTreeContext | undefined {\n if (visitor instanceof Polyface)\n return this.createCapture(visitor.createVisitor(0), maxChildPerNode, maxAppDataPerLeaf, convexFacets);\n const numFacet = PolyfaceQuery.visitorClientFacetCount(visitor);\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\n (index: number): Range3d => { visitor.moveToReadIndex(index); return visitor.range(); },\n (index: number): number => { return index; },\n numFacet,\n maxChildPerNode,\n maxAppDataPerLeaf,\n );\n return rangeTreeRoot ? new PolyfaceRangeTreeContext(rangeTreeRoot, visitor, convexFacets) : undefined;\n }\n /**\n * Search the range tree for closest facet(s) to spacePoint.\n * @param spacePoint point to test\n * @param maxDist collect facet locations at no more than this distance from spacePoint. If undefined, return only the closest facet location.\n * @param searchFacetInterior whether to include facet interiors in search. Default is false: just consider facet boundaries.\n * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point\n */\n public searchForClosestPoint(spacePoint: XYAndZ | XAndY, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetail | FacetLocationDetail[] | undefined {\n const handler = new SingleTreeSearchHandlerForClosestPointOnPolyface(spacePoint, this, maxDist, searchFacetInterior);\n this.numSearch++;\n const numFacet = PolyfaceQuery.visitorClientFacetCount(this.visitor);\n // seed the search with a few points -- this reduces early trips deep into early ranges that are far from spacePoint.\n const numTest = Geometry.clamp(Math.floor(numFacet / 20), 2, 7);\n const testStep = Math.floor(numFacet / numTest);\n handler.processAppData(0);\n handler.processAppData(numFacet - 1);\n for (let i = testStep; i + 1 < numFacet; i += testStep)\n handler.processAppData(i);\n this._rangeTreeRoot.searchTopDown(handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n /**\n * Search the range trees for closest approach(es) between the polyfaces.\n * @param contextA first polyface context\n * @param contextB second polyface context\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\n * @param searchFacetInterior whether to include facet interiors in search (`context.convexFacets` must be true for both contexts). Default is false: just consider facet boundaries.\n * @return closest approach detail pair(s), one per context, with detail.a set to the approach distance\n */\n public static searchForClosestApproach(contextA: PolyfaceRangeTreeContext, contextB: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetailPair | FacetLocationDetailPair[] | undefined {\n const handler = new TwoTreeSearchHandlerForFacetFacetCloseApproach(contextA, contextB, maxDist, searchFacetInterior);\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n}\n"]}
@@ -32,7 +32,7 @@ export declare abstract class SingleTreeSearchHandler<AppDataType> {
32
32
  * * Default implementation returns false so query runs to completion.
33
33
  * * Search processes check this after range tests and child processing.
34
34
  */
35
- isAborted(): boolean;
35
+ getIsAborted(): boolean;
36
36
  }
37
37
  /**
38
38
  * Abstract class for handler objects called during traversal of two range trees.
@@ -53,7 +53,9 @@ export declare abstract class TwoTreeSearchHandler<AppDataType> {
53
53
  * * Default implementation returns false so query runs to completion.
54
54
  * * Search processes check this after range tests and child processing.
55
55
  */
56
- isAborted(): boolean;
56
+ getIsAborted(): boolean;
57
+ /** Whether to ignore z-coordinates in distance computations. */
58
+ getXYOnly(): boolean;
57
59
  }
58
60
  /**
59
61
  * This class refines the TwoTreeSearchHandler with an implementation of `isRangePairActive` appropriate for computing the minimum distance between trees.
@@ -1 +1 @@
1
- {"version":3,"file":"RangeTreeNode.d.ts","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeNode.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD;;;;GAIG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI,SAAS,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AACvC;;;;GAIG;AACH,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC;AA0CnD;;;GAGG;AACH,8BAAsB,uBAAuB,CAAC,WAAW;IACvD,qFAAqF;aACrE,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IACtD;;;;OAIG;aACa,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IACvD;;;;OAIG;IAEI,SAAS,IAAI,OAAO;CAC5B;AACD;;;GAGG;AACH,8BAAsB,oBAAoB,CAAC,WAAW;IACpD,0FAA0F;aAC1E,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO;IACnF;;;;;OAKG;aACa,kBAAkB,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI;IACvF;;;;OAIG;IAEI,SAAS,IAAI,OAAO;CAC5B;AACD;;;;;GAKG;AACH,8BAAsB,wCAAwC,CAAC,WAAW,CAAE,SAAQ,oBAAoB,CAAC,WAAW,CAAC;IACnH;;;;OAIG;aACa,kBAAkB,IAAI,MAAM;IAC5C;;;;;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WvB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IA8ClC;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAmBtC;;;;;OAKG;WACW,qBAAqB,CAAC,WAAW,EAC7C,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,EACpC,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,EACrC,OAAO,EAAE,oBAAoB,CAAC,WAAW,CAAC;CAI7C;AACD;;;GAGG;AACH,qBAAa,YAAY;IACvB,gCAAgC;WAClB,qBAAqB,CAAC,WAAW,EAAE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,MAAM;IAK1F,kCAAkC;WACpB,wBAAwB,CAAC,WAAW,EAAE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,MAAM;IAM7F;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAgBrC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAuC3C;;;;;;;;;;OAUG;WACW,mBAAmB,CAAC,WAAW,EAC3C,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAC5B,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,EACjC,WAAW,EAAE,MAAM,EACnB,kBAAkB,GAAE,MAAU,EAC9B,iBAAiB,GAAE,MAAU,GAC5B,aAAa,CAAC,WAAW,CAAC,GAAG,SAAS;CAY1C"}
@@ -62,8 +62,7 @@ class SingleTreeSearchHandler {
62
62
  * * Default implementation returns false so query runs to completion.
63
63
  * * Search processes check this after range tests and child processing.
64
64
  */
65
- // eslint-disable-next-line @itwin/prefer-get
66
- isAborted() { return false; }
65
+ getIsAborted() { return false; }
67
66
  }
68
67
  exports.SingleTreeSearchHandler = SingleTreeSearchHandler;
69
68
  /**
@@ -76,8 +75,9 @@ class TwoTreeSearchHandler {
76
75
  * * Default implementation returns false so query runs to completion.
77
76
  * * Search processes check this after range tests and child processing.
78
77
  */
79
- // eslint-disable-next-line @itwin/prefer-get
80
- isAborted() { return false; }
78
+ getIsAborted() { return false; }
79
+ /** Whether to ignore z-coordinates in distance computations. */
80
+ getXYOnly() { return false; }
81
81
  }
82
82
  exports.TwoTreeSearchHandler = TwoTreeSearchHandler;
83
83
  /**
@@ -95,11 +95,8 @@ class TwoTreeDistanceMinimizationSearchHandler extends TwoTreeSearchHandler {
95
95
  */
96
96
  isRangePairActive(leftRange, rightRange) {
97
97
  const currentDistance = this.getCurrentDistance();
98
- const distanceBetweenRanges = leftRange.distanceToRange(rightRange);
99
- if (distanceBetweenRanges <= currentDistance) {
100
- return true;
101
- }
102
- return false;
98
+ const distanceBetweenRanges = this.getXYOnly() ? leftRange.distanceToRangeXY(rightRange) : leftRange.distanceToRange(rightRange);
99
+ return distanceBetweenRanges <= currentDistance;
103
100
  }
104
101
  }
105
102
  exports.TwoTreeDistanceMinimizationSearchHandler = TwoTreeDistanceMinimizationSearchHandler;
@@ -242,7 +239,7 @@ class RangeTreeNode {
242
239
  for (let i = 0; undefined !== (itemToProcess = this.getAppDataByIndex(i)); i++) {
243
240
  // console.log(itemToProcess);
244
241
  handler.processAppData(itemToProcess);
245
- if (handler.isAborted())
242
+ if (handler.getIsAborted())
246
243
  return;
247
244
  }
248
245
  let child;
@@ -271,7 +268,7 @@ class RangeTreeNode {
271
268
  handler.processAppDataPair(leftItem, rightItem);
272
269
  else
273
270
  handler.processAppDataPair(rightItem, leftItem);
274
- if (handler.isAborted())
271
+ if (handler.getIsAborted())
275
272
  return;
276
273
  }
277
274
  }
@@ -295,7 +292,7 @@ class RangeTreeNode {
295
292
  handler.processAppDataPair(leftItem, rightItem);
296
293
  else
297
294
  handler.processAppDataPair(rightItem, leftItem);
298
- if (handler.isAborted())
295
+ if (handler.getIsAborted())
299
296
  return;
300
297
  }
301
298
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RangeTreeNode.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeT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xH,MAAM,KAAK,GAAG,IAAI,CAAC,4BAA4B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;gBAClI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;oBACvC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,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;AAtHD,oCAsHC","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}\n\nlet numNodeCreated = 0;\n\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 * * The caller can specify:\n * * the number of _appData items per leaf\n * * the number of children per node within the tree.\n * * Compared to \"shallow\" trees with many children per node and many appData per leaf, \"deep\" trees with 2 children per node and 1 appData per leaf may have:\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"]}
1
+ {"version":3,"file":"RangeTreeNode.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeNode.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,kDAAiD;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,CAAC;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM;gBACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;A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AC5B,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;AAtHD,oCAsHC","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 public getIsAborted(): 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 public getIsAborted(): boolean { return false; }\n /** Whether to ignore z-coordinates in distance computations. */\n public getXYOnly(): 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 = this.getXYOnly() ? leftRange.distanceToRangeXY(rightRange) : leftRange.distanceToRange(rightRange);\n return distanceBetweenRanges <= currentDistance;\n }\n}\n\nlet numNodeCreated = 0;\n\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 * * The caller can specify:\n * * the number of _appData items per leaf\n * * the number of children per node within the tree.\n * * Compared to \"shallow\" trees with many children per node and many appData per leaf, \"deep\" trees with 2 children per node and 1 appData per leaf may have:\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.getIsAborted())\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.getIsAborted())\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.getIsAborted())\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"]}
@@ -4,6 +4,7 @@
4
4
  import { CurveLocationDetail, CurveLocationDetailPair } from "../../curve/CurveLocationDetail";
5
5
  import { Point3d } from "../../geometry3d/Point3dVector3d";
6
6
  import { Range3d } from "../../geometry3d/Range";
7
+ import { XAndY, XYAndZ } from "../../geometry3d/XYZProps";
7
8
  import { FacetLocationDetail, FacetLocationDetailPair } from "../FacetLocationDetail";
8
9
  import { LineString3dRangeTreeContext } from "./LineString3dRangeTreeContext";
9
10
  import { MinimumValueTester } from "./MinimumValueTester";
@@ -28,7 +29,7 @@ export declare class SingleTreeSearchHandlerForClosestPointInArray extends Singl
28
29
  * @param context captured
29
30
  * @param maxDist collect points at no more than this distance from spacePoint
30
31
  */
31
- constructor(spacePoint: Point3d, context: Point3dArrayRangeTreeContext, maxDist?: number);
32
+ constructor(spacePoint: XAndY | XYAndZ, context: Point3dArrayRangeTreeContext, maxDist?: number);
32
33
  /** Return the current closest point */
33
34
  getResult(): CurveLocationDetail | undefined;
34
35
  /** Return the collected closest points (if collecting) */
@@ -54,6 +55,8 @@ export declare class TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproac
54
55
  contextB: Point3dArrayRangeTreeContext;
55
56
  /** Search state with current min distance point pair */
56
57
  searchState: MinimumValueTester<CurveLocationDetailPair>;
58
+ /** True if and only if both contexts specify xy-only. */
59
+ private _xyOnly?;
57
60
  /**
58
61
  * Constructor
59
62
  * @param contextA captured
@@ -67,6 +70,8 @@ export declare class TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproac
67
70
  getSavedItems(): CurveLocationDetailPair[] | undefined;
68
71
  /** Get current min distance */
69
72
  getCurrentDistance(): number;
73
+ /** Whether to ignore z-coordinates in distance computations. */
74
+ getXYOnly(): boolean;
70
75
  /** Compute and test the distance between two points, given their indices. */
71
76
  processAppDataPair(indexA: number, indexB: number): void;
72
77
  }
@@ -152,12 +157,12 @@ export declare class SingleTreeSearchHandlerForClosestPointOnPolyface extends Si
152
157
  searchFacetInterior: boolean;
153
158
  /**
154
159
  * Constructor
155
- * @param spacePoint cloned
160
+ * @param spacePoint point to test
156
161
  * @param context captured
157
162
  * @param maxDist collect points at no more than this distance from spacePoint
158
163
  * @param searchFacetInterior true: search facet interior + boundary; false: just boundary
159
164
  */
160
- constructor(spacePoint: Point3d, context: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior?: boolean);
165
+ constructor(spacePoint: XYAndZ | XAndY, context: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior?: boolean);
161
166
  /** Return the current closest point */
162
167
  getResult(): FacetLocationDetail | undefined;
163
168
  /** Return the collected closest points (if collecting) */
@@ -1 +1 @@
1
- {"version":3,"file":"RangeTreeSearchHandlers.d.ts","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeSearchHandlers.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG/F,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAA6B,mBAAmB,EAAE,uBAAuB,EAAgC,MAAM,wBAAwB,CAAC;AAC/I,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAEpG;;;;GAIG;AACH,qBAAa,6CAA8C,SAAQ,uBAAuB,CAAC,MAAM,CAAC;IAChG,0BAA0B;IACnB,OAAO,EAAE,4BAA4B,CAAC;IAC7C,4BAA4B;IACrB,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC/C,kCAAkC;IAC3B,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