@itwin/core-geometry 4.10.0-dev.9 → 5.0.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/CHANGELOG.md +21 -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
@@ -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,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKhD;;;GAGG;AACH,qBAAa,WAAW;IACtB;;;;;;;;OAQG;WACW,8CAA8C,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAC7G,MAAM,EAAE,QAAQ,GAAG,OAAO;IAsB5B;;;;;;OAMG;WACW,8CAA8C,CAC1D,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAChD,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAChD,MAAM,EAAE,QAAQ,GAAG,OAAO;IAkB5B;;;;;;;;OAQG;WACW,8CAA8C,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,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AM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAC7C,OAAO,EAAE,GAAG,SAAS;CAGzB"}
@@ -0,0 +1,317 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Numerics
7
+ */
8
+ import { Geometry } from "../Geometry";
9
+ import { Vector2d } from "../geometry3d/Point2dVector2d";
10
+ import { Vector3d } from "../geometry3d/Point3dVector3d";
11
+ import { BilinearPolynomial } from "./Polynomials";
12
+ // cspell:word XYUV
13
+ /**
14
+ * static methods for commonly appearing sets of equations in 2 or 3 variables
15
+ * @public
16
+ */
17
+ export class SmallSystem {
18
+ /**
19
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection.
20
+ * Return the fractional (not xy) coordinates in result.x, result.y
21
+ * @param a0 start point of line a
22
+ * @param a1 end point of line a
23
+ * @param b0 start point of line b
24
+ * @param b1 end point of line b
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 lineSegment2dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
28
+ const ux = a1.x - a0.x;
29
+ const uy = a1.y - a0.y;
30
+ const vx = b1.x - b0.x;
31
+ const vy = b1.y - b0.y;
32
+ const cx = b0.x - a0.x;
33
+ const cy = b0.y - a0.y;
34
+ const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);
35
+ const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);
36
+ const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);
37
+ const s = Geometry.conditionalDivideFraction(cv, uv);
38
+ const t = Geometry.conditionalDivideFraction(cu, uv);
39
+ if (s !== undefined && t !== undefined) {
40
+ result.set(s, -t);
41
+ return true;
42
+ }
43
+ result.set(0, 0);
44
+ return false;
45
+ }
46
+ /**
47
+ * * (ax0,ay0) to (ax0+ux,ay0+uy) are line A.
48
+ * * (bx0,by0) to (bx0+vx,by0+vy) are lineB.
49
+ * * Return true if the lines have a simple intersection.
50
+ * * Return the fractional (not xy) coordinates in result.x, result.y
51
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
52
+ */
53
+ static lineSegmentXYUVTransverseIntersectionUnbounded(ax0, ay0, ux, uy, bx0, by0, vx, vy, result) {
54
+ const cx = bx0 - ax0;
55
+ const cy = by0 - ay0;
56
+ const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);
57
+ const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);
58
+ const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);
59
+ const s = Geometry.conditionalDivideFraction(cv, uv);
60
+ const t = Geometry.conditionalDivideFraction(cu, uv);
61
+ if (s !== undefined && t !== undefined) {
62
+ result.set(s, -t);
63
+ return true;
64
+ }
65
+ result.set(0, 0);
66
+ return false;
67
+ }
68
+ /**
69
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts
70
+ * Return the fractional (not xy) coordinates in result.x, result.y
71
+ * @param a0 start point of line a
72
+ * @param a1 end point of line a
73
+ * @param b0 start point of line b
74
+ * @param b1 end point of line b
75
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
76
+ */
77
+ static lineSegment3dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
78
+ const ux = a1.x - a0.x;
79
+ const uy = a1.y - a0.y;
80
+ const vx = b1.x - b0.x;
81
+ const vy = b1.y - b0.y;
82
+ const cx = b0.x - a0.x;
83
+ const cy = b0.y - a0.y;
84
+ const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);
85
+ const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);
86
+ const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);
87
+ const s = Geometry.conditionalDivideFraction(cv, uv);
88
+ const t = Geometry.conditionalDivideFraction(cu, uv);
89
+ if (s !== undefined && t !== undefined) {
90
+ result.set(s, -t);
91
+ return true;
92
+ }
93
+ result.set(0, 0);
94
+ return false;
95
+ }
96
+ /**
97
+ * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts of WEIGHTED 4D Points
98
+ * Return the fractional (not xy) coordinates in result.x, result.y
99
+ * @param hA0 homogeneous start point of line a
100
+ * @param hA1 homogeneous end point of line a
101
+ * @param hB0 homogeneous start point of line b
102
+ * @param hB1 homogeneous end point of line b
103
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
104
+ */
105
+ static lineSegment3dHXYTransverseIntersectionUnbounded(hA0, hA1, hB0, hB1, result) {
106
+ // Considering only x,y,w parts....
107
+ // Point Q along B is (in full homogeneous) `(1-lambda) B0 + lambda 1`
108
+ // PointQ is colinear with A0,A1 when the determinant det (A0,A1,Q) is zero. (Each column takes xyw parts)
109
+ const alpha0 = Geometry.tripleProduct(hA0.x, hA1.x, hB0.x, hA0.y, hA1.y, hB0.y, hA0.w, hA1.w, hB0.w);
110
+ const alpha1 = Geometry.tripleProduct(hA0.x, hA1.x, hB1.x, hA0.y, hA1.y, hB1.y, hA0.w, hA1.w, hB1.w);
111
+ const fractionB = Geometry.conditionalDivideFraction(-alpha0, alpha1 - alpha0);
112
+ if (fractionB !== undefined) {
113
+ const beta0 = Geometry.tripleProduct(hB0.x, hB1.x, hA0.x, hB0.y, hB1.y, hA0.y, hB0.w, hB1.w, hA0.w);
114
+ const beta1 = Geometry.tripleProduct(hB0.x, hB1.x, hA1.x, hB0.y, hB1.y, hA1.y, hB0.w, hB1.w, hA1.w);
115
+ const fractionA = Geometry.conditionalDivideFraction(-beta0, beta1 - beta0);
116
+ if (fractionA !== undefined)
117
+ return Vector2d.create(fractionA, fractionB, result);
118
+ }
119
+ return undefined;
120
+ }
121
+ /**
122
+ * Return the line fraction at which the (homogeneous) line is closest to a space point as viewed in xy only.
123
+ * @param hA0 homogeneous start point of line a
124
+ * @param hA1 homogeneous end point of line a
125
+ * @param spacePoint homogeneous point in space
126
+ */
127
+ static lineSegment3dHXYClosestPointUnbounded(hA0, hA1, spacePoint) {
128
+ // Considering only x,y,w parts....
129
+ // weighted difference of (A1 w0 - A0 w1) is (cartesian) tangent vector along the line as viewed.
130
+ // The perpendicular (pure vector) W = (-y,x) flip is the direction of projection
131
+ // Point Q along A is (in full homogeneous) `(1-lambda) A0 + lambda 1 A1`
132
+ // PointQ is colinear with spacePoint and and W when the xyw homogeneous determinant | Q W spacePoint | is zero.
133
+ const tx = hA1.x * hA0.w - hA0.x * hA1.w;
134
+ const ty = hA1.y * hA0.w - hA0.y * hA1.w;
135
+ const det0 = Geometry.tripleProduct(hA0.x, -ty, spacePoint.x, hA0.y, tx, spacePoint.y, hA0.w, 0, spacePoint.w);
136
+ const det1 = Geometry.tripleProduct(hA1.x, -ty, spacePoint.x, hA1.y, tx, spacePoint.y, hA1.w, 0, spacePoint.w);
137
+ return Geometry.conditionalDivideFraction(-det0, det1 - det0);
138
+ }
139
+ /**
140
+ * Return the line fraction at which the line is closest to a space point as viewed in xy only.
141
+ * @param pointA0 start point
142
+ * @param pointA1 end point
143
+ * @param spacePoint point in space
144
+ */
145
+ static lineSegment3dXYClosestPointUnbounded(pointA0, pointA1, spacePoint) {
146
+ // Considering only x,y parts....
147
+ const ux = pointA1.x - pointA0.x;
148
+ const uy = pointA1.y - pointA0.y;
149
+ const uu = ux * ux + uy * uy;
150
+ const vx = spacePoint.x - pointA0.x;
151
+ const vy = spacePoint.y - pointA0.y;
152
+ const uv = ux * vx + uy * vy;
153
+ return Geometry.conditionalDivideFraction(uv, uu);
154
+ }
155
+ /**
156
+ * Return the line fraction at which the line is closest to a space point
157
+ * @param pointA0 start point
158
+ * @param pointA1 end point
159
+ * @param spacePoint point in space
160
+ */
161
+ static lineSegment3dClosestPointUnbounded(pointA0, pointA1, spacePoint) {
162
+ const ux = pointA1.x - pointA0.x;
163
+ const uy = pointA1.y - pointA0.y;
164
+ const uz = pointA1.z - pointA0.z;
165
+ const uu = ux * ux + uy * uy + uz * uz;
166
+ const vx = spacePoint.x - pointA0.x;
167
+ const vy = spacePoint.y - pointA0.y;
168
+ const vz = spacePoint.z - pointA0.z;
169
+ const uv = ux * vx + uy * vy + uz * vz;
170
+ return Geometry.conditionalDivideFraction(uv, uu);
171
+ }
172
+ /**
173
+ * Return true if lines (a0,a1) to (b0, b1) have closest approach (go by each other) in 3d
174
+ * Return the fractional (not xy) coordinates in result.x, result.y
175
+ * @param a0 start point of line a
176
+ * @param a1 end point of line a
177
+ * @param b0 start point of line b
178
+ * @param b1 end point of line b
179
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
180
+ */
181
+ static lineSegment3dClosestApproachUnbounded(a0, a1, b0, b1, result) {
182
+ 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);
183
+ }
184
+ /**
185
+ * Return true if the given rays have closest approach (go by each other) in 3d
186
+ * Return the fractional (not xy) coordinates as x and y parts of a Point2d.
187
+ * @param ax x-coordinate of the origin of the first ray
188
+ * @param ay y-coordinate of the origin of the first ray
189
+ * @param az z-coordinate of the origin of the first ray
190
+ * @param au x-coordinate of the direction vector of the first ray
191
+ * @param av y-coordinate of the direction vector of the first ray
192
+ * @param aw z-coordinate of the direction vector of the first ray
193
+ * @param bx x-coordinate of the origin of the second ray
194
+ * @param by y-coordinate of the origin of the second ray
195
+ * @param bz z-coordinate of the origin of the second ray
196
+ * @param bu x-coordinate of the direction vector of the second ray
197
+ * @param bv y-coordinate of the direction vector of the second ray
198
+ * @param bw z-coordinate of the direction vector of the second ray
199
+ * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
200
+ */
201
+ static ray3dXYZUVWClosestApproachUnbounded(ax, ay, az, au, av, aw, bx, by, bz, bu, bv, bw, result) {
202
+ const cx = bx - ax;
203
+ const cy = by - ay;
204
+ const cz = bz - az;
205
+ const uu = Geometry.hypotenuseSquaredXYZ(au, av, aw);
206
+ const vv = Geometry.hypotenuseSquaredXYZ(bu, bv, bw);
207
+ const uv = Geometry.dotProductXYZXYZ(au, av, aw, bu, bv, bw);
208
+ const cu = Geometry.dotProductXYZXYZ(cx, cy, cz, au, av, aw);
209
+ const cv = Geometry.dotProductXYZXYZ(cx, cy, cz, bu, bv, bw);
210
+ return SmallSystem.linearSystem2d(uu, -uv, uv, -vv, cu, cv, result);
211
+ }
212
+ /**
213
+ * Solve the pair of linear equations
214
+ * * `ux * x + vx * y = cx`
215
+ * * `uy * x + vy * y = cy`
216
+ * @param ux xx coefficient
217
+ * @param vx xy coefficient
218
+ * @param uy yx coefficient
219
+ * @param vy yy coefficient
220
+ * @param cx x right hand side
221
+ * @param cy y right hand side
222
+ * @param result (x,y) solution (MUST be preallocated by caller)
223
+ */
224
+ static linearSystem2d(ux, vx, // first row of matrix
225
+ uy, vy, // second row of matrix
226
+ cx, cy, // right side
227
+ result) {
228
+ const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);
229
+ const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);
230
+ const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);
231
+ const s = Geometry.conditionalDivideFraction(cv, uv);
232
+ const t = Geometry.conditionalDivideFraction(cu, uv);
233
+ if (s !== undefined && t !== undefined) {
234
+ result.set(s, t);
235
+ return true;
236
+ }
237
+ result.set(0, 0);
238
+ return false;
239
+ }
240
+ /**
241
+ * Solve a linear system:
242
+ * * x equation: `axx * u + axy * v + axz * w = cx`
243
+ * * y equation: `ayx * u + ayy * v + ayz * w = cy`
244
+ * * z equation: `azx * u + azy * v + azz * w = cz`
245
+ * @param axx row 0, column 0 coefficient
246
+ * @param axy row 0, column 1 coefficient
247
+ * @param axz row 0, column 1 coefficient
248
+ * @param ayx row 1, column 0 coefficient
249
+ * @param ayy row 1, column 1 coefficient
250
+ * @param ayz row 1, column 2 coefficient
251
+ * @param azx row 2, column 0 coefficient
252
+ * @param azy row 2, column 1 coefficient
253
+ * @param azz row 2, column 2 coefficient
254
+ * @param cx right hand side row 0 coefficient
255
+ * @param cy right hand side row 1 coefficient
256
+ * @param cz right hand side row 2 coefficient
257
+ * @param result optional result.
258
+ * @returns solution vector (u,v,w) or `undefined` if system is singular.
259
+ */
260
+ static linearSystem3d(axx, axy, axz, // first row of matrix
261
+ ayx, ayy, ayz, // second row of matrix
262
+ azx, azy, azz, // second row of matrix
263
+ cx, cy, cz, // right side
264
+ result) {
265
+ // determinants of various combinations of columns ...
266
+ const detXYZ = Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, axz, ayz, azz);
267
+ const detCYZ = Geometry.tripleProduct(cx, cy, cz, axy, ayy, azy, axz, ayz, azz);
268
+ const detXCZ = Geometry.tripleProduct(axx, ayx, azx, cx, cy, cz, axz, ayz, azz);
269
+ const detXYC = Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, cx, cy, cz);
270
+ const s = Geometry.conditionalDivideFraction(detCYZ, detXYZ);
271
+ const t = Geometry.conditionalDivideFraction(detXCZ, detXYZ);
272
+ const u = Geometry.conditionalDivideFraction(detXYC, detXYZ);
273
+ if (s !== undefined && t !== undefined && u !== undefined) {
274
+ return Vector3d.create(s, t, u, result);
275
+ }
276
+ return undefined;
277
+ }
278
+ /**
279
+ * Compute the intersection of three planes.
280
+ * @param xyzA point on the first plane
281
+ * @param normalA normal of the first plane
282
+ * @param xyzB point on the second plane
283
+ * @param normalB normal of the second plane
284
+ * @param xyzC point on the third plane
285
+ * @param normalC normal of the third plane
286
+ * @param result optional result
287
+ * @returns intersection point of the three planes (as a Vector3d), or undefined if at least two planes are parallel.
288
+ */
289
+ static intersect3Planes(xyzA, normalA, xyzB, normalB, xyzC, normalC, result) {
290
+ return this.linearSystem3d(normalA.x, normalA.y, normalA.z, normalB.x, normalB.y, normalB.z, normalC.x, normalC.y, normalC.z, Geometry.dotProductXYZXYZ(xyzA.x, xyzA.y, xyzA.z, normalA.x, normalA.y, normalA.z), Geometry.dotProductXYZXYZ(xyzB.x, xyzB.y, xyzB.z, normalB.x, normalB.y, normalB.z), Geometry.dotProductXYZXYZ(xyzC.x, xyzC.y, xyzC.z, normalC.x, normalC.y, normalC.z), result);
291
+ }
292
+ /**
293
+ * * in rowB, replace `rowB[j] += a * rowB[pivot] * rowA[j] / rowA[pivot]` for `j>pivot`
294
+ * @param rowA row that does not change
295
+ * @param pivotIndex index of pivot (divisor) in rowA.
296
+ * @param rowB row where elimination occurs.
297
+ */
298
+ static eliminateFromPivot(rowA, pivotIndex, rowB, a) {
299
+ const n = rowA.length;
300
+ let q = Geometry.conditionalDivideFraction(rowB[pivotIndex], rowA[pivotIndex]);
301
+ if (q === undefined)
302
+ return false;
303
+ q *= a;
304
+ for (let j = pivotIndex + 1; j < n; j++)
305
+ rowB[j] += q * rowA[j];
306
+ return true;
307
+ }
308
+ /**
309
+ * Solve a pair of bilinear equations
310
+ * * First equation: `a0 + b0 * u + c0 * v + d0 * u * v = 0`
311
+ * * Second equation: `a1 + b1 * u + c1 * v + d1 * u * v = 0`
312
+ */
313
+ static solveBilinearPair(a0, b0, c0, d0, a1, b1, c1, d1) {
314
+ return BilinearPolynomial.solveBilinearPair(a0, b0, c0, d0, a1, b1, c1, d1);
315
+ }
316
+ }
317
+ //# sourceMappingURL=SmallSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmallSystem.js","sourceRoot":"","sources":["../../../src/numerics/SmallSystem.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAA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CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAClF,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,kBAAkB,CAAC,IAAkB,EAAE,UAAkB,EAAE,IAAkB,EAAE,CAAS;QACpG,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,GAAG,QAAQ,CAAC,yBAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAClC,CAAC,IAAI,CAAC,CAAC;QACP,KAAK,IAAI,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACrC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,iBAAiB,CAC7B,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAC9C,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;QAE9C,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF","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 { Point2d, Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { XAndY } from \"../geometry3d/XYZProps\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { BilinearPolynomial } from \"./Polynomials\";\r\n\r\n// cspell:word XYUV\r\n\r\n/**\r\n * static methods for commonly appearing sets of equations in 2 or 3 variables\r\n * @public\r\n */\r\nexport class SmallSystem {\r\n /**\r\n * Return true if lines (a0,a1) to (b0, b1) have a simple intersection.\r\n * Return the fractional (not xy) coordinates in result.x, result.y\r\n * @param a0 start point of line a\r\n * @param a1 end point of line a\r\n * @param b0 start point of line b\r\n * @param b1 end point of line b\r\n * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.\r\n */\r\n public static lineSegment2dXYTransverseIntersectionUnbounded(a0: Point2d, a1: Point2d, b0: Point2d, b1: Point2d,\r\n result: Vector2d): boolean {\r\n const ux = a1.x - a0.x;\r\n const uy = a1.y - a0.y;\r\n\r\n const vx = b1.x - b0.x;\r\n const vy = b1.y - b0.y;\r\n\r\n const cx = b0.x - a0.x;\r\n const cy = b0.y - a0.y;\r\n\r\n const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);\r\n const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);\r\n const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);\r\n const s = Geometry.conditionalDivideFraction(cv, uv);\r\n const t = Geometry.conditionalDivideFraction(cu, uv);\r\n if (s !== undefined && t !== undefined) {\r\n result.set(s, -t);\r\n return true;\r\n }\r\n result.set(0, 0);\r\n return false;\r\n }\r\n /**\r\n * * (ax0,ay0) to (ax0+ux,ay0+uy) are line A.\r\n * * (bx0,by0) to (bx0+vx,by0+vy) are lineB.\r\n * * Return true if the lines have a simple intersection.\r\n * * Return the fractional (not xy) coordinates in result.x, result.y\r\n * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.\r\n */\r\n public static lineSegmentXYUVTransverseIntersectionUnbounded(\r\n ax0: number, ay0: number, ux: number, uy: number,\r\n bx0: number, by0: number, vx: number, vy: number,\r\n result: Vector2d): boolean {\r\n\r\n const cx = bx0 - ax0;\r\n const cy = by0 - ay0;\r\n\r\n const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);\r\n const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);\r\n const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);\r\n const s = Geometry.conditionalDivideFraction(cv, uv);\r\n const t = Geometry.conditionalDivideFraction(cu, uv);\r\n if (s !== undefined && t !== undefined) {\r\n result.set(s, -t);\r\n return true;\r\n }\r\n result.set(0, 0);\r\n return false;\r\n }\r\n\r\n /**\r\n * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts\r\n * Return the fractional (not xy) coordinates in result.x, result.y\r\n * @param a0 start point of line a\r\n * @param a1 end point of line a\r\n * @param b0 start point of line b\r\n * @param b1 end point of line b\r\n * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.\r\n */\r\n public static lineSegment3dXYTransverseIntersectionUnbounded(a0: Point3d, a1: Point3d, b0: Point3d, b1: Point3d,\r\n result: Vector2d): boolean {\r\n const ux = a1.x - a0.x;\r\n const uy = a1.y - a0.y;\r\n\r\n const vx = b1.x - b0.x;\r\n const vy = b1.y - b0.y;\r\n\r\n const cx = b0.x - a0.x;\r\n const cy = b0.y - a0.y;\r\n\r\n const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);\r\n const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);\r\n const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);\r\n const s = Geometry.conditionalDivideFraction(cv, uv);\r\n const t = Geometry.conditionalDivideFraction(cu, uv);\r\n if (s !== undefined && t !== undefined) {\r\n result.set(s, -t);\r\n return true;\r\n }\r\n result.set(0, 0);\r\n return false;\r\n }\r\n\r\n /**\r\n * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts of WEIGHTED 4D Points\r\n * Return the fractional (not xy) coordinates in result.x, result.y\r\n * @param hA0 homogeneous start point of line a\r\n * @param hA1 homogeneous end point of line a\r\n * @param hB0 homogeneous start point of line b\r\n * @param hB1 homogeneous end point of line b\r\n * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.\r\n */\r\n public static lineSegment3dHXYTransverseIntersectionUnbounded(hA0: Point4d, hA1: Point4d, hB0: Point4d, hB1: Point4d, result?: Vector2d): Vector2d | undefined {\r\n // Considering only x,y,w parts....\r\n // Point Q along B is (in full homogeneous) `(1-lambda) B0 + lambda 1`\r\n // PointQ is colinear with A0,A1 when the determinant det (A0,A1,Q) is zero. (Each column takes xyw parts)\r\n const alpha0 = Geometry.tripleProduct(\r\n hA0.x, hA1.x, hB0.x,\r\n hA0.y, hA1.y, hB0.y,\r\n hA0.w, hA1.w, hB0.w);\r\n const alpha1 = Geometry.tripleProduct(\r\n hA0.x, hA1.x, hB1.x,\r\n hA0.y, hA1.y, hB1.y,\r\n hA0.w, hA1.w, hB1.w);\r\n const fractionB = Geometry.conditionalDivideFraction(-alpha0, alpha1 - alpha0);\r\n if (fractionB !== undefined) {\r\n const beta0 = Geometry.tripleProduct(\r\n hB0.x, hB1.x, hA0.x,\r\n hB0.y, hB1.y, hA0.y,\r\n hB0.w, hB1.w, hA0.w);\r\n const beta1 = Geometry.tripleProduct(\r\n hB0.x, hB1.x, hA1.x,\r\n hB0.y, hB1.y, hA1.y,\r\n hB0.w, hB1.w, hA1.w);\r\n const fractionA = Geometry.conditionalDivideFraction(-beta0, beta1 - beta0);\r\n if (fractionA !== undefined)\r\n return Vector2d.create(fractionA, fractionB, result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Return the line fraction at which the (homogeneous) line is closest to a space point as viewed in xy only.\r\n * @param hA0 homogeneous start point of line a\r\n * @param hA1 homogeneous end point of line a\r\n * @param spacePoint homogeneous point in space\r\n */\r\n public static lineSegment3dHXYClosestPointUnbounded(hA0: Point4d, hA1: Point4d, spacePoint: Point4d): number | undefined {\r\n // Considering only x,y,w parts....\r\n // weighted difference of (A1 w0 - A0 w1) is (cartesian) tangent vector along the line as viewed.\r\n // The perpendicular (pure vector) W = (-y,x) flip is the direction of projection\r\n // Point Q along A is (in full homogeneous) `(1-lambda) A0 + lambda 1 A1`\r\n // PointQ is colinear with spacePoint and and W when the xyw homogeneous determinant | Q W spacePoint | is zero.\r\n const tx = hA1.x * hA0.w - hA0.x * hA1.w;\r\n const ty = hA1.y * hA0.w - hA0.y * hA1.w;\r\n const det0 = Geometry.tripleProduct(\r\n hA0.x, -ty, spacePoint.x,\r\n hA0.y, tx, spacePoint.y,\r\n hA0.w, 0, spacePoint.w);\r\n const det1 = Geometry.tripleProduct(\r\n hA1.x, -ty, spacePoint.x,\r\n hA1.y, tx, spacePoint.y,\r\n hA1.w, 0, spacePoint.w);\r\n return Geometry.conditionalDivideFraction(-det0, det1 - det0);\r\n }\r\n\r\n /**\r\n * Return the line fraction at which the line is closest to a space point as viewed in xy only.\r\n * @param pointA0 start point\r\n * @param pointA1 end point\r\n * @param spacePoint point in space\r\n */\r\n public static lineSegment3dXYClosestPointUnbounded(pointA0: XAndY, pointA1: XAndY, spacePoint: XAndY): number | undefined {\r\n // Considering only x,y parts....\r\n const ux = pointA1.x - pointA0.x;\r\n const uy = pointA1.y - pointA0.y;\r\n const uu = ux * ux + uy * uy;\r\n const vx = spacePoint.x - pointA0.x;\r\n const vy = spacePoint.y - pointA0.y;\r\n const uv = ux * vx + uy * vy;\r\n return Geometry.conditionalDivideFraction(uv, uu);\r\n }\r\n\r\n /**\r\n * Return the line fraction at which the line is closest to a space point\r\n * @param pointA0 start point\r\n * @param pointA1 end point\r\n * @param spacePoint point in space\r\n */\r\n public static lineSegment3dClosestPointUnbounded(pointA0: Point3d, pointA1: Point3d, spacePoint: Point3d): number | undefined {\r\n const ux = pointA1.x - pointA0.x;\r\n const uy = pointA1.y - pointA0.y;\r\n const uz = pointA1.z - pointA0.z;\r\n const uu = ux * ux + uy * uy + uz * uz;\r\n const vx = spacePoint.x - pointA0.x;\r\n const vy = spacePoint.y - pointA0.y;\r\n const vz = spacePoint.z - pointA0.z;\r\n const uv = ux * vx + uy * vy + uz * vz;\r\n return Geometry.conditionalDivideFraction(uv, uu);\r\n }\r\n\r\n /**\r\n * Return true if lines (a0,a1) to (b0, b1) have closest approach (go by each other) in 3d\r\n * Return the fractional (not xy) coordinates in result.x, result.y\r\n * @param a0 start point of line a\r\n * @param a1 end point of line a\r\n * @param b0 start point of line b\r\n * @param b1 end point of line b\r\n * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.\r\n */\r\n public static lineSegment3dClosestApproachUnbounded(a0: Point3d, a1: Point3d, b0: Point3d, b1: Point3d,\r\n result: Vector2d): boolean {\r\n return this.ray3dXYZUVWClosestApproachUnbounded(\r\n a0.x, a0.y, a0.z,\r\n a1.x - a0.x, a1.y - a0.y, a1.z - a0.z,\r\n b0.x, b0.y, b0.z,\r\n b1.x - b0.x, b1.y - b0.y, b1.z - b0.z,\r\n result);\r\n }\r\n /**\r\n * Return true if the given rays have closest approach (go by each other) in 3d\r\n * Return the fractional (not xy) coordinates as x and y parts of a Point2d.\r\n * @param ax x-coordinate of the origin of the first ray\r\n * @param ay y-coordinate of the origin of the first ray\r\n * @param az z-coordinate of the origin of the first ray\r\n * @param au x-coordinate of the direction vector of the first ray\r\n * @param av y-coordinate of the direction vector of the first ray\r\n * @param aw z-coordinate of the direction vector of the first ray\r\n * @param bx x-coordinate of the origin of the second ray\r\n * @param by y-coordinate of the origin of the second ray\r\n * @param bz z-coordinate of the origin of the second ray\r\n * @param bu x-coordinate of the direction vector of the second ray\r\n * @param bv y-coordinate of the direction vector of the second ray\r\n * @param bw z-coordinate of the direction vector of the second ray\r\n * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.\r\n */\r\n public static ray3dXYZUVWClosestApproachUnbounded(\r\n ax: number, ay: number, az: number, au: number, av: number, aw: number,\r\n bx: number, by: number, bz: number, bu: number, bv: number, bw: number,\r\n result: Vector2d): boolean {\r\n\r\n const cx = bx - ax;\r\n const cy = by - ay;\r\n const cz = bz - az;\r\n\r\n const uu = Geometry.hypotenuseSquaredXYZ(au, av, aw);\r\n const vv = Geometry.hypotenuseSquaredXYZ(bu, bv, bw);\r\n const uv = Geometry.dotProductXYZXYZ(au, av, aw, bu, bv, bw);\r\n const cu = Geometry.dotProductXYZXYZ(cx, cy, cz, au, av, aw);\r\n const cv = Geometry.dotProductXYZXYZ(cx, cy, cz, bu, bv, bw);\r\n return SmallSystem.linearSystem2d(uu, -uv, uv, -vv, cu, cv, result);\r\n }\r\n /**\r\n * Solve the pair of linear equations\r\n * * `ux * x + vx * y = cx`\r\n * * `uy * x + vy * y = cy`\r\n * @param ux xx coefficient\r\n * @param vx xy coefficient\r\n * @param uy yx coefficient\r\n * @param vy yy coefficient\r\n * @param cx x right hand side\r\n * @param cy y right hand side\r\n * @param result (x,y) solution (MUST be preallocated by caller)\r\n */\r\n public static linearSystem2d(\r\n ux: number, vx: number, // first row of matrix\r\n uy: number, vy: number, // second row of matrix\r\n cx: number, cy: number, // right side\r\n result: Vector2d,\r\n ): boolean {\r\n const uv = Geometry.crossProductXYXY(ux, uy, vx, vy);\r\n const cv = Geometry.crossProductXYXY(cx, cy, vx, vy);\r\n const cu = Geometry.crossProductXYXY(ux, uy, cx, cy);\r\n const s = Geometry.conditionalDivideFraction(cv, uv);\r\n const t = Geometry.conditionalDivideFraction(cu, uv);\r\n if (s !== undefined && t !== undefined) {\r\n result.set(s, t);\r\n return true;\r\n }\r\n result.set(0, 0);\r\n return false;\r\n }\r\n /**\r\n * Solve a linear system:\r\n * * x equation: `axx * u + axy * v + axz * w = cx`\r\n * * y equation: `ayx * u + ayy * v + ayz * w = cy`\r\n * * z equation: `azx * u + azy * v + azz * w = cz`\r\n * @param axx row 0, column 0 coefficient\r\n * @param axy row 0, column 1 coefficient\r\n * @param axz row 0, column 1 coefficient\r\n * @param ayx row 1, column 0 coefficient\r\n * @param ayy row 1, column 1 coefficient\r\n * @param ayz row 1, column 2 coefficient\r\n * @param azx row 2, column 0 coefficient\r\n * @param azy row 2, column 1 coefficient\r\n * @param azz row 2, column 2 coefficient\r\n * @param cx right hand side row 0 coefficient\r\n * @param cy right hand side row 1 coefficient\r\n * @param cz right hand side row 2 coefficient\r\n * @param result optional result.\r\n * @returns solution vector (u,v,w) or `undefined` if system is singular.\r\n */\r\n public static linearSystem3d(\r\n axx: number, axy: number, axz: number, // first row of matrix\r\n ayx: number, ayy: number, ayz: number, // second row of matrix\r\n azx: number, azy: number, azz: number, // second row of matrix\r\n cx: number, cy: number, cz: number, // right side\r\n result?: Vector3d,\r\n ): Vector3d | undefined {\r\n // determinants of various combinations of columns ...\r\n const detXYZ = Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, axz, ayz, azz);\r\n const detCYZ = Geometry.tripleProduct(cx, cy, cz, axy, ayy, azy, axz, ayz, azz);\r\n const detXCZ = Geometry.tripleProduct(axx, ayx, azx, cx, cy, cz, axz, ayz, azz);\r\n const detXYC = Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, cx, cy, cz);\r\n const s = Geometry.conditionalDivideFraction(detCYZ, detXYZ);\r\n const t = Geometry.conditionalDivideFraction(detXCZ, detXYZ);\r\n const u = Geometry.conditionalDivideFraction(detXYC, detXYZ);\r\n if (s !== undefined && t !== undefined && u !== undefined) {\r\n return Vector3d.create(s, t, u, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Compute the intersection of three planes.\r\n * @param xyzA point on the first plane\r\n * @param normalA normal of the first plane\r\n * @param xyzB point on the second plane\r\n * @param normalB normal of the second plane\r\n * @param xyzC point on the third plane\r\n * @param normalC normal of the third plane\r\n * @param result optional result\r\n * @returns intersection point of the three planes (as a Vector3d), or undefined if at least two planes are parallel.\r\n */\r\n public static intersect3Planes(\r\n xyzA: Point3d, normalA: Vector3d,\r\n xyzB: Point3d, normalB: Vector3d,\r\n xyzC: Point3d, normalC: Vector3d, result?: Vector3d): Vector3d | undefined {\r\n return this.linearSystem3d(\r\n normalA.x, normalA.y, normalA.z,\r\n normalB.x, normalB.y, normalB.z,\r\n normalC.x, normalC.y, normalC.z,\r\n Geometry.dotProductXYZXYZ(xyzA.x, xyzA.y, xyzA.z, normalA.x, normalA.y, normalA.z),\r\n Geometry.dotProductXYZXYZ(xyzB.x, xyzB.y, xyzB.z, normalB.x, normalB.y, normalB.z),\r\n Geometry.dotProductXYZXYZ(xyzC.x, xyzC.y, xyzC.z, normalC.x, normalC.y, normalC.z), result);\r\n }\r\n\r\n /**\r\n * * in rowB, replace `rowB[j] += a * rowB[pivot] * rowA[j] / rowA[pivot]` for `j>pivot`\r\n * @param rowA row that does not change\r\n * @param pivotIndex index of pivot (divisor) in rowA.\r\n * @param rowB row where elimination occurs.\r\n */\r\n public static eliminateFromPivot(rowA: Float64Array, pivotIndex: number, rowB: Float64Array, a: number): boolean {\r\n const n = rowA.length;\r\n let q = Geometry.conditionalDivideFraction(rowB[pivotIndex], rowA[pivotIndex]);\r\n if (q === undefined) return false;\r\n q *= a;\r\n for (let j = pivotIndex + 1; j < n; j++)\r\n rowB[j] += q * rowA[j];\r\n return true;\r\n }\r\n /**\r\n * Solve a pair of bilinear equations\r\n * * First equation: `a0 + b0 * u + c0 * v + d0 * u * v = 0`\r\n * * Second equation: `a1 + b1 * u + c1 * v + d1 * u * v = 0`\r\n */\r\n public static solveBilinearPair(\r\n a0: number, b0: number, c0: number, d0: number,\r\n a1: number, b1: number, c1: number, d1: number,\r\n ): Point2d[] | undefined {\r\n return BilinearPolynomial.solveBilinearPair(a0, b0, c0, d0, a1, b1, c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