@itwin/core-geometry 4.10.0-dev.8 → 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 +11 -23
@@ -4,10 +4,11 @@
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.ImplicitLineXY = exports.SineCosinePolynomial = exports.BilinearPolynomial = exports.SmallSystem = exports.TrigPolynomial = exports.PowerPolynomial = exports.AnalyticRoots = exports.SphereImplicit = exports.TorusImplicit = exports.Degree4PowerPolynomial = exports.Degree3PowerPolynomial = exports.Degree2PowerPolynomial = void 0;
7
+ exports.ImplicitLineXY = exports.SineCosinePolynomial = exports.BilinearPolynomial = exports.TrigPolynomial = exports.PowerPolynomial = exports.AnalyticRoots = exports.SphereImplicit = exports.TorusImplicit = exports.Degree4PowerPolynomial = exports.Degree3PowerPolynomial = exports.Degree2PowerPolynomial = void 0;
8
8
  /** @packageDocumentation
9
9
  * @module Numerics
10
10
  */
11
+ const core_bentley_1 = require("@itwin/core-bentley");
11
12
  const Geometry_1 = require("../Geometry");
12
13
  const Angle_1 = require("../geometry3d/Angle");
13
14
  const AngleSweep_1 = require("../geometry3d/AngleSweep");
@@ -16,9 +17,7 @@ const LongitudeLatitudeAltitude_1 = require("../geometry3d/LongitudeLatitudeAlti
16
17
  const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
17
18
  const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
18
19
  const Range_1 = require("../geometry3d/Range");
19
- // cspell:word Cardano
20
- // cspell:word CCminusSS
21
- /* eslint-disable @typescript-eslint/naming-convention */
20
+ // cspell:words Cardano internaldocs
22
21
  /**
23
22
  * degree 2 (quadratic) polynomial in for y = c0 + c1*x + c2*x^2
24
23
  * @internal
@@ -684,8 +683,8 @@ class AnalyticRoots {
684
683
  return;
685
684
  }
686
685
  else if (D > 0) {
687
- const sqrt_D = Math.sqrt(D);
688
- this.append2Solutions(sqrt_D - p, -sqrt_D - p, values);
686
+ const sqrtD = Math.sqrt(D);
687
+ this.append2Solutions(sqrtD - p, -sqrtD - p, values);
689
688
  return;
690
689
  }
691
690
  return;
@@ -751,7 +750,7 @@ class AnalyticRoots {
751
750
  */
752
751
  /*
753
752
  private static _appendCubicRootsUnsorted(c: Float64Array | number[], results: GrowableFloat64Array) {
754
- let sq_A: number;
753
+ let AA: number;
755
754
  let p: number;
756
755
  let q: number;
757
756
 
@@ -772,9 +771,9 @@ class AnalyticRoots {
772
771
  // f' = 3y^2 + p
773
772
  // local min/max at Y = +-sqrt (-p)
774
773
  // f(+Y) = -p sqrt(-p) + 3p sqrt (-p) + 2q = 2 p sqrt (-p) + 2q
775
- sq_A = A * A;
776
- p = (3.0 * B - sq_A) / 9.0;
777
- q = 1.0 / 2 * (2.0 / 27 * A * sq_A - 1.0 / 3 * A * B + C);
774
+ AA = A * A;
775
+ p = (3.0 * B - AA) / 9.0;
776
+ q = 1.0 / 2 * (2.0 / 27 * A * AA - 1.0 / 3 * A * B + C);
778
777
 
779
778
  // Use Cardano formula
780
779
  const cb_p: number = p * p * p;
@@ -812,9 +811,9 @@ class AnalyticRoots {
812
811
 
813
812
  return;
814
813
  } else { // One real solution
815
- const sqrt_D = Math.sqrt(D);
816
- const u = this.cbrt(sqrt_D - q);
817
- const v = -(this.cbrt(sqrt_D + q));
814
+ const sqrtD = Math.sqrt(D);
815
+ const u = this.cbrt(sqrtD - q);
816
+ const v = -(this.cbrt(sqrtD + q));
818
817
  results.push(origin + u + v);
819
818
  this.improveRoots(c, 3, results, false);
820
819
  return;
@@ -828,7 +827,7 @@ class AnalyticRoots {
828
827
  // EDL April 5, 2020 replace classic GraphicsGems solver by RWDNickalls.
829
828
  // Don't know if improveRoots is needed.
830
829
  // Breaks in AnalyticRoots.test.ts checkQuartic suggest it indeed converts many e-16 errors to zero.
831
- // e-13 cases are unaffected
830
+ // e-13 cases are unaffected
832
831
  this.improveRoots(c, 3, results, false);
833
832
  }
834
833
  else {
@@ -837,49 +836,46 @@ class AnalyticRoots {
837
836
  // this.appendCubicRootsUnsorted(c, results);
838
837
  results.sort();
839
838
  }
840
- /** Compute roots of quartic 'c[0] + c[1] * x + c[2] * x^2 + c[3] * x^3 + c[4] * x^4 */
839
+ /** Compute roots of quartic `c[0] + c[1] * x + c[2] * x^2 + c[3] * x^3 + c[4] * x^4` */
841
840
  static appendQuarticRoots(c, results) {
842
- const coffs = new Float64Array(4); // at various times .. coefficients of quadratic an cubic intermediates.
841
+ // for details, see core\geometry\internaldocs\quarticRoots.md
842
+ const coffs = new Float64Array(4);
843
843
  let u;
844
844
  let v;
845
- // normal form: x^4 + Ax^3 + Bx^2 + Cx + D = 0
846
845
  const coffScale = new Float64Array(1);
847
846
  if (!this.safeDivide(coffScale, 1.0, c[4], 0.0, 0)) {
848
847
  this.appendCubicRoots(c, results);
849
848
  return;
850
849
  }
850
+ // normal form: x^4 + Ax^3 + Bx^2 + Cx + D = 0
851
851
  const A = c[3] * coffScale[0];
852
852
  const B = c[2] * coffScale[0];
853
853
  const C = c[1] * coffScale[0];
854
854
  const D = c[0] * coffScale[0];
855
855
  const origin = -0.25 * A;
856
- /* substitute x = y - A/4 to eliminate cubic term:
857
- x^4 + px^2 + qx + r = 0 */
858
- const sq_A = A * A;
859
- const p = -3.0 / 8 * sq_A + B;
860
- const q = 0.125 * sq_A * A - 0.5 * A * B + C;
861
- const r = -3.0 / 256 * sq_A * sq_A + 1.0 / 16 * sq_A * B - 1.0 / 4 * A * C + D;
862
- const tempStack = new GrowableFloat64Array_1.GrowableFloat64Array();
863
- if (this.isZero(r)) {
864
- // no absolute term: y(y^3 + py + q) = 0
856
+ // substitute x = y - A/4 to eliminate cubic term: y^4 + py^2 + qy + r = 0
857
+ const AA = A * A;
858
+ const p = -0.375 * AA + B;
859
+ const q = 0.125 * AA * A - 0.5 * A * B + C;
860
+ const r = -0.01171875 * AA * AA + 0.0625 * AA * B - 0.25 * A * C + D;
861
+ const cubicSolutions = new GrowableFloat64Array_1.GrowableFloat64Array();
862
+ if (this.isZero(r)) { // no absolute term: y(y^3 + py + q) = 0
865
863
  coffs[0] = q;
866
864
  coffs[1] = p;
867
865
  coffs[2] = 0;
868
866
  coffs[3] = 1;
869
867
  this.appendCubicRoots(coffs, results);
870
- results.push(0); // APPLY ORIGIN ....
871
- this.addConstant(origin, results);
868
+ results.push(0);
869
+ this.addConstant(origin, results); // apply origin
872
870
  return;
873
871
  }
874
- else {
875
- // Solve the resolvent cubic
876
- coffs[0] = 1.0 / 2 * r * p - 1.0 / 8 * q * q;
872
+ else { // solve the resolvent cubic
873
+ coffs[0] = 0.5 * r * p - 0.125 * q * q;
877
874
  coffs[1] = -r;
878
- coffs[2] = -1.0 / 2 * p;
875
+ coffs[2] = -0.5 * p;
879
876
  coffs[3] = 1;
880
- this.appendCubicRoots(coffs, tempStack);
881
- const z = this.mostDistantFromMean(tempStack);
882
- // ... to build two quadric equations
877
+ this.appendCubicRoots(coffs, cubicSolutions);
878
+ const z = this.mostDistantFromMean(cubicSolutions);
883
879
  u = z * z - r;
884
880
  v = 2 * z - p;
885
881
  if (this.isSmallRatio(u, r)) {
@@ -898,11 +894,9 @@ class AnalyticRoots {
898
894
  v = Math.sqrt(v);
899
895
  }
900
896
  else {
901
- for (let i = 0; i < tempStack.length; i++) {
902
- results.push(tempStack.atUncheckedIndex(i));
903
- }
904
897
  return;
905
898
  }
899
+ // the two quadratic equations
906
900
  coffs[0] = z - u;
907
901
  coffs[1] = ((q < 0) ? (-v) : (v));
908
902
  coffs[2] = 1;
@@ -912,8 +906,7 @@ class AnalyticRoots {
912
906
  coffs[2] = 1;
913
907
  this.appendQuadraticRoots(coffs, results);
914
908
  }
915
- // substitute
916
- this.addConstant(origin, results);
909
+ this.addConstant(origin, results); // apply origin
917
910
  results.sort();
918
911
  this.improveRoots(c, 4, results, true);
919
912
  return;
@@ -1018,19 +1011,17 @@ class PowerPolynomial {
1018
1011
  return this.degreeKnownEvaluate(coff, degree, x);
1019
1012
  }
1020
1013
  /**
1021
- * * Accumulate Q*scale into P. Both are treated as full degree.
1022
- * * (Expect Address exceptions if P is smaller than Q)
1023
- * * Returns degree of result as determined by comparing trailing coefficients to zero
1014
+ * Accumulate `coffQ*scaleQ` into `coffP`.
1015
+ * * The length of `coffP` must be at least length of `coffQ`.
1016
+ * * Returns degree of result as determined by comparing trailing coefficients to zero.
1024
1017
  */
1025
1018
  static accumulate(coffP, coffQ, scaleQ) {
1026
1019
  let degreeP = coffP.length - 1;
1027
1020
  const degreeQ = coffQ.length - 1;
1028
- for (let i = 0; i <= degreeQ; i++) {
1021
+ for (let i = 0; i <= degreeQ; i++)
1029
1022
  coffP[i] += scaleQ * coffQ[i];
1030
- }
1031
- while (degreeP >= 0 && coffP[degreeP] === 0.0) {
1023
+ while (degreeP >= 0 && coffP[degreeP] === 0.0)
1032
1024
  degreeP--;
1033
- }
1034
1025
  return degreeP;
1035
1026
  }
1036
1027
  /** Zero all coefficients */
@@ -1047,17 +1038,17 @@ exports.PowerPolynomial = PowerPolynomial;
1047
1038
  */
1048
1039
  class TrigPolynomial {
1049
1040
  /**
1050
- * Solve a polynomial created from trigonometric condition using
1051
- * Trig.S, Trig.C, Trig.W. Solution logic includes inferring angular roots
1052
- * corresponding zero leading coefficients (roots at infinity)
1053
- * @param coff Coefficients
1054
- * @param nominalDegree degree of the polynomial under most complex
1055
- * root case. If there are any zero coefficients up to this degree, a single root
1056
- * "at infinity" is recorded as its corresponding angular parameter at negative pi/2
1057
- * @param referenceCoefficient A number which represents the size of coefficients
1058
- * at various stages of computation. A small fraction of this will be used as a zero
1059
- * tolerance
1060
- * @param radians Roots are placed here
1041
+ * Find the roots of a univariate polynomial created from substituting the rational parameterization of the unit
1042
+ * circle into a trigonometric polynomial. Roots are returned as radian angles.
1043
+ * * Currently implemented for polynomials of degree <= 4.
1044
+ * * For example, the ellipse-ellipse intersection problem reduces to finding the roots of a quartic polynomial:
1045
+ * `p(t) = coff[0] + coff[1] t + coff[2] t^2 + coff[3] t^3 + coff[4] t^4`.
1046
+ * * Particular care is given to report a root at t = +/-infinity, which corresponds to the returned angle -pi/2.
1047
+ * @param coff coefficients in the power basis
1048
+ * @param nominalDegree degree of the polynomial under the most complex root case.
1049
+ * @param referenceCoefficient a number which represents the size of coefficients at various stages of computation.
1050
+ * A small fraction of this number will be used as a zero tolerance.
1051
+ * @param radians roots are placed here.
1061
1052
  * @return false if equation is all zeros. This usually means any angle is a solution.
1062
1053
  */
1063
1054
  static solveAngles(coff, nominalDegree, referenceCoefficient, radians) {
@@ -1067,31 +1058,23 @@ class TrigPolynomial {
1067
1058
  const relTol = this._smallAngle;
1068
1059
  for (let i = 0; i <= nominalDegree; i++) {
1069
1060
  a = Math.abs(coff[i]);
1070
- if (a > maxCoff) {
1061
+ if (a > maxCoff)
1071
1062
  maxCoff = a;
1072
- }
1073
1063
  }
1074
1064
  const coffTol = relTol * maxCoff;
1075
1065
  let degree = nominalDegree;
1076
- while (degree > 0 && (Math.abs(coff[degree]) <= coffTol)) {
1066
+ while (degree > 0 && (Math.abs(coff[degree]) <= coffTol))
1077
1067
  degree--;
1078
- }
1079
- // let status = false;
1080
1068
  const roots = new GrowableFloat64Array_1.GrowableFloat64Array();
1081
1069
  if (degree === -1) {
1082
- // Umm. Dunno. Nothing there.
1083
- // status = false;
1070
+ // do nothing
1084
1071
  }
1085
1072
  else {
1086
- // status = true;
1087
1073
  if (degree === 0) {
1088
- // p(t) is a nonzero constant
1089
- // No roots, but not degenerate.
1090
- // status = true;
1074
+ // p(t) is a nonzero constant; no roots but not degenerate.
1091
1075
  }
1092
1076
  else if (degree === 1) {
1093
- // p(t) = coff[1] * t + coff[0]
1094
- roots.push(-coff[0] / coff[1]);
1077
+ roots.push(-coff[0] / coff[1]); // p(t) = coff[0] + coff[1] * t
1095
1078
  }
1096
1079
  else if (degree === 2) {
1097
1080
  AnalyticRoots.appendQuadraticRoots(coff, roots);
@@ -1103,70 +1086,68 @@ class TrigPolynomial {
1103
1086
  AnalyticRoots.appendQuarticRoots(coff, roots);
1104
1087
  }
1105
1088
  else {
1106
- // TODO: WILL WORK WITH BEZIER SOLVER
1107
- // status = false;
1089
+ // TODO: WORK WITH BEZIER SOLVER
1090
+ (0, core_bentley_1.assert)(false, "Unimplemented degree in trig solver");
1108
1091
  }
1109
1092
  if (roots.length > 0) {
1110
- // Each solution t represents an angle with
1111
- // Math.Cos(theta)=C(t)/W(t), ,sin(theta)=S(t)/W(t)
1112
- // Division by W has no effect on Atan2 calculations, so we just compute S(t),C(t)
1093
+ // each solution t represents an angle with Math.Cos(theta) = C(t)/W(t) and sin(theta) = S(t)/W(t)
1094
+ // division by W has no effect on atan2 calculations, so we just compute S(t),C(t)
1113
1095
  for (let i = 0; i < roots.length; i++) {
1114
1096
  const ss = PowerPolynomial.evaluate(this.S, roots.atUncheckedIndex(i));
1115
1097
  const cc = PowerPolynomial.evaluate(this.C, roots.atUncheckedIndex(i));
1116
1098
  radians.push(Math.atan2(ss, cc));
1117
1099
  }
1118
- // Each leading zero at the front of the coefficients corresponds to a root at -PI/2.
1119
- // Only make one entry....
1120
- // for (int i = degree; i < nominalDegree; i++)
1121
- if (degree < nominalDegree) {
1122
- radians.push(-0.5 * Math.PI);
1123
- }
1124
1100
  }
1101
+ // If the tail of the coff array is zero, we solved a polynomial of lesser degree above, and
1102
+ // we report the skipped "root at infinity" as the corresponding angle -pi/2 (without multiplicity).
1103
+ // See core\geometry\internaldocs\unitCircleEllipseIntersection.md for details.
1104
+ if (degree < nominalDegree)
1105
+ radians.push(-0.5 * Math.PI);
1125
1106
  }
1126
1107
  return radians.length > 0;
1127
1108
  }
1128
1109
  /**
1129
- * Compute intersections of unit circle `x^2 + y^2 = 1` with general quadric
1130
- * `axx * x^2 + axy * x * y + ayy * y^2 + ax * x + ay * y + a1 = 0`
1131
- * Solutions are returned as angles. Sine and Cosine of the angles are the x, y results.
1132
- * @param axx Coefficient of x^2
1133
- * @param axy Coefficient of xy
1134
- * @param ayy Coefficient of y^2
1135
- * @param ax Coefficient of x
1136
- * @param ay Coefficient of y
1137
- * @param a1 Constant coefficient
1138
- * @param radians solution angles
1110
+ * Compute intersections of the unit circle `x^2 + y^2 = 1` with the general quadric (conic)
1111
+ * `axx x^2 + axy xy + ayy y^2 + ax x + ay y + a = 0`.
1112
+ * @param axx coefficient of x^2
1113
+ * @param axy coefficient of xy
1114
+ * @param ayy coefficient of y^2
1115
+ * @param ax coefficient of x
1116
+ * @param ay coefficient of y
1117
+ * @param a constant coefficient
1118
+ * @param radians up to 4 solution angles t in the quadric parameterization: x = cos(t), y = sin(t)
1139
1119
  */
1140
- static solveUnitCircleImplicitQuadricIntersection(axx, axy, ayy, ax, ay, a1, radians) {
1141
- const Coffs = new Float64Array(5);
1142
- PowerPolynomial.zero(Coffs);
1120
+ static solveUnitCircleImplicitQuadricIntersection(axx, axy, ayy, ax, ay, a, radians) {
1121
+ const coffs = new Float64Array(5);
1122
+ PowerPolynomial.zero(coffs);
1143
1123
  let degree;
1144
- if (Geometry_1.Geometry.hypotenuseXYZ(axx, axy, ayy) > TrigPolynomial._coefficientRelTol * Geometry_1.Geometry.hypotenuseXYZ(ax, ay, a1)) {
1145
- PowerPolynomial.accumulate(Coffs, this.CW, ax);
1146
- PowerPolynomial.accumulate(Coffs, this.SW, ay);
1147
- PowerPolynomial.accumulate(Coffs, this.WW, a1);
1148
- PowerPolynomial.accumulate(Coffs, this.SS, ayy);
1149
- PowerPolynomial.accumulate(Coffs, this.CC, axx);
1150
- PowerPolynomial.accumulate(Coffs, this.SC, axy);
1124
+ // see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients
1125
+ if (Geometry_1.Geometry.hypotenuseXYZ(axx, axy, ayy) > TrigPolynomial._coefficientRelTol * Geometry_1.Geometry.hypotenuseXYZ(ax, ay, a)) {
1126
+ PowerPolynomial.accumulate(coffs, this.CW, ax);
1127
+ PowerPolynomial.accumulate(coffs, this.SW, ay);
1128
+ PowerPolynomial.accumulate(coffs, this.WW, a);
1129
+ PowerPolynomial.accumulate(coffs, this.SS, ayy);
1130
+ PowerPolynomial.accumulate(coffs, this.CC, axx);
1131
+ PowerPolynomial.accumulate(coffs, this.SC, axy);
1151
1132
  degree = 4;
1152
1133
  }
1153
1134
  else {
1154
- PowerPolynomial.accumulate(Coffs, this.C, ax);
1155
- PowerPolynomial.accumulate(Coffs, this.S, ay);
1156
- PowerPolynomial.accumulate(Coffs, this.W, a1);
1135
+ PowerPolynomial.accumulate(coffs, this.C, ax);
1136
+ PowerPolynomial.accumulate(coffs, this.S, ay);
1137
+ PowerPolynomial.accumulate(coffs, this.W, a);
1157
1138
  degree = 2;
1158
1139
  }
1159
- let maxCoff = 0.0;
1160
- maxCoff = Math.max(maxCoff, Math.abs(axx), Math.abs(ayy), Math.abs(axy), Math.abs(ax), Math.abs(ay), Math.abs(a1));
1161
- const b = this.solveAngles(Coffs, degree, maxCoff, radians);
1140
+ const maxCoff = Math.max(Math.abs(axx), Math.abs(ayy), Math.abs(axy), Math.abs(ax), Math.abs(ay), Math.abs(a));
1141
+ const b = this.solveAngles(coffs, degree, maxCoff, radians);
1162
1142
  /*
1163
1143
  for (const theta of angles) {
1164
1144
  const c = theta.cos();
1165
1145
  const s = theta.sin();
1166
1146
  GeometryCoreTestIO.consoleLog({
1167
1147
  angle: theta, co: c, si: s,
1168
- f: axx * c * c + axy * c * s + ayy * s * s + ax * c + ay * s + a1});
1169
- } */
1148
+ f: axx * c * c + axy * c * s + ayy * s * s + ax * c + ay * s + a,
1149
+ });
1150
+ } */
1170
1151
  return b;
1171
1152
  }
1172
1153
  /**
@@ -1184,13 +1165,14 @@ class TrigPolynomial {
1184
1165
  */
1185
1166
  static solveUnitCircleEllipseIntersection(cx, cy, ux, uy, vx, vy, ellipseRadians, circleRadians) {
1186
1167
  circleRadians.length = 0;
1168
+ // see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients:
1187
1169
  const acc = ux * ux + uy * uy;
1188
1170
  const acs = 2.0 * (ux * vx + uy * vy);
1189
1171
  const ass = vx * vx + vy * vy;
1190
1172
  const ac = 2.0 * (ux * cx + uy * cy);
1191
- const asi = 2.0 * (vx * cx + vy * cy);
1173
+ const as = 2.0 * (vx * cx + vy * cy);
1192
1174
  const a = cx * cx + cy * cy - 1.0;
1193
- const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac, asi, a, ellipseRadians);
1175
+ const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac, as, a, ellipseRadians);
1194
1176
  for (const radians of ellipseRadians) {
1195
1177
  const cc = Math.cos(radians);
1196
1178
  const ss = Math.sin(radians);
@@ -1201,7 +1183,7 @@ class TrigPolynomial {
1201
1183
  return status;
1202
1184
  }
1203
1185
  /**
1204
- * Compute intersections of unit circle `x^2 + y^2 = w^2` with the ellipse
1186
+ * Compute intersections of unit circle `x^2 + y^2 = w^2` (in homogeneous coordinates) with the ellipse
1205
1187
  * `F(t) = (cx + ux cos(t) + vx sin(t), cy + uy cos(t) + vy sin(t)) / (cw + uw cos(t) + vw sin(t))`.
1206
1188
  * @param cx center x
1207
1189
  * @param cy center y
@@ -1217,13 +1199,14 @@ class TrigPolynomial {
1217
1199
  */
1218
1200
  static solveUnitCircleHomogeneousEllipseIntersection(cx, cy, cw, ux, uy, uw, vx, vy, vw, ellipseRadians, circleRadians) {
1219
1201
  circleRadians.length = 0;
1202
+ // see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients:
1220
1203
  const acc = ux * ux + uy * uy - uw * uw;
1221
1204
  const acs = 2.0 * (ux * vx + uy * vy - uw * vw);
1222
1205
  const ass = vx * vx + vy * vy - vw * vw;
1223
1206
  const ac = 2.0 * (ux * cx + uy * cy - uw * cw);
1224
- const asi = 2.0 * (vx * cx + vy * cy - vw * cw);
1207
+ const as = 2.0 * (vx * cx + vy * cy - vw * cw);
1225
1208
  const a = cx * cx + cy * cy - cw * cw;
1226
- const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac, asi, a, ellipseRadians);
1209
+ const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac, as, a, ellipseRadians);
1227
1210
  for (const radians of ellipseRadians) {
1228
1211
  const cc = Math.cos(radians);
1229
1212
  const ss = Math.sin(radians);
@@ -1237,326 +1220,62 @@ class TrigPolynomial {
1237
1220
  exports.TrigPolynomial = TrigPolynomial;
1238
1221
  // tolerance for small angle decision.
1239
1222
  TrigPolynomial._smallAngle = 1.0e-11;
1240
- /** Standard Basis coefficients for rational sine numerator. */
1223
+ // see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients.
1224
+ /** Standard Basis coefficients for the numerator of the y-coordinate y(t) = S(t)/W(t) in the rational semicircle parameterization. */
1241
1225
  TrigPolynomial.S = Float64Array.from([0.0, 2.0, -2.0]);
1242
- /** Standard Basis coefficients for rational cosine numerator. */
1226
+ /** Standard Basis coefficients for the numerator of the x-coordinate x(t) = C(t)/W(t) in the rational semicircle parameterization. */
1243
1227
  TrigPolynomial.C = Float64Array.from([1.0, -2.0]);
1244
- /** Standard Basis coefficients for rational denominator. */
1228
+ /** Standard Basis coefficients for the denominator of x(t) and y(t) in the rational semicircle parameterization. */
1245
1229
  TrigPolynomial.W = Float64Array.from([1.0, -2.0, 2.0]);
1246
- /** Standard Basis coefficients for cosine*weight numerator */
1230
+ /** Standard Basis coefficients for C(t) * W(t). */
1247
1231
  TrigPolynomial.CW = Float64Array.from([1.0, -4.0, 6.0, -4.0]);
1248
- /** Standard Basis coefficients for sine*weight numerator */
1232
+ /** Standard Basis coefficients for S(t) * W(t). */
1249
1233
  TrigPolynomial.SW = Float64Array.from([0.0, 2.0, -6.0, 8.0, -4.0]);
1250
- /** Standard Basis coefficients for sine*cosine numerator */
1234
+ /** Standard Basis coefficients for S(t) * C(t). */
1251
1235
  TrigPolynomial.SC = Float64Array.from([0.0, 2.0, -6.0, 4.0]);
1252
- /** Standard Basis coefficients for sine^2 numerator */
1236
+ /** Standard Basis coefficients for S(t) * S(t). */
1253
1237
  TrigPolynomial.SS = Float64Array.from([0.0, 0.0, 4.0, -8.0, 4.0]);
1254
- /** Standard Basis coefficients for cosine^2 numerator */
1238
+ /** Standard Basis coefficients for C(t) * C(t). */
1255
1239
  TrigPolynomial.CC = Float64Array.from([1.0, -4.0, 4.0]);
1256
- /** Standard Basis coefficients for weight^2 */
1240
+ /** Standard Basis coefficients for W(t) * W(t). */
1257
1241
  TrigPolynomial.WW = Float64Array.from([1.0, -4.0, 8.0, -8.0, 4.0]);
1258
- /** Standard Basis coefficients for (Math.Cos^2 - sine^2) numerator */
1259
- TrigPolynomial.CCminusSS = Float64Array.from([1.0, -4.0, 0.0, 8.0, -4.0]);
1242
+ /** Standard Basis coefficients for C(t) * C(t) - S(t) * S(t). */
1243
+ TrigPolynomial.CCMinusSS = Float64Array.from([1.0, -4.0, 0.0, 8.0, -4.0]); // eslint-disable-line @typescript-eslint/naming-convention
1260
1244
  TrigPolynomial._coefficientRelTol = 1.0e-12;
1261
1245
  /**
1262
- * static methods for commonly appearing sets of equations in 2 or 3 variables
1263
- * @public
1246
+ * * bilinear expression
1247
+ * * `f(u,v) = a + b * u * c * v + d * u * v`
1248
+ * @internal
1264
1249
  */
1265
- class SmallSystem {
1266
- /**
1267
- * Return true if lines (a0,a1) to (b0, b1) have a simple intersection.
1268
- * Return the fractional (not xy) coordinates in result.x, result.y
1269
- * @param a0 start point of line a
1270
- * @param a1 end point of line a
1271
- * @param b0 start point of line b
1272
- * @param b1 end point of line b
1273
- * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
1274
- */
1275
- static lineSegment2dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
1276
- const ux = a1.x - a0.x;
1277
- const uy = a1.y - a0.y;
1278
- const vx = b1.x - b0.x;
1279
- const vy = b1.y - b0.y;
1280
- const cx = b0.x - a0.x;
1281
- const cy = b0.y - a0.y;
1282
- const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
1283
- const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
1284
- const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
1285
- const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
1286
- const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
1287
- if (s !== undefined && t !== undefined) {
1288
- result.set(s, -t);
1289
- return true;
1290
- }
1291
- result.set(0, 0);
1292
- return false;
1293
- }
1294
- /**
1295
- * * (ax0,ay0) to (ax0+ux,ay0+uy) are line A.
1296
- * * (bx0,by0) to (bx0+vx,by0+vy) are lineB.
1297
- * * Return true if the lines have a simple intersection.
1298
- * * Return the fractional (not xy) coordinates in result.x, result.y
1299
- * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
1300
- */
1301
- static lineSegmentXYUVTransverseIntersectionUnbounded(ax0, ay0, ux, uy, bx0, by0, vx, vy, result) {
1302
- const cx = bx0 - ax0;
1303
- const cy = by0 - ay0;
1304
- const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
1305
- const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
1306
- const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
1307
- const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
1308
- const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
1309
- if (s !== undefined && t !== undefined) {
1310
- result.set(s, -t);
1311
- return true;
1312
- }
1313
- result.set(0, 0);
1314
- return false;
1315
- }
1316
- /**
1317
- * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts
1318
- * Return the fractional (not xy) coordinates in result.x, result.y
1319
- * @param a0 start point of line a
1320
- * @param a1 end point of line a
1321
- * @param b0 start point of line b
1322
- * @param b1 end point of line b
1323
- * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
1324
- */
1325
- static lineSegment3dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
1326
- const ux = a1.x - a0.x;
1327
- const uy = a1.y - a0.y;
1328
- const vx = b1.x - b0.x;
1329
- const vy = b1.y - b0.y;
1330
- const cx = b0.x - a0.x;
1331
- const cy = b0.y - a0.y;
1332
- const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
1333
- const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
1334
- const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
1335
- const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
1336
- const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
1337
- if (s !== undefined && t !== undefined) {
1338
- result.set(s, -t);
1339
- return true;
1340
- }
1341
- result.set(0, 0);
1342
- return false;
1343
- }
1344
- /**
1345
- * Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts of WEIGHTED 4D Points
1346
- * Return the fractional (not xy) coordinates in result.x, result.y
1347
- * @param hA0 homogeneous start point of line a
1348
- * @param hA1 homogeneous end point of line a
1349
- * @param hB0 homogeneous start point of line b
1350
- * @param hB1 homogeneous end point of line b
1351
- * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
1352
- */
1353
- static lineSegment3dHXYTransverseIntersectionUnbounded(hA0, hA1, hB0, hB1, result) {
1354
- // Considering only x,y,w parts....
1355
- // Point Q along B is (in full homogeneous) `(1-lambda) B0 + lambda 1`
1356
- // PointQ is colinear with A0,A1 when the determinant det (A0,A1,Q) is zero. (Each column takes xyw parts)
1357
- const alpha0 = Geometry_1.Geometry.tripleProduct(hA0.x, hA1.x, hB0.x, hA0.y, hA1.y, hB0.y, hA0.w, hA1.w, hB0.w);
1358
- const alpha1 = Geometry_1.Geometry.tripleProduct(hA0.x, hA1.x, hB1.x, hA0.y, hA1.y, hB1.y, hA0.w, hA1.w, hB1.w);
1359
- const fractionB = Geometry_1.Geometry.conditionalDivideFraction(-alpha0, alpha1 - alpha0);
1360
- if (fractionB !== undefined) {
1361
- const beta0 = Geometry_1.Geometry.tripleProduct(hB0.x, hB1.x, hA0.x, hB0.y, hB1.y, hA0.y, hB0.w, hB1.w, hA0.w);
1362
- const beta1 = Geometry_1.Geometry.tripleProduct(hB0.x, hB1.x, hA1.x, hB0.y, hB1.y, hA1.y, hB0.w, hB1.w, hA1.w);
1363
- const fractionA = Geometry_1.Geometry.conditionalDivideFraction(-beta0, beta1 - beta0);
1364
- if (fractionA !== undefined)
1365
- return Point2dVector2d_1.Vector2d.create(fractionA, fractionB, result);
1366
- }
1367
- return undefined;
1368
- }
1369
- /**
1370
- * Return the line fraction at which the (homogeneous) line is closest to a space point as viewed in xy only.
1371
- * @param hA0 homogeneous start point of line a
1372
- * @param hA1 homogeneous end point of line a
1373
- * @param spacePoint homogeneous point in space
1374
- */
1375
- static lineSegment3dHXYClosestPointUnbounded(hA0, hA1, spacePoint) {
1376
- // Considering only x,y,w parts....
1377
- // weighted difference of (A1 w0 - A0 w1) is (cartesian) tangent vector along the line as viewed.
1378
- // The perpendicular (pure vector) W = (-y,x) flip is the direction of projection
1379
- // Point Q along A is (in full homogeneous) `(1-lambda) A0 + lambda 1 A1`
1380
- // PointQ is colinear with spacePoint and and W when the xyw homogeneous determinant | Q W spacePoint | is zero.
1381
- const tx = hA1.x * hA0.w - hA0.x * hA1.w;
1382
- const ty = hA1.y * hA0.w - hA0.y * hA1.w;
1383
- const det0 = Geometry_1.Geometry.tripleProduct(hA0.x, -ty, spacePoint.x, hA0.y, tx, spacePoint.y, hA0.w, 0, spacePoint.w);
1384
- const det1 = Geometry_1.Geometry.tripleProduct(hA1.x, -ty, spacePoint.x, hA1.y, tx, spacePoint.y, hA1.w, 0, spacePoint.w);
1385
- return Geometry_1.Geometry.conditionalDivideFraction(-det0, det1 - det0);
1386
- }
1387
- /**
1388
- * Return the line fraction at which the line is closest to a space point as viewed in xy only.
1389
- * @param pointA0 start point
1390
- * @param pointA1 end point
1391
- * @param spacePoint point in space
1392
- */
1393
- static lineSegment3dXYClosestPointUnbounded(pointA0, pointA1, spacePoint) {
1394
- // Considering only x,y parts....
1395
- const ux = pointA1.x - pointA0.x;
1396
- const uy = pointA1.y - pointA0.y;
1397
- const uu = ux * ux + uy * uy;
1398
- const vx = spacePoint.x - pointA0.x;
1399
- const vy = spacePoint.y - pointA0.y;
1400
- const uv = ux * vx + uy * vy;
1401
- return Geometry_1.Geometry.conditionalDivideFraction(uv, uu);
1402
- }
1403
- /**
1404
- * Return the line fraction at which the line is closest to a space point
1405
- * @param pointA0 start point
1406
- * @param pointA1 end point
1407
- * @param spacePoint point in space
1408
- */
1409
- static lineSegment3dClosestPointUnbounded(pointA0, pointA1, spacePoint) {
1410
- const ux = pointA1.x - pointA0.x;
1411
- const uy = pointA1.y - pointA0.y;
1412
- const uz = pointA1.z - pointA0.z;
1413
- const uu = ux * ux + uy * uy + uz * uz;
1414
- const vx = spacePoint.x - pointA0.x;
1415
- const vy = spacePoint.y - pointA0.y;
1416
- const vz = spacePoint.z - pointA0.z;
1417
- const uv = ux * vx + uy * vy + uz * vz;
1418
- return Geometry_1.Geometry.conditionalDivideFraction(uv, uu);
1419
- }
1420
- /**
1421
- * Return true if lines (a0,a1) to (b0, b1) have closest approach (go by each other) in 3d
1422
- * Return the fractional (not xy) coordinates in result.x, result.y
1423
- * @param a0 start point of line a
1424
- * @param a1 end point of line a
1425
- * @param b0 start point of line b
1426
- * @param b1 end point of line b
1427
- * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
1428
- */
1429
- static lineSegment3dClosestApproachUnbounded(a0, a1, b0, b1, result) {
1430
- 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);
1431
- }
1432
- /**
1433
- * Return true if the given rays have closest approach (go by each other) in 3d
1434
- * Return the fractional (not xy) coordinates as x and y parts of a Point2d.
1435
- * @param ax x-coordinate of the origin of the first ray
1436
- * @param ay y-coordinate of the origin of the first ray
1437
- * @param az z-coordinate of the origin of the first ray
1438
- * @param au x-coordinate of the direction vector of the first ray
1439
- * @param av y-coordinate of the direction vector of the first ray
1440
- * @param aw z-coordinate of the direction vector of the first ray
1441
- * @param bx x-coordinate of the origin of the second ray
1442
- * @param by y-coordinate of the origin of the second ray
1443
- * @param bz z-coordinate of the origin of the second ray
1444
- * @param bu x-coordinate of the direction vector of the second ray
1445
- * @param bv y-coordinate of the direction vector of the second ray
1446
- * @param bw z-coordinate of the direction vector of the second ray
1447
- * @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
1448
- */
1449
- static ray3dXYZUVWClosestApproachUnbounded(ax, ay, az, au, av, aw, bx, by, bz, bu, bv, bw, result) {
1450
- const cx = bx - ax;
1451
- const cy = by - ay;
1452
- const cz = bz - az;
1453
- const uu = Geometry_1.Geometry.hypotenuseSquaredXYZ(au, av, aw);
1454
- const vv = Geometry_1.Geometry.hypotenuseSquaredXYZ(bu, bv, bw);
1455
- const uv = Geometry_1.Geometry.dotProductXYZXYZ(au, av, aw, bu, bv, bw);
1456
- const cu = Geometry_1.Geometry.dotProductXYZXYZ(cx, cy, cz, au, av, aw);
1457
- const cv = Geometry_1.Geometry.dotProductXYZXYZ(cx, cy, cz, bu, bv, bw);
1458
- return SmallSystem.linearSystem2d(uu, -uv, uv, -vv, cu, cv, result);
1459
- }
1460
- /**
1461
- * Solve the pair of linear equations
1462
- * * `ux * x + vx * y = cx`
1463
- * * `uy * x + vy * y = cy`
1464
- * @param ux xx coefficient
1465
- * @param vx xy coefficient
1466
- * @param uy yx coefficient
1467
- * @param vy yy coefficient
1468
- * @param cx x right hand side
1469
- * @param cy y right hand side
1470
- * @param result (x,y) solution (MUST be preallocated by caller)
1471
- */
1472
- static linearSystem2d(ux, vx, // first row of matrix
1473
- uy, vy, // second row of matrix
1474
- cx, cy, // right side
1475
- result) {
1476
- const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
1477
- const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
1478
- const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
1479
- const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
1480
- const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
1481
- if (s !== undefined && t !== undefined) {
1482
- result.set(s, t);
1483
- return true;
1484
- }
1485
- result.set(0, 0);
1486
- return false;
1487
- }
1250
+ class BilinearPolynomial {
1488
1251
  /**
1489
- * Solve a linear system:
1490
- * * x equation: `axx * u + axy * v + axz * w = cx`
1491
- * * y equation: `ayx * u + ayy * v + ayz * w = cy`
1492
- * * z equation: `azx * u + azy * v + azz * w = cz`
1493
- * @param axx row 0, column 0 coefficient
1494
- * @param axy row 0, column 1 coefficient
1495
- * @param axz row 0, column 1 coefficient
1496
- * @param ayx row 1, column 0 coefficient
1497
- * @param ayy row 1, column 1 coefficient
1498
- * @param ayz row 1, column 2 coefficient
1499
- * @param azx row 2, column 0 coefficient
1500
- * @param azy row 2, column 1 coefficient
1501
- * @param azz row 2, column 2 coefficient
1502
- * @param cx right hand side row 0 coefficient
1503
- * @param cy right hand side row 1 coefficient
1504
- * @param cz right hand side row 2 coefficient
1505
- * @param result optional result.
1506
- * @returns solution vector (u,v,w) or `undefined` if system is singular.
1252
+ *
1253
+ * @param a constant coefficient
1254
+ * @param b `u` coefficient
1255
+ * @param c `v` coefficient
1256
+ * @param d `u*v` coefficient
1507
1257
  */
1508
- static linearSystem3d(axx, axy, axz, // first row of matrix
1509
- ayx, ayy, ayz, // second row of matrix
1510
- azx, azy, azz, // second row of matrix
1511
- cx, cy, cz, // right side
1512
- result) {
1513
- // determinants of various combinations of columns ...
1514
- const detXYZ = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, axz, ayz, azz);
1515
- const detCYZ = Geometry_1.Geometry.tripleProduct(cx, cy, cz, axy, ayy, azy, axz, ayz, azz);
1516
- const detXCZ = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, cx, cy, cz, axz, ayz, azz);
1517
- const detXYC = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, cx, cy, cz);
1518
- const s = Geometry_1.Geometry.conditionalDivideFraction(detCYZ, detXYZ);
1519
- const t = Geometry_1.Geometry.conditionalDivideFraction(detXCZ, detXYZ);
1520
- const u = Geometry_1.Geometry.conditionalDivideFraction(detXYC, detXYZ);
1521
- if (s !== undefined && t !== undefined && u !== undefined) {
1522
- return Point3dVector3d_1.Vector3d.create(s, t, u, result);
1523
- }
1524
- return undefined;
1258
+ constructor(a, b, c, d) {
1259
+ this.a = a;
1260
+ this.b = b;
1261
+ this.c = c;
1262
+ this.d = d;
1525
1263
  }
1526
1264
  /**
1527
- * Compute the intersection of three planes.
1528
- * @param xyzA point on the first plane
1529
- * @param normalA normal of the first plane
1530
- * @param xyzB point on the second plane
1531
- * @param normalB normal of the second plane
1532
- * @param xyzC point on the third plane
1533
- * @param normalC normal of the third plane
1534
- * @param result optional result
1535
- * @returns intersection point of the three planes (as a Vector3d), or undefined if at least two planes are parallel.
1265
+ * Evaluate the bilinear expression at u,v
1536
1266
  */
1537
- static intersect3Planes(xyzA, normalA, xyzB, normalB, xyzC, normalC, result) {
1538
- 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);
1267
+ evaluate(u, v) {
1268
+ return this.a + this.b * u + v * (this.c + this.d * u);
1539
1269
  }
1540
- /**
1541
- * * in rowB, replace `rowB[j] += a * rowB[pivot] * rowA[j] / rowA[pivot]` for `j>pivot`
1542
- * @param rowA row that does not change
1543
- * @param pivotIndex index of pivot (divisor) in rowA.
1544
- * @param rowB row where elimination occurs.
1270
+ /** Create a bilinear polynomial z=f(u,v) given z values at 00, 10, 01, 11.
1545
1271
  */
1546
- static eliminateFromPivot(rowA, pivotIndex, rowB, a) {
1547
- const n = rowA.length;
1548
- let q = Geometry_1.Geometry.conditionalDivideFraction(rowB[pivotIndex], rowA[pivotIndex]);
1549
- if (q === undefined)
1550
- return false;
1551
- q *= a;
1552
- for (let j = pivotIndex + 1; j < n; j++)
1553
- rowB[j] += q * rowA[j];
1554
- return true;
1272
+ static createUnitSquareValues(f00, f10, f01, f11) {
1273
+ return new BilinearPolynomial(f00, f10, f10, f11 - f10 - f01);
1555
1274
  }
1556
1275
  /**
1557
1276
  * Solve a pair of bilinear equations
1558
1277
  * * First equation: `a0 + b0 * u + c0 * v + d0 * u * v = 0`
1559
- * * Second equation: `a0 + b0 * u + c0 * v + d0 * u * v = 0`
1278
+ * * Second equation: `a1 + b1 * u + c1 * v + d1 * u * v = 0`
1560
1279
  */
1561
1280
  static solveBilinearPair(a0, b0, c0, d0, a1, b1, c1, d1) {
1562
1281
  // constant linear, and quadratic coefficients for c0 + c1 * u + c2 * u*u = 0
@@ -1577,38 +1296,6 @@ class SmallSystem {
1577
1296
  }
1578
1297
  return uv;
1579
1298
  }
1580
- }
1581
- exports.SmallSystem = SmallSystem;
1582
- /**
1583
- * * bilinear expression
1584
- * * `f(u,v) = a + b * u * c * v + d * u * v`
1585
- * @internal
1586
- */
1587
- class BilinearPolynomial {
1588
- /**
1589
- *
1590
- * @param a constant coefficient
1591
- * @param b `u` coefficient
1592
- * @param c `v` coefficient
1593
- * @param d `u*v` coefficient
1594
- */
1595
- constructor(a, b, c, d) {
1596
- this.a = a;
1597
- this.b = b;
1598
- this.c = c;
1599
- this.d = d;
1600
- }
1601
- /**
1602
- * Evaluate the bilinear expression at u,v
1603
- */
1604
- evaluate(u, v) {
1605
- return this.a + this.b * u + v * (this.c + this.d * u);
1606
- }
1607
- /** Create a bilinear polynomial z=f(u,v) given z values at 00, 10, 01, 11.
1608
- */
1609
- static createUnitSquareValues(f00, f10, f01, f11) {
1610
- return new BilinearPolynomial(f00, f10, f10, f11 - f10 - f01);
1611
- }
1612
1299
  /**
1613
1300
  * Solve the simultaneous equations
1614
1301
  * * `p(u,v) = pValue`
@@ -1619,7 +1306,7 @@ class BilinearPolynomial {
1619
1306
  * @param qValue
1620
1307
  */
1621
1308
  static solvePair(p, pValue, q, qValue) {
1622
- return SmallSystem.solveBilinearPair(p.a - pValue, p.b, p.c, p.d, q.a - qValue, q.b, q.c, q.d);
1309
+ return BilinearPolynomial.solveBilinearPair(p.a - pValue, p.b, p.c, p.d, q.a - qValue, q.b, q.c, q.d);
1623
1310
  }
1624
1311
  }
1625
1312
  exports.BilinearPolynomial = BilinearPolynomial;