@itwin/core-geometry 4.10.0-dev.9 → 5.0.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 (338) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/lib/cjs/Geometry.js +2 -2
  3. package/lib/cjs/Geometry.js.map +1 -1
  4. package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
  5. package/lib/cjs/bspline/BSpline1dNd.js +0 -1
  6. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurve.d.ts +5 -3
  8. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.js +5 -4
  10. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  11. package/lib/cjs/clipping/ClipVector.js +1 -1
  12. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  13. package/lib/cjs/core-geometry.d.ts +1 -1
  14. package/lib/cjs/core-geometry.d.ts.map +1 -1
  15. package/lib/cjs/core-geometry.js +1 -1
  16. package/lib/cjs/core-geometry.js.map +1 -1
  17. package/lib/cjs/curve/Arc3d.d.ts +136 -128
  18. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  19. package/lib/cjs/curve/Arc3d.js +177 -152
  20. package/lib/cjs/curve/Arc3d.js.map +1 -1
  21. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +7 -5
  22. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  23. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +9 -7
  24. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  25. package/lib/cjs/curve/CurveCollection.d.ts +21 -2
  26. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  27. package/lib/cjs/curve/CurveCollection.js +45 -10
  28. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  29. package/lib/cjs/curve/CurveExtendMode.d.ts +18 -15
  30. package/lib/cjs/curve/CurveExtendMode.d.ts.map +1 -1
  31. package/lib/cjs/curve/CurveExtendMode.js +18 -17
  32. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  33. package/lib/cjs/curve/CurveFactory.d.ts +11 -13
  34. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  35. package/lib/cjs/curve/CurveFactory.js +19 -46
  36. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  37. package/lib/cjs/curve/CurvePrimitive.d.ts +9 -5
  38. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  39. package/lib/cjs/curve/CurvePrimitive.js +9 -5
  40. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  41. package/lib/cjs/curve/CurveProcessor.d.ts.map +1 -1
  42. package/lib/cjs/curve/CurveProcessor.js +0 -1
  43. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  44. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  45. package/lib/cjs/curve/LineSegment3d.js +2 -3
  46. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  47. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  48. package/lib/cjs/curve/OffsetOptions.d.ts.map +1 -1
  49. package/lib/cjs/curve/OffsetOptions.js +4 -4
  50. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  51. package/lib/cjs/curve/Path.d.ts +14 -0
  52. package/lib/cjs/curve/Path.d.ts.map +1 -1
  53. package/lib/cjs/curve/Path.js +27 -0
  54. package/lib/cjs/curve/Path.js.map +1 -1
  55. package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
  56. package/lib/cjs/curve/PointString3d.js +0 -1
  57. package/lib/cjs/curve/PointString3d.js.map +1 -1
  58. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  59. package/lib/cjs/curve/StrokeOptions.js +0 -1
  60. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  61. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  62. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -6
  63. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  64. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  65. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +10 -10
  66. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  67. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  68. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +4 -4
  69. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts +18 -18
  71. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  72. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +46 -42
  73. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +5 -4
  75. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  76. package/lib/cjs/geometry3d/AngleSweep.d.ts +10 -6
  77. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  78. package/lib/cjs/geometry3d/AngleSweep.js +15 -12
  79. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  80. package/lib/cjs/geometry3d/BilinearPatch.js +4 -4
  81. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  82. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  83. package/lib/cjs/geometry3d/FrameBuilder.js +0 -1
  84. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  85. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  86. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  87. package/lib/cjs/geometry3d/Matrix3d.d.ts +28 -17
  88. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  89. package/lib/cjs/geometry3d/Matrix3d.js +36 -17
  90. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  91. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  92. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -3
  93. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  94. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -5
  95. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  96. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
  97. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  98. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  99. package/lib/cjs/geometry3d/PointHelpers.js +0 -1
  100. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  101. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  102. package/lib/cjs/geometry3d/PolygonOps.js +2 -4
  103. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  104. package/lib/cjs/geometry3d/Ray3d.js +2 -2
  105. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  106. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  107. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  108. package/lib/cjs/geometry4d/Map4d.d.ts +5 -5
  109. package/lib/cjs/geometry4d/Map4d.js +5 -5
  110. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  111. package/lib/cjs/geometry4d/Matrix4d.d.ts +4 -7
  112. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  113. package/lib/cjs/geometry4d/Matrix4d.js +4 -7
  114. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  115. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  116. package/lib/cjs/geometry4d/Point4d.js +2 -1
  117. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  118. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  119. package/lib/cjs/numerics/BezierPolynomials.js +0 -1
  120. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  121. package/lib/cjs/numerics/Newton.d.ts +3 -0
  122. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  123. package/lib/cjs/numerics/Newton.js +2 -5
  124. package/lib/cjs/numerics/Newton.js.map +1 -1
  125. package/lib/cjs/numerics/Polynomials.d.ts +46 -201
  126. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  127. package/lib/cjs/numerics/Polynomials.js +132 -445
  128. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  129. package/lib/cjs/numerics/Range1dArray.js +2 -2
  130. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  131. package/lib/cjs/numerics/SmallSystem.d.ts +164 -0
  132. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -0
  133. package/lib/cjs/numerics/SmallSystem.js +321 -0
  134. package/lib/cjs/numerics/SmallSystem.js.map +1 -0
  135. package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
  136. package/lib/cjs/polyface/AuxData.js.map +1 -1
  137. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  138. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +0 -1
  139. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  140. package/lib/cjs/polyface/Polyface.d.ts +2 -2
  141. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  142. package/lib/cjs/polyface/Polyface.js +0 -1
  143. package/lib/cjs/polyface/Polyface.js.map +1 -1
  144. package/lib/cjs/polyface/PolyfaceBuilder.js +1 -1
  145. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  146. package/lib/cjs/polyface/PolyfaceClip.d.ts +3 -3
  147. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  148. package/lib/cjs/polyface/PolyfaceClip.js +1 -2
  149. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  150. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  151. package/lib/cjs/polyface/PolyfaceQuery.js +0 -1
  152. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  153. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  154. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  155. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
  156. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
  157. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +7 -7
  158. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  159. package/lib/cjs/serialization/DeepCompare.d.ts.map +1 -1
  160. package/lib/cjs/serialization/DeepCompare.js +0 -1
  161. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  162. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  163. package/lib/cjs/topology/Graph.js +2 -2
  164. package/lib/cjs/topology/Graph.js.map +1 -1
  165. package/lib/cjs/topology/InsertAndRetriangulateContext.js +2 -2
  166. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  167. package/lib/cjs/topology/Merging.d.ts +1 -1
  168. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  169. package/lib/cjs/topology/Merging.js +2 -2
  170. package/lib/cjs/topology/Merging.js.map +1 -1
  171. package/lib/esm/Geometry.js +2 -2
  172. package/lib/esm/Geometry.js.map +1 -1
  173. package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
  174. package/lib/esm/bspline/BSpline1dNd.js +0 -1
  175. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  176. package/lib/esm/bspline/BSplineCurve.d.ts +5 -3
  177. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  178. package/lib/esm/bspline/BSplineCurve.js +5 -4
  179. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  180. package/lib/esm/clipping/ClipVector.js +1 -1
  181. package/lib/esm/clipping/ClipVector.js.map +1 -1
  182. package/lib/esm/core-geometry.d.ts +1 -1
  183. package/lib/esm/core-geometry.d.ts.map +1 -1
  184. package/lib/esm/core-geometry.js +1 -1
  185. package/lib/esm/core-geometry.js.map +1 -1
  186. package/lib/esm/curve/Arc3d.d.ts +136 -128
  187. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  188. package/lib/esm/curve/Arc3d.js +177 -152
  189. package/lib/esm/curve/Arc3d.js.map +1 -1
  190. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +7 -5
  191. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  192. package/lib/esm/curve/CurveChainWithDistanceIndex.js +9 -7
  193. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  194. package/lib/esm/curve/CurveCollection.d.ts +21 -2
  195. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  196. package/lib/esm/curve/CurveCollection.js +45 -10
  197. package/lib/esm/curve/CurveCollection.js.map +1 -1
  198. package/lib/esm/curve/CurveExtendMode.d.ts +18 -15
  199. package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
  200. package/lib/esm/curve/CurveExtendMode.js +18 -17
  201. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  202. package/lib/esm/curve/CurveFactory.d.ts +11 -13
  203. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  204. package/lib/esm/curve/CurveFactory.js +17 -44
  205. package/lib/esm/curve/CurveFactory.js.map +1 -1
  206. package/lib/esm/curve/CurvePrimitive.d.ts +9 -5
  207. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  208. package/lib/esm/curve/CurvePrimitive.js +9 -5
  209. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  210. package/lib/esm/curve/CurveProcessor.d.ts.map +1 -1
  211. package/lib/esm/curve/CurveProcessor.js +0 -1
  212. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  213. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  214. package/lib/esm/curve/LineSegment3d.js +1 -2
  215. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  216. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  217. package/lib/esm/curve/OffsetOptions.d.ts.map +1 -1
  218. package/lib/esm/curve/OffsetOptions.js +4 -4
  219. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  220. package/lib/esm/curve/Path.d.ts +14 -0
  221. package/lib/esm/curve/Path.d.ts.map +1 -1
  222. package/lib/esm/curve/Path.js +27 -0
  223. package/lib/esm/curve/Path.js.map +1 -1
  224. package/lib/esm/curve/PointString3d.d.ts.map +1 -1
  225. package/lib/esm/curve/PointString3d.js +0 -1
  226. package/lib/esm/curve/PointString3d.js.map +1 -1
  227. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  228. package/lib/esm/curve/StrokeOptions.js +0 -1
  229. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  230. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  231. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +4 -5
  232. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  233. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  234. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +5 -5
  235. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  236. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  237. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +3 -3
  238. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  239. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts +18 -18
  240. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  241. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +46 -42
  242. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  243. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +5 -4
  244. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  245. package/lib/esm/geometry3d/AngleSweep.d.ts +10 -6
  246. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  247. package/lib/esm/geometry3d/AngleSweep.js +15 -12
  248. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  249. package/lib/esm/geometry3d/BilinearPatch.js +1 -1
  250. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  251. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  252. package/lib/esm/geometry3d/FrameBuilder.js +0 -1
  253. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  254. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  255. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  256. package/lib/esm/geometry3d/Matrix3d.d.ts +28 -17
  257. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  258. package/lib/esm/geometry3d/Matrix3d.js +36 -17
  259. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  260. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  261. package/lib/esm/geometry3d/Point2dArrayCarrier.js +0 -1
  262. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  263. package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -5
  264. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  265. package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
  266. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  267. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  268. package/lib/esm/geometry3d/PointHelpers.js +0 -1
  269. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  270. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  271. package/lib/esm/geometry3d/PolygonOps.js +2 -4
  272. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  273. package/lib/esm/geometry3d/Ray3d.js +1 -1
  274. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  275. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  276. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  277. package/lib/esm/geometry4d/Map4d.d.ts +5 -5
  278. package/lib/esm/geometry4d/Map4d.js +5 -5
  279. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  280. package/lib/esm/geometry4d/Matrix4d.d.ts +4 -7
  281. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  282. package/lib/esm/geometry4d/Matrix4d.js +4 -7
  283. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  284. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  285. package/lib/esm/geometry4d/Point4d.js +2 -1
  286. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  287. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  288. package/lib/esm/numerics/BezierPolynomials.js +0 -1
  289. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  290. package/lib/esm/numerics/Newton.d.ts +3 -0
  291. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  292. package/lib/esm/numerics/Newton.js +1 -4
  293. package/lib/esm/numerics/Newton.js.map +1 -1
  294. package/lib/esm/numerics/Polynomials.d.ts +46 -201
  295. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  296. package/lib/esm/numerics/Polynomials.js +132 -444
  297. package/lib/esm/numerics/Polynomials.js.map +1 -1
  298. package/lib/esm/numerics/SmallSystem.d.ts +164 -0
  299. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -0
  300. package/lib/esm/numerics/SmallSystem.js +317 -0
  301. package/lib/esm/numerics/SmallSystem.js.map +1 -0
  302. package/lib/esm/polyface/AuxData.d.ts.map +1 -1
  303. package/lib/esm/polyface/AuxData.js.map +1 -1
  304. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  305. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +0 -1
  306. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  307. package/lib/esm/polyface/Polyface.d.ts +2 -2
  308. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  309. package/lib/esm/polyface/Polyface.js +0 -1
  310. package/lib/esm/polyface/Polyface.js.map +1 -1
  311. package/lib/esm/polyface/PolyfaceBuilder.js +1 -1
  312. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  313. package/lib/esm/polyface/PolyfaceClip.d.ts +3 -3
  314. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  315. package/lib/esm/polyface/PolyfaceClip.js +1 -2
  316. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  317. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  318. package/lib/esm/polyface/PolyfaceQuery.js +0 -1
  319. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  320. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  321. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  322. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
  323. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
  324. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +4 -4
  325. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  326. package/lib/esm/serialization/DeepCompare.d.ts.map +1 -1
  327. package/lib/esm/serialization/DeepCompare.js +0 -1
  328. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  329. package/lib/esm/topology/Graph.d.ts.map +1 -1
  330. package/lib/esm/topology/Graph.js +1 -1
  331. package/lib/esm/topology/Graph.js.map +1 -1
  332. package/lib/esm/topology/InsertAndRetriangulateContext.js +1 -1
  333. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  334. package/lib/esm/topology/Merging.d.ts +1 -1
  335. package/lib/esm/topology/Merging.d.ts.map +1 -1
  336. package/lib/esm/topology/Merging.js +1 -1
  337. package/lib/esm/topology/Merging.js.map +1 -1
  338. package/package.json +8 -8
@@ -4,7 +4,8 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.compareRange1dLexicalLowHigh = exports.Range1dArray = void 0;
7
+ exports.Range1dArray = void 0;
8
+ exports.compareRange1dLexicalLowHigh = compareRange1dLexicalLowHigh;
8
9
  /** @packageDocumentation
9
10
  * @module Numerics
10
11
  */
@@ -359,5 +360,4 @@ function compareRange1dLexicalLowHigh(a, b) {
359
360
  return 1;
360
361
  return 0;
361
362
  }
362
- exports.compareRange1dLexicalLowHigh = compareRange1dLexicalLowHigh;
363
363
  //# sourceMappingURL=Range1dArray.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Range1dArray.js","sourceRoot":"","sources":["../../../src/numerics/Range1dArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,6EAA0E;AAC1E,+CAA8C;AAE9C;;;GAGG;AACH,MAAa,YAAY;IACvB;;;;OAIG;IACK,MAAM,CAAC,yBAAyB,CAAC,MAAe,EAAE,KAAgB,EAAE,EAAU,EAAE,MAAiB;QACvG,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACrB,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACvB,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;YACf,MAAM,M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AC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,MAAM,EAAE,CAAC;YACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;oBACjC,OAAO,KAAK,CAAC;YACjB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;oBAChC,OAAO,KAAK,CAAC;YACjB,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3VD,oCA2VC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAAC,CAAU,EAAE,CAAU;IACjE,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG;QAAE,OAAO,CAAC,CAAC,CAAC;IAC7B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG;QAAE,OAAO,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI;QAAE,OAAO,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI;QAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,CAAC;AACX,CAAC;AAND,oEAMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Numerics\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { Range1d } from \"../geometry3d/Range\";\r\n\r\n/**\r\n * A Range1d array is a set of intervals, such as occur when a line is clipped to a (nonconvex) polygon\r\n * @internal\r\n */\r\nexport class Range1dArray {\r\n /** Internal step: Caller supplies rangeA = interval from left operand of set difference {A - B}\r\n * ib = lowest possible index of overlapping interval of {B}\r\n * Output live parts of rangeA, advancing B over intervals that do not extend beyond {rangeA}\r\n * iB is advanced to the first interval whose high is to the right of {rangeA.high}\r\n */\r\n private static advanceIntervalDifference(rangeA: Range1d, dataB: Range1d[], iB: number, retVal: Range1d[]) {\r\n const nB = dataB.length;\r\n let low = rangeA.low;\r\n let high = rangeA.high;\r\n while (iB < nB) {\r\n const rangeB = dataB[iB];\r\n if (rangeB.high < low) {\r\n iB++;\r\n } else if (rangeB.high <= high) {\r\n if (rangeB.low > low)\r\n retVal.push(Range1d.createXX(low, rangeB.low));\r\n low = rangeB.high;\r\n iB++;\r\n } else {\r\n // B ends beyond rangeA...\r\n if (rangeB.low < high)\r\n high = rangeB.low;\r\n break;\r\n }\r\n }\r\n\r\n if (low < high)\r\n retVal.push(Range1d.createXX(low, high));\r\n\r\n return retVal;\r\n }\r\n\r\n /** Intersect intervals in two pre-sorted sets. Output may NOT be the same as either input. */\r\n public static differenceSorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n const nA = dataA.length;\r\n const iB = 0;\r\n const retVal: Range1d[] = [];\r\n for (let iA = 0; iA < nA; iA++) {\r\n Range1dArray.advanceIntervalDifference(dataA[iA], dataB, iB, retVal);\r\n }\r\n\r\n return retVal;\r\n }\r\n\r\n /** Internal step: Caller ensures rangeA is the \"lower\" interval.\r\n * Look rangeB to decide (a) what output interval to create and (b) which read index to advance.\r\n * Returns true or false to indicate whether the value associated with rangeA or rangeB should be incremented after this function returns\r\n */\r\n private static advanceIntervalIntersection(rangeA: Range1d, rangeB: Range1d, retVal: Range1d[]): boolean {\r\n if (rangeB.low > rangeA.high) {\r\n return true;\r\n } else if (rangeB.high >= rangeA.high) {\r\n retVal.push(Range1d.createXX(rangeB.low, rangeA.high));\r\n return true;\r\n } else {\r\n retVal.push(Range1d.createXX(rangeB.low, rangeB.high));\r\n return false;\r\n }\r\n }\r\n /** Boolean intersection among the (presorted) input ranges */\r\n public static intersectSorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n let iA = 0;\r\n let iB = 0;\r\n const nA = dataA.length;\r\n const nB = dataB.length;\r\n const retVal: Range1d[] = [];\r\n while (iA < nA && iB < nB) {\r\n const rangeA = dataA[iA];\r\n const rangeB = dataB[iB];\r\n if (rangeA.low <= rangeB.low) {\r\n if (Range1dArray.advanceIntervalIntersection(rangeA, rangeB, retVal))\r\n iA++;\r\n else\r\n iB++;\r\n } else {\r\n if (Range1dArray.advanceIntervalIntersection(rangeB, rangeA, retVal))\r\n iB++;\r\n else\r\n iA++;\r\n }\r\n }\r\n\r\n return retVal;\r\n }\r\n\r\n /** Internal step: Read an interval from the array.\r\n * If it overlaps the work interval, advance the work interval, and return true to notify caller to increment read index.\r\n */\r\n private static advanceIntervalUnion(workRange: Range1d, source: Range1d[], readIndex: number): boolean {\r\n if (readIndex >= source.length)\r\n return false;\r\n const candidate = source[readIndex];\r\n if (candidate.low > workRange.high)\r\n return false;\r\n if (candidate.high > workRange.high)\r\n workRange.high = candidate.high;\r\n return true;\r\n }\r\n\r\n /** Boolean union among the (presorted) input ranges */\r\n public static unionSorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n const nA = dataA.length;\r\n const nB = dataB.length;\r\n let iA = 0;\r\n let iB = 0;\r\n const retVal: Range1d[] = [];\r\n while (iA < nA && iB < nB) {\r\n const rangeA = dataA[iA];\r\n const rangeB = dataB[iB];\r\n let workRange: Range1d;\r\n // Pull from the lower of rangeA and rangeB. This always advances exactly one of the indices -- progress towards getting out.\r\n if (rangeA.low <= rangeB.low) {\r\n workRange = rangeA.clone();\r\n iA++;\r\n } else {\r\n workRange = rangeB.clone();\r\n iB++;\r\n }\r\n\r\n let toLoop = true;\r\n do {\r\n const resultA = Range1dArray.advanceIntervalUnion(workRange, dataA, iA);\r\n const resultB = Range1dArray.advanceIntervalUnion(workRange, dataB, iB);\r\n if (resultA)\r\n iA++;\r\n if (resultB)\r\n iB++;\r\n if (!(resultA || resultB))\r\n toLoop = false;\r\n } while (toLoop);\r\n\r\n retVal.push(workRange);\r\n }\r\n\r\n while (iA < nA)\r\n retVal.push(dataA[iA++]);\r\n while (iB < nB)\r\n retVal.push(dataB[iB++]);\r\n\r\n return retVal;\r\n }\r\n\r\n /** Boolean parity among the (presorted) input ranges */\r\n public static paritySorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n // Combine the two arrays, and then perform a simplification using simplifySortParity function\r\n const retVal: Range1d[] = [];\r\n for (const range of dataA)\r\n retVal.push(range.clone());\r\n for (const range of dataB)\r\n retVal.push(range.clone());\r\n\r\n // Sort the array\r\n retVal.sort(compareRange1dLexicalLowHigh);\r\n\r\n Range1dArray.simplifySortParity(retVal, true);\r\n return retVal;\r\n }\r\n\r\n /** Uses the Range1d specific compare function `compareRange1dLexicalLowHigh` for sorting the array of ranges */\r\n public static sort(data: Range1d[]) {\r\n data.sort(compareRange1dLexicalLowHigh);\r\n }\r\n\r\n /** Cleans up the array, compressing any overlapping ranges. If removeZeroLengthRanges is set to true, will also remove any Ranges in the form (x, x) */\r\n public static simplifySortUnion(data: Range1d[], removeZeroLengthRanges: boolean = false) {\r\n if (data.length < 2)\r\n return;\r\n\r\n data.sort(compareRange1dLexicalLowHigh);\r\n\r\n let currentIndex = 0; // last accepted interval\r\n for (let i = 1; i < data.length; i++) {\r\n if (data[i].low <= data[currentIndex].high) {\r\n // extend the current range\r\n if (data[i].high > data[currentIndex].high)\r\n data[currentIndex].high = data[i].high;\r\n } else {\r\n // data[i] is a new entry.\r\n currentIndex++;\r\n data[currentIndex].setFrom(data[i]);\r\n }\r\n }\r\n\r\n data.length = currentIndex + 1;\r\n if (removeZeroLengthRanges) {\r\n currentIndex = -1;\r\n for (let i = 0; i < data.length; i++) {\r\n if (data[i].low < data[i].high) {\r\n if (currentIndex < i)\r\n data[++currentIndex].setFrom(data[i]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Apply parity logic among ranges which are not pre-sorted. */\r\n public static simplifySortParity(data: Range1d[], removeZeroLengthRanges: boolean = false) {\r\n const numData: number[] = [];\r\n for (const range of data) {\r\n if (range.low !== range.high) {\r\n numData.push(range.low);\r\n numData.push(range.high);\r\n }\r\n }\r\n const n = numData.length;\r\n numData.sort((a: number, b: number): number => {\r\n if (a < b) return -1;\r\n if (a > b) return 1;\r\n return 0;\r\n });\r\n\r\n let currIdx = 0;\r\n let x0;\r\n let x1;\r\n for (let i = 0; i < n; i += 2) {\r\n x0 = numData[i];\r\n x1 = numData[i + 1];\r\n if (!removeZeroLengthRanges) {\r\n Range1d.createXX(x0, x1, data[currIdx++]);\r\n } else {\r\n // coalesce intervals that share end and start:\r\n while (i + 2 < n && numData[i + 2] === x1) {\r\n i += 2;\r\n x1 = numData[i + 1];\r\n }\r\n if (x1 > x0)\r\n Range1d.createXX(x0, x1, data[currIdx++]);\r\n }\r\n }\r\n\r\n data.length = currIdx;\r\n }\r\n\r\n /** test if value is \"in\" by union rules.\r\n * * This considers all intervals-- i.e. does not expect or take advantage of sorting.\r\n */\r\n public static testUnion(data: Range1d[], value: number): boolean {\r\n return this.countContainingRanges(data, value) > 0;\r\n }\r\n /** test if value is \"in\" by parity rules.\r\n * * This considers all intervals-- i.e. does not expect or take advantage of sorting.\r\n */\r\n public static testParity(data: Range1d[], value: number): boolean {\r\n let inside = false;\r\n for (const range of data) {\r\n if (range.containsX(value))\r\n inside = !inside;\r\n }\r\n return inside;\r\n }\r\n\r\n /** linear search to count number of intervals which contain `value`.\r\n */\r\n public static countContainingRanges(data: Range1d[], value: number): number {\r\n let n = 0;\r\n for (const range of data) {\r\n if (range.containsX(value))\r\n n++;\r\n }\r\n return n;\r\n }\r\n\r\n /** return an array with all the low and high values of all the ranges.\r\n * @param data array of ranges.\r\n * @param sort optionally request immediate sort.\r\n * @param compress optionally request removal of duplicates.\r\n */\r\n public static getBreaks(data: Range1d[], result?: GrowableFloat64Array, sort: boolean = false, compress: boolean = false, clear: boolean = true): GrowableFloat64Array {\r\n if (!result) result = new GrowableFloat64Array(2 * data.length);\r\n if (clear) result.clear();\r\n for (const range of data) {\r\n result.push(range.low);\r\n result.push(range.high);\r\n }\r\n if (sort)\r\n result.sort();\r\n if (compress)\r\n result.compressAdjacentDuplicates();\r\n\r\n return result;\r\n }\r\n\r\n /** evaluate a point at an array of given fraction values\r\n * @param data array of ranges.\r\n * @param initialRangeFraction fraction coordinate applied only to first range. (typically negative)\r\n * @param rangeFraction fraction within each range.\r\n * @param includeDegenerateRange if false, skip rangeFraction for 0-length ranges.\r\n * @param gapFraction fraction within interval from each range high to successor low\r\n * @param includeDegenerateGap if false, skip rangeFraction for 0-length gaps.\r\n * @param finalRangeFraction fraction coordinate applied only to last range (typically an extrapolation above)\r\n * @param result array to receive values\r\n */\r\n public static appendFractionalPoints(data: Range1d[], initialRangeFraction: number | undefined, rangeFraction: number | undefined, includeDegenerateRange: boolean,\r\n gapFraction: number | undefined, includeDegenerateGap: boolean,\r\n finalRangeFraction: number | undefined, result: GrowableFloat64Array | number[]): GrowableFloat64Array | number[] {\r\n const numRange = data.length;\r\n if (numRange > 0) {\r\n if (undefined !== initialRangeFraction)\r\n result.push(data[0].fractionToPoint(initialRangeFraction));\r\n for (let i = 0; i < numRange; i++) {\r\n if (rangeFraction !== undefined && (includeDegenerateRange || data[i].low !== data[i].high))\r\n result.push(data[i].fractionToPoint(rangeFraction));\r\n if (i > 1 && gapFraction !== undefined && (includeDegenerateGap || data[i].low !== data[i].high))\r\n result.push(Geometry.interpolate(data[i - 1].high, gapFraction, data[i].low));\r\n }\r\n if (undefined !== finalRangeFraction)\r\n result.push(data[numRange - 1].fractionToPoint(finalRangeFraction));\r\n }\r\n return result;\r\n }\r\n\r\n /** Return a single range constructed with the low of range 0 and high of final range in the set. */\r\n public static firstLowToLastHigh(data: Range1d[]): Range1d {\r\n if (data.length === 0)\r\n return Range1d.createNull();\r\n return Range1d.createXX(data[0].low, data[data.length - 1].high);\r\n }\r\n /** sum the lengths of all ranges */\r\n public static sumLengths(data: Range1d[]): number {\r\n let sum = 0.0;\r\n for (const range of data) {\r\n sum += range.length();\r\n }\r\n return sum;\r\n }\r\n\r\n /**\r\n * Test if the low,high values are sorted with no overlap.\r\n * @param data array of ranges.\r\n * @param strict if true, consider exact high-to-low match as overlap.\r\n */\r\n public static isSorted(data: Range1d[], strict: boolean = true): boolean {\r\n const n = data.length;\r\n if (strict) {\r\n for (let i = 0; i + 1 < n; i++) {\r\n if (data[i].high >= data[i + 1].low)\r\n return false;\r\n }\r\n } else {\r\n for (let i = 0; i + 1 < n; i++) {\r\n if (data[i].high > data[i + 1].low)\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/** Checks low's first, then high's\r\n * @internal\r\n */\r\nexport function compareRange1dLexicalLowHigh(a: Range1d, b: Range1d): number {\r\n if (a.low < b.low) return -1;\r\n if (a.low > b.low) return 1;\r\n if (a.high < b.high) return -1;\r\n if (a.high > b.high) return 1;\r\n return 0;\r\n}\r\n"]}
1
+ {"version":3,"file":"Range1dArray.js","sourceRoot":"","sources":["../../../src/numerics/Range1dArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA8W/F,oEAMC;AAlXD;;GAEG;AAEH,0CAAuC;AACvC,6EAA0E;AAC1E,+CAA8C;AAE9C;;;GAGG;AACH,MAAa,YAAY;IACvB;;;;OAIG;IACK,MAAM,CAAC,yBAAyB,CAAC,MAAe,EAAE,KAAgB,EAAE,EAAU,EAAE,MAAiB;QACvG,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,G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CAAC;QACxB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAe,EAAE,SAAkB,IAAI;QAC5D,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,MAAM,EAAE,CAAC;YACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;oBACjC,OAAO,KAAK,CAAC;YACjB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;oBAChC,OAAO,KAAK,CAAC;YACjB,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3VD,oCA2VC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAAC,CAAU,EAAE,CAAU;IACjE,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG;QAAE,OAAO,CAAC,CAAC,CAAC;IAC7B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG;QAAE,OAAO,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI;QAAE,OAAO,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI;QAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Numerics\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { Range1d } from \"../geometry3d/Range\";\r\n\r\n/**\r\n * A Range1d array is a set of intervals, such as occur when a line is clipped to a (nonconvex) polygon\r\n * @internal\r\n */\r\nexport class Range1dArray {\r\n /** Internal step: Caller supplies rangeA = interval from left operand of set difference {A - B}\r\n * ib = lowest possible index of overlapping interval of {B}\r\n * Output live parts of rangeA, advancing B over intervals that do not extend beyond {rangeA}\r\n * iB is advanced to the first interval whose high is to the right of {rangeA.high}\r\n */\r\n private static advanceIntervalDifference(rangeA: Range1d, dataB: Range1d[], iB: number, retVal: Range1d[]) {\r\n const nB = dataB.length;\r\n let low = rangeA.low;\r\n let high = rangeA.high;\r\n while (iB < nB) {\r\n const rangeB = dataB[iB];\r\n if (rangeB.high < low) {\r\n iB++;\r\n } else if (rangeB.high <= high) {\r\n if (rangeB.low > low)\r\n retVal.push(Range1d.createXX(low, rangeB.low));\r\n low = rangeB.high;\r\n iB++;\r\n } else {\r\n // B ends beyond rangeA...\r\n if (rangeB.low < high)\r\n high = rangeB.low;\r\n break;\r\n }\r\n }\r\n\r\n if (low < high)\r\n retVal.push(Range1d.createXX(low, high));\r\n\r\n return retVal;\r\n }\r\n\r\n /** Intersect intervals in two pre-sorted sets. Output may NOT be the same as either input. */\r\n public static differenceSorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n const nA = dataA.length;\r\n const iB = 0;\r\n const retVal: Range1d[] = [];\r\n for (let iA = 0; iA < nA; iA++) {\r\n Range1dArray.advanceIntervalDifference(dataA[iA], dataB, iB, retVal);\r\n }\r\n\r\n return retVal;\r\n }\r\n\r\n /** Internal step: Caller ensures rangeA is the \"lower\" interval.\r\n * Look rangeB to decide (a) what output interval to create and (b) which read index to advance.\r\n * Returns true or false to indicate whether the value associated with rangeA or rangeB should be incremented after this function returns\r\n */\r\n private static advanceIntervalIntersection(rangeA: Range1d, rangeB: Range1d, retVal: Range1d[]): boolean {\r\n if (rangeB.low > rangeA.high) {\r\n return true;\r\n } else if (rangeB.high >= rangeA.high) {\r\n retVal.push(Range1d.createXX(rangeB.low, rangeA.high));\r\n return true;\r\n } else {\r\n retVal.push(Range1d.createXX(rangeB.low, rangeB.high));\r\n return false;\r\n }\r\n }\r\n /** Boolean intersection among the (presorted) input ranges */\r\n public static intersectSorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n let iA = 0;\r\n let iB = 0;\r\n const nA = dataA.length;\r\n const nB = dataB.length;\r\n const retVal: Range1d[] = [];\r\n while (iA < nA && iB < nB) {\r\n const rangeA = dataA[iA];\r\n const rangeB = dataB[iB];\r\n if (rangeA.low <= rangeB.low) {\r\n if (Range1dArray.advanceIntervalIntersection(rangeA, rangeB, retVal))\r\n iA++;\r\n else\r\n iB++;\r\n } else {\r\n if (Range1dArray.advanceIntervalIntersection(rangeB, rangeA, retVal))\r\n iB++;\r\n else\r\n iA++;\r\n }\r\n }\r\n\r\n return retVal;\r\n }\r\n\r\n /** Internal step: Read an interval from the array.\r\n * If it overlaps the work interval, advance the work interval, and return true to notify caller to increment read index.\r\n */\r\n private static advanceIntervalUnion(workRange: Range1d, source: Range1d[], readIndex: number): boolean {\r\n if (readIndex >= source.length)\r\n return false;\r\n const candidate = source[readIndex];\r\n if (candidate.low > workRange.high)\r\n return false;\r\n if (candidate.high > workRange.high)\r\n workRange.high = candidate.high;\r\n return true;\r\n }\r\n\r\n /** Boolean union among the (presorted) input ranges */\r\n public static unionSorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n const nA = dataA.length;\r\n const nB = dataB.length;\r\n let iA = 0;\r\n let iB = 0;\r\n const retVal: Range1d[] = [];\r\n while (iA < nA && iB < nB) {\r\n const rangeA = dataA[iA];\r\n const rangeB = dataB[iB];\r\n let workRange: Range1d;\r\n // Pull from the lower of rangeA and rangeB. This always advances exactly one of the indices -- progress towards getting out.\r\n if (rangeA.low <= rangeB.low) {\r\n workRange = rangeA.clone();\r\n iA++;\r\n } else {\r\n workRange = rangeB.clone();\r\n iB++;\r\n }\r\n\r\n let toLoop = true;\r\n do {\r\n const resultA = Range1dArray.advanceIntervalUnion(workRange, dataA, iA);\r\n const resultB = Range1dArray.advanceIntervalUnion(workRange, dataB, iB);\r\n if (resultA)\r\n iA++;\r\n if (resultB)\r\n iB++;\r\n if (!(resultA || resultB))\r\n toLoop = false;\r\n } while (toLoop);\r\n\r\n retVal.push(workRange);\r\n }\r\n\r\n while (iA < nA)\r\n retVal.push(dataA[iA++]);\r\n while (iB < nB)\r\n retVal.push(dataB[iB++]);\r\n\r\n return retVal;\r\n }\r\n\r\n /** Boolean parity among the (presorted) input ranges */\r\n public static paritySorted(dataA: Range1d[], dataB: Range1d[]): Range1d[] {\r\n // Combine the two arrays, and then perform a simplification using simplifySortParity function\r\n const retVal: Range1d[] = [];\r\n for (const range of dataA)\r\n retVal.push(range.clone());\r\n for (const range of dataB)\r\n retVal.push(range.clone());\r\n\r\n // Sort the array\r\n retVal.sort(compareRange1dLexicalLowHigh);\r\n\r\n Range1dArray.simplifySortParity(retVal, true);\r\n return retVal;\r\n }\r\n\r\n /** Uses the Range1d specific compare function `compareRange1dLexicalLowHigh` for sorting the array of ranges */\r\n public static sort(data: Range1d[]) {\r\n data.sort(compareRange1dLexicalLowHigh);\r\n }\r\n\r\n /** Cleans up the array, compressing any overlapping ranges. If removeZeroLengthRanges is set to true, will also remove any Ranges in the form (x, x) */\r\n public static simplifySortUnion(data: Range1d[], removeZeroLengthRanges: boolean = false) {\r\n if (data.length < 2)\r\n return;\r\n\r\n data.sort(compareRange1dLexicalLowHigh);\r\n\r\n let currentIndex = 0; // last accepted interval\r\n for (let i = 1; i < data.length; i++) {\r\n if (data[i].low <= data[currentIndex].high) {\r\n // extend the current range\r\n if (data[i].high > data[currentIndex].high)\r\n data[currentIndex].high = data[i].high;\r\n } else {\r\n // data[i] is a new entry.\r\n currentIndex++;\r\n data[currentIndex].setFrom(data[i]);\r\n }\r\n }\r\n\r\n data.length = currentIndex + 1;\r\n if (removeZeroLengthRanges) {\r\n currentIndex = -1;\r\n for (let i = 0; i < data.length; i++) {\r\n if (data[i].low < data[i].high) {\r\n if (currentIndex < i)\r\n data[++currentIndex].setFrom(data[i]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Apply parity logic among ranges which are not pre-sorted. */\r\n public static simplifySortParity(data: Range1d[], removeZeroLengthRanges: boolean = false) {\r\n const numData: number[] = [];\r\n for (const range of data) {\r\n if (range.low !== range.high) {\r\n numData.push(range.low);\r\n numData.push(range.high);\r\n }\r\n }\r\n const n = numData.length;\r\n numData.sort((a: number, b: number): number => {\r\n if (a < b) return -1;\r\n if (a > b) return 1;\r\n return 0;\r\n });\r\n\r\n let currIdx = 0;\r\n let x0;\r\n let x1;\r\n for (let i = 0; i < n; i += 2) {\r\n x0 = numData[i];\r\n x1 = numData[i + 1];\r\n if (!removeZeroLengthRanges) {\r\n Range1d.createXX(x0, x1, data[currIdx++]);\r\n } else {\r\n // coalesce intervals that share end and start:\r\n while (i + 2 < n && numData[i + 2] === x1) {\r\n i += 2;\r\n x1 = numData[i + 1];\r\n }\r\n if (x1 > x0)\r\n Range1d.createXX(x0, x1, data[currIdx++]);\r\n }\r\n }\r\n\r\n data.length = currIdx;\r\n }\r\n\r\n /** test if value is \"in\" by union rules.\r\n * * This considers all intervals-- i.e. does not expect or take advantage of sorting.\r\n */\r\n public static testUnion(data: Range1d[], value: number): boolean {\r\n return this.countContainingRanges(data, value) > 0;\r\n }\r\n /** test if value is \"in\" by parity rules.\r\n * * This considers all intervals-- i.e. does not expect or take advantage of sorting.\r\n */\r\n public static testParity(data: Range1d[], value: number): boolean {\r\n let inside = false;\r\n for (const range of data) {\r\n if (range.containsX(value))\r\n inside = !inside;\r\n }\r\n return inside;\r\n }\r\n\r\n /** linear search to count number of intervals which contain `value`.\r\n */\r\n public static countContainingRanges(data: Range1d[], value: number): number {\r\n let n = 0;\r\n for (const range of data) {\r\n if (range.containsX(value))\r\n n++;\r\n }\r\n return n;\r\n }\r\n\r\n /** return an array with all the low and high values of all the ranges.\r\n * @param data array of ranges.\r\n * @param sort optionally request immediate sort.\r\n * @param compress optionally request removal of duplicates.\r\n */\r\n public static getBreaks(data: Range1d[], result?: GrowableFloat64Array, sort: boolean = false, compress: boolean = false, clear: boolean = true): GrowableFloat64Array {\r\n if (!result) result = new GrowableFloat64Array(2 * data.length);\r\n if (clear) result.clear();\r\n for (const range of data) {\r\n result.push(range.low);\r\n result.push(range.high);\r\n }\r\n if (sort)\r\n result.sort();\r\n if (compress)\r\n result.compressAdjacentDuplicates();\r\n\r\n return result;\r\n }\r\n\r\n /** evaluate a point at an array of given fraction values\r\n * @param data array of ranges.\r\n * @param initialRangeFraction fraction coordinate applied only to first range. (typically negative)\r\n * @param rangeFraction fraction within each range.\r\n * @param includeDegenerateRange if false, skip rangeFraction for 0-length ranges.\r\n * @param gapFraction fraction within interval from each range high to successor low\r\n * @param includeDegenerateGap if false, skip rangeFraction for 0-length gaps.\r\n * @param finalRangeFraction fraction coordinate applied only to last range (typically an extrapolation above)\r\n * @param result array to receive values\r\n */\r\n public static appendFractionalPoints(data: Range1d[], initialRangeFraction: number | undefined, rangeFraction: number | undefined, includeDegenerateRange: boolean,\r\n gapFraction: number | undefined, includeDegenerateGap: boolean,\r\n finalRangeFraction: number | undefined, result: GrowableFloat64Array | number[]): GrowableFloat64Array | number[] {\r\n const numRange = data.length;\r\n if (numRange > 0) {\r\n if (undefined !== initialRangeFraction)\r\n result.push(data[0].fractionToPoint(initialRangeFraction));\r\n for (let i = 0; i < numRange; i++) {\r\n if (rangeFraction !== undefined && (includeDegenerateRange || data[i].low !== data[i].high))\r\n result.push(data[i].fractionToPoint(rangeFraction));\r\n if (i > 1 && gapFraction !== undefined && (includeDegenerateGap || data[i].low !== data[i].high))\r\n result.push(Geometry.interpolate(data[i - 1].high, gapFraction, data[i].low));\r\n }\r\n if (undefined !== finalRangeFraction)\r\n result.push(data[numRange - 1].fractionToPoint(finalRangeFraction));\r\n }\r\n return result;\r\n }\r\n\r\n /** Return a single range constructed with the low of range 0 and high of final range in the set. */\r\n public static firstLowToLastHigh(data: Range1d[]): Range1d {\r\n if (data.length === 0)\r\n return Range1d.createNull();\r\n return Range1d.createXX(data[0].low, data[data.length - 1].high);\r\n }\r\n /** sum the lengths of all ranges */\r\n public static sumLengths(data: Range1d[]): number {\r\n let sum = 0.0;\r\n for (const range of data) {\r\n sum += range.length();\r\n }\r\n return sum;\r\n }\r\n\r\n /**\r\n * Test if the low,high values are sorted with no overlap.\r\n * @param data array of ranges.\r\n * @param strict if true, consider exact high-to-low match as overlap.\r\n */\r\n public static isSorted(data: Range1d[], strict: boolean = true): boolean {\r\n const n = data.length;\r\n if (strict) {\r\n for (let i = 0; i + 1 < n; i++) {\r\n if (data[i].high >= data[i + 1].low)\r\n return false;\r\n }\r\n } else {\r\n for (let i = 0; i + 1 < n; i++) {\r\n if (data[i].high > data[i + 1].low)\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/** Checks low's first, then high's\r\n * @internal\r\n */\r\nexport function compareRange1dLexicalLowHigh(a: Range1d, b: Range1d): number {\r\n if (a.low < b.low) return -1;\r\n if (a.low > b.low) return 1;\r\n if (a.high < b.high) return -1;\r\n if (a.high > b.high) return 1;\r\n return 0;\r\n}\r\n"]}
@@ -0,0 +1,164 @@
1
+ import { Point2d, Vector2d } from "../geometry3d/Point2dVector2d";
2
+ import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
3
+ import { XAndY } from "../geometry3d/XYZProps";
4
+ import { Point4d } from "../geometry4d/Point4d";
5
+ /**
6
+ * static methods for commonly appearing sets of equations in 2 or 3 variables
7
+ * @public
8
+ */
9
+ export declare class SmallSystem {
10
+ /**
11
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection.
12
+ * Return the fractional (not xy) coordinates in result.x, result.y
13
+ * @param a0 start point of line a
14
+ * @param a1 end point of line a
15
+ * @param b0 start point of line b
16
+ * @param b1 end point of line b
17
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
18
+ */
19
+ static lineSegment2dXYTransverseIntersectionUnbounded(a0: Point2d, a1: Point2d, b0: Point2d, b1: Point2d, result: Vector2d): boolean;
20
+ /**
21
+ * * (ax0,ay0) to (ax0+ux,ay0+uy) are line A.
22
+ * * (bx0,by0) to (bx0+vx,by0+vy) are lineB.
23
+ * * Return true if the lines have a simple intersection.
24
+ * * Return the fractional (not xy) coordinates in result.x, result.y
25
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
26
+ */
27
+ static lineSegmentXYUVTransverseIntersectionUnbounded(ax0: number, ay0: number, ux: number, uy: number, bx0: number, by0: number, vx: number, vy: number, result: Vector2d): boolean;
28
+ /**
29
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts
30
+ * Return the fractional (not xy) coordinates in result.x, result.y
31
+ * @param a0 start point of line a
32
+ * @param a1 end point of line a
33
+ * @param b0 start point of line b
34
+ * @param b1 end point of line b
35
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
36
+ */
37
+ static lineSegment3dXYTransverseIntersectionUnbounded(a0: Point3d, a1: Point3d, b0: Point3d, b1: Point3d, result: Vector2d): boolean;
38
+ /**
39
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts of WEIGHTED 4D Points
40
+ * Return the fractional (not xy) coordinates in result.x, result.y
41
+ * @param hA0 homogeneous start point of line a
42
+ * @param hA1 homogeneous end point of line a
43
+ * @param hB0 homogeneous start point of line b
44
+ * @param hB1 homogeneous end point of line b
45
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
46
+ */
47
+ static lineSegment3dHXYTransverseIntersectionUnbounded(hA0: Point4d, hA1: Point4d, hB0: Point4d, hB1: Point4d, result?: Vector2d): Vector2d | undefined;
48
+ /**
49
+ * Return the line fraction at which the (homogeneous) line is closest to a space point as viewed in xy only.
50
+ * @param hA0 homogeneous start point of line a
51
+ * @param hA1 homogeneous end point of line a
52
+ * @param spacePoint homogeneous point in space
53
+ */
54
+ static lineSegment3dHXYClosestPointUnbounded(hA0: Point4d, hA1: Point4d, spacePoint: Point4d): number | undefined;
55
+ /**
56
+ * Return the line fraction at which the line is closest to a space point as viewed in xy only.
57
+ * @param pointA0 start point
58
+ * @param pointA1 end point
59
+ * @param spacePoint point in space
60
+ */
61
+ static lineSegment3dXYClosestPointUnbounded(pointA0: XAndY, pointA1: XAndY, spacePoint: XAndY): number | undefined;
62
+ /**
63
+ * Return the line fraction at which the line is closest to a space point
64
+ * @param pointA0 start point
65
+ * @param pointA1 end point
66
+ * @param spacePoint point in space
67
+ */
68
+ static lineSegment3dClosestPointUnbounded(pointA0: Point3d, pointA1: Point3d, spacePoint: Point3d): number | undefined;
69
+ /**
70
+ * Return true if lines (a0,a1) to (b0, b1) have closest approach (go by each other) in 3d
71
+ * Return the fractional (not xy) coordinates in result.x, result.y
72
+ * @param a0 start point of line a
73
+ * @param a1 end point of line a
74
+ * @param b0 start point of line b
75
+ * @param b1 end point of line b
76
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
77
+ */
78
+ static lineSegment3dClosestApproachUnbounded(a0: Point3d, a1: Point3d, b0: Point3d, b1: Point3d, result: Vector2d): boolean;
79
+ /**
80
+ * Return true if the given rays have closest approach (go by each other) in 3d
81
+ * Return the fractional (not xy) coordinates as x and y parts of a Point2d.
82
+ * @param ax x-coordinate of the origin of the first ray
83
+ * @param ay y-coordinate of the origin of the first ray
84
+ * @param az z-coordinate of the origin of the first ray
85
+ * @param au x-coordinate of the direction vector of the first ray
86
+ * @param av y-coordinate of the direction vector of the first ray
87
+ * @param aw z-coordinate of the direction vector of the first ray
88
+ * @param bx x-coordinate of the origin of the second ray
89
+ * @param by y-coordinate of the origin of the second ray
90
+ * @param bz z-coordinate of the origin of the second ray
91
+ * @param bu x-coordinate of the direction vector of the second ray
92
+ * @param bv y-coordinate of the direction vector of the second ray
93
+ * @param bw z-coordinate of the direction vector of the second ray
94
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
95
+ */
96
+ static ray3dXYZUVWClosestApproachUnbounded(ax: number, ay: number, az: number, au: number, av: number, aw: number, bx: number, by: number, bz: number, bu: number, bv: number, bw: number, result: Vector2d): boolean;
97
+ /**
98
+ * Solve the pair of linear equations
99
+ * * `ux * x + vx * y = cx`
100
+ * * `uy * x + vy * y = cy`
101
+ * @param ux xx coefficient
102
+ * @param vx xy coefficient
103
+ * @param uy yx coefficient
104
+ * @param vy yy coefficient
105
+ * @param cx x right hand side
106
+ * @param cy y right hand side
107
+ * @param result (x,y) solution (MUST be preallocated by caller)
108
+ */
109
+ static linearSystem2d(ux: number, vx: number, // first row of matrix
110
+ uy: number, vy: number, // second row of matrix
111
+ cx: number, cy: number, // right side
112
+ result: Vector2d): boolean;
113
+ /**
114
+ * Solve a linear system:
115
+ * * x equation: `axx * u + axy * v + axz * w = cx`
116
+ * * y equation: `ayx * u + ayy * v + ayz * w = cy`
117
+ * * z equation: `azx * u + azy * v + azz * w = cz`
118
+ * @param axx row 0, column 0 coefficient
119
+ * @param axy row 0, column 1 coefficient
120
+ * @param axz row 0, column 1 coefficient
121
+ * @param ayx row 1, column 0 coefficient
122
+ * @param ayy row 1, column 1 coefficient
123
+ * @param ayz row 1, column 2 coefficient
124
+ * @param azx row 2, column 0 coefficient
125
+ * @param azy row 2, column 1 coefficient
126
+ * @param azz row 2, column 2 coefficient
127
+ * @param cx right hand side row 0 coefficient
128
+ * @param cy right hand side row 1 coefficient
129
+ * @param cz right hand side row 2 coefficient
130
+ * @param result optional result.
131
+ * @returns solution vector (u,v,w) or `undefined` if system is singular.
132
+ */
133
+ static linearSystem3d(axx: number, axy: number, axz: number, // first row of matrix
134
+ ayx: number, ayy: number, ayz: number, // second row of matrix
135
+ azx: number, azy: number, azz: number, // second row of matrix
136
+ cx: number, cy: number, cz: number, // right side
137
+ result?: Vector3d): Vector3d | undefined;
138
+ /**
139
+ * Compute the intersection of three planes.
140
+ * @param xyzA point on the first plane
141
+ * @param normalA normal of the first plane
142
+ * @param xyzB point on the second plane
143
+ * @param normalB normal of the second plane
144
+ * @param xyzC point on the third plane
145
+ * @param normalC normal of the third plane
146
+ * @param result optional result
147
+ * @returns intersection point of the three planes (as a Vector3d), or undefined if at least two planes are parallel.
148
+ */
149
+ static intersect3Planes(xyzA: Point3d, normalA: Vector3d, xyzB: Point3d, normalB: Vector3d, xyzC: Point3d, normalC: Vector3d, result?: Vector3d): Vector3d | undefined;
150
+ /**
151
+ * * in rowB, replace `rowB[j] += a * rowB[pivot] * rowA[j] / rowA[pivot]` for `j>pivot`
152
+ * @param rowA row that does not change
153
+ * @param pivotIndex index of pivot (divisor) in rowA.
154
+ * @param rowB row where elimination occurs.
155
+ */
156
+ static eliminateFromPivot(rowA: Float64Array, pivotIndex: number, rowB: Float64Array, a: number): boolean;
157
+ /**
158
+ * Solve a pair of bilinear equations
159
+ * * First equation: `a0 + b0 * u + c0 * v + d0 * u * v = 0`
160
+ * * Second equation: `a1 + b1 * u + c1 * v + d1 * u * v = 0`
161
+ */
162
+ static solveBilinearPair(a0: number, b0: number, c0: number, d0: number, a1: number, b1: number, c1: number, d1: number): Point2d[] | undefined;
163
+ }
164
+ //# sourceMappingURL=SmallSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmallSystem.d.ts","sourceRoot":"","sources":["../../../src/numerics/SmallSystem.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,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B;IAC9D,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAK,aAAa;IACpD,MAAM,CAAC,EAAE,QAAQ,GAChB,QAAQ,GAAG,SAAS;IAcvB;;;;;;;;;;OAUG;WACW,gBAAgB,CAC5B,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAChC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAChC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IAU5E;;;;;OAKG;WACW,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IAShH;;;;OAIG;WACW,iBAAiB,CAC7B,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAC9C,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAC7C,OAAO,EAAE,GAAG,SAAS;CAGzB"}
@@ -0,0 +1,321 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SmallSystem = void 0;
8
+ /** @packageDocumentation
9
+ * @module Numerics
10
+ */
11
+ const Geometry_1 = require("../Geometry");
12
+ const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
13
+ const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
14
+ const Polynomials_1 = require("./Polynomials");
15
+ // cspell:word XYUV
16
+ /**
17
+ * static methods for commonly appearing sets of equations in 2 or 3 variables
18
+ * @public
19
+ */
20
+ class SmallSystem {
21
+ /**
22
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection.
23
+ * Return the fractional (not xy) coordinates in result.x, result.y
24
+ * @param a0 start point of line a
25
+ * @param a1 end point of line a
26
+ * @param b0 start point of line b
27
+ * @param b1 end point of line b
28
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
29
+ */
30
+ static lineSegment2dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
31
+ const ux = a1.x - a0.x;
32
+ const uy = a1.y - a0.y;
33
+ const vx = b1.x - b0.x;
34
+ const vy = b1.y - b0.y;
35
+ const cx = b0.x - a0.x;
36
+ const cy = b0.y - a0.y;
37
+ const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
38
+ const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
39
+ const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
40
+ const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
41
+ const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
42
+ if (s !== undefined && t !== undefined) {
43
+ result.set(s, -t);
44
+ return true;
45
+ }
46
+ result.set(0, 0);
47
+ return false;
48
+ }
49
+ /**
50
+ * * (ax0,ay0) to (ax0+ux,ay0+uy) are line A.
51
+ * * (bx0,by0) to (bx0+vx,by0+vy) are lineB.
52
+ * * Return true if the lines have a simple intersection.
53
+ * * Return the fractional (not xy) coordinates in result.x, result.y
54
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
55
+ */
56
+ static lineSegmentXYUVTransverseIntersectionUnbounded(ax0, ay0, ux, uy, bx0, by0, vx, vy, result) {
57
+ const cx = bx0 - ax0;
58
+ const cy = by0 - ay0;
59
+ const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
60
+ const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
61
+ const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
62
+ const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
63
+ const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
64
+ if (s !== undefined && t !== undefined) {
65
+ result.set(s, -t);
66
+ return true;
67
+ }
68
+ result.set(0, 0);
69
+ return false;
70
+ }
71
+ /**
72
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts
73
+ * Return the fractional (not xy) coordinates in result.x, result.y
74
+ * @param a0 start point of line a
75
+ * @param a1 end point of line a
76
+ * @param b0 start point of line b
77
+ * @param b1 end point of line b
78
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
79
+ */
80
+ static lineSegment3dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
81
+ const ux = a1.x - a0.x;
82
+ const uy = a1.y - a0.y;
83
+ const vx = b1.x - b0.x;
84
+ const vy = b1.y - b0.y;
85
+ const cx = b0.x - a0.x;
86
+ const cy = b0.y - a0.y;
87
+ const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
88
+ const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
89
+ const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
90
+ const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
91
+ const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
92
+ if (s !== undefined && t !== undefined) {
93
+ result.set(s, -t);
94
+ return true;
95
+ }
96
+ result.set(0, 0);
97
+ return false;
98
+ }
99
+ /**
100
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts of WEIGHTED 4D Points
101
+ * Return the fractional (not xy) coordinates in result.x, result.y
102
+ * @param hA0 homogeneous start point of line a
103
+ * @param hA1 homogeneous end point of line a
104
+ * @param hB0 homogeneous start point of line b
105
+ * @param hB1 homogeneous end point of line b
106
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
107
+ */
108
+ static lineSegment3dHXYTransverseIntersectionUnbounded(hA0, hA1, hB0, hB1, result) {
109
+ // Considering only x,y,w parts....
110
+ // Point Q along B is (in full homogeneous) `(1-lambda) B0 + lambda 1`
111
+ // PointQ is colinear with A0,A1 when the determinant det (A0,A1,Q) is zero. (Each column takes xyw parts)
112
+ const alpha0 = Geometry_1.Geometry.tripleProduct(hA0.x, hA1.x, hB0.x, hA0.y, hA1.y, hB0.y, hA0.w, hA1.w, hB0.w);
113
+ const alpha1 = Geometry_1.Geometry.tripleProduct(hA0.x, hA1.x, hB1.x, hA0.y, hA1.y, hB1.y, hA0.w, hA1.w, hB1.w);
114
+ const fractionB = Geometry_1.Geometry.conditionalDivideFraction(-alpha0, alpha1 - alpha0);
115
+ if (fractionB !== undefined) {
116
+ const beta0 = Geometry_1.Geometry.tripleProduct(hB0.x, hB1.x, hA0.x, hB0.y, hB1.y, hA0.y, hB0.w, hB1.w, hA0.w);
117
+ const beta1 = Geometry_1.Geometry.tripleProduct(hB0.x, hB1.x, hA1.x, hB0.y, hB1.y, hA1.y, hB0.w, hB1.w, hA1.w);
118
+ const fractionA = Geometry_1.Geometry.conditionalDivideFraction(-beta0, beta1 - beta0);
119
+ if (fractionA !== undefined)
120
+ return Point2dVector2d_1.Vector2d.create(fractionA, fractionB, result);
121
+ }
122
+ return undefined;
123
+ }
124
+ /**
125
+ * Return the line fraction at which the (homogeneous) line is closest to a space point as viewed in xy only.
126
+ * @param hA0 homogeneous start point of line a
127
+ * @param hA1 homogeneous end point of line a
128
+ * @param spacePoint homogeneous point in space
129
+ */
130
+ static lineSegment3dHXYClosestPointUnbounded(hA0, hA1, spacePoint) {
131
+ // Considering only x,y,w parts....
132
+ // weighted difference of (A1 w0 - A0 w1) is (cartesian) tangent vector along the line as viewed.
133
+ // The perpendicular (pure vector) W = (-y,x) flip is the direction of projection
134
+ // Point Q along A is (in full homogeneous) `(1-lambda) A0 + lambda 1 A1`
135
+ // PointQ is colinear with spacePoint and and W when the xyw homogeneous determinant | Q W spacePoint | is zero.
136
+ const tx = hA1.x * hA0.w - hA0.x * hA1.w;
137
+ const ty = hA1.y * hA0.w - hA0.y * hA1.w;
138
+ const det0 = Geometry_1.Geometry.tripleProduct(hA0.x, -ty, spacePoint.x, hA0.y, tx, spacePoint.y, hA0.w, 0, spacePoint.w);
139
+ const det1 = Geometry_1.Geometry.tripleProduct(hA1.x, -ty, spacePoint.x, hA1.y, tx, spacePoint.y, hA1.w, 0, spacePoint.w);
140
+ return Geometry_1.Geometry.conditionalDivideFraction(-det0, det1 - det0);
141
+ }
142
+ /**
143
+ * Return the line fraction at which the line is closest to a space point as viewed in xy only.
144
+ * @param pointA0 start point
145
+ * @param pointA1 end point
146
+ * @param spacePoint point in space
147
+ */
148
+ static lineSegment3dXYClosestPointUnbounded(pointA0, pointA1, spacePoint) {
149
+ // Considering only x,y parts....
150
+ const ux = pointA1.x - pointA0.x;
151
+ const uy = pointA1.y - pointA0.y;
152
+ const uu = ux * ux + uy * uy;
153
+ const vx = spacePoint.x - pointA0.x;
154
+ const vy = spacePoint.y - pointA0.y;
155
+ const uv = ux * vx + uy * vy;
156
+ return Geometry_1.Geometry.conditionalDivideFraction(uv, uu);
157
+ }
158
+ /**
159
+ * Return the line fraction at which the line is closest to a space point
160
+ * @param pointA0 start point
161
+ * @param pointA1 end point
162
+ * @param spacePoint point in space
163
+ */
164
+ static lineSegment3dClosestPointUnbounded(pointA0, pointA1, spacePoint) {
165
+ const ux = pointA1.x - pointA0.x;
166
+ const uy = pointA1.y - pointA0.y;
167
+ const uz = pointA1.z - pointA0.z;
168
+ const uu = ux * ux + uy * uy + uz * uz;
169
+ const vx = spacePoint.x - pointA0.x;
170
+ const vy = spacePoint.y - pointA0.y;
171
+ const vz = spacePoint.z - pointA0.z;
172
+ const uv = ux * vx + uy * vy + uz * vz;
173
+ return Geometry_1.Geometry.conditionalDivideFraction(uv, uu);
174
+ }
175
+ /**
176
+ * Return true if lines (a0,a1) to (b0, b1) have closest approach (go by each other) in 3d
177
+ * Return the fractional (not xy) coordinates in result.x, result.y
178
+ * @param a0 start point of line a
179
+ * @param a1 end point of line a
180
+ * @param b0 start point of line b
181
+ * @param b1 end point of line b
182
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
183
+ */
184
+ static lineSegment3dClosestApproachUnbounded(a0, a1, b0, b1, result) {
185
+ return this.ray3dXYZUVWClosestApproachUnbounded(a0.x, a0.y, a0.z, a1.x - a0.x, a1.y - a0.y, a1.z - a0.z, b0.x, b0.y, b0.z, b1.x - b0.x, b1.y - b0.y, b1.z - b0.z, result);
186
+ }
187
+ /**
188
+ * Return true if the given rays have closest approach (go by each other) in 3d
189
+ * Return the fractional (not xy) coordinates as x and y parts of a Point2d.
190
+ * @param ax x-coordinate of the origin of the first ray
191
+ * @param ay y-coordinate of the origin of the first ray
192
+ * @param az z-coordinate of the origin of the first ray
193
+ * @param au x-coordinate of the direction vector of the first ray
194
+ * @param av y-coordinate of the direction vector of the first ray
195
+ * @param aw z-coordinate of the direction vector of the first ray
196
+ * @param bx x-coordinate of the origin of the second ray
197
+ * @param by y-coordinate of the origin of the second ray
198
+ * @param bz z-coordinate of the origin of the second ray
199
+ * @param bu x-coordinate of the direction vector of the second ray
200
+ * @param bv y-coordinate of the direction vector of the second ray
201
+ * @param bw z-coordinate of the direction vector of the second ray
202
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
203
+ */
204
+ static ray3dXYZUVWClosestApproachUnbounded(ax, ay, az, au, av, aw, bx, by, bz, bu, bv, bw, result) {
205
+ const cx = bx - ax;
206
+ const cy = by - ay;
207
+ const cz = bz - az;
208
+ const uu = Geometry_1.Geometry.hypotenuseSquaredXYZ(au, av, aw);
209
+ const vv = Geometry_1.Geometry.hypotenuseSquaredXYZ(bu, bv, bw);
210
+ const uv = Geometry_1.Geometry.dotProductXYZXYZ(au, av, aw, bu, bv, bw);
211
+ const cu = Geometry_1.Geometry.dotProductXYZXYZ(cx, cy, cz, au, av, aw);
212
+ const cv = Geometry_1.Geometry.dotProductXYZXYZ(cx, cy, cz, bu, bv, bw);
213
+ return SmallSystem.linearSystem2d(uu, -uv, uv, -vv, cu, cv, result);
214
+ }
215
+ /**
216
+ * Solve the pair of linear equations
217
+ * * `ux * x + vx * y = cx`
218
+ * * `uy * x + vy * y = cy`
219
+ * @param ux xx coefficient
220
+ * @param vx xy coefficient
221
+ * @param uy yx coefficient
222
+ * @param vy yy coefficient
223
+ * @param cx x right hand side
224
+ * @param cy y right hand side
225
+ * @param result (x,y) solution (MUST be preallocated by caller)
226
+ */
227
+ static linearSystem2d(ux, vx, // first row of matrix
228
+ uy, vy, // second row of matrix
229
+ cx, cy, // right side
230
+ result) {
231
+ const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
232
+ const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
233
+ const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
234
+ const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
235
+ const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
236
+ if (s !== undefined && t !== undefined) {
237
+ result.set(s, t);
238
+ return true;
239
+ }
240
+ result.set(0, 0);
241
+ return false;
242
+ }
243
+ /**
244
+ * Solve a linear system:
245
+ * * x equation: `axx * u + axy * v + axz * w = cx`
246
+ * * y equation: `ayx * u + ayy * v + ayz * w = cy`
247
+ * * z equation: `azx * u + azy * v + azz * w = cz`
248
+ * @param axx row 0, column 0 coefficient
249
+ * @param axy row 0, column 1 coefficient
250
+ * @param axz row 0, column 1 coefficient
251
+ * @param ayx row 1, column 0 coefficient
252
+ * @param ayy row 1, column 1 coefficient
253
+ * @param ayz row 1, column 2 coefficient
254
+ * @param azx row 2, column 0 coefficient
255
+ * @param azy row 2, column 1 coefficient
256
+ * @param azz row 2, column 2 coefficient
257
+ * @param cx right hand side row 0 coefficient
258
+ * @param cy right hand side row 1 coefficient
259
+ * @param cz right hand side row 2 coefficient
260
+ * @param result optional result.
261
+ * @returns solution vector (u,v,w) or `undefined` if system is singular.
262
+ */
263
+ static linearSystem3d(axx, axy, axz, // first row of matrix
264
+ ayx, ayy, ayz, // second row of matrix
265
+ azx, azy, azz, // second row of matrix
266
+ cx, cy, cz, // right side
267
+ result) {
268
+ // determinants of various combinations of columns ...
269
+ const detXYZ = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, axz, ayz, azz);
270
+ const detCYZ = Geometry_1.Geometry.tripleProduct(cx, cy, cz, axy, ayy, azy, axz, ayz, azz);
271
+ const detXCZ = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, cx, cy, cz, axz, ayz, azz);
272
+ const detXYC = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, cx, cy, cz);
273
+ const s = Geometry_1.Geometry.conditionalDivideFraction(detCYZ, detXYZ);
274
+ const t = Geometry_1.Geometry.conditionalDivideFraction(detXCZ, detXYZ);
275
+ const u = Geometry_1.Geometry.conditionalDivideFraction(detXYC, detXYZ);
276
+ if (s !== undefined && t !== undefined && u !== undefined) {
277
+ return Point3dVector3d_1.Vector3d.create(s, t, u, result);
278
+ }
279
+ return undefined;
280
+ }
281
+ /**
282
+ * Compute the intersection of three planes.
283
+ * @param xyzA point on the first plane
284
+ * @param normalA normal of the first plane
285
+ * @param xyzB point on the second plane
286
+ * @param normalB normal of the second plane
287
+ * @param xyzC point on the third plane
288
+ * @param normalC normal of the third plane
289
+ * @param result optional result
290
+ * @returns intersection point of the three planes (as a Vector3d), or undefined if at least two planes are parallel.
291
+ */
292
+ static intersect3Planes(xyzA, normalA, xyzB, normalB, xyzC, normalC, result) {
293
+ return this.linearSystem3d(normalA.x, normalA.y, normalA.z, normalB.x, normalB.y, normalB.z, normalC.x, normalC.y, normalC.z, Geometry_1.Geometry.dotProductXYZXYZ(xyzA.x, xyzA.y, xyzA.z, normalA.x, normalA.y, normalA.z), Geometry_1.Geometry.dotProductXYZXYZ(xyzB.x, xyzB.y, xyzB.z, normalB.x, normalB.y, normalB.z), Geometry_1.Geometry.dotProductXYZXYZ(xyzC.x, xyzC.y, xyzC.z, normalC.x, normalC.y, normalC.z), result);
294
+ }
295
+ /**
296
+ * * in rowB, replace `rowB[j] += a * rowB[pivot] * rowA[j] / rowA[pivot]` for `j>pivot`
297
+ * @param rowA row that does not change
298
+ * @param pivotIndex index of pivot (divisor) in rowA.
299
+ * @param rowB row where elimination occurs.
300
+ */
301
+ static eliminateFromPivot(rowA, pivotIndex, rowB, a) {
302
+ const n = rowA.length;
303
+ let q = Geometry_1.Geometry.conditionalDivideFraction(rowB[pivotIndex], rowA[pivotIndex]);
304
+ if (q === undefined)
305
+ return false;
306
+ q *= a;
307
+ for (let j = pivotIndex + 1; j < n; j++)
308
+ rowB[j] += q * rowA[j];
309
+ return true;
310
+ }
311
+ /**
312
+ * Solve a pair of bilinear equations
313
+ * * First equation: `a0 + b0 * u + c0 * v + d0 * u * v = 0`
314
+ * * Second equation: `a1 + b1 * u + c1 * v + d1 * u * v = 0`
315
+ */
316
+ static solveBilinearPair(a0, b0, c0, d0, a1, b1, c1, d1) {
317
+ return Polynomials_1.BilinearPolynomial.solveBilinearPair(a0, b0, c0, d0, a1, b1, c1, d1);
318
+ }
319
+ }
320
+ exports.SmallSystem = SmallSystem;
321
+ //# sourceMappingURL=SmallSystem.js.map