@itwin/core-geometry 4.0.0-dev.4 → 4.0.0-dev.40

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 (344) hide show
  1. package/CHANGELOG.md +17 -3
  2. package/lib/cjs/Geometry.d.ts +56 -16
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +87 -30
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurveOps.js +4 -5
  7. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  8. package/lib/cjs/bspline/InterpolationCurve3d.js +7 -10
  9. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  10. package/lib/cjs/clipping/ClipPrimitive.js +2 -2
  11. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  12. package/lib/cjs/clipping/ClipUtils.js +4 -4
  13. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  14. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  15. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  16. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  17. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +20 -13
  18. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  19. package/lib/cjs/curve/CurveCollection.js +1 -1
  20. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  21. package/lib/cjs/curve/CurveCurve.d.ts +11 -8
  22. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  23. package/lib/cjs/curve/CurveCurve.js +16 -12
  24. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  25. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts +5 -1
  26. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  27. package/lib/cjs/curve/CurveCurveIntersectXY.js +11 -10
  28. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  29. package/lib/cjs/curve/Loop.d.ts +2 -2
  30. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  31. package/lib/cjs/curve/Loop.js +6 -0
  32. package/lib/cjs/curve/Loop.js.map +1 -1
  33. package/lib/cjs/curve/RegionOps.d.ts +10 -10
  34. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  35. package/lib/cjs/curve/RegionOps.js +11 -11
  36. package/lib/cjs/curve/RegionOps.js.map +1 -1
  37. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +2 -1
  38. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  39. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +5 -2
  40. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  41. package/lib/cjs/curve/StrokeOptions.js +1 -2
  42. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  43. package/lib/cjs/curve/spiral/DirectSpiral3d.js +1 -2
  44. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  45. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -2
  46. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  47. package/lib/cjs/geometry3d/Angle.d.ts +19 -0
  48. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  49. package/lib/cjs/geometry3d/Angle.js +39 -0
  50. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  51. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -0
  52. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  53. package/lib/cjs/geometry3d/AngleSweep.js +1 -0
  54. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  55. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +195 -8
  56. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  57. package/lib/cjs/geometry3d/BarycentricTriangle.js +459 -11
  58. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  59. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +1 -0
  60. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +3 -0
  62. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  63. package/lib/cjs/geometry3d/GrowableFloat64Array.js +2 -2
  64. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  65. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  66. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  67. package/lib/cjs/geometry3d/GrowableXYArray.js +2 -2
  68. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  69. package/lib/cjs/geometry3d/GrowableXYZArray.js +1 -1
  70. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  71. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +22 -7
  72. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  73. package/lib/cjs/geometry3d/IndexedXYCollection.js +41 -5
  74. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  75. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +58 -4
  76. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  77. package/lib/cjs/geometry3d/IndexedXYZCollection.js +102 -4
  78. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  79. package/lib/cjs/geometry3d/Matrix3d.d.ts +479 -265
  80. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  81. package/lib/cjs/geometry3d/Matrix3d.js +996 -784
  82. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  83. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts +1 -0
  84. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  85. package/lib/cjs/geometry3d/OrderedRotationAngles.js +1 -0
  86. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  87. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  88. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  89. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +14 -0
  90. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  91. package/lib/cjs/geometry3d/Point2dVector2d.js +4 -6
  92. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  93. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  94. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  95. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +0 -6
  96. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  97. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +57 -57
  98. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  99. package/lib/cjs/geometry3d/Point3dVector3d.js +63 -65
  100. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  101. package/lib/cjs/geometry3d/PointHelpers.d.ts +14 -1
  102. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  103. package/lib/cjs/geometry3d/PointHelpers.js +33 -1
  104. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  105. package/lib/cjs/geometry3d/PolygonOps.d.ts +127 -19
  106. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  107. package/lib/cjs/geometry3d/PolygonOps.js +420 -22
  108. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  109. package/lib/cjs/geometry3d/Ray3d.js +1 -1
  110. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  111. package/lib/cjs/geometry3d/Segment1d.d.ts +1 -1
  112. package/lib/cjs/geometry3d/Segment1d.js +1 -1
  113. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  114. package/lib/cjs/numerics/Polynomials.d.ts +12 -0
  115. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  116. package/lib/cjs/numerics/Polynomials.js +14 -0
  117. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  118. package/lib/cjs/polyface/AuxData.js +1 -1
  119. package/lib/cjs/polyface/AuxData.js.map +1 -1
  120. package/lib/cjs/polyface/FacetLocationDetail.d.ts +264 -0
  121. package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -0
  122. package/lib/cjs/polyface/FacetLocationDetail.js +376 -0
  123. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -0
  124. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  125. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  126. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -2
  127. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  128. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +24 -14
  129. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  130. package/lib/cjs/polyface/PolyfaceBuilder.js +74 -23
  131. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  132. package/lib/cjs/polyface/PolyfaceClip.js +6 -7
  133. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  134. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  135. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  136. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  137. package/lib/cjs/polyface/PolyfaceQuery.d.ts +76 -1
  138. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  139. package/lib/cjs/polyface/PolyfaceQuery.js +123 -3
  140. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  141. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts +202 -0
  142. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -0
  143. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +1038 -0
  144. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -0
  145. package/lib/cjs/serialization/BGFBReader.js +4 -4
  146. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  147. package/lib/cjs/serialization/GeometrySamples.d.ts +8 -6
  148. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  149. package/lib/cjs/serialization/GeometrySamples.js +26 -19
  150. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  151. package/lib/cjs/serialization/IModelJsonSchema.js +1 -2
  152. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  153. package/lib/cjs/solid/Sphere.d.ts +5 -5
  154. package/lib/cjs/solid/Sphere.js +5 -5
  155. package/lib/cjs/solid/Sphere.js.map +1 -1
  156. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  157. package/lib/cjs/solid/SweepContour.js +8 -1
  158. package/lib/cjs/solid/SweepContour.js.map +1 -1
  159. package/lib/cjs/topology/Graph.d.ts +113 -7
  160. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  161. package/lib/cjs/topology/Graph.js +185 -7
  162. package/lib/cjs/topology/Graph.js.map +1 -1
  163. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +38 -0
  164. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -0
  165. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +82 -0
  166. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -0
  167. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +2 -1
  168. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  169. package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -0
  170. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  171. package/lib/cjs/topology/Triangulation.js +1 -1
  172. package/lib/cjs/topology/Triangulation.js.map +1 -1
  173. package/lib/esm/Geometry.d.ts +56 -16
  174. package/lib/esm/Geometry.d.ts.map +1 -1
  175. package/lib/esm/Geometry.js +86 -29
  176. package/lib/esm/Geometry.js.map +1 -1
  177. package/lib/esm/bspline/BSplineCurveOps.js +4 -5
  178. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  179. package/lib/esm/bspline/InterpolationCurve3d.js +7 -10
  180. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  181. package/lib/esm/clipping/ClipPrimitive.js +2 -2
  182. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  183. package/lib/esm/clipping/ClipUtils.js +4 -4
  184. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  185. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  186. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  187. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  188. package/lib/esm/curve/CurveChainWithDistanceIndex.js +21 -14
  189. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  190. package/lib/esm/curve/CurveCollection.js +1 -1
  191. package/lib/esm/curve/CurveCollection.js.map +1 -1
  192. package/lib/esm/curve/CurveCurve.d.ts +11 -8
  193. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  194. package/lib/esm/curve/CurveCurve.js +16 -12
  195. package/lib/esm/curve/CurveCurve.js.map +1 -1
  196. package/lib/esm/curve/CurveCurveIntersectXY.d.ts +5 -1
  197. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  198. package/lib/esm/curve/CurveCurveIntersectXY.js +11 -10
  199. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  200. package/lib/esm/curve/Loop.d.ts +2 -2
  201. package/lib/esm/curve/Loop.d.ts.map +1 -1
  202. package/lib/esm/curve/Loop.js +6 -0
  203. package/lib/esm/curve/Loop.js.map +1 -1
  204. package/lib/esm/curve/RegionOps.d.ts +10 -10
  205. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  206. package/lib/esm/curve/RegionOps.js +11 -11
  207. package/lib/esm/curve/RegionOps.js.map +1 -1
  208. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +2 -1
  209. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  210. package/lib/esm/curve/RegionOpsClassificationSweeps.js +5 -2
  211. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  212. package/lib/esm/curve/StrokeOptions.js +1 -2
  213. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  214. package/lib/esm/curve/spiral/DirectSpiral3d.js +1 -2
  215. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  216. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -2
  217. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  218. package/lib/esm/geometry3d/Angle.d.ts +19 -0
  219. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  220. package/lib/esm/geometry3d/Angle.js +39 -0
  221. package/lib/esm/geometry3d/Angle.js.map +1 -1
  222. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -0
  223. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  224. package/lib/esm/geometry3d/AngleSweep.js +1 -0
  225. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  226. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +195 -8
  227. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  228. package/lib/esm/geometry3d/BarycentricTriangle.js +459 -12
  229. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  230. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +1 -0
  231. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  232. package/lib/esm/geometry3d/CoincidentGeometryOps.js +3 -0
  233. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  234. package/lib/esm/geometry3d/GrowableFloat64Array.js +2 -2
  235. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  236. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  237. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  238. package/lib/esm/geometry3d/GrowableXYArray.js +2 -2
  239. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  240. package/lib/esm/geometry3d/GrowableXYZArray.js +1 -1
  241. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  242. package/lib/esm/geometry3d/IndexedXYCollection.d.ts +22 -7
  243. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  244. package/lib/esm/geometry3d/IndexedXYCollection.js +41 -5
  245. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  246. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +58 -4
  247. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  248. package/lib/esm/geometry3d/IndexedXYZCollection.js +103 -5
  249. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  250. package/lib/esm/geometry3d/Matrix3d.d.ts +479 -265
  251. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  252. package/lib/esm/geometry3d/Matrix3d.js +996 -784
  253. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  254. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts +1 -0
  255. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  256. package/lib/esm/geometry3d/OrderedRotationAngles.js +1 -0
  257. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  258. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  259. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  260. package/lib/esm/geometry3d/Point2dArrayCarrier.js +14 -0
  261. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  262. package/lib/esm/geometry3d/Point2dVector2d.js +4 -6
  263. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  264. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  265. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  266. package/lib/esm/geometry3d/Point3dArrayCarrier.js +0 -6
  267. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  268. package/lib/esm/geometry3d/Point3dVector3d.d.ts +57 -57
  269. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  270. package/lib/esm/geometry3d/Point3dVector3d.js +63 -65
  271. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  272. package/lib/esm/geometry3d/PointHelpers.d.ts +14 -1
  273. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  274. package/lib/esm/geometry3d/PointHelpers.js +33 -1
  275. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  276. package/lib/esm/geometry3d/PolygonOps.d.ts +127 -19
  277. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  278. package/lib/esm/geometry3d/PolygonOps.js +419 -22
  279. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  280. package/lib/esm/geometry3d/Ray3d.js +1 -1
  281. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  282. package/lib/esm/geometry3d/Segment1d.d.ts +1 -1
  283. package/lib/esm/geometry3d/Segment1d.js +1 -1
  284. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  285. package/lib/esm/numerics/Polynomials.d.ts +12 -0
  286. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  287. package/lib/esm/numerics/Polynomials.js +14 -0
  288. package/lib/esm/numerics/Polynomials.js.map +1 -1
  289. package/lib/esm/polyface/AuxData.js +1 -1
  290. package/lib/esm/polyface/AuxData.js.map +1 -1
  291. package/lib/esm/polyface/FacetLocationDetail.d.ts +264 -0
  292. package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -0
  293. package/lib/esm/polyface/FacetLocationDetail.js +369 -0
  294. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -0
  295. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  296. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  297. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -2
  298. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  299. package/lib/esm/polyface/PolyfaceBuilder.d.ts +24 -14
  300. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  301. package/lib/esm/polyface/PolyfaceBuilder.js +74 -23
  302. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  303. package/lib/esm/polyface/PolyfaceClip.js +6 -7
  304. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  305. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  306. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  307. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  308. package/lib/esm/polyface/PolyfaceQuery.d.ts +76 -1
  309. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  310. package/lib/esm/polyface/PolyfaceQuery.js +121 -2
  311. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  312. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts +202 -0
  313. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -0
  314. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +1032 -0
  315. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -0
  316. package/lib/esm/serialization/BGFBReader.js +4 -4
  317. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  318. package/lib/esm/serialization/GeometrySamples.d.ts +8 -6
  319. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  320. package/lib/esm/serialization/GeometrySamples.js +26 -19
  321. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  322. package/lib/esm/serialization/IModelJsonSchema.js +1 -2
  323. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  324. package/lib/esm/solid/Sphere.d.ts +5 -5
  325. package/lib/esm/solid/Sphere.js +5 -5
  326. package/lib/esm/solid/Sphere.js.map +1 -1
  327. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  328. package/lib/esm/solid/SweepContour.js +8 -1
  329. package/lib/esm/solid/SweepContour.js.map +1 -1
  330. package/lib/esm/topology/Graph.d.ts +113 -7
  331. package/lib/esm/topology/Graph.d.ts.map +1 -1
  332. package/lib/esm/topology/Graph.js +185 -7
  333. package/lib/esm/topology/Graph.js.map +1 -1
  334. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +38 -0
  335. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -0
  336. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +78 -0
  337. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -0
  338. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +2 -1
  339. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  340. package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -0
  341. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  342. package/lib/esm/topology/Triangulation.js +1 -1
  343. package/lib/esm/topology/Triangulation.js.map +1 -1
  344. package/package.json +5 -5
@@ -136,7 +136,10 @@ export declare class Matrix3d implements BeJSONFunctions {
136
136
  inverseCoffs: Float64Array | undefined;
137
137
  /** Indicates if inverse is unknown, available, or known singular */
138
138
  inverseState: InverseMatrixState;
139
+ /** The identity matrix */
139
140
  private static _identity;
141
+ /** temporary buffer to store a matrix as a Float64Array (array of 9 floats) */
142
+ private static _productBuffer;
140
143
  /** The identity Matrix3d. Value is frozen and cannot be modified. */
141
144
  static get identity(): Matrix3d;
142
145
  /** Freeze this Matrix3d. */
@@ -234,9 +237,15 @@ export declare class Matrix3d implements BeJSONFunctions {
234
237
  */
235
238
  static createColumnsInAxisOrder(axisOrder: AxisOrder, columnA: Vector3d | undefined, columnB: Vector3d | undefined, columnC: Vector3d | undefined, result?: Matrix3d): Matrix3d;
236
239
  /**
237
- * Copy the transpose of the coffs to the inverseCoffs.
238
- * * Mark the matrix as inverseStored.
239
- */
240
+ * Create the inverseCoffs member (filled with zeros)
241
+ * This is for use by matrix * matrix multiplications which need to be sure the member is there to be
242
+ * filled with method-specific content.
243
+ */
244
+ private createInverseCoffsWithZeros;
245
+ /**
246
+ * Copy the transpose of the coffs to the inverseCoffs.
247
+ * * Mark the matrix as inverseStored.
248
+ */
240
249
  private setupInverseTranspose;
241
250
  /**
242
251
  * Set all entries in the matrix from call parameters appearing in row-major order.
@@ -336,13 +345,22 @@ export declare class Matrix3d implements BeJSONFunctions {
336
345
  */
337
346
  static createRigidFromColumns(vectorA: Vector3d, vectorB: Vector3d, axisOrder: AxisOrder, result?: Matrix3d): Matrix3d | undefined;
338
347
  /**
339
- * Construct a rigid matrix using vectorA and its 2 perpendicular.
348
+ * Construct a rigid matrix (orthogonal matrix with +1 determinant) using vectorA and its 2 perpendicular.
349
+ * * If axisOrder is not passed then `AxisOrder = AxisOrder.ZXY` is used as default.
340
350
  * * This function internally uses createPerpendicularVectorFavorXYPlane and createRigidFromColumns.
351
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/2PerpendicularVectorsTo1Vector
341
352
  */
342
353
  static createRigidHeadsUp(vectorA: Vector3d, axisOrder?: AxisOrder, result?: Matrix3d): Matrix3d;
343
- /** Return the matrix for rotation of `angle` around `axis` */
354
+ /**
355
+ * Return the matrix for rotation of `angle` around desired `axis`
356
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CubeRotationAroundAnAxis
357
+ * @param axis the axis of rotation
358
+ * @param angle the angle of rotation
359
+ * @param result caller-allocated matrix (optional)
360
+ * @returns the `rotation matrix` or `undefined` (if axis magnitude is near zero).
361
+ */
344
362
  static createRotationAroundVector(axis: Vector3d, angle: Angle, result?: Matrix3d): Matrix3d | undefined;
345
- /** Returns a rotation of specified angle around an axis
363
+ /** Returns a rotation of specified angle around one of the main axis (X,Y,Z).
346
364
  * @param axisIndex index of axis (AxisIndex.X, AxisIndex.Y, AxisIndex.Z) kept fixed by the rotation.
347
365
  * @param angle angle of rotation
348
366
  * @param result optional result matrix.
@@ -350,22 +368,31 @@ export declare class Matrix3d implements BeJSONFunctions {
350
368
  */
351
369
  static createRotationAroundAxisIndex(axisIndex: AxisIndex, angle: Angle, result?: Matrix3d): Matrix3d;
352
370
  /**
353
- * Replace current columns Ui and Uj with (c*Ui - s*Uj) and (c*Uj + s*Ui).
354
- * * There is no checking for i,j being 0,1,2.
355
- * * This is used in compute intensive inner loops
356
- * @param i first row index. **must be 0,1,2** (unchecked)
357
- * @param j second row index. **must be 0,1,2** (unchecked)
358
- * @param c fist coefficient
359
- * @param s second coefficient
360
- */
371
+ * Replace current rows Ui and Uj with (c*Ui + s*Uj) and (c*Uj - s*Ui).
372
+ * * There is no checking for i,j being 0,1,2.
373
+ * @param i first row index. **must be 0,1,2** (unchecked)
374
+ * @param j second row index. **must be 0,1,2** (unchecked)
375
+ * @param c fist coefficient
376
+ * @param s second coefficient
377
+ */
378
+ private applyGivensRowOp;
379
+ /**
380
+ * Replace current columns Ui and Uj with (c*Ui + s*Uj) and (c*Uj - s*Ui).
381
+ * * There is no checking for i,j being 0,1,2.
382
+ * * This is used in compute intensive inner loops
383
+ * @param i first row index. **must be 0,1,2** (unchecked)
384
+ * @param j second row index. **must be 0,1,2** (unchecked)
385
+ * @param c fist coefficient
386
+ * @param s second coefficient
387
+ */
361
388
  applyGivensColumnOp(i: number, j: number, c: number, s: number): void;
362
389
  /**
363
- * Create a matrix from column vectors.
364
- * ```
365
- * equation
366
- * \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ U_z & V_z & W_z \end{bmatrix}
367
- * ```
368
- */
390
+ * Create a matrix from column vectors.
391
+ * ```
392
+ * equation
393
+ * \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ U_z & V_z & W_z \end{bmatrix}
394
+ * ```
395
+ */
369
396
  static createColumns(vectorU: Vector3d, vectorV: Vector3d, vectorW: Vector3d, result?: Matrix3d): Matrix3d;
370
397
  /** Create a matrix with each column's _x,y_ parts given `XAndY` and separate numeric z values.
371
398
  * ```
@@ -374,29 +401,36 @@ export declare class Matrix3d implements BeJSONFunctions {
374
401
  * ```
375
402
  */
376
403
  static createColumnsXYW(vectorU: XAndY, u: number, vectorV: XAndY, v: number, vectorW: XAndY, w: number, result?: Matrix3d): Matrix3d;
377
- /** Create a matrix from "as viewed" right and up vectors.
378
- * * ColumnX points in the rightVector direction
379
- * * ColumnY points in the upVector direction
404
+ /**
405
+ * Create a matrix from "as viewed" right and up vectors.
406
+ * * ColumnX points in the rightVector direction.
407
+ * * ColumnY points in the upVector direction.
380
408
  * * ColumnZ is a unit cross product of ColumnX and ColumnY.
381
- * * Optionally rotate the standard cube by 45 degrees ccw around Y to bring its left or right vertical edge to center.
382
- * * Optionally rotate the standard cube by 35.264 degrees ccw around X (isometric rotation).
383
- * * This is expected to be used with various principal unit vectors that are perpendicular to each other.
409
+ * * Optionally rotate by 45 degrees around `upVector` to bring its left or right vertical edge to center.
410
+ * * Optionally rotate by arctan(1/sqrt(2)) ~ 35.264 degrees around `rightVector` to bring the top or bottom
411
+ * horizontal edge of the view to the center (for isometric views).
412
+ *
413
+ * This is expected to be used with various principal unit vectors that are perpendicular to each other.
384
414
  * * STANDARD TOP VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(), 0, 0)
385
415
  * * STANDARD FRONT VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), 0, 0)
386
416
  * * STANDARD BACK VIEW: createViewedAxes(Vector3d.unitX(-1), Vector3d.unitZ(), 0, 0)
387
417
  * * STANDARD RIGHT VIEW: createViewedAxes(Vector3d.unitY(), Vector3d.unitZ(), 0, 0)
388
418
  * * STANDARD LEFT VIEW: createViewedAxes(Vector3d.unitY(-1), Vector3d.unitZ(), 0, 0)
389
419
  * * STANDARD BOTTOM VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(-1), 0, 0)
420
+ * * STANDARD ISO VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), -1, 1)
421
+ * * STANDARD RIGHT ISO VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), 1, 1)
422
+ * * Front, right, back, left, top, and bottom standard views are views from faces of the cube
423
+ * and iso and right iso standard views are views from corners of the cube.
390
424
  * * Note: createViewedAxes is column-based so always returns local to world
391
425
  *
392
426
  * @param rightVector ColumnX of the returned matrix. Expected to be perpendicular to upVector.
393
427
  * @param upVector ColumnY of the returned matrix. Expected to be perpendicular to rightVector.
394
- * @param leftNoneRight Specifies the ccw rotation around Y axis. Normally one of "-1", "0", and "1", where
395
- * "-1" indicates rotation by 45 degrees to bring the left vertical edge to center, "0" means no rotation,
428
+ * @param leftNoneRight Specifies the ccw rotation around `upVector` axis. Normally one of "-1", "0", and "1",
429
+ * where "-1" indicates rotation by 45 degrees to bring the left vertical edge to center, "0" means no rotation,
396
430
  * and "1" indicates rotation by 45 degrees to bring the right vertical edge to center. Other numbers are
397
431
  * used as multiplier for this 45 degree rotation.
398
- * @param topNoneBottom Specifies the ccw rotation around X axis. Normally one of "-1", "0", and "1", where
399
- * "-1" indicates isometric rotation (35.264 degrees) to bring the bottom upward, "0" means no rotation,
432
+ * @param topNoneBottom Specifies the ccw rotation around `rightVector` axis. Normally one of "-1", "0", and "1",
433
+ * where "-1" indicates isometric rotation (35.264 degrees) to bring the bottom upward, "0" means no rotation,
400
434
  * and "1" indicates isometric rotation (35.264 degrees) to bring the top downward. Other numbers are
401
435
  * used as multiplier for the 35.264 degree rotation.
402
436
  * @returns matrix = [rightVector, upVector, rightVector cross upVector] with the applied rotations specified
@@ -408,9 +442,11 @@ export declare class Matrix3d implements BeJSONFunctions {
408
442
  * * Default is TOP view (`local X = world X`, `local Y = world Y`, `local Z = world Z`).
409
443
  * * To change view from the TOP to one of the other 7 standard views, we need to multiply "world data" to
410
444
  * the corresponding matrix1 provided by `createStandardWorldToView(index, false)` and then
411
- * `matrix1.multiply(world data)` will returns "local data".
445
+ * `matrix1.multiply(world data)` will return "local data".
412
446
  * * To change view back to the TOP, we need to multiply "local data" to the corresponding matrix2 provided
413
447
  * by `createStandardWorldToView(index, true)` and then `matrix2.multiply(local data)` will returns "world data".
448
+ * * Note: No matter how you rotate the world axis, local X is always pointing right, local Y is always pointing up,
449
+ * and local Z is always pointing toward you.
414
450
  *
415
451
  * @param index standard view index `StandardViewIndex.Top, Bottom, Left, Right, Front, Back, Iso, RightIso`
416
452
  * @param invert if false (default), the return matrix is world to local (view) and if true, the the return
@@ -419,7 +455,60 @@ export declare class Matrix3d implements BeJSONFunctions {
419
455
  */
420
456
  static createStandardWorldToView(index: StandardViewIndex, invert?: boolean, result?: Matrix3d): Matrix3d;
421
457
  /**
422
- * Compute the (unit vector) axis and angle of rotation.
458
+ * Apply (in place) a jacobi eigenvalue algorithm.
459
+ * @param i row index of zeroed member
460
+ * @param j column index of zeroed member
461
+ * @param leftEigenvectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
462
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
463
+ * mutually perpendicular because `this` matrix is symmetric.
464
+ * @param lambda a matrix that its diagonal entries will be filled by eigenvalues and its non-diagonal elements
465
+ * converge to 0 (allocated by caller, computed and filled by this function).
466
+ */
467
+ private applySymmetricJacobi;
468
+ /**
469
+ * Factor `this` matrix as a product `U * lambda * UT` where `U` is an orthogonal matrix and `lambda`
470
+ * is a diagonal matrix.
471
+ *
472
+ * * **Note 1:** You must apply this function to a `symmetric` matrix. Otherwise, the lower triangle is ignored
473
+ * and the upper triangle is mirrored to the lower triangle to enforce symmetry.
474
+ * * **Note 2:** This function is replaced by a faster method called `fastSymmetricEigenvalues` so consider
475
+ * using the fast version instead.
476
+ * @param leftEigenvectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
477
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
478
+ * mutually perpendicular because `this` matrix is symmetric.
479
+ * @param lambda a vector that its entries will be filled by eigenvalues of `this` Matrix3d (allocated by
480
+ * caller, computed and filled by this function).
481
+ */
482
+ symmetricEigenvalues(leftEigenvectors: Matrix3d, lambda: Vector3d): boolean;
483
+ /**
484
+ * Apply (in place) a jacobi eigenvalue algorithm that diagonalize `this` matrix, i.e., zeros out this.at(i,j).
485
+ * * During diagonalization, the upper triangle is mirrored to lower triangle to enforce symmetry.
486
+ * * Math details can be found at docs/learning/geometry/Matrix.md
487
+ * @param i row index of zeroed member.
488
+ * @param j column index of zeroed member.
489
+ * @param k other row/column index (different from i and j).
490
+ * @param leftEigenVectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
491
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
492
+ * mutually perpendicular because `this` matrix is symmetric.
493
+ */
494
+ private applyFastSymmetricJacobi;
495
+ /**
496
+ * Factor `this` matrix as a product `U * lambda * UT` where `U` is an orthogonal matrix and `lambda`
497
+ * is a diagonal matrix.
498
+ *
499
+ * * **Note:** You must apply this function to a `symmetric` matrix. Otherwise, the lower triangle is ignored
500
+ * and the upper triangle is mirrored to the lower triangle to enforce symmetry.
501
+ * * Math details can be found at docs/learning/geometry/Matrix.md
502
+ * @param leftEigenvectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
503
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
504
+ * mutually perpendicular because `this` matrix is symmetric.
505
+ * @param lambda a vector that its entries will be filled by eigenvalues of `this` Matrix3d (allocated by
506
+ * caller, computed and filled by this function).
507
+ */
508
+ fastSymmetricEigenvalues(leftEigenvectors: Matrix3d, lambda: Vector3d): boolean;
509
+ /**
510
+ * Compute the (unit vector) axis and angle for the rotation generated by `this` Matrix3d.
511
+ * * Math details can be found at docs/learning/geometry/Angle.md
423
512
  * @returns Returns axis and angle of rotation with result.ok === true when the conversion succeeded.
424
513
  */
425
514
  getAxisAndAngleOfRotation(): {
@@ -428,24 +517,53 @@ export declare class Matrix3d implements BeJSONFunctions {
428
517
  ok: boolean;
429
518
  };
430
519
  /**
431
- * Returns a matrix that rotates from vectorA to vectorB.
520
+ * Rotate columns i and j of `this` matrix to make them perpendicular using the angle that zero-out
521
+ * `thisTranspose * this`.
522
+ * @param i row index of zeroed member.
523
+ * @param j column index of zeroed member.
524
+ * @param matrixU a matrix that its columns will be filled by the right eigenvectors of `thisTranspose * this`
525
+ * (allocated by caller, computed and filled by this function). Note that columns of matrixU will be mutually
526
+ * perpendicular because `thisTranspose * this` matrix is symmetric.
432
527
  */
433
- static createRotationVectorToVector(vectorA: Vector3d, vectorB: Vector3d, result?: Matrix3d): Matrix3d | undefined;
528
+ private applyJacobiColumnRotation;
529
+ /**
530
+ * Factor `this` matrix as a product `VD * U` where `VD` has mutually perpendicular columns and `U` is orthogonal.
531
+ * @param matrixVD a matrix that its columns will be filled by rotating columns of `this` to make them mutually
532
+ * perpendicular (allocated by caller, computed and filled by this function).
533
+ * @param matrixU a matrix that its columns will be filled by the right eigenvectors of `thisTranspose * this`
534
+ * (allocated by caller, computed and filled by this function). Note that columns of matrixU will be mutually
535
+ * perpendicular because `thisTranspose * this` matrix is symmetric.
536
+ */
537
+ factorPerpendicularColumns(matrixVD: Matrix3d, matrixU: Matrix3d): boolean;
538
+ /**
539
+ * Factor `this` matrix as a product `V * D * U` where `V` and `U` are orthogonal and `D` is diagonal with
540
+ * positive entries.
541
+ * * This is formally known as the `Singular Value Decomposition` or `SVD`.
542
+ * @param matrixV an orthogonal matrix that its columns will be filled by the left eigenvectors of
543
+ * `thisTranspose * this` (allocated by caller, computed and filled by this function).
544
+ * @param scale singular values of `this` (allocated by caller, computed and filled by this function).
545
+ * The singular values in the `scale` are non-negative and decreasing.
546
+ * @param matrixU an orthogonal matrix that its columns will be filled by the right eigenvectors of
547
+ * `thisTranspose * this` (allocated by caller, computed and filled by this function).
548
+ */
549
+ factorOrthogonalScaleOrthogonal(matrixV: Matrix3d, scale: Point3d, matrixU: Matrix3d): boolean;
434
550
  /**
435
551
  * Return a matrix that rotates a fraction of the angular sweep from vectorA to vectorB.
436
552
  * @param vectorA initial vector position
437
- * @param fraction fractional rotation. 1.0 is "all the way"
553
+ * @param fraction fractional rotation (1 means rotate all the way)
438
554
  * @param vectorB final vector position
439
555
  * @param result optional result matrix.
440
556
  */
441
557
  static createPartialRotationVectorToVector(vectorA: Vector3d, fraction: number, vectorB: Vector3d, result?: Matrix3d): Matrix3d | undefined;
558
+ /** Returns a matrix that rotates from vectorA to vectorB. */
559
+ static createRotationVectorToVector(vectorA: Vector3d, vectorB: Vector3d, result?: Matrix3d): Matrix3d | undefined;
442
560
  /** Create a 90 degree rotation around a principal axis */
443
561
  static create90DegreeRotationAroundAxis(axisIndex: number): Matrix3d;
444
562
  /** Return (a copy of) the X column */
445
563
  columnX(result?: Vector3d): Vector3d;
446
- /** Return (a copy of)the Y column */
564
+ /** Return (a copy of) the Y column */
447
565
  columnY(result?: Vector3d): Vector3d;
448
- /** Return (a copy of)the Z column */
566
+ /** Return (a copy of) the Z column */
449
567
  columnZ(result?: Vector3d): Vector3d;
450
568
  /** Return the X column magnitude squared */
451
569
  columnXMagnitudeSquared(): number;
@@ -461,18 +579,21 @@ export declare class Matrix3d implements BeJSONFunctions {
461
579
  columnZMagnitude(): number;
462
580
  /** Return magnitude of columnX cross columnY. */
463
581
  columnXYCrossProductMagnitude(): number;
464
- /** Return the X row magnitude d */
582
+ /** Return the X row magnitude */
465
583
  rowXMagnitude(): number;
466
584
  /** Return the Y row magnitude */
467
585
  rowYMagnitude(): number;
468
586
  /** Return the Z row magnitude */
469
587
  rowZMagnitude(): number;
470
588
  /** Return the dot product of column X with column Y */
471
- /** Return the dot product of column X with column Y */
472
589
  columnXDotColumnY(): number;
590
+ /** Return the dot product of column X with column Z */
591
+ columnXDotColumnZ(): number;
592
+ /** Return the dot product of column Y with column Z */
593
+ columnYDotColumnZ(): number;
473
594
  /**
474
595
  * Dot product of an indexed column with a vector given as x,y,z
475
- * @param columnIndex index of column. Must be 0,1,2
596
+ * @param columnIndex index of column. Must be 0,1,2.
476
597
  * @param x x component of vector
477
598
  * @param y y component of vector
478
599
  * @param z z component of vector
@@ -502,59 +623,9 @@ export declare class Matrix3d implements BeJSONFunctions {
502
623
  dotRowYXYZ(x: number, y: number, z: number): number;
503
624
  /** Return the dot product of the x,y,z with the Z row. */
504
625
  dotRowZXYZ(x: number, y: number, z: number): number;
505
- /** Return the (vector) cross product of the Z column with the vector parameter. */
626
+ /** Return the cross product of the Z column with the vector parameter. */
506
627
  columnZCrossVector(vector: XYZ, result?: Vector3d): Vector3d;
507
- private applyGivensRowOp;
508
- /**
509
- * create a rigid coordinate frame column z parallel to (_x_,_y_,_z_) and column x in the xy plane.
510
- * * column z points from origin to x,y,z
511
- * * column x is perpendicular and in the xy plane
512
- * * column y is perpendicular to both. It is the "up" vector on the view plane.
513
- * * Multiplying a world vector times the transpose of this matrix transforms into the view xy
514
- * * Multiplying the matrix times the an in-view vector transforms the vector to world.
515
- * @param x eye x coordinate
516
- * @param y eye y coordinate
517
- * @param z eye z coordinate
518
- * @param result
519
- */
520
- static createRigidViewAxesZTowardsEye(x: number, y: number, z: number, result?: Matrix3d): Matrix3d;
521
- /** Rotate so columns i and j become perpendicular */
522
- private applyJacobiColumnRotation;
523
- /**
524
- * Factor this as a product C * U where C has mutually perpendicular columns and
525
- * U is orthogonal.
526
- * @param matrixC (allocate by caller, computed here)
527
- * @param matrixU (allocate by caller, computed here)
528
- */
529
- factorPerpendicularColumns(matrixC: Matrix3d, matrixU: Matrix3d): boolean;
530
- /**
531
- * Factor this matrix M as a product M = V * D * U where V and U are orthogonal, and D is diagonal (scale matrix).
532
- * @param matrixV left orthogonal factor (allocate by caller, computed here)
533
- * @param scale diagonal entries of D (allocate by caller, computed here)
534
- * @param matrixU right orthogonal factor (allocate by caller, computed here)
535
- */
536
- factorOrthogonalScaleOrthogonal(matrixV: Matrix3d, scale: Point3d, matrixU: Matrix3d): boolean;
537
- /** Apply a jacobi step to lambda which evolves towards diagonal. */
538
- private applySymmetricJacobi;
539
- /**
540
- * Factor this (symmetrized) as a product U * lambda * UT where U is orthogonal, lambda is diagonal.
541
- * The upper triangle is mirrored to lower triangle to enforce symmetry.
542
- * @param matrixC (allocate by caller, computed here)
543
- * @param factor (allocate by caller, computed here)
544
- */
545
- symmetricEigenvalues(leftEigenvectors: Matrix3d, lambda: Vector3d): boolean;
546
- /** Apply (in place a jacobi update that zeros out this.at(i,j).
547
- *
548
- */
549
- private applyFastSymmetricJacobiUpdate;
550
- /**
551
- * Factor this (symmetrized) as a product U * lambda * UT where U is orthogonal, lambda is diagonal.
552
- * The upper triangle is mirrored to lower triangle to enforce symmetry.
553
- * @param matrixC (allocate by caller, computed here)
554
- * @param factor (allocate by caller, computed here)
555
- */
556
- fastSymmetricEigenvalues(leftEigenvectors: Matrix3d, lambda: Vector3d): boolean;
557
- /** Install data from xyz parts of Point4d (w part of Point4d ignored) */
628
+ /** Set data from xyz parts of Point4d (w part of Point4d ignored) */
558
629
  setColumnsPoint4dXYZ(vectorU: Point4d, vectorV: Point4d, vectorW: Point4d): void;
559
630
  /**
560
631
  * Set entries in one column of the matrix.
@@ -562,40 +633,58 @@ export declare class Matrix3d implements BeJSONFunctions {
562
633
  * @param value x,yz, values for column. If undefined, zeros are installed.
563
634
  */
564
635
  setColumn(columnIndex: number, value: Vector3d | undefined): void;
565
- /** Set all columns of the matrix. Any undefined vector is zeros. */
566
- setColumns(vectorX: Vector3d | undefined, vectorY: Vector3d | undefined, vectorZ?: Vector3d | undefined): void;
567
636
  /**
568
- * set entries in one row of the matrix.
569
- * @param rowIndex row index. this is interpreted cyclically.
570
- * @param value x,yz, values for row. If undefined, zeros are installed.
637
+ * Set all columns of the matrix. Any undefined vector is zeros.
638
+ * @param vectorX values for column 0
639
+ * @param vectorY values for column 1
640
+ * @param vectorZ optional values for column 2 (it's optional in case column 2 is 000, which is a
641
+ * projection onto the xy-plane)
642
+ */
643
+ setColumns(vectorX: Vector3d | undefined, vectorY: Vector3d | undefined, vectorZ?: Vector3d): void;
644
+ /**
645
+ * Set entries in one row of the matrix.
646
+ * @param rowIndex row index. This is interpreted cyclically (using Geometry.cyclic3dAxis).
647
+ * @param value x,y,z values for row.
571
648
  */
572
649
  setRow(rowIndex: number, value: Vector3d): void;
573
- /** Return a (copy of) a column of the matrix.
574
- * @param i column index. This is corrected to 012 by Geometry.cyclic3dAxis.
650
+ /**
651
+ * Return (a copy of) a column of the matrix.
652
+ * @param i column index. This is interpreted cyclically (using Geometry.cyclic3dAxis).
653
+ * @param result optional preallocated result.
575
654
  */
576
655
  getColumn(columnIndex: number, result?: Vector3d): Vector3d;
577
- /** Return a (copy of) a row of the matrix.
578
- * @param i row index. This is corrected to 012 by Geometry.cyclic3dAxis.
656
+ /**
657
+ * Return a (copy of) a row of the matrix.
658
+ * @param i row index. This is interpreted cyclically (using Geometry.cyclic3dAxis).
659
+ * @param result optional preallocated result.
579
660
  */
580
661
  getRow(columnIndex: number, result?: Vector3d): Vector3d;
581
- /** Create a matrix from row vectors.
662
+ /**
663
+ * Create a matrix from row vectors.
582
664
  * ```
583
665
  * equation
584
666
  * \begin{bmatrix}U_x & U_y & U_z \\ V_x & V_y & V_z \\ W_x & W_y & W_z \end{bmatrix}
585
667
  * ```
586
668
  */
587
669
  static createRows(vectorU: Vector3d, vectorV: Vector3d, vectorW: Vector3d, result?: Matrix3d): Matrix3d;
588
- /** Create a matrix that scales along a specified direction.
589
- * * The scale factor can be negative.
590
- * * A scale of -1.0 (negative one) is a mirror across the plane perpendicular to the vector.
670
+ /**
671
+ * Create a matrix that scales along a specified `direction`. This means if you multiply the returned matrix
672
+ * by a `vector`, you get `directional scale` of that `vector`. Suppose `plane` is the plane perpendicular
673
+ * to the `direction`. When scale = 0, `directional scale` is projection of the `vector` to the `plane`.
674
+ * When scale = 1, `directional scale` is the `vector` itself. When scale = -1, `directional scale` is
675
+ * mirror of the `vector` across the `plane`. In general, When scale != 0, the result is computed by first
676
+ * projecting the `vector` to the `plane`, then translating that projection along the `direction` (if scale > 0)
677
+ * or in opposite direction (if scale < 0).
591
678
  * ```
592
679
  * equation
593
- * \text{The matrix is } I - (s-1) U U^T
594
- * \\ \text{with }U\text{ being the unit vector in the direction of the input vector.}
680
+ * \text{The matrix is } I + (s-1) D D^T
681
+ * \\ \text{with }D\text{ being the normalized direction vector and }s\text{ being the scale.}
595
682
  * ```
683
+ * * Visualization can be found at itwinjs.org/sandbox/SaeedTorabi/DirectionalScale
596
684
  */
597
685
  static createDirectionalScale(direction: Vector3d, scale: number, result?: Matrix3d): Matrix3d;
598
- /** Multiply the matrix * vector, treating the vector is a column vector on the right.
686
+ /**
687
+ * Multiply `matrix * vector`, treating the vector is a column vector on the right.
599
688
  * ```
600
689
  * equation
601
690
  * \matrixXY{A}\columnSubXYZ{U}
@@ -603,58 +692,71 @@ export declare class Matrix3d implements BeJSONFunctions {
603
692
  * @return the vector result
604
693
  */
605
694
  multiplyVector(vectorU: XYAndZ, result?: Vector3d): Vector3d;
606
- /** Multiply matrix * vector for each array member, i.e. the vector is a column vector on the right.
607
- * @return the vector result
695
+ /**
696
+ * Multiply `matrix * vector` in place for vector in the array, i.e. treating the vector is a column
697
+ * vector on the right.
698
+ * * Each `vector` is updated to be `matrix * vector`
608
699
  */
609
700
  multiplyVectorArrayInPlace(data: XYZ[]): void;
610
- /** compute `origin - matrix * vector` */
701
+ /** Compute `origin - matrix * vector` */
611
702
  static xyzMinusMatrixTimesXYZ(origin: XYAndZ, matrix: Matrix3d, vector: XYAndZ, result?: Point3d): Point3d;
612
- /** compute `origin + matrix * vector` using only the xy parts of the inputs. */
703
+ /** Compute `origin + matrix * vector` using only the xy parts of the inputs. */
613
704
  static xyPlusMatrixTimesXY(origin: XAndY, matrix: Matrix3d, vector: XAndY, result?: Point2d): Point2d;
614
- /** compute `origin + matrix * vector` using all xyz parts of the inputs. */
705
+ /** Compute `origin + matrix * vector` using all xyz parts of the inputs. */
615
706
  static xyzPlusMatrixTimesXYZ(origin: XYZ, matrix: Matrix3d, vector: XYAndZ, result?: Point3d): Point3d;
616
- /** compute `origin + matrix * vector` using all xyz parts of the inputs. */
707
+ /** Updates vector to be `origin + matrix * vector` using all xyz parts of the inputs. */
617
708
  static xyzPlusMatrixTimesXYZInPlace(origin: XYZ, matrix: Matrix3d, vector: WritableXYAndZ): void;
618
- /** compute `origin + matrix * vector` where the final vector is given as direct x,y,z coordinates */
709
+ /** Compute `origin + matrix * vector` where the final vector is given as direct x,y,z coordinates */
619
710
  static xyzPlusMatrixTimesCoordinates(origin: XYZ, matrix: Matrix3d, x: number, y: number, z: number, result?: Point3d): Point3d;
620
711
  /**
621
712
  * Treat the 3x3 matrix and origin as upper 3x4 part of a 4x4 matrix, with 0001 as the final row.
622
- * Multiply times point with coordinates `[x,y,z,w]`
713
+ * Multiply the 4x4 matrix by `[x,y,z,w]`
714
+ * ```
715
+ * equation
716
+ * \begin{bmatrix}M_0 & M_1 & M_2 & Ox \\ M_3 & M_4 & M_5 & Oy \\ M_6 & M_7 & M_8 & Oz \\ 0 & 0 & 0 & 1\end{bmatrix} * \begin{bmatrix}x \\ y \\ z \\ w\end{bmatrix}
717
+ * ```
623
718
  * @param origin translation part (xyz in column 3)
624
719
  * @param matrix matrix part (leading 3x3)
625
720
  * @param x x part of multiplied point
626
721
  * @param y y part of multiplied point
627
722
  * @param z z part of multiplied point
628
723
  * @param w w part of multiplied point
629
- * @param result optional result.
724
+ * @param result optional preallocated result.
630
725
  */
631
726
  static xyzPlusMatrixTimesWeightedCoordinates(origin: XYZ, matrix: Matrix3d, x: number, y: number, z: number, w: number, result?: Point4d): Point4d;
632
727
  /**
633
728
  * Treat the 3x3 matrix and origin as upper 3x4 part of a 4x4 matrix, with 0001 as the final row.
634
- * Multiply times point with coordinates `[x,y,z,w]`
729
+ * Multiply the 4x4 matrix by `[x,y,z,w]`
730
+ * ```
731
+ * equation
732
+ * \begin{bmatrix}M_0 & M_1 & M_2 & Ox \\ M_3 & M_4 & M_5 & Oy \\ M_6 & M_7 & M_8 & Oz \\ 0 & 0 & 0 & 1\end{bmatrix} * \begin{bmatrix}x \\ y \\ z \\ w\end{bmatrix}
733
+ * ```
635
734
  * @param origin translation part (xyz in column 3)
636
735
  * @param matrix matrix part (leading 3x3)
637
736
  * @param x x part of multiplied point
638
737
  * @param y y part of multiplied point
639
738
  * @param z z part of multiplied point
640
739
  * @param w w part of multiplied point
641
- * @param result optional result.
740
+ * @param result optional preallocated result.
642
741
  */
643
742
  static xyzPlusMatrixTimesWeightedCoordinatesToFloat64Array(origin: XYZ, matrix: Matrix3d, x: number, y: number, z: number, w: number, result?: Float64Array): Float64Array;
644
743
  /**
645
- * Treat the 3x3 matrix and origin as upper 3x4 part of a 4x4 matrix, with 0001 as the final row.
646
- * Multiply times point with coordinates `[x,y,z,w]`
744
+ * Treat the 3x3 matrix and origin as a 3x4 matrix.
745
+ * * Multiply the 3x4 matrix by `[x,y,z,1]`
746
+ * ```
747
+ * equation
748
+ * \begin{bmatrix}M_0 & M_1 & M_2 & Ox \\ M_3 & M_4 & M_5 & Oy \\ M_6 & M_7 & M_8 & Oz\end{bmatrix} * \begin{bmatrix}x \\ y \\ z \\ 1\end{bmatrix}
749
+ * ```
647
750
  * @param origin translation part (xyz in column 3)
648
751
  * @param matrix matrix part (leading 3x3)
649
752
  * @param x x part of multiplied point
650
753
  * @param y y part of multiplied point
651
754
  * @param z z part of multiplied point
652
- * @param w w part of multiplied point
653
- * @param result optional result.
755
+ * @param result optional preallocated result.
654
756
  */
655
757
  static xyzPlusMatrixTimesCoordinatesToFloat64Array(origin: XYZ, matrix: Matrix3d, x: number, y: number, z: number, result?: Float64Array): Float64Array;
656
758
  /**
657
- * Multiply transpose of this matrix times a vector.
759
+ * Multiply the transpose matrix times a vector.
658
760
  * * This produces the same x,y,z as treating the vector as a row on the left of the (un-transposed) matrix.
659
761
  * ```
660
762
  * equation
@@ -663,161 +765,215 @@ export declare class Matrix3d implements BeJSONFunctions {
663
765
  * \text{Treating U as a row to the left of untransposed matrix\: return row}&\rowSubXYZ{V}&=&\rowSubXYZ{U}\matrixXY{A}
664
766
  * \end{matrix}
665
767
  * ```
666
- * @return the vector result
768
+ * @param result the vector result (optional)
667
769
  */
668
770
  multiplyTransposeVector(vector: Vector3d, result?: Vector3d): Vector3d;
669
- /** Multiply the matrix * (x,y,z), i.e. the vector (x,y,z) is a column vector on the right.
670
- * @return the vector result
771
+ /**
772
+ * Multiply the matrix * [x,y,z], i.e. the vector [x,y,z] is a column vector on the right.
773
+ * @param result the vector result (optional)
671
774
  */
672
775
  multiplyXYZ(x: number, y: number, z: number, result?: Vector3d): Vector3d;
673
- /** Multiply the matrix * xyz, place result in (required) return value.
674
- * @param xyz right side
675
- * @param result result.
776
+ /**
777
+ * Multiply the matrix * xyz, place result in (required) return value.
778
+ * @param xyz right side
779
+ * @param result the result.
676
780
  */
677
781
  multiplyXYZtoXYZ(xyz: XYZ, result: XYZ): XYZ;
678
- /** Multiply the matrix * (x,y,0), i.e. the vector (x,y,z) is a column vector on the right.
679
- * @return the vector result
782
+ /**
783
+ * Multiply the matrix * [x,y,0], i.e. the vector [x,y,0] is a column vector on the right.
784
+ * @param result the vector result (optional)
680
785
  */
681
786
  multiplyXY(x: number, y: number, result?: Vector3d): Vector3d;
682
- /** compute `origin + this*[x,y,0]` */
787
+ /**
788
+ * Compute origin + the matrix * [x,y,0].
789
+ * @param result the Point3d result (optional)
790
+ */
683
791
  originPlusMatrixTimesXY(origin: XYZ, x: number, y: number, result?: Point3d): Point3d;
684
- /** Multiply matrix * (x, y, z) using any 3d object given containing those members */
792
+ /**
793
+ * Multiply the matrix * (x,y,z) in place, i.e. the vector (x,y,z) is a column vector on the right and
794
+ * the multiplication updates the vector values.
795
+ * @param xyzData the vector data.
796
+ */
685
797
  multiplyVectorInPlace(xyzData: XYZ): void;
686
- /** Multiply the transpose matrix times column using any 3d object with x,y,z members.
687
- * This is equivalent to `multiplyTransposeVector` but always returns the result directly in the input.
798
+ /**
799
+ * Multiply the transpose matrix times [x,y,z] in place, i.e. the vector [x,y,z] is a column vector on
800
+ * the right and the multiplication updates the vector values.
801
+ * * This is equivalent to `multiplyTransposeVector` but always returns the result directly in the input.
802
+ * @param vectorU the vector data
688
803
  */
689
804
  multiplyTransposeVectorInPlace(vectorU: XYZ): void;
690
- /** Multiply the transpose matrix times column using individual numeric inputs.
691
- * * This is equivalent to multiplying with the vector as a row to the left of the plain matrix.
805
+ /**
806
+ * Multiply the transpose matrix times column using individual numeric inputs.
807
+ * * This produces the same x,y,z as treating the vector as a row on the left of the (un-transposed) matrix.
692
808
  * ```
693
809
  * equation
694
810
  * \begin{matrix}
695
- * \text{treating the input as a column } \columnXYZ{x}{y}{z}\text{ compute }&\columnSubXYZ{V} &= &A^T \columnXYZ{x}{y}{z} \\
696
- * \text{or row vector } \rowXYZ{x}{y}{z} \text{ compute }&\rowSubXYZ{V} &= &\rowXYZ{x}{y}{z} A \\
811
+ * \text{treating the input as a column vector } \columnXYZ{x}{y}{z}\text{ compute }&\columnSubXYZ{V} &= &A^T \columnXYZ{x}{y}{z} \\
812
+ * \text{or as a row vector } \rowXYZ{x}{y}{z} \text{ compute }&\rowSubXYZ{V} &= &\rowXYZ{x}{y}{z} A \\
697
813
  * \phantom{8888}\text{and return V as a Vector3d} & & &
698
814
  * \end{matrix}
699
815
  * ````
700
- * @return the vector result
816
+ * @param result the vector result (optional)
701
817
  */
702
818
  multiplyTransposeXYZ(x: number, y: number, z: number, result?: Vector3d): Vector3d;
703
- /** Solve `matrix * result = vector`.
819
+ /**
820
+ * Solve `matrix * result = vector` for an unknown `result`.
704
821
  * * This is equivalent to multiplication `result = matrixInverse * vector`.
705
- * * Result is undefined if the matrix is singular (e.g. has parallel or zero length columns)
822
+ * * Result is `undefined` if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
706
823
  */
707
824
  multiplyInverse(vector: Vector3d, result?: Vector3d): Vector3d | undefined;
708
- /** Solve `matrixTranspose * result = vector`.
825
+ /**
826
+ * Solve `matrixTranspose * result = vector` for an unknown `result`.
709
827
  * * This is equivalent to multiplication `result = matrixInverseTranspose * vector`.
710
- * * Result is undefined if the matrix is singular (e.g. has parallel or zero length columns)
828
+ * * Result is `undefined` if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
711
829
  */
712
830
  multiplyInverseTranspose(vector: Vector3d, result?: Vector3d): Vector3d | undefined;
713
831
  /**
714
- * multiply `matrixInverse * [x,y,z]`.
715
- * * This is equivalent to solving `matrix * result = [x,y,z]`
716
- * * return as a Vector3d, or undefined if the matrix is singular.
832
+ * Multiply `matrixInverse * [x,y,z]`.
833
+ * * This is equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
834
+ * * Result is `undefined` if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
835
+ * @return result as a Vector3d or undefined (if the matrix is singular).
717
836
  */
718
837
  multiplyInverseXYZAsVector3d(x: number, y: number, z: number, result?: Vector3d): Vector3d | undefined;
719
838
  /**
720
- * multiply `matrixInverse * [x,y,z]` and return packaged as `Point4d` with given weight.
721
- * * Equivalent to solving matrix * result = [x,y,z]
722
- * * return as a Point4d with the same weight.
723
- * * Called by Transform with x,y,z adjusted by subtraction ((xw) - w * origin.x, etc) where xw is the pre-weighted space point.
839
+ * Multiply `matrixInverse * [x,y,z]` and return result as `Point4d` with given weight.
840
+ * * Equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
841
+ * * Result is `undefined` if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
842
+ * @return result as a Point4d with the same weight.
724
843
  */
725
844
  multiplyInverseXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d | undefined;
726
845
  /**
727
- * multiply `matrixInverse * [x,y,z]` and return packaged as `Point3d`.
728
- * * multiply matrixInverse * [x,y,z]
729
- * * Equivalent to solving matrix * result = [x,y,z]
730
- * * return as a Point3d.
846
+ * Multiply `matrixInverse * [x,y,z]` and return result as `Point3d`.
847
+ * * Equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
848
+ * @return result as a Point3d or `undefined` (if the matrix is singular).
731
849
  */
732
850
  multiplyInverseXYZAsPoint3d(x: number, y: number, z: number, result?: Point3d): Point3d | undefined;
733
851
  /**
734
- * * invoke a given matrix-matrix operation (product function) to compute this.inverseCOffs
735
- * * set this.inverseCoffs
736
- * * if either input cffA or coffB is undefined, set state to `InverseMatrixState.unknown` (but leave the inverseCoffs untouched)
852
+ * Invoke a given matrix*matrix operation to compute the inverse matrix and set this.inverseCoffs
853
+ * * If either input coffA or coffB is `undefined`, set state to `InverseMatrixState.unknown` but
854
+ * leave the inverseCoffs untouched.
855
+ * @param f the given matrix*matrix operation that is called by this function to compute the inverse.
856
+ * `f` must be a matrix*matrix operation. Otherwise, the function does not generate the inverse properly.
737
857
  */
738
858
  private finishInverseCoffs;
739
- /** Multiply the instance matrix A by the input matrix B.
740
- * @return the matrix product A * B
859
+ /**
860
+ * Multiply `this` matrix times `other` matrix
861
+ * @return the matrix result: this*other
741
862
  */
742
863
  multiplyMatrixMatrix(other: Matrix3d, result?: Matrix3d): Matrix3d;
743
- private static _productBuffer;
744
- /** Multiply this matrix times inverse of other
745
- * @return the matrix result
864
+ /**
865
+ * Multiply `this` matrix times `inverse of other` matrix
866
+ * @return the matrix result: this*otherInverse
746
867
  */
747
868
  multiplyMatrixMatrixInverse(other: Matrix3d, result?: Matrix3d): Matrix3d | undefined;
748
- /** Multiply this matrix times inverse of other
749
- * @return the matrix result
869
+ /**
870
+ * Multiply `inverse of this` matrix times `other` matrix
871
+ * @return the matrix result: thisInverse*other
750
872
  */
751
873
  multiplyMatrixInverseMatrix(other: Matrix3d, result?: Matrix3d): Matrix3d | undefined;
752
- /** Multiply `this` matrix times the transpose of `matrixB`.
874
+ /**
875
+ * Multiply `this` matrix times the transpose of `other` matrix
753
876
  * ```
754
877
  * equation
755
- * \text{for instance matrix }A\text{ and other matrix }B\text{ return matrix }C{\text where }\\\matrixXY{C}=\matrixXY{A}\matrixTransposeSubXY{B}
878
+ * \text{for instance matrix }A\text{ and matrix }B\text{ return matrix }C{\text where }\\\matrixXY{C}=\matrixXY{A}\matrixTransposeSubXY{B}
756
879
  * ```
757
- * @return the matrix result
880
+ * @return the matrix result: this*otherTranspose
758
881
  */
759
- multiplyMatrixMatrixTranspose(matrixB: Matrix3d, result?: Matrix3d): Matrix3d;
760
- /** Matrix multiplication `thisTranspose * other`.
882
+ multiplyMatrixMatrixTranspose(other: Matrix3d, result?: Matrix3d): Matrix3d;
883
+ /**
884
+ * Multiply the transpose of `this` matrix times `other` matrix
761
885
  * ```
762
886
  * equation
763
887
  * \matrixXY{result}=\matrixXY{\text{this}}\matrixTransposeSubXY{\text{other}}
764
888
  * ```
765
- * @return the matrix result
889
+ * @return the matrix result: thisTranspose*other
766
890
  */
767
891
  multiplyMatrixTransposeMatrix(other: Matrix3d, result?: Matrix3d): Matrix3d;
768
- /** multiply this Matrix3d (considered as a transform with 0 translation) times other Transform.
892
+ /**
893
+ * Multiply `this` Matrix3d (considered as a Transform with 0 translation) times `other` Transform.
769
894
  * ```
770
895
  * equation
771
896
  * \begin{matrix}
772
- * \text{This matrix }\bold{A}\text{ promoted to block transform} & \blockTransform{A}{0} \\
773
- * \text{other transform with matrix part }\bold{B}\text{ and translation }\bold{b} & \blockTransform{B}{b}\\
897
+ * \text{This matrix }\bold{A}\text{ promoted to block transform} & \blockTransform{A}{0} \\
898
+ * \text{other transform with matrix part }\bold{B}\text{ and translation }\bold{b} & \blockTransform{B}{b}\\
774
899
  * \text{product}& \blockTransform{A}{0}\blockTransform{B}{b}=\blockTransform{AB}{Ab}
775
900
  * \end{matrix}
776
901
  * ```
777
- * @param other right hand Matrix3d for multiplication.
778
- * @param result optional preallocated result to reuse.
902
+ * @param other Right hand Matrix3d for multiplication.
903
+ * @param result the Transform result (optional)
779
904
  */
780
905
  multiplyMatrixTransform(other: Transform, result?: Transform): Transform;
781
906
  /**
782
907
  * Return the transpose of `this` matrix.
783
- * If `result` is passed as argument, then the function copies the transpose of `this` into `result`
784
- * `this` is not changed unless also passed as the result, i.e., this.transpose(this) transposes `this` in place
908
+ * * If `result` is passed as argument, then the function copies the transpose of `this` into `result`.
909
+ * * `this` is not changed unless also passed as the result, i.e., `this.transpose(this)` transposes `this` in place.
785
910
  */
786
911
  transpose(result?: Matrix3d): Matrix3d;
787
912
  /**
788
913
  * Transpose this matrix in place.
789
914
  */
790
915
  transposeInPlace(): void;
791
- /** return the inverse matrix.
792
- * The return is undefined if the matrix is singular (has columns that are coplanar or colinear)
793
- * * Note that each Matrix3d object caches its own inverse, and has methods to multiply the inverse times matrices and vectors.
794
- * * Hence explicitly constructing this new inverse object is rarely necessary.
916
+ /**
917
+ * Return the inverse matrix.
918
+ * The return is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
919
+ * * If `result == this`, then content of inverse of `this` matrix is copied into `this`. Otherwise, inverse
920
+ * of `this` is stored in `result`.
921
+ * * **Note:** Each Matrix3d object caches its own inverse (`this.inverseCoffs`) and has methods to multiply
922
+ * the inverse times matrices and vectors (e.g., `multiplyMatrixInverseMatrix`, `multiplyMatrixMatrixInverse`,
923
+ * `multiplyInverse`). Hence explicitly constructing this new inverse object is rarely necessary.
795
924
  */
796
925
  inverse(result?: Matrix3d): Matrix3d | undefined;
926
+ /**
927
+ * Take the dot product of a row (specified by `rowStartA`) of `coffA` and `columnStartB` of `coffB`.
928
+ * * **Note:** We don't validate row/column numbers. Pass 0/3/6 for row 0/1/2 and pass 0/1/2 for column 0/1/2.
929
+ */
930
+ private static rowColumnDot;
931
+ /**
932
+ * Take the cross product of 2 rows (specified by `rowStart0` and `rowStart1`) of `source` and store the result
933
+ * in `columnStart` of `dest`.
934
+ * * **Note:** We don't validate row/column numbers. Pass 0/3/6 for row 0/1/2 and pass 0/1/2 for column 0/1/2.
935
+ */
797
936
  private static indexedRowCrossProduct;
937
+ /**
938
+ * Take the cross product of 2 columns (i.e., `colStart0` and `colStart1`) of `this` matrix and store the
939
+ * result in `colStart2` of the same matrix.
940
+ * * **Note:** We don't validate column numbers. Pass 0/1/2 for column 0/1/2.
941
+ */
798
942
  private indexedColumnCrossProductInPlace;
799
- /** Form cross products among columns in axisOrder.
800
- * For axis order ABC,
801
- * * form cross product of column A and B, store in C
943
+ /**
944
+ * Form cross products among columns in axisOrder.
945
+ * For axis order ABC:
946
+ * * form cross product of column A and B, store in C.
802
947
  * * form cross product of column C and A, store in B.
948
+ * * [A B C] ===> [A B AxB] ===> [A (AxB)xA AxB]
949
+ *
803
950
  * This means that in the final matrix:
804
- * * column A is strictly parallel to original column A
805
- * * column B is linear combination of only original A and B
806
- * * column C is perpendicular to A and B of both the original and final.
807
- * * original column C does not participate in the result.
951
+ * * first column is same as original column A.
952
+ * * second column is linear combination of original A and B (i.e., is in the plane of original A and B).
953
+ * * third column is perpendicular to first and second columns of both the original and final.
954
+ * * original column C is overwritten and does not participate in the result.
955
+ *
956
+ * The final matrix will have 3 orthogonal columns.
808
957
  */
809
958
  axisOrderCrossProductsInPlace(axisOrder: AxisOrder): void;
810
- /** Normalize each column in place.
811
- * * For false return the magnitudes are stored in the originalMagnitudes vector but no columns are altered.
812
- * @returns Return true if all columns had nonzero lengths.
813
- * @param originalMagnitudes optional vector to receive original column magnitudes.
814
- */
815
- normalizeColumnsInPlace(originalMagnitudes?: Vector3d): boolean;
816
- /** Normalize each row in place */
817
- normalizeRowsInPlace(originalMagnitudes?: Vector3d): boolean;
818
- private static rowColumnDot;
819
959
  /**
820
- * Returns true if the matrix is singular (i.e. collapses data to a plane, line, or point)
960
+ * Normalize each column in place.
961
+ * @param originalColumnMagnitudes optional vector to store original column magnitudes.
962
+ * @returns return true if all columns have non-zero lengths. Otherwise, return false.
963
+ * * If false is returned, the magnitudes are stored in the `originalColumnMagnitudes` vector but no columns
964
+ * are altered.
965
+ */
966
+ normalizeColumnsInPlace(originalColumnMagnitudes?: Vector3d): boolean;
967
+ /**
968
+ * Normalize each row in place.
969
+ * @param originalRowMagnitudes optional vector to store original row magnitudes.
970
+ * @returns return true if all rows have non-zero lengths. Otherwise, return false.
971
+ * * If false is returned, the magnitudes are stored in the `originalRowMagnitudes` vector but no rows
972
+ * are altered.
973
+ */
974
+ normalizeRowsInPlace(originalRowMagnitudes?: Vector3d): boolean;
975
+ /**
976
+ * Returns true if the matrix is singular.
821
977
  */
822
978
  isSingular(): boolean;
823
979
  /**
@@ -825,81 +981,112 @@ export declare class Matrix3d implements BeJSONFunctions {
825
981
  */
826
982
  markSingular(): void;
827
983
  /**
828
- * Create the inverseCoffs member (filled with zeros)
829
- * This is for use by matrix * matrix multiplications which need to be sure the member is there to be
830
- * filled with method-specific content.
831
- */
832
- private createInverseCoffsWithZeros;
833
- /** compute the inverse of this Matrix3d. The inverse is stored for later use.
834
- * @returns Return true if the inverse computed. (False if the columns collapse to a point, line or plane.)
984
+ * Compute the inverse of `this` Matrix3d. The inverse is stored in `this.inverseCoffs` for later use.
985
+ * @param useCacheIfAvailable if `true`, use the previously computed inverse if available. If `false`,
986
+ * recompute the inverse.
987
+ * @returns return `true` if the inverse is computed. Return `false` if matrix is singular.
835
988
  */
836
989
  computeCachedInverse(useCacheIfAvailable: boolean): boolean;
837
- /** convert a (row,column) index pair to the single index within flattened array of 9 numbers in row-major-order */
990
+ /**
991
+ * Convert a (row,column) index pair to the single index within flattened array of 9 numbers in row-major-order
992
+ * * **Note:** Out of range row/column is interpreted cyclically.
993
+ */
838
994
  static flatIndexOf(row: number, column: number): number;
839
- /** Get a column by index (0,1,2), packaged as a Point4d with given weight. Out of range index is interpreted cyclically. */
995
+ /**
996
+ * Get elements of column `index` packaged as a Point4d with given `weight`.
997
+ * * **Note:** Out of range index is interpreted cyclically.
998
+ */
840
999
  indexedColumnWithWeight(index: number, weight: number, result?: Point4d): Point4d;
841
- /** return the entry at specific row and column */
1000
+ /** Return the entry at specific row and column */
842
1001
  at(row: number, column: number): number;
843
1002
  /** Set the entry at specific row and column */
844
1003
  setAt(row: number, column: number, value: number): void;
845
- /** create a Matrix3d whose columns are scaled copies of this Matrix3d.
846
- * @param scaleX scale factor for column x
847
- * @param scaleY scale factor for column y
848
- * @param scaleZ scale factor for column z
1004
+ /**
1005
+ * Create a Matrix3d whose values are uniformly scaled from `this` Matrix3d.
1006
+ * @param scale scale factor to apply.
849
1007
  * @param result optional result.
1008
+ * @returns return the scaled matrix.
1009
+ */
1010
+ scale(scale: number, result?: Matrix3d): Matrix3d;
1011
+ /**
1012
+ * Create a Matrix3d whose columns are scaled copies of `this` Matrix3d.
1013
+ * @param scaleX scale factor for column 0
1014
+ * @param scaleY scale factor for column 1
1015
+ * @param scaleZ scale factor for column 2
1016
+ * @param result optional result
850
1017
  */
851
1018
  scaleColumns(scaleX: number, scaleY: number, scaleZ: number, result?: Matrix3d): Matrix3d;
852
- /** Scale the columns of this Matrix3d.
853
- * @param scaleX scale factor for column x
854
- * @param scaleY scale factor for column y
855
- * @param scaleZ scale factor for column z
1019
+ /**
1020
+ * Scale the columns of `this` Matrix3d in place.
1021
+ * @param scaleX scale factor for column 0
1022
+ * @param scaleY scale factor for column 1
1023
+ * @param scaleZ scale factor for column 2
856
1024
  */
857
1025
  scaleColumnsInPlace(scaleX: number, scaleY: number, scaleZ: number): void;
858
- /** create a Matrix3d whose rows are scaled copies of this Matrix3d.
859
- * @param scaleX scale factor for row x
860
- * @param scaleY scale factor for row y
861
- * @param scaleZ scale factor for row z
862
- * @param result optional result.
1026
+ /**
1027
+ * Create a Matrix3d whose rows are scaled copies of `this` Matrix3d.
1028
+ * @param scaleX scale factor for row 0
1029
+ * @param scaleY scale factor for row 1
1030
+ * @param scaleZ scale factor for row 2
1031
+ * @param result optional result
863
1032
  */
864
1033
  scaleRows(scaleX: number, scaleY: number, scaleZ: number, result?: Matrix3d): Matrix3d;
865
1034
  /**
866
- * add scaled values from other Matrix3d to this Matrix3d
867
- * @param other Matrix3d with values to be added
1035
+ * Scale the rows of `this` Matrix3d in place.
1036
+ * @param scaleX scale factor for row 0
1037
+ * @param scaleY scale factor for row 1
1038
+ * @param scaleZ scale factor for row 2
1039
+ */
1040
+ scaleRowsInPlace(scaleX: number, scaleY: number, scaleZ: number): void;
1041
+ /**
1042
+ * Add scaled values from `other` Matrix3d to `this` Matrix3d.
1043
+ * @param other Matrix3d with values to be added.
868
1044
  * @param scale scale factor to apply to the added values.
869
1045
  */
870
1046
  addScaledInPlace(other: Matrix3d, scale: number): void;
871
1047
  /**
872
- * add scaled values from an outer product.
873
- * * The scaled outer product is a "rank 1" matrix.
1048
+ * Add scaled values from an outer product of vectors U and V.
1049
+ * * The scaled outer product is a matrix with `rank 1` (all columns/rows are linearly dependent).
874
1050
  * * This is useful in constructing mirrors and directional scales.
875
1051
  * ```
876
1052
  * equation
877
1053
  * A += s \columnSubXYZ{U}\rowSubXYZ{V}
878
1054
  * \\ \matrixXY{A} += s \begin{bmatrix}
879
- * U_x * V_x & U_y * V_x & U_z * V_x \\
880
- * U_x * V_y & U_y * V_y & U_z * V_y \\
881
- * U_x * V_z & U_y * V_z & U_z * V_z \end{bmatrix}
1055
+ * U_x * V_x & U_x * V_y & U_x * V_z \\
1056
+ * U_y * V_x & U_y * V_y & U_y * V_z \\
1057
+ * U_z * V_x & U_z * V_y & U_z * V_z \end{bmatrix}
882
1058
  * ```
883
- * @param other Matrix3d with values to be added
1059
+ * @param vectorU first vector in the outer product.
1060
+ * @param vectorV second vector in the outer product.
884
1061
  * @param scale scale factor to apply to the added values.
885
1062
  */
886
1063
  addScaledOuterProductInPlace(vectorU: Vector3d, vectorV: Vector3d, scale: number): void;
887
- /** create a Matrix3d whose values are uniformly scaled from this.
888
- * @param scale scale factor to apply.
889
- * @param result optional result.
890
- * @returns Return the new or repopulated matrix
1064
+ /**
1065
+ * Create a rigid matrix (columns and rows are unit length and pairwise perpendicular) for the given eye coordinate.
1066
+ * * column 2 is parallel to (x,y,z).
1067
+ * * column 0 is perpendicular to column 2 and is in the xy plane.
1068
+ * * column 1 is perpendicular to both. It is the "up" vector on the view plane.
1069
+ * * Multiplying the returned matrix times a local (view) vector gives the world vector.
1070
+ * * Multiplying transpose of the returned matrix times a world vector gives the local (view) vector.
1071
+ * @param x eye x coordinate
1072
+ * @param y eye y coordinate
1073
+ * @param z eye z coordinate
1074
+ * @param result optional preallocated result
891
1075
  */
892
- scale(scale: number, result?: Matrix3d): Matrix3d;
893
- /** Return the determinant of this matrix. */
1076
+ static createRigidViewAxesZTowardsEye(x: number, y: number, z: number, result?: Matrix3d): Matrix3d;
1077
+ /** Return the determinant of `this` matrix. */
894
1078
  determinant(): number;
895
- /** Return an estimate of how independent the columns are. Near zero is bad. Near 1 is good
1079
+ /**
1080
+ * Return an estimate of how independent the columns of `this` matrix are. Near zero is bad (i.e.,
1081
+ * columns are almost dependent and matrix is nearly singular). Near 1 is good (i.e., columns are
1082
+ * almost independent and matrix is invertible).
896
1083
  */
897
1084
  conditionNumber(): number;
898
1085
  /** Return the sum of squares of all entries */
899
1086
  sumSquares(): number;
900
1087
  /** Return the sum of squares of diagonal entries */
901
1088
  sumDiagonalSquares(): number;
902
- /** Return the sum of diagonal entries (also known as the trace) */
1089
+ /** Return the matrix `trace` (sum of diagonal entries) */
903
1090
  sumDiagonal(): number;
904
1091
  /** Return the Maximum absolute value of any single entry */
905
1092
  maxAbs(): number;
@@ -909,38 +1096,56 @@ export declare class Matrix3d implements BeJSONFunctions {
909
1096
  get isIdentity(): boolean;
910
1097
  /** Test if the off diagonal entries are all nearly zero */
911
1098
  get isDiagonal(): boolean;
1099
+ /** Sum of squared differences between symmetric pairs (symmetric pairs have indices (1,3), (2,6), and (5,7).) */
1100
+ sumSkewSquares(): number;
1101
+ /** Test if the matrix is (very near to) symmetric */
1102
+ isSymmetric(): boolean;
912
1103
  /** Test if the stored inverse is present and marked valid */
913
1104
  get hasCachedInverse(): boolean;
914
- /** Test if the below diagonal entries are all nearly zero */
1105
+ /** Test if the below diagonal entries (3,6,7) are all nearly zero */
915
1106
  get isUpperTriangular(): boolean;
916
- /** If the matrix is diagonal and all diagonals are within tolerance, return the first diagonal. Otherwise return undefined.
1107
+ /** Test if the above diagonal entries (1,2,5) are all nearly zero */
1108
+ get isLowerTriangular(): boolean;
1109
+ /**
1110
+ * If the matrix is diagonal and all diagonals are almost equal, return the first diagonal (entry 0
1111
+ * which is same as entry 4 and 8). Otherwise return `undefined`.
917
1112
  */
918
1113
  sameDiagonalScale(): number | undefined;
919
- /** Sum of squared differences between symmetric pairs */
920
- sumSkewSquares(): number;
921
- /** Test if the matrix is a pure rotation.
922
- * @param allowMirror whether to widen the test to return true if the matrix is orthogonal (a pure rotation or a mirror)
1114
+ /**
1115
+ * Test if all rows and columns are unit length and are perpendicular to each other, i.e., the matrix is either
1116
+ * a `pure rotation` (determinant is +1) or is a `mirror` (determinant is -1).
1117
+ * * **Note:** such a matrix is called `orthogonal` and its inverse is its transpose.
1118
+ */
1119
+ testPerpendicularUnitRowsAndColumns(): boolean;
1120
+ /**
1121
+ * Test if the matrix is a `rigid` matrix (or `pure rotation`, i.e., columns and rows are unit length and
1122
+ * pairwise perpendicular and determinant is +1).
1123
+ * @param allowMirror whether to widen the test to return true if the matrix is a `mirror` (determinant is -1).
923
1124
  */
924
1125
  isRigid(allowMirror?: boolean): boolean;
925
- /** Test if all rows and columns are perpendicular to each other and have equal length.
926
- * If so, the length (or its negative) is the scale factor from a set of rigid axes to these axes.
927
- * * result.rigidAxes is the rigid axes (with the scale factor removed)
928
- * * result.scale is the scale factor
1126
+ /**
1127
+ * Test if all rows and columns are perpendicular to each other and have equal length.
1128
+ * If so, the length (or its negative) is the `scale` factor from a set of `orthonormal axes` to
1129
+ * the set of axes created by columns of `this` matrix. Otherwise, returns `undefined`.
1130
+ * @returns returns `{ rigidAxes, scale }` where `rigidAxes` is a Matrix3d with its columns as the rigid axes
1131
+ * (with the scale factor removed) and `scale` is the scale factor.
1132
+ * * Note that determinant of a rigid matrix is +1.
1133
+ * * The context for this method is to determine if the matrix is the product a `rotation` matrix and a uniform
1134
+ * `scale` matrix (diagonal matrix with all diagonal entries the same nonzero number).
929
1135
  */
930
1136
  factorRigidWithSignedScale(): {
931
1137
  rigidAxes: Matrix3d;
932
1138
  scale: number;
933
1139
  } | undefined;
934
- /** Test if the matrix is shuffles and negates columns. */
1140
+ /** Test if `this` matrix reorders and/or negates the columns of the `identity` matrix. */
935
1141
  get isSignedPermutation(): boolean;
936
- /** Test if all rows and columns are length 1 and are perpendicular to each other. (I.e. the matrix is either a pure rotation with uniform scale factor of 1 or -1) */
937
- testPerpendicularUnitRowsAndColumns(): boolean;
938
- /** Adjust the matrix in place so that:
939
- * * columns are perpendicular and have unit length
940
- * * transpose equals inverse
941
- * * mirroring is removed
1142
+ /**
1143
+ * Adjust the matrix in place to make is a `rigid` matrix so that:
1144
+ * * columns are perpendicular and have unit length.
1145
+ * * transpose equals inverse.
1146
+ * * mirroring is removed.
942
1147
  * @param axisOrder how to reorder the matrix columns
943
- * @return whether the instance is rigid on return
1148
+ * @return whether the adjusted matrix is `rigid` on return
944
1149
  */
945
1150
  makeRigid(axisOrder?: AxisOrder): boolean;
946
1151
  /** Create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
@@ -948,16 +1153,25 @@ export declare class Matrix3d implements BeJSONFunctions {
948
1153
  * * Mirroring in the matrix is removed.
949
1154
  */
950
1155
  static createRigidFromMatrix3d(source: Matrix3d, axisOrder?: AxisOrder, result?: Matrix3d): Matrix3d | undefined;
951
- private static computeQuatTerm;
952
- /** create a matrix from a quaternion.
953
- * **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by rows and columns.
954
- * **WARNING:** If you find that the matrix seems to rotate by the opposite angle expect it, transpose it.
1156
+ /**
1157
+ * Create a matrix from a quaternion.
1158
+ * **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by
1159
+ * rows or columns. If you find that the matrix seems to rotate by the opposite angle, transpose it.
1160
+ *
1161
+ * Some math details can be found at
1162
+ * http://marc-b-reynolds.github.io/quaternions/2017/08/08/QuatRotMatrix.html
955
1163
  */
956
1164
  static createFromQuaternion(quat: Point4d): Matrix3d;
957
- /** convert the matrix to a quaternion.
958
- * @note This calculation requires the matrix to have unit length rows and columns.
959
- * **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by rows and columns.
960
- * **WARNING:** If you find that the matrix seems to rotate by the opposite angle expect it, transpose it.
1165
+ /** Calculate quaternion terms used to convert matrix to a quaternion */
1166
+ private static computeQuatTerm;
1167
+ /**
1168
+ * Create `this` matrix to a quaternion.
1169
+ * **Note:** This calculation requires `this` matrix to have unit length rows and columns.
1170
+ * **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by
1171
+ * rows or columns. If you find that the matrix seems to rotate by the opposite angle, transpose it.
1172
+ *
1173
+ * Some math details can be found at
1174
+ * http://marc-b-reynolds.github.io/quaternions/2017/08/08/QuatRotMatrix.html
961
1175
  */
962
1176
  toQuaternion(): Point4d;
963
1177
  }