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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (772) hide show
  1. package/CHANGELOG.md +46 -1
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.d.ts +30 -10
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js +74 -10
  6. package/lib/cjs/Geometry.js.map +1 -1
  7. package/lib/cjs/bspline/AkimaCurve3d.d.ts +19 -6
  8. package/lib/cjs/bspline/AkimaCurve3d.d.ts.map +1 -1
  9. package/lib/cjs/bspline/AkimaCurve3d.js +21 -5
  10. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  11. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurve.d.ts +3 -3
  13. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  14. package/lib/cjs/bspline/BSplineCurve.js +6 -6
  15. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  16. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  17. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  18. package/lib/cjs/bspline/BSplineCurveOps.js +1 -1
  19. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  20. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  21. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  22. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  23. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  24. package/lib/cjs/bspline/BezierCurveBase.d.ts +2 -2
  25. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  26. package/lib/cjs/bspline/BezierCurveBase.js +4 -6
  27. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  28. package/lib/cjs/bspline/InterpolationCurve3d.d.ts +27 -17
  29. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  30. package/lib/cjs/bspline/InterpolationCurve3d.js +17 -7
  31. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  32. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  33. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  34. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  35. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  36. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  37. package/lib/cjs/clipping/ClipPlane.d.ts +19 -6
  38. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  39. package/lib/cjs/clipping/ClipPlane.js +17 -2
  40. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  41. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  42. package/lib/cjs/clipping/ClipUtils.d.ts +14 -1
  43. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  44. package/lib/cjs/clipping/ClipUtils.js +21 -3
  45. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  46. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  47. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +14 -11
  48. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  49. package/lib/cjs/clipping/ConvexClipPlaneSet.js +23 -16
  50. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  51. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  52. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  53. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  54. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  55. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  56. package/lib/cjs/core-geometry.js.map +1 -1
  57. package/lib/cjs/curve/Arc3d.d.ts +27 -17
  58. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  59. package/lib/cjs/curve/Arc3d.js +61 -35
  60. package/lib/cjs/curve/Arc3d.js.map +1 -1
  61. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  62. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  63. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  64. package/lib/cjs/curve/CurveCollection.d.ts +1 -0
  65. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  66. package/lib/cjs/curve/CurveCollection.js +1 -0
  67. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  68. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  69. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  70. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  71. package/lib/cjs/curve/CurveLocationDetail.d.ts +8 -7
  72. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  73. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  74. package/lib/cjs/curve/CurveOps.d.ts +51 -1
  75. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  76. package/lib/cjs/curve/CurveOps.js +97 -3
  77. package/lib/cjs/curve/CurveOps.js.map +1 -1
  78. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  79. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  80. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  81. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  82. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  83. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  84. package/lib/cjs/curve/LineString3d.d.ts +4 -4
  85. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  86. package/lib/cjs/curve/LineString3d.js +8 -8
  87. package/lib/cjs/curve/LineString3d.js.map +1 -1
  88. package/lib/cjs/curve/Loop.js.map +1 -1
  89. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  90. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  91. package/lib/cjs/curve/Path.js.map +1 -1
  92. package/lib/cjs/curve/PointString3d.js.map +1 -1
  93. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  94. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
  95. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  96. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  97. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  98. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  99. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +6 -2
  100. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  101. package/lib/cjs/curve/Query/PlanarSubdivision.js +12 -7
  102. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  103. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  104. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  105. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  106. package/lib/cjs/curve/RegionOps.d.ts +9 -4
  107. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  108. package/lib/cjs/curve/RegionOps.js +10 -5
  109. package/lib/cjs/curve/RegionOps.js.map +1 -1
  110. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  111. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  112. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  113. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  114. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  115. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  116. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  117. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  118. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  119. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  120. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  121. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  122. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
  123. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  124. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  125. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  126. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  127. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  128. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  129. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -4
  130. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  131. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +21 -18
  132. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  133. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  134. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  135. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  136. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +30 -50
  137. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  138. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  139. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  140. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  141. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  142. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  143. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  144. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  145. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  146. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  147. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  148. package/lib/cjs/curve/spiral/DirectSpiral3d.js +6 -2
  149. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  150. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  151. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  152. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +6 -2
  153. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  154. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  155. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  156. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  157. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  158. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +5 -1
  159. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  160. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +0 -3
  161. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  162. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  163. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  164. package/lib/cjs/geometry3d/AngleSweep.d.ts +6 -2
  165. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  166. package/lib/cjs/geometry3d/AngleSweep.js +12 -3
  167. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  168. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  169. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  170. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  171. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  172. package/lib/cjs/geometry3d/FrameBuilder.d.ts +2 -1
  173. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  174. package/lib/cjs/geometry3d/FrameBuilder.js +14 -18
  175. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  176. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  177. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  178. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  179. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  180. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  181. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  182. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  183. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  184. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  185. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  186. package/lib/cjs/geometry3d/Matrix3d.d.ts +1 -1
  187. package/lib/cjs/geometry3d/Matrix3d.js +1 -1
  188. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  189. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  190. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  191. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  192. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  193. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  194. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +18 -2
  195. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  196. package/lib/cjs/geometry3d/Point2dVector2d.js +37 -4
  197. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  198. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  199. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  200. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  201. package/lib/cjs/geometry3d/Point3dVector3d.js +1 -0
  202. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  203. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  204. package/lib/cjs/geometry3d/PointStreaming.d.ts +8 -0
  205. package/lib/cjs/geometry3d/PointStreaming.d.ts.map +1 -1
  206. package/lib/cjs/geometry3d/PointStreaming.js +18 -2
  207. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  208. package/lib/cjs/geometry3d/PolygonOps.d.ts +18 -9
  209. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  210. package/lib/cjs/geometry3d/PolygonOps.js +53 -26
  211. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  212. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
  213. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  214. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
  215. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  216. package/lib/cjs/geometry3d/PolylineOps.d.ts +14 -3
  217. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  218. package/lib/cjs/geometry3d/PolylineOps.js +20 -4
  219. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  220. package/lib/cjs/geometry3d/Range.d.ts +34 -32
  221. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  222. package/lib/cjs/geometry3d/Range.js +28 -21
  223. package/lib/cjs/geometry3d/Range.js.map +1 -1
  224. package/lib/cjs/geometry3d/Ray2d.d.ts +16 -6
  225. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  226. package/lib/cjs/geometry3d/Ray2d.js +28 -4
  227. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  228. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  229. package/lib/cjs/geometry3d/Ray3d.js +3 -4
  230. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  231. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  232. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  233. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  234. package/lib/cjs/geometry3d/Transform.d.ts +1 -1
  235. package/lib/cjs/geometry3d/Transform.js +1 -1
  236. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  237. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  238. package/lib/cjs/geometry3d/XYZProps.d.ts +12 -1
  239. package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
  240. package/lib/cjs/geometry3d/XYZProps.js +17 -2
  241. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  242. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  243. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  244. package/lib/cjs/geometry4d/Matrix4d.d.ts +16 -0
  245. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  246. package/lib/cjs/geometry4d/Matrix4d.js +26 -0
  247. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  248. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  249. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  250. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  251. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  252. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  253. package/lib/cjs/numerics/BezierPolynomials.js +5 -9
  254. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  255. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  256. package/lib/cjs/numerics/Complex.js.map +1 -1
  257. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  258. package/lib/cjs/numerics/Newton.js.map +1 -1
  259. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  260. package/lib/cjs/numerics/PolarData.js.map +1 -1
  261. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  262. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  263. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  264. package/lib/cjs/numerics/SmallSystem.d.ts +13 -7
  265. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  266. package/lib/cjs/numerics/SmallSystem.js +13 -7
  267. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  268. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  269. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  270. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  271. package/lib/cjs/polyface/AuxData.js.map +1 -1
  272. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  273. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  274. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  275. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  276. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  277. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  278. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  279. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  280. package/lib/cjs/polyface/Polyface.d.ts +1 -3
  281. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  282. package/lib/cjs/polyface/Polyface.js +2 -6
  283. package/lib/cjs/polyface/Polyface.js.map +1 -1
  284. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +25 -6
  285. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  286. package/lib/cjs/polyface/PolyfaceBuilder.js +59 -8
  287. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  288. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  289. package/lib/cjs/polyface/PolyfaceData.d.ts +2 -0
  290. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  291. package/lib/cjs/polyface/PolyfaceData.js +7 -3
  292. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  293. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  294. package/lib/cjs/polyface/PolyfaceQuery.js +8 -10
  295. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  296. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  297. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  298. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  299. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
  300. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
  301. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
  302. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  303. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
  304. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
  305. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
  306. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  307. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
  308. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  309. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +9 -12
  310. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  311. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
  312. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  313. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
  314. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  315. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  316. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  317. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  318. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  319. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  320. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  321. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  322. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  323. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  324. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  325. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  326. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  327. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  328. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  329. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  330. package/lib/cjs/serialization/DeepCompare.js +1 -1
  331. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  332. package/lib/cjs/serialization/GeometrySamples.d.ts +2 -1
  333. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  334. package/lib/cjs/serialization/GeometrySamples.js +2 -1
  335. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  336. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  337. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  338. package/lib/cjs/solid/Box.js.map +1 -1
  339. package/lib/cjs/solid/Cone.js.map +1 -1
  340. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  341. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  342. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  343. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  344. package/lib/cjs/solid/Sphere.js.map +1 -1
  345. package/lib/cjs/solid/SweepContour.js.map +1 -1
  346. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  347. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  348. package/lib/cjs/topology/Graph.d.ts +38 -12
  349. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  350. package/lib/cjs/topology/Graph.js +91 -23
  351. package/lib/cjs/topology/Graph.js.map +1 -1
  352. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
  353. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
  354. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
  355. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  356. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +20 -11
  357. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  358. package/lib/cjs/topology/HalfEdgeGraphSearch.js +43 -39
  359. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  360. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  361. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  362. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  363. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  364. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  365. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  366. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  367. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  368. package/lib/cjs/topology/MaskManager.js.map +1 -1
  369. package/lib/cjs/topology/Merging.d.ts +7 -4
  370. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  371. package/lib/cjs/topology/Merging.js +16 -11
  372. package/lib/cjs/topology/Merging.js.map +1 -1
  373. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  374. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  375. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  376. package/lib/cjs/topology/Triangulation.d.ts +13 -11
  377. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  378. package/lib/cjs/topology/Triangulation.js +40 -36
  379. package/lib/cjs/topology/Triangulation.js.map +1 -1
  380. package/lib/cjs/topology/Voronoi.d.ts +195 -0
  381. package/lib/cjs/topology/Voronoi.d.ts.map +1 -0
  382. package/lib/cjs/topology/Voronoi.js +700 -0
  383. package/lib/cjs/topology/Voronoi.js.map +1 -0
  384. package/lib/cjs/topology/XYParitySearchContext.d.ts +1 -1
  385. package/lib/cjs/topology/XYParitySearchContext.d.ts.map +1 -1
  386. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  387. package/lib/esm/Constant.js.map +1 -1
  388. package/lib/esm/Geometry.d.ts +30 -10
  389. package/lib/esm/Geometry.d.ts.map +1 -1
  390. package/lib/esm/Geometry.js +74 -10
  391. package/lib/esm/Geometry.js.map +1 -1
  392. package/lib/esm/bspline/AkimaCurve3d.d.ts +19 -6
  393. package/lib/esm/bspline/AkimaCurve3d.d.ts.map +1 -1
  394. package/lib/esm/bspline/AkimaCurve3d.js +21 -5
  395. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  396. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  397. package/lib/esm/bspline/BSplineCurve.d.ts +3 -3
  398. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  399. package/lib/esm/bspline/BSplineCurve.js +6 -6
  400. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  401. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  402. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  403. package/lib/esm/bspline/BSplineCurveOps.js +1 -1
  404. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  405. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  406. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  407. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  408. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  409. package/lib/esm/bspline/BezierCurveBase.d.ts +2 -2
  410. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  411. package/lib/esm/bspline/BezierCurveBase.js +4 -6
  412. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  413. package/lib/esm/bspline/InterpolationCurve3d.d.ts +27 -17
  414. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  415. package/lib/esm/bspline/InterpolationCurve3d.js +17 -7
  416. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  417. package/lib/esm/bspline/KnotVector.js.map +1 -1
  418. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  419. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  420. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  421. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  422. package/lib/esm/clipping/ClipPlane.d.ts +19 -6
  423. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  424. package/lib/esm/clipping/ClipPlane.js +17 -2
  425. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  426. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  427. package/lib/esm/clipping/ClipUtils.d.ts +14 -1
  428. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  429. package/lib/esm/clipping/ClipUtils.js +21 -3
  430. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  431. package/lib/esm/clipping/ClipVector.js.map +1 -1
  432. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +14 -11
  433. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  434. package/lib/esm/clipping/ConvexClipPlaneSet.js +23 -16
  435. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  436. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  437. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  438. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  439. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  440. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  441. package/lib/esm/core-geometry.js.map +1 -1
  442. package/lib/esm/curve/Arc3d.d.ts +27 -17
  443. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  444. package/lib/esm/curve/Arc3d.js +61 -35
  445. package/lib/esm/curve/Arc3d.js.map +1 -1
  446. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  447. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  448. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  449. package/lib/esm/curve/CurveCollection.d.ts +1 -0
  450. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  451. package/lib/esm/curve/CurveCollection.js +1 -0
  452. package/lib/esm/curve/CurveCollection.js.map +1 -1
  453. package/lib/esm/curve/CurveCurve.js.map +1 -1
  454. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  455. package/lib/esm/curve/CurveFactory.js.map +1 -1
  456. package/lib/esm/curve/CurveLocationDetail.d.ts +8 -7
  457. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  458. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  459. package/lib/esm/curve/CurveOps.d.ts +51 -1
  460. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  461. package/lib/esm/curve/CurveOps.js +98 -4
  462. package/lib/esm/curve/CurveOps.js.map +1 -1
  463. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  464. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  465. package/lib/esm/curve/CurveTypes.js.map +1 -1
  466. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  467. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  468. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  469. package/lib/esm/curve/LineString3d.d.ts +4 -4
  470. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  471. package/lib/esm/curve/LineString3d.js +8 -8
  472. package/lib/esm/curve/LineString3d.js.map +1 -1
  473. package/lib/esm/curve/Loop.js.map +1 -1
  474. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  475. package/lib/esm/curve/ParityRegion.js.map +1 -1
  476. package/lib/esm/curve/Path.js.map +1 -1
  477. package/lib/esm/curve/PointString3d.js.map +1 -1
  478. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  479. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
  480. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  481. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  482. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  483. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  484. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +6 -2
  485. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  486. package/lib/esm/curve/Query/PlanarSubdivision.js +12 -7
  487. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  488. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  489. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  490. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  491. package/lib/esm/curve/RegionOps.d.ts +9 -4
  492. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  493. package/lib/esm/curve/RegionOps.js +10 -5
  494. package/lib/esm/curve/RegionOps.js.map +1 -1
  495. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  496. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  497. package/lib/esm/curve/UnionRegion.js.map +1 -1
  498. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  499. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  500. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  501. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  502. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  503. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  504. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  505. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  506. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  507. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
  508. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  509. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  510. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  511. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  512. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  513. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  514. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -4
  515. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  516. package/lib/esm/curve/internalContexts/MultiChainCollector.js +21 -18
  517. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  518. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  519. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  520. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  521. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +30 -50
  522. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  523. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  524. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  525. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  526. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  527. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  528. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  529. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  530. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  531. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  532. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  533. package/lib/esm/curve/spiral/DirectSpiral3d.js +6 -2
  534. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  535. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  536. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  537. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +6 -2
  538. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  539. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  540. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  541. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  542. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  543. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +5 -1
  544. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  545. package/lib/esm/curve/spiral/TransitionSpiral3d.js +0 -3
  546. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  547. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  548. package/lib/esm/geometry3d/Angle.js.map +1 -1
  549. package/lib/esm/geometry3d/AngleSweep.d.ts +6 -2
  550. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  551. package/lib/esm/geometry3d/AngleSweep.js +12 -3
  552. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  553. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  554. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  555. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  556. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  557. package/lib/esm/geometry3d/FrameBuilder.d.ts +2 -1
  558. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  559. package/lib/esm/geometry3d/FrameBuilder.js +14 -18
  560. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  561. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  562. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  563. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  564. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  565. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  566. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  567. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  568. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  569. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  570. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  571. package/lib/esm/geometry3d/Matrix3d.d.ts +1 -1
  572. package/lib/esm/geometry3d/Matrix3d.js +1 -1
  573. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  574. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  575. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  576. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  577. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  578. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  579. package/lib/esm/geometry3d/Point2dVector2d.d.ts +18 -2
  580. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  581. package/lib/esm/geometry3d/Point2dVector2d.js +37 -4
  582. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  583. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  584. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  585. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  586. package/lib/esm/geometry3d/Point3dVector3d.js +1 -0
  587. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  588. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  589. package/lib/esm/geometry3d/PointStreaming.d.ts +8 -0
  590. package/lib/esm/geometry3d/PointStreaming.d.ts.map +1 -1
  591. package/lib/esm/geometry3d/PointStreaming.js +18 -2
  592. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  593. package/lib/esm/geometry3d/PolygonOps.d.ts +18 -9
  594. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  595. package/lib/esm/geometry3d/PolygonOps.js +53 -26
  596. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  597. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
  598. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  599. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
  600. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  601. package/lib/esm/geometry3d/PolylineOps.d.ts +14 -3
  602. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  603. package/lib/esm/geometry3d/PolylineOps.js +20 -4
  604. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  605. package/lib/esm/geometry3d/Range.d.ts +34 -32
  606. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  607. package/lib/esm/geometry3d/Range.js +28 -21
  608. package/lib/esm/geometry3d/Range.js.map +1 -1
  609. package/lib/esm/geometry3d/Ray2d.d.ts +16 -6
  610. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  611. package/lib/esm/geometry3d/Ray2d.js +28 -4
  612. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  613. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  614. package/lib/esm/geometry3d/Ray3d.js +3 -4
  615. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  616. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  617. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  618. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  619. package/lib/esm/geometry3d/Transform.d.ts +1 -1
  620. package/lib/esm/geometry3d/Transform.js +1 -1
  621. package/lib/esm/geometry3d/Transform.js.map +1 -1
  622. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  623. package/lib/esm/geometry3d/XYZProps.d.ts +12 -1
  624. package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
  625. package/lib/esm/geometry3d/XYZProps.js +16 -1
  626. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  627. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  628. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  629. package/lib/esm/geometry4d/Matrix4d.d.ts +16 -0
  630. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  631. package/lib/esm/geometry4d/Matrix4d.js +26 -0
  632. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  633. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  634. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  635. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  636. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  637. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  638. package/lib/esm/numerics/BezierPolynomials.js +5 -9
  639. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  640. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  641. package/lib/esm/numerics/Complex.js.map +1 -1
  642. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  643. package/lib/esm/numerics/Newton.js.map +1 -1
  644. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  645. package/lib/esm/numerics/PolarData.js.map +1 -1
  646. package/lib/esm/numerics/Polynomials.js.map +1 -1
  647. package/lib/esm/numerics/Quadrature.js.map +1 -1
  648. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  649. package/lib/esm/numerics/SmallSystem.d.ts +13 -7
  650. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  651. package/lib/esm/numerics/SmallSystem.js +13 -7
  652. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  653. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  654. package/lib/esm/numerics/UnionFind.js.map +1 -1
  655. package/lib/esm/numerics/UsageSums.js.map +1 -1
  656. package/lib/esm/polyface/AuxData.js.map +1 -1
  657. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  658. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  659. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  660. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  661. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  662. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  663. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  664. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  665. package/lib/esm/polyface/Polyface.d.ts +1 -3
  666. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  667. package/lib/esm/polyface/Polyface.js +2 -6
  668. package/lib/esm/polyface/Polyface.js.map +1 -1
  669. package/lib/esm/polyface/PolyfaceBuilder.d.ts +25 -6
  670. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  671. package/lib/esm/polyface/PolyfaceBuilder.js +59 -8
  672. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  673. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  674. package/lib/esm/polyface/PolyfaceData.d.ts +2 -0
  675. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  676. package/lib/esm/polyface/PolyfaceData.js +7 -3
  677. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  678. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  679. package/lib/esm/polyface/PolyfaceQuery.js +8 -10
  680. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  681. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  682. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  683. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  684. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
  685. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
  686. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
  687. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  688. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
  689. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
  690. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
  691. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  692. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
  693. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  694. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +9 -12
  695. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  696. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
  697. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  698. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
  699. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  700. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  701. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  702. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  703. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  704. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  705. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  706. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  707. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  708. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  709. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  710. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  711. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  712. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  713. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  714. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  715. package/lib/esm/serialization/DeepCompare.js +1 -1
  716. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  717. package/lib/esm/serialization/GeometrySamples.d.ts +2 -1
  718. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  719. package/lib/esm/serialization/GeometrySamples.js +2 -1
  720. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  721. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  722. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  723. package/lib/esm/solid/Box.js.map +1 -1
  724. package/lib/esm/solid/Cone.js.map +1 -1
  725. package/lib/esm/solid/LinearSweep.js.map +1 -1
  726. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  727. package/lib/esm/solid/RuledSweep.js.map +1 -1
  728. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  729. package/lib/esm/solid/Sphere.js.map +1 -1
  730. package/lib/esm/solid/SweepContour.js.map +1 -1
  731. package/lib/esm/solid/TorusPipe.js.map +1 -1
  732. package/lib/esm/topology/ChainMerge.js.map +1 -1
  733. package/lib/esm/topology/Graph.d.ts +38 -12
  734. package/lib/esm/topology/Graph.d.ts.map +1 -1
  735. package/lib/esm/topology/Graph.js +92 -24
  736. package/lib/esm/topology/Graph.js.map +1 -1
  737. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
  738. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
  739. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
  740. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  741. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +20 -11
  742. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  743. package/lib/esm/topology/HalfEdgeGraphSearch.js +43 -39
  744. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  745. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  746. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  747. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  748. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  749. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  750. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  751. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  752. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  753. package/lib/esm/topology/MaskManager.js.map +1 -1
  754. package/lib/esm/topology/Merging.d.ts +7 -4
  755. package/lib/esm/topology/Merging.d.ts.map +1 -1
  756. package/lib/esm/topology/Merging.js +17 -12
  757. package/lib/esm/topology/Merging.js.map +1 -1
  758. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  759. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  760. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  761. package/lib/esm/topology/Triangulation.d.ts +13 -11
  762. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  763. package/lib/esm/topology/Triangulation.js +40 -36
  764. package/lib/esm/topology/Triangulation.js.map +1 -1
  765. package/lib/esm/topology/Voronoi.d.ts +195 -0
  766. package/lib/esm/topology/Voronoi.d.ts.map +1 -0
  767. package/lib/esm/topology/Voronoi.js +696 -0
  768. package/lib/esm/topology/Voronoi.js.map +1 -0
  769. package/lib/esm/topology/XYParitySearchContext.d.ts +1 -1
  770. package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
  771. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  772. package/package.json +3 -3
@@ -0,0 +1,700 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Bspline
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Voronoi = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const ClipPlane_1 = require("../clipping/ClipPlane");
13
+ const ConvexClipPlaneSet_1 = require("../clipping/ConvexClipPlaneSet");
14
+ const UnionOfConvexClipPlaneSets_1 = require("../clipping/UnionOfConvexClipPlaneSets");
15
+ const Arc3d_1 = require("../curve/Arc3d");
16
+ const CurveCurve_1 = require("../curve/CurveCurve");
17
+ const CurveOps_1 = require("../curve/CurveOps");
18
+ const LineSegment3d_1 = require("../curve/LineSegment3d");
19
+ const LineString3d_1 = require("../curve/LineString3d");
20
+ const StrokeOptions_1 = require("../curve/StrokeOptions");
21
+ const Geometry_1 = require("../Geometry");
22
+ const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
23
+ const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
24
+ const PolylineOps_1 = require("../geometry3d/PolylineOps");
25
+ const Range_1 = require("../geometry3d/Range");
26
+ const Ray2d_1 = require("../geometry3d/Ray2d");
27
+ const Ray3d_1 = require("../geometry3d/Ray3d");
28
+ const XYZProps_1 = require("../geometry3d/XYZProps");
29
+ const Graph_1 = require("./Graph");
30
+ const HalfEdgeGraphSearch_1 = require("./HalfEdgeGraphSearch");
31
+ const Merging_1 = require("./Merging");
32
+ const Triangulation_1 = require("./Triangulation");
33
+ /**
34
+ * A class to represent a Voronoi diagram in the xy-plane.
35
+ * * A Voronoi diagram is a partitioning of the plane into regions of points closest to a given generating point or curve.
36
+ * * It is constructed from the circumcenters of its dual Delaunay triangulation.
37
+ * * Static construction methods take Delaunay, points, and CurveChain input.
38
+ * * More info can be found here: https://en.wikipedia.org/wiki/Voronoi_diagram and
39
+ * https://en.wikipedia.org/wiki/Delaunay_triangulation
40
+ * @internal
41
+ */
42
+ class Voronoi {
43
+ _voronoiGraph;
44
+ _inputGraph;
45
+ _inputGraphIsTriangulation;
46
+ _inputGraphRange;
47
+ _idToIndexMap;
48
+ _circumcenterMap;
49
+ _circumcenterRange;
50
+ _isCurveBased;
51
+ _superFaceMask;
52
+ static _workXY0 = Point2dVector2d_1.Point2d.createZero();
53
+ static _workXY1 = Point2dVector2d_1.Point2d.createZero();
54
+ static _workRay = Ray2d_1.Ray2d.createZero();
55
+ static _workArc = Arc3d_1.Arc3d.createUnitCircle();
56
+ /** Construct an empty Voronoi graph and minimally validate input (use [[isValid]] to check). */
57
+ constructor(inputGraph, isColinear = false) {
58
+ this._voronoiGraph = new Graph_1.HalfEdgeGraph();
59
+ this._inputGraph = inputGraph;
60
+ this._inputGraphRange = Merging_1.HalfEdgeGraphOps.graphRangeXY(inputGraph);
61
+ this._idToIndexMap = inputGraph.constructIdToVertexIndexMap();
62
+ this._circumcenterMap = new Map();
63
+ this._inputGraphIsTriangulation = isColinear ? false : this.populateCircumcenters(this._circumcenterMap);
64
+ this._circumcenterRange = Range_1.Range2d.createArray(Array.from(this._circumcenterMap.values()));
65
+ this._isCurveBased = false;
66
+ this._superFaceMask = Graph_1.HalfEdgeMask.NULL_MASK;
67
+ }
68
+ /**
69
+ * Accessor for the graph passed into the private constructor.
70
+ * * It is either a triangulation (assumed Delaunay) or a graph with no interior faces (assumed colinear path).
71
+ */
72
+ get getInputGraph() {
73
+ return this._inputGraph;
74
+ }
75
+ /** Accessor for the input graph's range */
76
+ get getInputGraphRange() {
77
+ return this._inputGraphRange;
78
+ }
79
+ /**
80
+ * Accessor for the Voronoi graph constructed from the input graph.
81
+ * * The Voronoi graph is typically constructed by static createFromXXX methods.
82
+ */
83
+ get getVoronoiGraph() {
84
+ return this._voronoiGraph;
85
+ }
86
+ /** Whether or not this instance represents a curve-based Voronoi diagram. */
87
+ get isCurveBased() {
88
+ return this._isCurveBased;
89
+ }
90
+ /** Accessor for the super face mask used for constructing a curve-based Voronoi diagram. */
91
+ get getSuperFaceMask() {
92
+ return this._superFaceMask;
93
+ }
94
+ /** Whether the constructor has created a minimally valid instance. */
95
+ get isValid() {
96
+ if (this._inputGraph.allHalfEdges.length < 2)
97
+ return false;
98
+ if (this._idToIndexMap.size === 0)
99
+ return false;
100
+ if (!this._inputGraphIsTriangulation)
101
+ return true;
102
+ return this._circumcenterMap.size > 0;
103
+ }
104
+ /** Add an edge to the graph and set its edgeTags. */
105
+ static addEdgeWithEdgeTags(graph, p0, p1, edgeTag0, edgeTag1) {
106
+ return graph.addEdgeXY(p0.x, p0.y, p1.x, p1.y, edgeTag0, edgeTag1);
107
+ }
108
+ /** Add an edge to the graph and set its faceTags. */
109
+ static addEdgeWithFaceTags(graph, p0, p1, faceTag0, faceTag1) {
110
+ return graph.addEdgeXY(p0.x, p0.y, p1.x, p1.y, undefined, undefined, faceTag0, faceTag1);
111
+ }
112
+ /** Return the smallest HalfEdge id in the face, or -1 if not a triangle. */
113
+ getTriangleId(face) {
114
+ if (face !== face.faceSuccessor.faceSuccessor.faceSuccessor)
115
+ return -1;
116
+ return Math.min(face.id, face.faceSuccessor.id, face.facePredecessor.id);
117
+ }
118
+ /**
119
+ * Populate a mapping from a triangle's id to its circumcircle.
120
+ * @returns whether the input graph is a triangulation.
121
+ */
122
+ populateCircumcenters(circumcenterMap) {
123
+ circumcenterMap.clear();
124
+ let isValid = true;
125
+ const p0 = Point3dVector3d_1.Point3d.createZero();
126
+ const p1 = Point3dVector3d_1.Point3d.createZero();
127
+ const p2 = Point3dVector3d_1.Point3d.createZero();
128
+ this._inputGraph.announceFaceLoops((_g, face) => {
129
+ if (face.isMaskSet(Graph_1.HalfEdgeMask.EXTERIOR))
130
+ return true;
131
+ if (face.countEdgesAroundFace() !== 3)
132
+ return isValid = false;
133
+ face.getPoint3d(p0);
134
+ face.faceSuccessor.getPoint3d(p1);
135
+ face.facePredecessor.getPoint3d(p2);
136
+ p0.z = p1.z = p2.z = 0;
137
+ const circumcircle = Arc3d_1.Arc3d.createCircularStartMiddleEnd(p0, p1, p2, Voronoi._workArc);
138
+ if (circumcircle instanceof Arc3d_1.Arc3d) // ignore a degenerate triangle
139
+ circumcenterMap.set(this.getTriangleId(face), circumcircle.center); // getter clones center
140
+ return true;
141
+ });
142
+ if (!isValid)
143
+ circumcenterMap.clear();
144
+ return isValid;
145
+ }
146
+ /**
147
+ * Return a segment along the bisector of the given triangle edge with the following properties:
148
+ * * start point is the triangle's circumcenter
149
+ * * end point is on the Voronoi boundary
150
+ * * direction vector has positive dot product with the vector from triangle centroid to edge midpoint
151
+ * @returns bisector segment, or undefined if the triangle circumcenter lies outside the Voronoi boundary
152
+ */
153
+ getTriangleEdgeBisector(edge, circumcenter, box) {
154
+ const v0 = edge;
155
+ const v1 = edge.faceSuccessor;
156
+ const v2 = edge.facePredecessor;
157
+ const oneThird = 1.0 / 3.0;
158
+ const midPoint = Point2dVector2d_1.Point2d.createAdd2ScaledXY(v0.x, v0.y, 0.5, v1.x, v1.y, 0.5);
159
+ const centroid = Point2dVector2d_1.Point2d.createAdd3ScaledXY(v0.x, v0.y, oneThird, v1.x, v1.y, oneThird, v2.x, v2.y, oneThird);
160
+ const direction = Point2dVector2d_1.Vector2d.createStartEnd(circumcenter, midPoint);
161
+ if (midPoint.dotVectorsToTargets(circumcenter, centroid) < 0)
162
+ direction.negate(direction); // ensure direction points away from triangle
163
+ const bisector = Ray2d_1.Ray2d.createOriginAndDirectionCapture(Point2dVector2d_1.Point2d.createFrom(circumcenter), direction, Voronoi._workRay);
164
+ const fractions = box.intersect(bisector);
165
+ const haveTwoIntersections = undefined !== fractions && fractions.length === 2;
166
+ if (!haveTwoIntersections || (fractions[0] <= 0 && fractions[1] <= 0) || (fractions[0] >= 1 && fractions[1] >= 1))
167
+ return undefined; // bisector ray lies outside box
168
+ const start = bisector.fractionToPoint(Geometry_1.Geometry.clamp(fractions[0], 0, 1), Voronoi._workXY0);
169
+ const end = bisector.fractionToPoint(fractions[1], Voronoi._workXY1);
170
+ return { start, end };
171
+ }
172
+ /** Add the edge of an unbounded Voronoi region that corresponds to a Delaunay boundary edge; clip it at the boundary. */
173
+ addVoronoiEdgeForDelaunayBoundaryEdge(edge, box) {
174
+ const triangleId = this.getTriangleId(edge);
175
+ if (triangleId < 0)
176
+ return false; // invalid graph (not a triangulation)
177
+ const circumcenter = this._circumcenterMap.get(triangleId);
178
+ if (!circumcenter)
179
+ return true; // skip Delaunay edge (degenerate boundary triangle)
180
+ const bisector = this.getTriangleEdgeBisector(edge, circumcenter, box);
181
+ if (!bisector)
182
+ return true; // skip Delaunay edge (bisector ray outside box)
183
+ const faceTag0 = this._idToIndexMap.get(edge.edgeMate.id);
184
+ const faceTag1 = this._idToIndexMap.get(edge.id);
185
+ Voronoi.addEdgeWithFaceTags(this._voronoiGraph, bisector.start, bisector.end, faceTag0, faceTag1);
186
+ return true;
187
+ }
188
+ /** Add the edge of a bounded Voronoi region that corresponds to a Delaunay interior edge. */
189
+ addVoronoiEdgeForDelaunayInteriorEdge(edge, box, distanceTol) {
190
+ const triangleId0 = this.getTriangleId(edge);
191
+ const triangleId1 = this.getTriangleId(edge.edgeMate);
192
+ if (triangleId0 < 0 || triangleId1 < 0)
193
+ return false; // invalid graph (not a triangulation)
194
+ const circumcenter0 = this._circumcenterMap.get(triangleId0);
195
+ const circumcenter1 = this._circumcenterMap.get(triangleId1);
196
+ if (!circumcenter0 && !circumcenter1)
197
+ return true; // skip Delaunay edge between degenerate triangles
198
+ if (!circumcenter0 || !circumcenter1) {
199
+ // only one triangle is degenerate; if it is a boundary triangle, treat the opposite edge as a boundary
200
+ if (!circumcenter0 && edge.findMaskAroundFace(Graph_1.HalfEdgeMask.BOUNDARY_EDGE))
201
+ return this.addVoronoiEdgeForDelaunayBoundaryEdge(edge.edgeMate, box);
202
+ if (!circumcenter1 && edge.edgeMate.findMaskAroundFace(Graph_1.HalfEdgeMask.BOUNDARY_EDGE))
203
+ return this.addVoronoiEdgeForDelaunayBoundaryEdge(edge, box);
204
+ return false; // invalid graph (interior degenerate triangle)
205
+ }
206
+ if (XYZProps_1.XAndY.almostEqual(circumcenter0, circumcenter1, distanceTol))
207
+ return true; // skip trivial Voronoi edge (it will collapse during clustering)
208
+ const segment = Ray2d_1.Ray2d.createOriginAndTarget(circumcenter0, circumcenter1, Voronoi._workRay);
209
+ const fractions = box.intersect(segment);
210
+ const haveTwoIntersections = undefined !== fractions && fractions.length === 2;
211
+ if (!haveTwoIntersections || (fractions[0] <= 0 && fractions[1] <= 0) || (fractions[0] >= 1 && fractions[1] >= 1))
212
+ return true; // skip Delaunay edge whose Voronoi segment is outside box
213
+ const pt0 = segment.fractionToPoint(Geometry_1.Geometry.clamp(fractions[0], 0, 1), Voronoi._workXY0);
214
+ const pt1 = segment.fractionToPoint(Geometry_1.Geometry.clamp(fractions[1], 0, 1), Voronoi._workXY1);
215
+ const faceTag0 = this._idToIndexMap.get(edge.edgeMate.id);
216
+ const faceTag1 = this._idToIndexMap.get(edge.id);
217
+ Voronoi.addEdgeWithFaceTags(this._voronoiGraph, pt0, pt1, faceTag0, faceTag1);
218
+ return true;
219
+ }
220
+ /** Mask the exterior face, and set missing interior face tags */
221
+ populateMasksAndFaceTags() {
222
+ this._voronoiGraph.announceFaceLoops((_g, face) => {
223
+ let faceTag;
224
+ let edge = face;
225
+ do { // look around the face for a faceTag
226
+ faceTag = edge.faceTag;
227
+ edge = edge.faceSuccessor;
228
+ } while (faceTag === undefined && edge !== face);
229
+ if (faceTag !== undefined) // ensure faceTag is set around the interior face
230
+ face.announceEdgesInFace((e) => e.faceTag = faceTag);
231
+ else // mask the edges of the exterior face
232
+ face.announceEdgesInFace((e) => { e.setMask(Graph_1.HalfEdgeMask.EXTERIOR); e.setMaskAroundEdge(Graph_1.HalfEdgeMask.BOUNDARY_EDGE); });
233
+ return true;
234
+ });
235
+ }
236
+ /**
237
+ * Construct a Voronoi instance from a Delaunay triangulation.
238
+ * * The Delaunay generating vertex `v` for a returned Voronoi region `R` is encoded thusly:
239
+ * * For each [[HalfEdge]] `e` in the face loop of `R`, `delaunayGraph.allHalfEdges[e.faceTag]` is a HalfEdge in the
240
+ * vertex loop of `v`.
241
+ * * The same `faceTag` is assigned to all HalfEdges in the face loop of `R`.
242
+ * * For best results:
243
+ * * The input triangulation should be Delaunay and have convex boundary.
244
+ * * Each HalfEdge in the exterior face loop of the input graph should have `HalfEdgeMask.BOUNDARY_EDGE` set on both edge mates.
245
+ * * Each HalfEdge in the exterior face loop of the input graph should have `HalfEdgeMask.EXTERIOR` set.
246
+ * * The input graph should not contain any pair of vertices closer than `distanceTol`.
247
+ * * The input graph should not contain any triangle altitude smaller than `distanceTol` (this is a degenerate triangle).
248
+ * @param delaunayGraph A HalfEdgeGraph representing a Delaunay triangulation. Z-coordinates are ignored.
249
+ * @param distanceTol Optional distance tolerance to use when comparing points; default is `Geometry.smallMetricDistance`.
250
+ * @param boundingBox Optional nominal xy-bounding box for the Voronoi diagram. Default uses the Delaunay circumcenter range so
251
+ * that interior Voronoi regions are maximal.
252
+ * @returns a new instance containing the Voronoi diagram derived from the input graph, or `undefined` if invalid input.
253
+ */
254
+ static createFromDelaunayGraph(delaunayGraph, distanceTol = Geometry_1.Geometry.smallMetricDistance, boundingBox) {
255
+ const instance = new Voronoi(delaunayGraph);
256
+ if (!instance.isValid)
257
+ return undefined;
258
+ let isValidVoronoi = true;
259
+ const box = new VoronoiBoundary(instance._inputGraphRange, boundingBox ? boundingBox : instance._circumcenterRange);
260
+ // iterate Delaunay edges and add Voronoi edges:
261
+ // * for each boundary edge, add a bisector separating unbounded Voronoi cells
262
+ // * for each interior edge, add a segment joining the adjacent triangles' circumcenters
263
+ instance._inputGraph.announceEdges((_g, edge) => {
264
+ if (edge.isMaskSet(Graph_1.HalfEdgeMask.BOUNDARY_EDGE)) {
265
+ if (edge.isMaskSet(Graph_1.HalfEdgeMask.EXTERIOR))
266
+ edge = edge.edgeMate;
267
+ return isValidVoronoi = instance.addVoronoiEdgeForDelaunayBoundaryEdge(edge, box);
268
+ }
269
+ return isValidVoronoi = instance.addVoronoiEdgeForDelaunayInteriorEdge(edge, box, distanceTol);
270
+ });
271
+ if (!isValidVoronoi)
272
+ return undefined;
273
+ box.addEdgesToGraph(instance._voronoiGraph);
274
+ Merging_1.HalfEdgeGraphMerge.splitIntersectingEdges(instance._voronoiGraph, distanceTol);
275
+ Merging_1.HalfEdgeGraphMerge.clusterAndMergeXYTheta(instance._voronoiGraph, undefined, distanceTol);
276
+ instance.populateMasksAndFaceTags();
277
+ return instance;
278
+ }
279
+ /** Create a graph from ordered colinear points; optional Dictionary supplies edgeTag for the HalfEdges at each vertex. */
280
+ static createColinearXYGraph(points) {
281
+ const colinearGraph = new Graph_1.HalfEdgeGraph();
282
+ let indices;
283
+ if (!Array.isArray(points)) {
284
+ indices = Array.from(points.values());
285
+ points = Array.from(points.keys());
286
+ }
287
+ if (points.length < 2)
288
+ return colinearGraph; // empty
289
+ let prevNode = this.addEdgeWithEdgeTags(colinearGraph, points[0], points[1], indices ? indices[0] : 0, indices ? indices[1] : 0);
290
+ for (let i = 1; i < points.length - 1; i++) {
291
+ const nextNode = this.addEdgeWithEdgeTags(colinearGraph, points[i], points[i + 1], indices ? indices[i] : 0, indices ? indices[i + 1] : 0);
292
+ Graph_1.HalfEdge.pinch(prevNode.faceSuccessor, nextNode);
293
+ prevNode = nextNode;
294
+ }
295
+ colinearGraph.setMask(Graph_1.HalfEdgeMask.EXTERIOR | Graph_1.HalfEdgeMask.BOUNDARY_EDGE);
296
+ return colinearGraph;
297
+ }
298
+ /** Return a segment along the bisector of the given edge. Clip the bisector to the Voronoi boundary. */
299
+ static getEdgeBisector(edge, box) {
300
+ const v0 = edge;
301
+ const v1 = edge.faceSuccessor;
302
+ const midPoint = Point2dVector2d_1.Point2d.createAdd2ScaledXY(v0.x, v0.y, 0.5, v1.x, v1.y, 0.5);
303
+ const perpendicular = Point2dVector2d_1.Vector2d.createStartEnd(v0, v1);
304
+ [perpendicular.x, perpendicular.y] = [-perpendicular.y, perpendicular.x];
305
+ const bisector = Ray2d_1.Ray2d.createOriginAndDirectionCapture(midPoint, perpendicular);
306
+ const fractions = box.intersect(bisector);
307
+ const haveIntersections = undefined !== fractions && fractions.length > 1 && fractions[0] < 0 && fractions[1] > 0;
308
+ (0, core_bentley_1.assert)(haveIntersections, "Midpoints should be strictly inside bounding box");
309
+ return haveIntersections ? { start: bisector.fractionToPoint(fractions[0]), end: bisector.fractionToPoint(fractions[1]) } : undefined;
310
+ }
311
+ /** Construct a Voronoi instance from a graph representing a colinear linestring. */
312
+ static createFromColinearGraph(colinearGraph, distanceTol = Geometry_1.Geometry.smallMetricDistance, boundingBox) {
313
+ const instance = new Voronoi(colinearGraph, true);
314
+ if (!instance.isValid)
315
+ return undefined;
316
+ let isValidVoronoi = true;
317
+ const box = new VoronoiBoundary(instance._inputGraphRange, boundingBox);
318
+ instance._inputGraph.announceEdges((_g, edge) => {
319
+ const bisector = Voronoi.getEdgeBisector(edge, box);
320
+ if (!bisector)
321
+ return isValidVoronoi = false; // edge midpoint outside box (shouldn't happen)
322
+ const faceTag0 = instance._idToIndexMap.get(edge.id);
323
+ const faceTag1 = instance._idToIndexMap.get(edge.edgeMate.id);
324
+ this.addEdgeWithFaceTags(instance._voronoiGraph, bisector.start, bisector.end, faceTag0, faceTag1);
325
+ return true;
326
+ });
327
+ if (!isValidVoronoi)
328
+ return undefined;
329
+ box.addEdgesToGraph(instance._voronoiGraph);
330
+ Merging_1.HalfEdgeGraphMerge.splitIntersectingEdges(instance._voronoiGraph, distanceTol);
331
+ Merging_1.HalfEdgeGraphMerge.clusterAndMergeXYTheta(instance._voronoiGraph, undefined, distanceTol);
332
+ instance.populateMasksAndFaceTags();
333
+ return instance;
334
+ }
335
+ /**
336
+ * Construct a Voronoi instance from a set of points.
337
+ * @param points An array of points. Z-coordinates are ignored. Points can be colinear.
338
+ * @param distanceTol Optional distance tolerance to use when comparing points; default is [[Geometry.smallMetricDistance]].
339
+ * @param boundingBox Optional nominal xy-bounding box for the Voronoi diagram. If unspecified, interior Voronoi cells are maximal.
340
+ * @returns a new instance containing the Voronoi diagram derived from the input points, or `undefined` if invalid input.
341
+ */
342
+ static createFromPoints(points, distanceTol = Geometry_1.Geometry.smallMetricDistance, boundingBox) {
343
+ const sortedPoints = new core_bentley_1.SortedArray(Geometry_1.Geometry.compareXY(distanceTol), core_bentley_1.DuplicatePolicy.Retain, (p) => p.clone());
344
+ points.forEach((pt) => sortedPoints.insert(pt));
345
+ const uniquePoints = sortedPoints.extractArray();
346
+ if (uniquePoints.length < 2)
347
+ return undefined;
348
+ if (PolylineOps_1.PolylineOps.isColinear(uniquePoints, distanceTol, true)) {
349
+ const colinearGraph = Voronoi.createColinearXYGraph(uniquePoints);
350
+ return colinearGraph ? Voronoi.createFromColinearGraph(colinearGraph, distanceTol, boundingBox) : undefined;
351
+ }
352
+ else {
353
+ const delaunayGraph = Triangulation_1.Triangulator.createTriangulatedGraphFromPoints(uniquePoints, undefined, distanceTol);
354
+ return delaunayGraph ? Voronoi.createFromDelaunayGraph(delaunayGraph, distanceTol, boundingBox) : undefined;
355
+ }
356
+ }
357
+ /** Stroke the curve interior, and associate the stroke points to the given index. Return first and last point. */
358
+ static pushInteriorStrokePoints(pointToIndex, curve, index, strokeOptions, workPoint) {
359
+ const strokes = LineString3d_1.LineString3d.create();
360
+ curve.emitStrokes(strokes, strokeOptions);
361
+ let pt;
362
+ const n = strokes.numPoints();
363
+ for (let i = 1; i < n - 1; ++i) { // skip first and last point
364
+ if (pt = strokes.pointAt(i, workPoint))
365
+ pointToIndex.insert(pt, index);
366
+ }
367
+ (0, core_bentley_1.assert)(() => n > 2, "Expect at least 1 interior stroke point");
368
+ const p0 = (n > 2 ? strokes.pointAt(1) : undefined) ?? curve.fractionToPoint(0.5);
369
+ const p1 = (n > 2 ? strokes.pointAt(n - 2) : undefined) ?? p0;
370
+ return { p0, p1 };
371
+ }
372
+ /** Intersect the circle with the curve and return the intersection closest to the desired curve endpoint. */
373
+ static computeCircleIntersection(circle, curve, atCurveStart, distanceTol) {
374
+ const intersections = CurveCurve_1.CurveCurve.intersectionProjectedXYPairs(undefined, circle, false, curve, false, distanceTol);
375
+ if (!intersections.length)
376
+ return undefined;
377
+ if (intersections.length > 1) { // detailB has the info for curve
378
+ if (atCurveStart)
379
+ intersections.sort((a, b) => a.detailB.fraction - b.detailB.fraction); // first intersection is closest to curve start
380
+ else
381
+ intersections.sort((a, b) => b.detailB.fraction - a.detailB.fraction); // first intersection is closest to curve end
382
+ }
383
+ return intersections[0].detailB.point;
384
+ }
385
+ ;
386
+ /** Intersect two consecutive curves with a tiny circle centered at their joint, and associate the intersection on each curve with its respective index. */
387
+ static pushSymmetricPointPairAtJoint = (pointToIndex, prevStroke, nextStroke, distanceTol, workArc) => {
388
+ const circle = Arc3d_1.Arc3d.createUnitCircle(workArc);
389
+ const joint = nextStroke.cp.startPoint(circle.centerRef);
390
+ // ensure the symmetric pair we add will be the last/first stroke points on prev/next curve
391
+ const radius = 0.5 * Math.min(prevStroke.pt.distance(joint), nextStroke.pt.distance(joint));
392
+ circle.matrixRef.setAt(0, 0, radius);
393
+ circle.matrixRef.setAt(1, 1, radius);
394
+ const prevPt = this.computeCircleIntersection(circle, prevStroke.cp, false, distanceTol);
395
+ const nextPt = this.computeCircleIntersection(circle, nextStroke.cp, true, distanceTol);
396
+ if (!prevPt || !nextPt) {
397
+ (0, core_bentley_1.assert)(() => false, "Failed to add symmetric strokes at joint");
398
+ return false;
399
+ }
400
+ pointToIndex.set(prevPt, prevStroke.i);
401
+ pointToIndex.set(nextPt, nextStroke.i);
402
+ return true;
403
+ };
404
+ /** Stroke each curve in the chain and associate each point with the index of its generating curve in the chain. */
405
+ static createStrokePointsWithIndices(curveChain, strokeOptions, distanceTol = Geometry_1.Geometry.smallMetricDistance) {
406
+ const children = curveChain.children;
407
+ if (!children)
408
+ return undefined;
409
+ const numChildren = children.length;
410
+ if (numChildren < 2)
411
+ return undefined;
412
+ strokeOptions = strokeOptions?.clone() ?? StrokeOptions_1.StrokeOptions.createForCurves();
413
+ if (!strokeOptions.minStrokesPerPrimitive || strokeOptions.minStrokesPerPrimitive < 2)
414
+ strokeOptions.minStrokesPerPrimitive = 2; // ensure at least one interior point per primitive
415
+ const workPoint = Point3dVector3d_1.Point3d.createZero();
416
+ const workCircle = Arc3d_1.Arc3d.createUnitCircle(Voronoi._workArc);
417
+ const workSegment0 = LineSegment3d_1.LineSegment3d.createXYXY(0, 0, 0, 0);
418
+ const workRay = Ray3d_1.Ray3d.createZero();
419
+ let stroke0;
420
+ let prevStroke;
421
+ let firstLastStroke;
422
+ // lambda for iterating the chain, splitting a linestring primitive into segments
423
+ const getNextCurve = (cp, index) => cp instanceof LineString3d_1.LineString3d ? cp.getIndexedSegment(index, workSegment0) : index ? undefined : cp;
424
+ const pointToIndex = new core_bentley_1.Dictionary(Geometry_1.Geometry.compareXY(distanceTol), (p) => p.clone());
425
+ // Step 1: add open chain start/end point
426
+ const isClosedChain = curveChain.isPhysicallyClosedCurve(distanceTol, true);
427
+ if (!isClosedChain) {
428
+ if (curveChain.startPoint(workPoint))
429
+ pointToIndex.insert(workPoint, 0);
430
+ if (curveChain.endPoint(workPoint))
431
+ pointToIndex.insert(workPoint, numChildren - 1);
432
+ }
433
+ // Step 2: add interior stroke points for each chain primitive
434
+ // To ensure Voronoi edges exactly hit the chain joints, the joints themselves are omitted from the strokes
435
+ for (let i = 0; i < numChildren; i++) {
436
+ let child = children[i];
437
+ if (CurveOps_1.CurveOps.isColinear(child, { colinearRay: workRay, xyColinear: true, maxDeviation: distanceTol }))
438
+ child = LineSegment3d_1.LineSegment3d.createCapture(child.startPoint(), child.endPoint());
439
+ let j = 0;
440
+ for (let currCurve; currCurve = getNextCurve(child, j); j++) {
441
+ firstLastStroke = this.pushInteriorStrokePoints(pointToIndex, currCurve, i, strokeOptions, workPoint);
442
+ const currStroke = { pt: firstLastStroke.p0, cp: currCurve, i };
443
+ if (prevStroke)
444
+ this.pushSymmetricPointPairAtJoint(pointToIndex, prevStroke, currStroke, distanceTol, workCircle);
445
+ stroke0 = (isClosedChain && i === 0 && j === 0) ? currStroke : stroke0;
446
+ prevStroke = { pt: firstLastStroke.p1, cp: currCurve, i };
447
+ }
448
+ }
449
+ // Step 3: handle the seam if necessary
450
+ if (prevStroke && stroke0)
451
+ this.pushSymmetricPointPairAtJoint(pointToIndex, prevStroke, stroke0, distanceTol, workCircle);
452
+ return pointToIndex;
453
+ }
454
+ /** Construct a graph from unique xy points. */
455
+ static createGraphFromPointsWithIndices(pointToIndex, distanceTol) {
456
+ if (pointToIndex.size < 2)
457
+ return undefined;
458
+ let graph;
459
+ let isTriangulation = false;
460
+ const workPoint = Point3dVector3d_1.Point3d.createZero();
461
+ const points = Array.from(pointToIndex.keys());
462
+ if (PolylineOps_1.PolylineOps.isColinear(points, distanceTol, true)) {
463
+ graph = Voronoi.createColinearXYGraph(pointToIndex);
464
+ isTriangulation = false;
465
+ }
466
+ else {
467
+ // tighter triangulation tolerance to reduce vertex consolidation that might result in dictionary misses
468
+ graph = Triangulation_1.Triangulator.createTriangulatedGraphFromPoints(points, undefined, 0.1 * distanceTol);
469
+ if (isTriangulation = (graph !== undefined)) {
470
+ // tag every edge of the Delaunay graph with the index associated to its start vertex
471
+ graph.announceVertexLoops((_g, vertex) => {
472
+ const index = pointToIndex.get(vertex.getPoint3d(workPoint));
473
+ (0, core_bentley_1.assert)(index !== undefined, "Delaunay vertex must know its generating curve");
474
+ if (index !== undefined)
475
+ vertex.announceEdgesAroundVertex((edge) => edge.edgeTag = index);
476
+ return true;
477
+ });
478
+ }
479
+ }
480
+ return graph ? { graph, isTriangulation } : undefined;
481
+ }
482
+ /**
483
+ * Create a Voronoi instance from a curve chain.
484
+ * * This is the curve-based analog for point-based Voronoi cells.
485
+ * * Each curve in the chain is sampled and a Voronoi diagram is generated from the Delaunay triangulation of all samples.
486
+ * * The union of Voronoi cells generated by a single curve's samples is:
487
+ * * an approximation to the xy-region of points closest to the curve
488
+ * * represented in the Voronoi graph by a _super face_, a loop of edges from multiple adjacent faces
489
+ * * not necessarily convex
490
+ * * The generating curve with chain index `i` for the returned Voronoi super face `R` is encoded thusly:
491
+ * * Each Voronoi edge has `faceTag` set as per [[createFromDelaunayGraph]], referring to its generating Delaunay vertex.
492
+ * * Each Delaunay edge has `edgeTag` set to the index in `curveChain` of its generating curve.
493
+ * * For each [[HalfEdge]] `e` in the super face loop of `R`, `delaunayGraph.allHalfEdges[e.faceTag].edgeTag === i`.
494
+ * @param curveChain A curve chain consisting of at least two [[CurvePrimitive]]s. Z-coordinates are ignored.
495
+ * The length of each child should exceed `distanceTol`.
496
+ * @param strokeOptions Optional stroke options to control the sampling of the curve chain.
497
+ * @param distanceTol Optional distance tolerance to use when comparing points; default is [[Geometry.smallMetricDistance]].
498
+ * @param boundingBox Optional nominal xy-bounding box for the Voronoi diagram. If unspecified, interior Voronoi cells are maximal.
499
+ * @returns a new instance, or `undefined` for invalid input.
500
+ */
501
+ static createFromCurveChain(curveChain, strokeOptions, distanceTol = Geometry_1.Geometry.smallMetricDistance, boundingBox) {
502
+ const pointsWithIndices = Voronoi.createStrokePointsWithIndices(curveChain, strokeOptions);
503
+ if (!pointsWithIndices)
504
+ return undefined; // no points created from the curve chain
505
+ const inputGraph = Voronoi.createGraphFromPointsWithIndices(pointsWithIndices, distanceTol);
506
+ if (!inputGraph)
507
+ return undefined; // no graph created from points
508
+ const instance = inputGraph.isTriangulation ?
509
+ Voronoi.createFromDelaunayGraph(inputGraph.graph, distanceTol, boundingBox) :
510
+ Voronoi.createFromColinearGraph(inputGraph.graph, distanceTol, boundingBox);
511
+ if (instance)
512
+ instance._isCurveBased = true;
513
+ return instance;
514
+ }
515
+ /**
516
+ * Test whether the edge is part of a curve-based Voronoi graph super face.
517
+ * @param curveIndex optional test for a _specific_ super face associated with the curve with the given index.
518
+ */
519
+ isEdgeInVoronoiSuperFace(edge, curveIndex) {
520
+ if (!this._isCurveBased || edge.faceTag === undefined)
521
+ return false;
522
+ const edgeIndex = this._inputGraph.allHalfEdges[edge.faceTag].edgeTag;
523
+ if (edge.edgeMate.isMaskSet(Graph_1.HalfEdgeMask.EXTERIOR)) // edge is part of an unbounded Voronoi super face clipped by the bounding box
524
+ return curveIndex === undefined ? true : curveIndex === edgeIndex;
525
+ if (edge.edgeMate.faceTag === undefined)
526
+ return false;
527
+ const mateIndex = this._inputGraph.allHalfEdges[edge.edgeMate.faceTag].edgeTag;
528
+ if (curveIndex !== undefined)
529
+ return edgeIndex === curveIndex && mateIndex !== curveIndex; // edge is in a specific super face
530
+ return edgeIndex !== mateIndex; // edge is part of a bounded Voronoi super face
531
+ }
532
+ /** Examine all edges in the curve-based Voronoi graph and return the first edge in an unvisited Voronoi super face. */
533
+ findNextVoronoiSuperFaceStart() {
534
+ if (!this._isCurveBased)
535
+ return undefined;
536
+ let start;
537
+ this._voronoiGraph.announceEdges((_g, edge) => {
538
+ if (edge.isMaskSet(Graph_1.HalfEdgeMask.EXTERIOR))
539
+ return true; // skip exterior face
540
+ if (edge.isMaskSet(this._superFaceMask))
541
+ return true; // skip previously visited super face
542
+ if (!this.isEdgeInVoronoiSuperFace(edge))
543
+ return true; // skip edge; keep searching
544
+ (0, core_bentley_1.assert)(() => edge.faceTag !== undefined, "Voronoi edge must know its generating Delaunay vertex");
545
+ (0, core_bentley_1.assert)(() => this._inputGraph.allHalfEdges[edge.faceTag].edgeTag !== undefined, "Delaunay vertex must know its generating curve");
546
+ start = edge;
547
+ return false; // stop search; we found an unvisited super face
548
+ });
549
+ return start;
550
+ }
551
+ /**
552
+ * Traverse the curve-based Voronoi graph and collect the edges comprising the Voronoi super face that starts with
553
+ * the given seed edge.
554
+ */
555
+ collectVoronoiSuperFace(seed) {
556
+ if (!this._isCurveBased || seed.faceTag === undefined)
557
+ return undefined;
558
+ const superFace = [];
559
+ const curveIndex = this._inputGraph.allHalfEdges[seed.faceTag].edgeTag;
560
+ const foundSuperFace = seed.announceEdgesInSuperFace((e) => !this.isEdgeInVoronoiSuperFace(e, curveIndex), // skipEdge
561
+ (e) => { superFace.push(e); e.setMask(this._superFaceMask); });
562
+ return (foundSuperFace && superFace.length > 2) ? superFace : undefined;
563
+ }
564
+ /**
565
+ * Compute super faces of a curve-based Voronoi diagram.
566
+ * * The instance must have been constructed with [[createFromCurveChain]].
567
+ * * Each super face corresponds to the planar region of points closer to one curve in the generating chain than to any other.
568
+ * * Each returned edge is masked for querying by subsequent methods.
569
+ * @param numSuperFaces maximum number of super faces to return.
570
+ * @returns up to `numSuperFaces` Voronoi super faces, sorted by curve index, or `undefined` if invalid input.
571
+ * Each super face is an array of HalfEdges that form a loop.
572
+ */
573
+ computeVoronoiSuperFaces(numSuperFaces) {
574
+ if (!this._isCurveBased || numSuperFaces < 1)
575
+ return undefined;
576
+ const superFaces = [];
577
+ if (this._superFaceMask === Graph_1.HalfEdgeMask.NULL_MASK)
578
+ this._superFaceMask = this._voronoiGraph.grabMask(false);
579
+ this._voronoiGraph.clearMask(this._superFaceMask);
580
+ for (let i = 0; i < numSuperFaces; i++) {
581
+ const start = this.findNextVoronoiSuperFaceStart();
582
+ if (!start)
583
+ break; // no more super faces to find
584
+ const superFace = this.collectVoronoiSuperFace(start);
585
+ if (!superFace)
586
+ return undefined; // invalid Voronoi graph
587
+ superFaces.push(superFace);
588
+ }
589
+ superFaces.sort((a, b) => {
590
+ const tagA = this._inputGraph.allHalfEdges[a[0].faceTag].edgeTag;
591
+ const tagB = this._inputGraph.allHalfEdges[b[0].faceTag].edgeTag;
592
+ return tagA - tagB;
593
+ });
594
+ return (superFaces.length > 0) ? superFaces : undefined;
595
+ }
596
+ /**
597
+ * Construct a clipper for each curve-based Voronoi super face in the input array.
598
+ * @param superFaces array returned by [[collectVoronoiSuperFaces]].
599
+ * @returns array of clippers; the i_th clipper corresponds to the i_th input super face.
600
+ * Returns `undefined` if input is invalid, or if a clipper construction failed.
601
+ */
602
+ generateClippersFromVoronoiSuperFaces(superFaces) {
603
+ if (!this._isCurveBased || this._superFaceMask === Graph_1.HalfEdgeMask.NULL_MASK)
604
+ return undefined;
605
+ const allClippers = [];
606
+ const superFaceOutsideMask = this._voronoiGraph.grabMask();
607
+ const visitedMask = this._voronoiGraph.grabMask();
608
+ const maskOutsideOfSuperFace = (startEdge, clearMask) => {
609
+ return startEdge.announceEdgesInSuperFace((e) => !e.isMaskSet(this._superFaceMask), (e) => e.edgeMate.applyMask(superFaceOutsideMask, clearMask));
610
+ };
611
+ // Step 0: split each super face into convex faces (clipper prerequisite)
612
+ // Disable triangle-flipping; we don't care about aspect ratio here.
613
+ Triangulation_1.Triangulator.triangulateAllInteriorFaces(this._voronoiGraph, false, true);
614
+ Merging_1.HalfEdgeGraphOps.expandConvexFaces(this._voronoiGraph, this._superFaceMask);
615
+ for (const superFace of superFaces) {
616
+ if (superFace.length < 3) {
617
+ allClippers.length = 0;
618
+ break; // invalid Voronoi graph
619
+ }
620
+ // Step 1: collect the convex faces for this super face
621
+ const convexFaces = [];
622
+ if (!maskOutsideOfSuperFace(superFace[0], false)) {
623
+ allClippers.length = 0;
624
+ break; // invalid Voronoi graph
625
+ }
626
+ HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.exploreComponent(superFace[0], visitedMask, superFaceOutsideMask, undefined, convexFaces);
627
+ maskOutsideOfSuperFace(superFace[0], true);
628
+ // Step 2: generate a clipper for each convex face
629
+ const clippers = [];
630
+ for (const face of convexFaces) {
631
+ const clipPlanes = [];
632
+ face.announceEdgesInFace((edge) => {
633
+ if (!edge.isMaskSet(Graph_1.HalfEdgeMask.BOUNDARY_EDGE)) {
634
+ const clipPlane = ClipPlane_1.ClipPlane.createMidPointEdgeXY(edge, edge.faceSuccessor);
635
+ if (clipPlane)
636
+ clipPlanes.push(clipPlane);
637
+ }
638
+ });
639
+ if (clipPlanes.length === face.countMaskAroundFace(Graph_1.HalfEdgeMask.BOUNDARY_EDGE, false))
640
+ clippers.push(ConvexClipPlaneSet_1.ConvexClipPlaneSet.createPlanes(clipPlanes));
641
+ }
642
+ // Step 3: assemble the clippers for this super face
643
+ if (clippers.length === convexFaces.length)
644
+ allClippers.push(UnionOfConvexClipPlaneSets_1.UnionOfConvexClipPlaneSets.createConvexSets(clippers));
645
+ }
646
+ this._voronoiGraph.dropMask(visitedMask);
647
+ this._voronoiGraph.dropMask(superFaceOutsideMask);
648
+ return allClippers.length === superFaces.length ? allClippers : undefined;
649
+ }
650
+ }
651
+ exports.Voronoi = Voronoi;
652
+ /**
653
+ * Interfaces used by the Voronoi class.
654
+ * @internal
655
+ */
656
+ (function (Voronoi) {
657
+ ;
658
+ ;
659
+ ;
660
+ })(Voronoi || (exports.Voronoi = Voronoi = {}));
661
+ /**
662
+ * A class to represent a bounding box for a Voronoi diagram.
663
+ * * A Voronoi diagram is unbounded, so we create a large rectangle around the diagram to limit it.
664
+ * * To avoid clipping bounded Voronoi cells, this boundary should be large enough to contain the
665
+ * circumcenters of the Delaunay triangles.
666
+ * @internal
667
+ */
668
+ class VoronoiBoundary {
669
+ bbox;
670
+ /**
671
+ * Constructor that takes up to two ranges to union and expand by a margin.
672
+ * * For example, Delaunay graph range and circumcenter range.
673
+ */
674
+ constructor(r0, r1) {
675
+ this.bbox = Range_1.Range2d.createFrom(r0);
676
+ if (r1)
677
+ this.bbox.union(r1, this.bbox);
678
+ if (!this.bbox.isNull && !this.bbox.isSinglePoint) {
679
+ const pad = 0.02473 * (this.bbox.xLength() + this.bbox.yLength()); // ~5% of average side length
680
+ this.bbox.expandInPlace(pad);
681
+ }
682
+ }
683
+ /** Compute the intersection fractions of the ray and this boundary. */
684
+ intersect(ray) {
685
+ const fractionalRange = ray.intersectionWithRange2d(this.bbox);
686
+ if (fractionalRange.isNull)
687
+ return undefined;
688
+ if (fractionalRange.isSinglePoint)
689
+ return [fractionalRange.low];
690
+ return [fractionalRange.low, fractionalRange.high];
691
+ }
692
+ /** Add edges of this boundary to the graph. */
693
+ addEdgesToGraph(graph) {
694
+ graph.addEdgeXY(this.bbox.low.x, this.bbox.low.y, this.bbox.high.x, this.bbox.low.y);
695
+ graph.addEdgeXY(this.bbox.high.x, this.bbox.low.y, this.bbox.high.x, this.bbox.high.y);
696
+ graph.addEdgeXY(this.bbox.high.x, this.bbox.high.y, this.bbox.low.x, this.bbox.high.y);
697
+ graph.addEdgeXY(this.bbox.low.x, this.bbox.high.y, this.bbox.low.x, this.bbox.low.y);
698
+ }
699
+ }
700
+ //# sourceMappingURL=Voronoi.js.map