@itwin/core-geometry 5.0.0-dev.2 → 5.0.0-dev.20

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 (278) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  3. package/lib/cjs/bspline/BSplineCurveOps.js +18 -21
  4. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  5. package/lib/cjs/curve/Arc3d.d.ts +30 -7
  6. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  7. package/lib/cjs/curve/Arc3d.js +53 -7
  8. package/lib/cjs/curve/Arc3d.js.map +1 -1
  9. package/lib/cjs/curve/CurveCollection.d.ts +16 -2
  10. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  11. package/lib/cjs/curve/CurveCollection.js +33 -2
  12. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  13. package/lib/cjs/curve/CurveFactory.d.ts +81 -53
  14. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurveFactory.js +190 -103
  16. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  17. package/lib/cjs/curve/LineString3d.d.ts +12 -8
  18. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  19. package/lib/cjs/curve/LineString3d.js +29 -8
  20. package/lib/cjs/curve/LineString3d.js.map +1 -1
  21. package/lib/cjs/curve/Loop.d.ts +12 -6
  22. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  23. package/lib/cjs/curve/Loop.js +12 -6
  24. package/lib/cjs/curve/Loop.js.map +1 -1
  25. package/lib/cjs/curve/Query/CylindricalRange.d.ts +8 -6
  26. package/lib/cjs/curve/Query/CylindricalRange.d.ts.map +1 -1
  27. package/lib/cjs/curve/Query/CylindricalRange.js +13 -9
  28. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  29. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  30. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  31. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  32. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  33. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
  34. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  35. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
  36. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  37. package/lib/cjs/geometry3d/AngleSweep.js +1 -1
  38. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  39. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +14 -8
  40. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  41. package/lib/cjs/geometry3d/BarycentricTriangle.js +17 -8
  42. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  43. package/lib/cjs/geometry3d/FrameBuilder.js +4 -4
  44. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  45. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +2 -0
  46. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  47. package/lib/cjs/geometry3d/GrowableFloat64Array.js +4 -0
  48. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  49. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +32 -10
  50. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  51. package/lib/cjs/geometry3d/GrowableXYZArray.js +54 -16
  52. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  53. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +13 -2
  54. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  55. package/lib/cjs/geometry3d/IndexedXYZCollection.js +24 -10
  56. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  57. package/lib/cjs/geometry3d/Matrix3d.d.ts +11 -8
  58. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  59. package/lib/cjs/geometry3d/Matrix3d.js +28 -26
  60. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  61. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +1 -1
  62. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  63. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -6
  64. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -6
  65. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  66. package/lib/cjs/geometry3d/PolygonOps.d.ts +12 -6
  67. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  68. package/lib/cjs/geometry3d/PolygonOps.js +94 -47
  69. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  70. package/lib/cjs/geometry3d/PolylineOps.d.ts +7 -4
  71. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  72. package/lib/cjs/geometry3d/PolylineOps.js +7 -4
  73. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  74. package/lib/cjs/geometry4d/MomentData.d.ts +72 -73
  75. package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
  76. package/lib/cjs/geometry4d/MomentData.js +62 -64
  77. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  78. package/lib/cjs/numerics/Polynomials.d.ts +5 -5
  79. package/lib/cjs/numerics/Polynomials.js +6 -6
  80. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  81. package/lib/cjs/polyface/AuxData.d.ts +2 -2
  82. package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
  83. package/lib/cjs/polyface/AuxData.js +11 -3
  84. package/lib/cjs/polyface/AuxData.js.map +1 -1
  85. package/lib/cjs/polyface/Polyface.d.ts +3 -5
  86. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  87. package/lib/cjs/polyface/Polyface.js +6 -13
  88. package/lib/cjs/polyface/Polyface.js.map +1 -1
  89. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +13 -6
  90. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  91. package/lib/cjs/polyface/PolyfaceBuilder.js +65 -38
  92. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  93. package/lib/cjs/polyface/PolyfaceData.d.ts +13 -3
  94. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  95. package/lib/cjs/polyface/PolyfaceData.js +21 -4
  96. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  97. package/lib/cjs/polyface/PolyfaceQuery.d.ts +2 -2
  98. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  99. package/lib/cjs/polyface/PolyfaceQuery.js +4 -3
  100. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  101. package/lib/cjs/serialization/GeometrySamples.d.ts +5 -5
  102. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  103. package/lib/cjs/serialization/GeometrySamples.js +5 -5
  104. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  105. package/lib/cjs/solid/Box.d.ts +9 -3
  106. package/lib/cjs/solid/Box.d.ts.map +1 -1
  107. package/lib/cjs/solid/Box.js +10 -5
  108. package/lib/cjs/solid/Box.js.map +1 -1
  109. package/lib/cjs/solid/Cone.d.ts +3 -2
  110. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  111. package/lib/cjs/solid/Cone.js +3 -3
  112. package/lib/cjs/solid/Cone.js.map +1 -1
  113. package/lib/cjs/solid/LinearSweep.d.ts +9 -3
  114. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  115. package/lib/cjs/solid/LinearSweep.js +9 -4
  116. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  117. package/lib/cjs/solid/RotationalSweep.d.ts +15 -4
  118. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  119. package/lib/cjs/solid/RotationalSweep.js +20 -7
  120. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  121. package/lib/cjs/solid/RuledSweep.d.ts +35 -26
  122. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  123. package/lib/cjs/solid/RuledSweep.js +41 -28
  124. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  125. package/lib/cjs/solid/SolidPrimitive.d.ts +12 -11
  126. package/lib/cjs/solid/SolidPrimitive.d.ts.map +1 -1
  127. package/lib/cjs/solid/SolidPrimitive.js +8 -5
  128. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  129. package/lib/cjs/solid/Sphere.d.ts +17 -7
  130. package/lib/cjs/solid/Sphere.d.ts.map +1 -1
  131. package/lib/cjs/solid/Sphere.js +22 -16
  132. package/lib/cjs/solid/Sphere.js.map +1 -1
  133. package/lib/cjs/solid/SweepContour.d.ts +1 -1
  134. package/lib/cjs/solid/SweepContour.js +1 -1
  135. package/lib/cjs/solid/SweepContour.js.map +1 -1
  136. package/lib/cjs/solid/TorusPipe.d.ts +8 -2
  137. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  138. package/lib/cjs/solid/TorusPipe.js +9 -5
  139. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  140. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  141. package/lib/esm/bspline/BSplineCurveOps.js +18 -21
  142. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  143. package/lib/esm/curve/Arc3d.d.ts +30 -7
  144. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  145. package/lib/esm/curve/Arc3d.js +53 -7
  146. package/lib/esm/curve/Arc3d.js.map +1 -1
  147. package/lib/esm/curve/CurveCollection.d.ts +16 -2
  148. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  149. package/lib/esm/curve/CurveCollection.js +33 -2
  150. package/lib/esm/curve/CurveCollection.js.map +1 -1
  151. package/lib/esm/curve/CurveFactory.d.ts +81 -53
  152. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  153. package/lib/esm/curve/CurveFactory.js +190 -103
  154. package/lib/esm/curve/CurveFactory.js.map +1 -1
  155. package/lib/esm/curve/LineString3d.d.ts +12 -8
  156. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  157. package/lib/esm/curve/LineString3d.js +29 -8
  158. package/lib/esm/curve/LineString3d.js.map +1 -1
  159. package/lib/esm/curve/Loop.d.ts +12 -6
  160. package/lib/esm/curve/Loop.d.ts.map +1 -1
  161. package/lib/esm/curve/Loop.js +12 -6
  162. package/lib/esm/curve/Loop.js.map +1 -1
  163. package/lib/esm/curve/Query/CylindricalRange.d.ts +8 -6
  164. package/lib/esm/curve/Query/CylindricalRange.d.ts.map +1 -1
  165. package/lib/esm/curve/Query/CylindricalRange.js +13 -9
  166. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  167. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  168. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  169. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  170. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  171. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
  172. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  173. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
  174. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  175. package/lib/esm/geometry3d/AngleSweep.js +1 -1
  176. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  177. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +14 -8
  178. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  179. package/lib/esm/geometry3d/BarycentricTriangle.js +17 -8
  180. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  181. package/lib/esm/geometry3d/FrameBuilder.js +4 -4
  182. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  183. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +2 -0
  184. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  185. package/lib/esm/geometry3d/GrowableFloat64Array.js +4 -0
  186. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  187. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +32 -10
  188. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  189. package/lib/esm/geometry3d/GrowableXYZArray.js +54 -16
  190. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  191. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +13 -2
  192. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  193. package/lib/esm/geometry3d/IndexedXYZCollection.js +24 -10
  194. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  195. package/lib/esm/geometry3d/Matrix3d.d.ts +11 -8
  196. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  197. package/lib/esm/geometry3d/Matrix3d.js +28 -26
  198. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  199. package/lib/esm/geometry3d/Point3dArrayCarrier.js +1 -1
  200. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  201. package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -6
  202. package/lib/esm/geometry3d/Point3dVector3d.js +6 -6
  203. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  204. package/lib/esm/geometry3d/PolygonOps.d.ts +12 -6
  205. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  206. package/lib/esm/geometry3d/PolygonOps.js +94 -47
  207. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  208. package/lib/esm/geometry3d/PolylineOps.d.ts +7 -4
  209. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  210. package/lib/esm/geometry3d/PolylineOps.js +7 -4
  211. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  212. package/lib/esm/geometry4d/MomentData.d.ts +72 -73
  213. package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
  214. package/lib/esm/geometry4d/MomentData.js +62 -64
  215. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  216. package/lib/esm/numerics/Polynomials.d.ts +5 -5
  217. package/lib/esm/numerics/Polynomials.js +6 -6
  218. package/lib/esm/numerics/Polynomials.js.map +1 -1
  219. package/lib/esm/polyface/AuxData.d.ts +2 -2
  220. package/lib/esm/polyface/AuxData.d.ts.map +1 -1
  221. package/lib/esm/polyface/AuxData.js +11 -3
  222. package/lib/esm/polyface/AuxData.js.map +1 -1
  223. package/lib/esm/polyface/Polyface.d.ts +3 -5
  224. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  225. package/lib/esm/polyface/Polyface.js +6 -13
  226. package/lib/esm/polyface/Polyface.js.map +1 -1
  227. package/lib/esm/polyface/PolyfaceBuilder.d.ts +13 -6
  228. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  229. package/lib/esm/polyface/PolyfaceBuilder.js +65 -38
  230. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  231. package/lib/esm/polyface/PolyfaceData.d.ts +13 -3
  232. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  233. package/lib/esm/polyface/PolyfaceData.js +21 -4
  234. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  235. package/lib/esm/polyface/PolyfaceQuery.d.ts +2 -2
  236. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  237. package/lib/esm/polyface/PolyfaceQuery.js +4 -3
  238. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  239. package/lib/esm/serialization/GeometrySamples.d.ts +5 -5
  240. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  241. package/lib/esm/serialization/GeometrySamples.js +5 -5
  242. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  243. package/lib/esm/solid/Box.d.ts +9 -3
  244. package/lib/esm/solid/Box.d.ts.map +1 -1
  245. package/lib/esm/solid/Box.js +10 -5
  246. package/lib/esm/solid/Box.js.map +1 -1
  247. package/lib/esm/solid/Cone.d.ts +3 -2
  248. package/lib/esm/solid/Cone.d.ts.map +1 -1
  249. package/lib/esm/solid/Cone.js +3 -3
  250. package/lib/esm/solid/Cone.js.map +1 -1
  251. package/lib/esm/solid/LinearSweep.d.ts +9 -3
  252. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  253. package/lib/esm/solid/LinearSweep.js +9 -4
  254. package/lib/esm/solid/LinearSweep.js.map +1 -1
  255. package/lib/esm/solid/RotationalSweep.d.ts +15 -4
  256. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  257. package/lib/esm/solid/RotationalSweep.js +20 -7
  258. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  259. package/lib/esm/solid/RuledSweep.d.ts +35 -26
  260. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  261. package/lib/esm/solid/RuledSweep.js +41 -28
  262. package/lib/esm/solid/RuledSweep.js.map +1 -1
  263. package/lib/esm/solid/SolidPrimitive.d.ts +12 -11
  264. package/lib/esm/solid/SolidPrimitive.d.ts.map +1 -1
  265. package/lib/esm/solid/SolidPrimitive.js +8 -5
  266. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  267. package/lib/esm/solid/Sphere.d.ts +17 -7
  268. package/lib/esm/solid/Sphere.d.ts.map +1 -1
  269. package/lib/esm/solid/Sphere.js +22 -16
  270. package/lib/esm/solid/Sphere.js.map +1 -1
  271. package/lib/esm/solid/SweepContour.d.ts +1 -1
  272. package/lib/esm/solid/SweepContour.js +1 -1
  273. package/lib/esm/solid/SweepContour.js.map +1 -1
  274. package/lib/esm/solid/TorusPipe.d.ts +8 -2
  275. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  276. package/lib/esm/solid/TorusPipe.js +9 -5
  277. package/lib/esm/solid/TorusPipe.js.map +1 -1
  278. package/package.json +4 -4
@@ -5,8 +5,8 @@
5
5
  /** @packageDocumentation
6
6
  * @module Numerics
7
7
  */
8
- // import { Point2d } from "./Geometry2d";
9
8
  /* eslint-disable @typescript-eslint/naming-convention */
9
+ // cspell:word ABAT
10
10
  import { Geometry } from "../Geometry";
11
11
  import { Matrix3d } from "../geometry3d/Matrix3d";
12
12
  import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
@@ -19,58 +19,55 @@ import { Point4d } from "./Point4d";
19
19
  * * origin = local origin used as moments are summed.
20
20
  * * sums = array of summed moments.
21
21
  * * The [i,j] entry of the sums is a summed or integrated moment for product of axis i and j.
22
- * * axes 0,1,2 are x,y,z
22
+ * * axes 0,1,2 are x,y,z.
23
23
  * * e.g. entry [0,1] is summed product xy
24
24
  * * axis 3 is "w", which is 1 in sums.
25
- * * e.g. entry 03 is summed x
26
- * * In this level,
25
+ * * e.g. entry 03 is summed x.
26
+ * * In this level:
27
27
  * * the `absoluteQuantity` member is undefined.
28
28
  * * the `localToWorldMap` and `radiiOfGyration` are created by have undefined contents.
29
- * * Second level: after a call to inertiaProductsToPrincipalAxes, the `localToWorldMap`, `absoluteQuantity` and `radiiOfGyration` are filled in.
29
+ * * Second level: after a call to inertiaProductsToPrincipalAxes, the `localToWorldMap`, `absoluteQuantity` and
30
+ * `radiiOfGyration` are filled in.
30
31
  * @public
31
32
  */
32
33
  export class MomentData {
33
- /** Return the lower-right (3,3) entry in the sums.
34
- * * This is the quantity (i.e. length, area, or volume) summed
34
+ /**
35
+ * Return the lower-right (3,3) entry in the sums.
36
+ * * This is the quantity (i.e. length, area, or volume) summed.
35
37
  */
36
- get quantitySum() { return this.sums.atIJ(3, 3); }
37
- /** Return a scale factor to make these sums match the target orientation sign.
38
+ get quantitySum() {
39
+ return this.sums.atIJ(3, 3);
40
+ }
41
+ /**
42
+ * Return a scale factor to make these sums match the target orientation sign.
38
43
  * * 1.0 if `this.quantitySum` has the same sign as `targetSign`.
39
44
  * * -1.0 if `this.quantitySum` has the opposite sign from `targetSign`
40
45
  */
41
46
  signFactor(targetSign) {
42
47
  return targetSign * this.quantitySum > 0 ? 1.0 : -1.0;
43
48
  }
44
- /**
45
- * If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag.
46
- *
47
- */
49
+ /** If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag. */
48
50
  setOriginIfNeeded(origin) {
49
51
  if (this.needOrigin) {
50
52
  this.origin.setFromPoint3d(origin);
51
53
  this.needOrigin = false;
52
54
  }
53
55
  }
54
- /**
55
- * If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag.
56
- *
57
- */
56
+ /** If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag. */
58
57
  setOriginFromGrowableXYZArrayIfNeeded(points) {
59
58
  if (this.needOrigin && points.length > 0) {
60
59
  points.getPoint3dAtCheckedPointIndex(0, this.origin);
61
60
  this.needOrigin = false;
62
61
  }
63
62
  }
64
- /**
65
- * If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag.
66
- *
67
- */
63
+ /** If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag. */
68
64
  setOriginXYZIfNeeded(x, y, z) {
69
65
  if (this.needOrigin) {
70
66
  this.origin.set(x, y, z);
71
67
  this.needOrigin = false;
72
68
  }
73
69
  }
70
+ /** Constructor. */
74
71
  constructor() {
75
72
  this._point0 = Point3d.create();
76
73
  this._point1 = Point3d.create();
@@ -82,12 +79,13 @@ export class MomentData {
82
79
  this.absoluteQuantity = 0.1; // so optimizer sees its type
83
80
  this.absoluteQuantity = undefined;
84
81
  }
85
- /** Create moments with optional origin.
86
- * * origin and needOrigin are quirky.
82
+ /**
83
+ * Create moments with optional origin.
84
+ * * Origin and needOrigin are quirky.
87
85
  * * (undefined, true) sets up to use first incoming point as origin.
88
- * * (origin) sets up to use that durable origin, set needsOrigin flag false
89
- * * (origin, true) the "true" is meaningless
90
- * * (undefined, false) makes 000 the durable origin
86
+ * * (origin) sets up to use that durable origin, set needsOrigin flag false.
87
+ * * (origin, true) the "true" is meaningless.
88
+ * * (undefined, false) makes 000 the durable origin.
91
89
  */
92
90
  static create(origin, needOrigin = false) {
93
91
  const data = new MomentData();
@@ -99,8 +97,8 @@ export class MomentData {
99
97
  return data;
100
98
  }
101
99
  /**
102
- * Return the formal tensor of integrated values `[yy+zz,xy,xz][yx,xx+zz,yz][zx,xy,xx+yy]`
103
- * @param products matrix of (integrated) `[xx,xy,xz][yx,yy,yz][zx,xy,zz]`
100
+ * Return the formal tensor of integrated values `[yy+zz,xy,xz][yx,xx+zz,yz][zx,xy,xx+yy]`.
101
+ * @param products matrix of (integrated) `[xx,xy,xz][yx,yy,yz][zx,xy,zz]`.
104
102
  */
105
103
  static momentTensorFromInertiaProducts(products) {
106
104
  const rr = products.sumDiagonal();
@@ -133,7 +131,7 @@ export class MomentData {
133
131
  }
134
132
  /**
135
133
  * Return the principal moment data for an array of points.
136
- * @param points array of points
134
+ * @param points array of points.
137
135
  */
138
136
  static pointsToPrincipalAxes(points) {
139
137
  const moments = new MomentData();
@@ -144,12 +142,12 @@ export class MomentData {
144
142
  return this.inertiaProductsToPrincipalAxes(moments.origin, moments.sums);
145
143
  }
146
144
  /**
147
- * Compute principal axes from inertial products
148
- * * The radii of gyration are sorted smallest to largest
149
- * * Hence x axis is long direction
150
- * * Hence planar data generates large moment as Z
145
+ * Compute principal axes from inertial products.
146
+ * * The radii of gyration are sorted smallest to largest.
147
+ * * Hence x axis is long direction.
148
+ * * Hence planar data generates large moment as Z.
151
149
  * @param origin The origin used for the inertia products.
152
- * @param inertiaProducts The inertia products -- sums or integrals of [xx,xy,xz,xw; yx,yy, yz,yw; zx,zy,zz,zw; wx,wy,wz,w]
150
+ * @param inertiaProducts The inertia products: sums or integrals of [xx,xy,xz,xw; yx,yy, yz,yw; zx,zy,zz,zw; wx,wy,wz,w].
153
151
  */
154
152
  static inertiaProductsToPrincipalAxes(origin, inertiaProducts) {
155
153
  const moments = new MomentData();
@@ -177,18 +175,19 @@ export class MomentData {
177
175
  return moments;
178
176
  }
179
177
  /**
180
- * Test for match among selected members as they exist after `inertiaProductsToPrincipalAxes`
181
- * * The members considered are
182
- * * origin of local to world map (i.e. centroid)
183
- * * radius of gyration
178
+ * Test for match among selected members as they exist after `inertiaProductsToPrincipalAxes`.
179
+ * * The members considered are:
180
+ * * origin of local to world map (i.e. centroid),
181
+ * * radius of gyration,
184
182
  * * axes of localToWorldMap.
185
183
  * * Axis direction tests allow these quirks:
186
184
  * * opposite orientation is considered matched.
187
185
  * * Full xyz symmetry: If x,y,z radii are matched, axes are not tested.
188
- * * Symmetry in xy plane: If x and y radii are matched, the x and y axes area allowed to spin freely. Only Z direction is tested.
186
+ * * Symmetry in xy plane: If x and y radii are matched, the x and y axes area allowed to spin freely. Only Z direction
187
+ * is tested.
189
188
  * * If either or both are undefined, returns false.
190
- * @param dataA first set of moments
191
- * @param dataB second set of moments
189
+ * @param dataA first set of moments.
190
+ * @param dataB second set of moments.
192
191
  */
193
192
  static areEquivalentPrincipalAxes(dataA, dataB) {
194
193
  if (dataA && dataB
@@ -236,7 +235,7 @@ export class MomentData {
236
235
  this.sums.addMomentsInPlace(p.x - this.origin.x, p.y - this.origin.y, p.z - this.origin.z, 1.0);
237
236
  }
238
237
  }
239
- /** revise the accumulated sums to be "around the centroid" */
238
+ /** Revise the accumulated sums to be "around the centroid". */
240
239
  shiftOriginAndSumsToCentroidOfSums() {
241
240
  const xyz = this.sums.columnW().realPoint();
242
241
  if (xyz) {
@@ -245,7 +244,8 @@ export class MomentData {
245
244
  }
246
245
  return false;
247
246
  }
248
- /** revise the accumulated sums
247
+ /**
248
+ * Revise the accumulated sums.
249
249
  * * add ax,ay,ax to the origin coordinates.
250
250
  * * apply the negative translation to the sums.
251
251
  */
@@ -253,11 +253,12 @@ export class MomentData {
253
253
  this.origin.addXYZInPlace(ax, ay, az);
254
254
  this.sums.multiplyTranslationSandwichInPlace(-ax, -ay, -az);
255
255
  }
256
- /** revise the accumulated sums so they are based at a specified origin. */
256
+ /** Revise the accumulated sums so they are based at a specified origin. */
257
257
  shiftOriginAndSumsToNewOrigin(newOrigin) {
258
258
  this.shiftOriginAndSumsByXYZ(newOrigin.x - this.origin.x, newOrigin.y - this.origin.y, newOrigin.z - this.origin.z);
259
259
  }
260
- /** compute moments of a triangle from the origin to the given line.
260
+ /**
261
+ * Compute moments of a triangle from the origin to the given line.
261
262
  * Accumulate them to this.sums.
262
263
  * * If `pointA` is undefined, use `this.origin` as pointA.
263
264
  * * If `this.needOrigin` is set, pointB is used
@@ -289,7 +290,7 @@ export class MomentData {
289
290
  this.sums.addScaledOuterProductInPlace(vectorC, vectorC, r1_12);
290
291
  }
291
292
  }
292
- /** add scaled outer product of (4d, unit weight) point to this.sums */
293
+ /** Add scaled outer product of (4d, unit weight) point to this.sums. */
293
294
  accumulateScaledOuterProduct(point, scaleFactor) {
294
295
  this.setOriginXYZIfNeeded(point.x, point.y, 0.0);
295
296
  const vectorA = MomentData._vectorA = Point4d.create(point.x - this.origin.x, point.y - this.origin.y, point.z - this.origin.z, 1.0, MomentData._vectorA);
@@ -311,7 +312,8 @@ export class MomentData {
311
312
  this.sums.addScaledOuterProductInPlace(vectorB, vectorA, r1_6);
312
313
  this.sums.addScaledOuterProductInPlace(vectorB, vectorB, r1_3);
313
314
  }
314
- /** compute moments of triangles from a base point to the given linestring.
315
+ /**
316
+ * Compute moments of triangles from a base point to the given linestring.
315
317
  * Accumulate them to this.sums.
316
318
  * * If `pointA` is undefined, use `this.origin` as pointA.
317
319
  * * If `this.needOrigin` is set, the first point of the array is captured as local origin for subsequent sums.
@@ -328,18 +330,18 @@ export class MomentData {
328
330
  }
329
331
  }
330
332
  }
331
- // cspell:word ABAT
332
333
  /**
333
334
  * * Assemble XX, YY, XY products into a full matrix form [xx,xy,0,0; xy,yy,0,0;0,0,0,0;0,0,0,1].
334
- * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin]. (Column weights 0001) (only xy parts of vectors)
335
+ * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin]. (Column weights 0001) (only xy
336
+ * parts of vectors).
335
337
  * * scale by detJ for the xy-only determinant of the vectors.
336
338
  * @param productXX
337
339
  * @param productXY
338
340
  * @param productYY
339
- * @param area Area in caller's system
340
- * @param origin Caller's origin
341
- * @param vectorU Caller's U axis (not necessarily unit)
342
- * @param vectorV Caller's V axis (not necessarily unit)
341
+ * @param area Area in caller's system.
342
+ * @param origin Caller's origin.
343
+ * @param vectorU Caller's U axis (not necessarily unit).
344
+ * @param vectorV Caller's V axis (not necessarily unit).
343
345
  */
344
346
  accumulateXYProductsInCentroidalFrame(productXX, productXY, productYY, area, origin, vectorU, vectorV) {
345
347
  const centroidalProducts = Matrix4d.createRowValues(productXX, productXY, 0, 0, productXY, productYY, 0, 0, 0, 0, 0, 0, 0, 0, 0, area);
@@ -351,27 +353,23 @@ export class MomentData {
351
353
  }
352
354
  /**
353
355
  * Accumulate sums from other moments.
354
- * * scale by given scaleFactor (e.g. sign to correct orientation)
355
- * * pull the origin from `other` if `this` needs an origin.
356
- * *
356
+ * * Scale by given scaleFactor (e.g. sign to correct orientation).
357
+ * * Pull the origin from `other` if `this` needs an origin.
357
358
  */
358
359
  accumulateProducts(other, scale) {
359
360
  this.setOriginIfNeeded(other.origin);
360
361
  this.sums.addTranslationSandwichInPlace(other.sums, this.origin.x - other.origin.x, this.origin.y - other.origin.y, this.origin.z - other.origin.z, scale);
361
362
  }
362
363
  /**
363
- * Accumulate sums from Matrix4d and origin.
364
- * * scale by given scaleFactor (e.g. sign to correct orientation)
365
- * * trap the origin if `this` needs an origin.
366
- * *
367
- */
364
+ * Accumulate sums from Matrix4d and origin.
365
+ * * Scale by given scaleFactor (e.g. sign to correct orientation).
366
+ * * Trap the origin if `this` needs an origin.
367
+ */
368
368
  accumulateProductsFromOrigin(origin, products, scale) {
369
369
  this.setOriginIfNeeded(origin);
370
370
  this.sums.addTranslationSandwichInPlace(products, this.origin.x - origin.x, this.origin.y - origin.y, this.origin.z - origin.z, scale);
371
371
  }
372
- /**
373
- * Convert to a json data object with:
374
- */
372
+ /** Convert to a json data object. */
375
373
  toJSON() {
376
374
  return {
377
375
  origin: this.origin,
@@ -1 +1 @@
1
- {"version":3,"file":"MomentData.js","sourceRoot":"","sources":["../../../src/geometry4d/MomentData.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,yDAAyD;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAO,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,UAAU;IAcrB;;OAEG;IACH,IAAW,WAAW,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE;;;OAGG;IACI,UAAU,CAAC,UAAkB;QAClC,OAAO,UAAU,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,MAAe;QACtC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC;IACH,CAAC;IACD;;;OAGG;IACI,qCAAqC,CAAC,MAAwB;QACnE,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC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M,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzI,CAAC;IACD;;OAEG;IACI,MAAM;QACX,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;YAChD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;SAC5C,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Numerics\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Point3d, Vector3d, XYZ } from \"../geometry3d/Point3dVector3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XAndY, XYAndZ } from \"../geometry3d/XYZProps\";\r\nimport { Matrix4d } from \"./Matrix4d\";\r\nimport { Point4d } from \"./Point4d\";\r\n\r\n/**\r\n * A MomentData structure exists in several levels:\r\n * * First level: as a carrier of sums of inertial products that determine moments.\r\n * * origin = local origin used as moments are summed.\r\n * * sums = array of summed moments.\r\n * * The [i,j] entry of the sums is a summed or integrated moment for product of axis i and j.\r\n * * axes 0,1,2 are x,y,z\r\n * * e.g. entry [0,1] is summed product xy\r\n * * axis 3 is \"w\", which is 1 in sums.\r\n * * e.g. entry 03 is summed x\r\n * * In this level,\r\n * * the `absoluteQuantity` member is undefined.\r\n * * the `localToWorldMap` and `radiiOfGyration` are created by have undefined contents.\r\n * * Second level: after a call to inertiaProductsToPrincipalAxes, the `localToWorldMap`, `absoluteQuantity` and `radiiOfGyration` are filled in.\r\n * @public\r\n */\r\nexport class MomentData {\r\n /** Origin used for sums. */\r\n public origin: Point3d;\r\n /** flag to request deferred origin setup. */\r\n public needOrigin: boolean;\r\n /** Moment sums.\r\n * * Set to zero at initialization and if requested later.\r\n * * Accumulated during data entry phase.\r\n */\r\n public sums: Matrix4d;\r\n /** the mapping between principal and world system.\r\n * * This set up with its inverse already constructed.\r\n */\r\n public localToWorldMap: Transform;\r\n /** Return the lower-right (3,3) entry in the sums.\r\n * * This is the quantity (i.e. length, area, or volume) summed\r\n */\r\n public get quantitySum(): number { return this.sums.atIJ(3, 3); }\r\n /** Return a scale factor to make these sums match the target orientation sign.\r\n * * 1.0 if `this.quantitySum` has the same sign as `targetSign`.\r\n * * -1.0 if `this.quantitySum` has the opposite sign from `targetSign`\r\n */\r\n public signFactor(targetSign: number): number {\r\n return targetSign * this.quantitySum > 0 ? 1.0 : -1.0;\r\n }\r\n\r\n /**\r\n * If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag.\r\n *\r\n */\r\n public setOriginIfNeeded(origin: Point3d) {\r\n if (this.needOrigin) {\r\n this.origin.setFromPoint3d(origin);\r\n this.needOrigin = false;\r\n }\r\n }\r\n /**\r\n * If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag.\r\n *\r\n */\r\n public setOriginFromGrowableXYZArrayIfNeeded(points: GrowableXYZArray) {\r\n if (this.needOrigin && points.length > 0) {\r\n points.getPoint3dAtCheckedPointIndex(0, this.origin);\r\n this.needOrigin = false;\r\n }\r\n }\r\n\r\n /**\r\n * If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag.\r\n *\r\n */\r\n public setOriginXYZIfNeeded(x: number, y: number, z: number) {\r\n if (this.needOrigin) {\r\n this.origin.set(x, y, z);\r\n this.needOrigin = false;\r\n }\r\n }\r\n\r\n /** radii of gyration (square roots of principal second moments)\r\n */\r\n public radiusOfGyration: Vector3d;\r\n /** principal quantity (e.g. length, area, or volume). This is undefined in raw moments, and becomes defined by\r\n *\r\n */\r\n public absoluteQuantity?: number;\r\n\r\n private constructor() {\r\n this.origin = Point3d.createZero();\r\n this.sums = Matrix4d.createZero();\r\n this.localToWorldMap = Transform.createIdentity();\r\n this.radiusOfGyration = Vector3d.create();\r\n this.needOrigin = false;\r\n this.absoluteQuantity = 0.1; // so optimizer sees its type\r\n this.absoluteQuantity = undefined;\r\n }\r\n /** Create moments with optional origin.\r\n * * origin and needOrigin are quirky.\r\n * * (undefined, true) sets up to use first incoming point as origin.\r\n * * (origin) sets up to use that durable origin, set needsOrigin flag false\r\n * * (origin, true) the \"true\" is meaningless\r\n * * (undefined, false) makes 000 the durable origin\r\n */\r\n public static create(origin?: Point3d | undefined, needOrigin: boolean = false): MomentData {\r\n const data = new MomentData();\r\n data.needOrigin = needOrigin;\r\n if (origin) {\r\n data.origin.setFromPoint3d(origin);\r\n data.needOrigin = false;\r\n }\r\n return data;\r\n }\r\n /**\r\n * Return the formal tensor of integrated values `[yy+zz,xy,xz][yx,xx+zz,yz][zx,xy,xx+yy]`\r\n * @param products matrix of (integrated) `[xx,xy,xz][yx,yy,yz][zx,xy,zz]`\r\n */\r\n public static momentTensorFromInertiaProducts(products: Matrix3d): Matrix3d {\r\n const rr = products.sumDiagonal();\r\n const result = Matrix3d.createScale(rr, rr, rr);\r\n result.addScaledInPlace(products, -1.0);\r\n return result;\r\n }\r\n /** Sort the columns of the matrix for increasing moments. */\r\n public static sortColumnsForIncreasingMoments(axes: Matrix3d, moments: Vector3d) {\r\n const points = [\r\n axes.indexedColumnWithWeight(0, moments.x),\r\n axes.indexedColumnWithWeight(1, moments.y),\r\n axes.indexedColumnWithWeight(2, moments.z),\r\n ].sort((dataA: Point4d, dataB: Point4d): number => {\r\n if (dataA.w < dataB.w) return -1;\r\n if (dataA.w > dataB.w) return 1;\r\n return 0;\r\n });\r\n axes.setColumnsPoint4dXYZ(points[0], points[1], points[2]);\r\n if (axes.determinant() < 0)\r\n axes.scaleColumnsInPlace(-1.0, -1.0, -1.0);\r\n // prefer x and z positive -- y falls wherever . ..\r\n if (axes.at(0, 0) < 0.0)\r\n axes.scaleColumnsInPlace(-1.0, -1.0, 1.0);\r\n if (axes.at(2, 2) < 0.0)\r\n axes.scaleColumnsInPlace(1.0, -1.0, -1.0);\r\n moments.set(points[0].w, points[1].w, points[2].w);\r\n }\r\n\r\n /**\r\n * Return the principal moment data for an array of points.\r\n * @param points array of points\r\n */\r\n public static pointsToPrincipalAxes(points: Point3d[]): MomentData | undefined {\r\n const moments = new MomentData();\r\n if (points.length === 0)\r\n return moments;\r\n moments.clearSums(points[0]);\r\n moments.accumulatePointMomentsFromOrigin(points);\r\n return this.inertiaProductsToPrincipalAxes(moments.origin, moments.sums);\r\n }\r\n /**\r\n * Compute principal axes from inertial products\r\n * * The radii of gyration are sorted smallest to largest\r\n * * Hence x axis is long direction\r\n * * Hence planar data generates large moment as Z\r\n * @param origin The origin used for the inertia products.\r\n * @param inertiaProducts The inertia products -- sums or integrals of [xx,xy,xz,xw; yx,yy, yz,yw; zx,zy,zz,zw; wx,wy,wz,w]\r\n */\r\n public static inertiaProductsToPrincipalAxes(origin: XYZ, inertiaProducts: Matrix4d): MomentData | undefined {\r\n const moments = new MomentData();\r\n moments.sums.setFrom(inertiaProducts);\r\n moments.origin.setFrom(origin);\r\n if (!moments.shiftOriginAndSumsToCentroidOfSums())\r\n return undefined;\r\n const products = moments.sums.matrixPart();\r\n const w = moments.sums.weight();\r\n if (w < 0.0)\r\n products.scaleColumnsInPlace(-1, -1, -1);\r\n const tensor = MomentData.momentTensorFromInertiaProducts(products);\r\n const moment2 = Vector3d.create();\r\n const axisVectors = Matrix3d.createZero();\r\n tensor.fastSymmetricEigenvalues(axisVectors, moment2);\r\n if (moment2.x < 0.0)\r\n return undefined;\r\n MomentData.sortColumnsForIncreasingMoments(axisVectors, moment2);\r\n if (w < 0.0)\r\n axisVectors.scaleColumnsInPlace(1, -1, -1);\r\n moments.localToWorldMap = Transform.createOriginAndMatrix(moments.origin, axisVectors);\r\n moments.radiusOfGyration.set(\r\n Math.sqrt(Math.abs(moment2.x)), Math.sqrt(Math.abs(moment2.y)), Math.sqrt(Math.abs(moment2.z)));\r\n moments.radiusOfGyration.scaleInPlace(1.0 / Math.sqrt(Math.abs(w)));\r\n moments.absoluteQuantity = Math.abs(w);\r\n return moments;\r\n }\r\n /**\r\n * Test for match among selected members as they exist after `inertiaProductsToPrincipalAxes`\r\n * * The members considered are\r\n * * origin of local to world map (i.e. centroid)\r\n * * radius of gyration\r\n * * axes of localToWorldMap.\r\n * * Axis direction tests allow these quirks:\r\n * * opposite orientation is considered matched.\r\n * * Full xyz symmetry: If x,y,z radii are matched, axes are not tested.\r\n * * Symmetry in xy plane: If x and y radii are matched, the x and y axes area allowed to spin freely. Only Z direction is tested.\r\n * * If either or both are undefined, returns false.\r\n * @param dataA first set of moments\r\n * @param dataB second set of moments\r\n */\r\n public static areEquivalentPrincipalAxes(dataA: MomentData | undefined, dataB: MomentData | undefined): boolean {\r\n if (dataA && dataB\r\n && Geometry.isSameCoordinate(dataA.quantitySum, dataB.quantitySum)) { // um.. need different tolerance for area, volume?)\r\n if (dataA.localToWorldMap.getOrigin().isAlmostEqual(dataB.localToWorldMap.getOrigin())\r\n && dataA.radiusOfGyration.isAlmostEqual(dataB.radiusOfGyration)) {\r\n if (Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.y)) {\r\n // We have at least xy symmetry ....\r\n if (Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.z))\r\n return true;\r\n // just xy.\r\n // allow opposite z directions.\r\n // If the z's are aligned, x an dy can spin freely.\r\n const zA = dataA.localToWorldMap.matrix.columnZ();\r\n const zB = dataB.localToWorldMap.matrix.columnZ();\r\n if (zA.isParallelTo(zB, true))\r\n return true;\r\n return false;\r\n }\r\n // no symmetry. Test all three axes.\r\n const vectorA = Vector3d.create();\r\n const vectorB = Vector3d.create();\r\n for (let i = 0; i < 3; i++) {\r\n dataA.localToWorldMap.matrix.getColumn(i, vectorA);\r\n dataB.localToWorldMap.matrix.getColumn(i, vectorB);\r\n if (!vectorA.isParallelTo(vectorB, true))\r\n return false;\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /** Clear the MomentData sums to zero, and establish a new origin. */\r\n public clearSums(origin?: Point3d) {\r\n this.sums.setZero();\r\n if (origin)\r\n this.origin.setFrom(origin);\r\n else\r\n this.origin.setZero();\r\n }\r\n /** Accumulate products-of-components for given points. */\r\n public accumulatePointMomentsFromOrigin(points: Point3d[]) {\r\n for (const p of points) {\r\n this.sums.addMomentsInPlace(\r\n p.x - this.origin.x,\r\n p.y - this.origin.y,\r\n p.z - this.origin.z,\r\n 1.0);\r\n }\r\n }\r\n /** revise the accumulated sums to be \"around the centroid\" */\r\n public shiftOriginAndSumsToCentroidOfSums(): boolean {\r\n const xyz = this.sums.columnW().realPoint();\r\n if (xyz) {\r\n this.shiftOriginAndSumsByXYZ(xyz.x, xyz.y, xyz.z);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** revise the accumulated sums\r\n * * add ax,ay,ax to the origin coordinates.\r\n * * apply the negative translation to the sums.\r\n */\r\n public shiftOriginAndSumsByXYZ(ax: number, ay: number, az: number) {\r\n this.origin.addXYZInPlace(ax, ay, az);\r\n this.sums.multiplyTranslationSandwichInPlace(-ax, -ay, -az);\r\n }\r\n /** revise the accumulated sums so they are based at a specified origin. */\r\n public shiftOriginAndSumsToNewOrigin(newOrigin: XYAndZ) {\r\n this.shiftOriginAndSumsByXYZ(newOrigin.x - this.origin.x, newOrigin.y - this.origin.y, newOrigin.z - this.origin.z);\r\n }\r\n private static _vectorA?: Point4d;\r\n private static _vectorB?: Point4d;\r\n private static _vectorC?: Point4d;\r\n\r\n /** compute moments of a triangle from the origin to the given line.\r\n * Accumulate them to this.sums.\r\n * * If `pointA` is undefined, use `this.origin` as pointA.\r\n * * If `this.needOrigin` is set, pointB is used\r\n */\r\n public accumulateTriangleMomentsXY(pointA: XAndY | undefined, pointB: XAndY, pointC: XAndY) {\r\n this.setOriginXYZIfNeeded(pointB.x, pointB.y, 0.0);\r\n const x0 = this.origin.x;\r\n const y0 = this.origin.y;\r\n const vectorA = MomentData._vectorA =\r\n pointA !== undefined ? Point4d.create(pointA.x - x0, pointA.y - y0, 0.0, 1.0, MomentData._vectorA)\r\n : Point4d.create(this.origin.x, this.origin.y, 0.0, 1.0, MomentData._vectorA);\r\n const vectorB = MomentData._vectorB = Point4d.create(pointB.x - x0, pointB.y - y0, 0.0, 1.0, MomentData._vectorB);\r\n const vectorC = MomentData._vectorC = Point4d.create(pointC.x - x0, pointC.y - y0, 0.0, 1.0, MomentData._vectorC);\r\n\r\n // accumulate Return product integrals I(0<=u<=1) I (0<=v<= u) (w*W + u *U + v * V)(w*W + u *U + v * V)^ du dv\r\n // where w = 1-u-v\r\n // W = column vector (point00.x, point00.y, point00.z, 1.0) etc.\r\n const detJ = Geometry.crossProductXYXY(vectorB.x - vectorA.x, vectorB.y - vectorA.y, vectorC.x - vectorA.x, vectorC.y - vectorA.y);\r\n if (detJ !== 0.0) {\r\n const r1_12 = detJ / 12.0;\r\n const r1_24 = detJ / 24.0;\r\n\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorA, r1_12);\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorB, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorC, r1_24);\r\n\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorA, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorB, r1_12);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorC, r1_24);\r\n\r\n this.sums.addScaledOuterProductInPlace(vectorC, vectorA, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorC, vectorB, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorC, vectorC, r1_12);\r\n }\r\n }\r\n /** add scaled outer product of (4d, unit weight) point to this.sums */\r\n public accumulateScaledOuterProduct(point: XYAndZ, scaleFactor: number) {\r\n this.setOriginXYZIfNeeded(point.x, point.y, 0.0);\r\n const vectorA = MomentData._vectorA = Point4d.create(point.x - this.origin.x, point.y - this.origin.y, point.z - this.origin.z, 1.0, MomentData._vectorA);\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorA, scaleFactor);\r\n }\r\n /** Accumulate wire moment integral from pointA to pointB */\r\n public accumulateLineMomentsXYZ(pointA: Point3d, pointB: Point3d) {\r\n this.setOriginXYZIfNeeded(pointA.x, pointA.y, pointA.z);\r\n const x0 = this.origin.x;\r\n const y0 = this.origin.y;\r\n const z0 = this.origin.z;\r\n const vectorA = MomentData._vectorA = Point4d.create(pointA.x - x0, pointA.y - y0, pointA.z - z0, 1.0, MomentData._vectorA);\r\n const vectorB = MomentData._vectorB = Point4d.create(pointB.x - x0, pointB.y - y0, pointB.z - z0, 1.0, MomentData._vectorB);\r\n const detJ = pointA.distance(pointB);\r\n const r1_3 = detJ / 3.0;\r\n const r1_6 = detJ / 6.0;\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorA, r1_3);\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorB, r1_6);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorA, r1_6);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorB, r1_3);\r\n\r\n }\r\n\r\n private _point0 = Point3d.create();\r\n private _point1 = Point3d.create();\r\n /** compute moments of triangles from a base point to the given linestring.\r\n * Accumulate them to this.sums.\r\n * * If `pointA` is undefined, use `this.origin` as pointA.\r\n * * If `this.needOrigin` is set, the first point of the array is captured as local origin for subsequent sums.\r\n *\r\n */\r\n public accumulateTriangleToLineStringMomentsXY(sweepBase: XAndY | undefined, points: GrowableXYZArray) {\r\n const n = points.length;\r\n if (n > 1) {\r\n points.getPoint3dAtUncheckedPointIndex(0, this._point0);\r\n for (let i = 1; i < n; i++) {\r\n points.getPoint3dAtUncheckedPointIndex(i, this._point1);\r\n this.accumulateTriangleMomentsXY(sweepBase, this._point0, this._point1);\r\n this._point0.setFromPoint3d(this._point1);\r\n }\r\n }\r\n }\r\n // cspell:word ABAT\r\n /**\r\n * * Assemble XX, YY, XY products into a full matrix form [xx,xy,0,0; xy,yy,0,0;0,0,0,0;0,0,0,1].\r\n * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin]. (Column weights 0001) (only xy parts of vectors)\r\n * * scale by detJ for the xy-only determinant of the vectors.\r\n * @param productXX\r\n * @param productXY\r\n * @param productYY\r\n * @param area Area in caller's system\r\n * @param origin Caller's origin\r\n * @param vectorU Caller's U axis (not necessarily unit)\r\n * @param vectorV Caller's V axis (not necessarily unit)\r\n */\r\n public accumulateXYProductsInCentroidalFrame(productXX: number, productXY: number, productYY: number, area: number,\r\n origin: XAndY, vectorU: XAndY, vectorV: XAndY) {\r\n const centroidalProducts = Matrix4d.createRowValues(\r\n productXX, productXY, 0, 0,\r\n productXY, productYY, 0, 0,\r\n 0, 0, 0, 0,\r\n 0, 0, 0, area);\r\n const detJ = Geometry.crossProductXYXY(vectorU.x, vectorV.x, vectorU.y, vectorV.y);\r\n const placement = Matrix4d.createRowValues(\r\n vectorU.x, vectorV.x, 0, origin.x - this.origin.x,\r\n vectorU.y, vectorV.y, 0, origin.y - this.origin.y,\r\n 0, 0, 0, 0,\r\n 0, 0, 0, 1);\r\n const AB = placement.multiplyMatrixMatrix(centroidalProducts);\r\n const ABAT = AB.multiplyMatrixMatrixTranspose(placement);\r\n this.sums.addScaledInPlace(ABAT, detJ);\r\n }\r\n /**\r\n * Accumulate sums from other moments.\r\n * * scale by given scaleFactor (e.g. sign to correct orientation)\r\n * * pull the origin from `other` if `this` needs an origin.\r\n * *\r\n */\r\n public accumulateProducts(other: MomentData, scale: number) {\r\n this.setOriginIfNeeded(other.origin);\r\n this.sums.addTranslationSandwichInPlace(other.sums, this.origin.x - other.origin.x, this.origin.y - other.origin.y, this.origin.z - other.origin.z, scale);\r\n }\r\n\r\n /**\r\n * Accumulate sums from Matrix4d and origin.\r\n * * scale by given scaleFactor (e.g. sign to correct orientation)\r\n * * trap the origin if `this` needs an origin.\r\n * *\r\n */\r\n public accumulateProductsFromOrigin(origin: Point3d, products: Matrix4d, scale: number) {\r\n this.setOriginIfNeeded(origin);\r\n this.sums.addTranslationSandwichInPlace(products, this.origin.x - origin.x, this.origin.y - origin.y, this.origin.z - origin.z, scale);\r\n }\r\n /**\r\n * Convert to a json data object with:\r\n */\r\n public toJSON(): any {\r\n return {\r\n origin: this.origin,\r\n sums: this.sums.toJSON(),\r\n radiusOfGyration: this.radiusOfGyration.toJSON(),\r\n localToWorld: this.localToWorldMap.toJSON(),\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MomentData.js","sourceRoot":"","sources":["../../../src/geometry4d/MomentData.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,yDAAyD;AACzD,mBAAmB;AAEnB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAO,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,UAAU;IAsBrB;;;OAGG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;IACD;;;;OAIG;IACI,UAAU,CAAC,UAAkB;QAClC,OAAO,UAAU,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,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AAC;IACJ,CAAC;IAED;;;;OAIG;IACI,4BAA4B,CAAC,MAAe,EAAE,QAAkB,EAAE,KAAa;QACpF,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,6BAA6B,CACrC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAC9F,CAAC;IACJ,CAAC;IACD,qCAAqC;IAC9B,MAAM;QACX,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;YAChD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;SAC5C,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Numerics\r\n */\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n// cspell:word ABAT\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Point3d, Vector3d, XYZ } from \"../geometry3d/Point3dVector3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XAndY, XYAndZ } from \"../geometry3d/XYZProps\";\r\nimport { Matrix4d } from \"./Matrix4d\";\r\nimport { Point4d } from \"./Point4d\";\r\n\r\n/**\r\n * A MomentData structure exists in several levels:\r\n * * First level: as a carrier of sums of inertial products that determine moments.\r\n * * origin = local origin used as moments are summed.\r\n * * sums = array of summed moments.\r\n * * The [i,j] entry of the sums is a summed or integrated moment for product of axis i and j.\r\n * * axes 0,1,2 are x,y,z.\r\n * * e.g. entry [0,1] is summed product xy\r\n * * axis 3 is \"w\", which is 1 in sums.\r\n * * e.g. entry 03 is summed x.\r\n * * In this level:\r\n * * the `absoluteQuantity` member is undefined.\r\n * * the `localToWorldMap` and `radiiOfGyration` are created by have undefined contents.\r\n * * Second level: after a call to inertiaProductsToPrincipalAxes, the `localToWorldMap`, `absoluteQuantity` and\r\n * `radiiOfGyration` are filled in.\r\n * @public\r\n */\r\nexport class MomentData {\r\n /** Origin used for sums. */\r\n public origin: Point3d;\r\n /** Flag to request deferred origin setup. */\r\n public needOrigin: boolean;\r\n /**\r\n * Moment sums.\r\n * * Set to zero at initialization and if requested later.\r\n * * Accumulated during data entry phase.\r\n */\r\n public sums: Matrix4d;\r\n /**\r\n * The mapping between principal and world system.\r\n * * This set up with its inverse already constructed.\r\n */\r\n public localToWorldMap: Transform;\r\n // private variables\r\n private static _vectorA?: Point4d;\r\n private static _vectorB?: Point4d;\r\n private static _vectorC?: Point4d;\r\n private _point0 = Point3d.create();\r\n private _point1 = Point3d.create();\r\n /**\r\n * Return the lower-right (3,3) entry in the sums.\r\n * * This is the quantity (i.e. length, area, or volume) summed.\r\n */\r\n public get quantitySum(): number {\r\n return this.sums.atIJ(3, 3);\r\n }\r\n /**\r\n * Return a scale factor to make these sums match the target orientation sign.\r\n * * 1.0 if `this.quantitySum` has the same sign as `targetSign`.\r\n * * -1.0 if `this.quantitySum` has the opposite sign from `targetSign`\r\n */\r\n public signFactor(targetSign: number): number {\r\n return targetSign * this.quantitySum > 0 ? 1.0 : -1.0;\r\n }\r\n /** If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag. */\r\n public setOriginIfNeeded(origin: Point3d) {\r\n if (this.needOrigin) {\r\n this.origin.setFromPoint3d(origin);\r\n this.needOrigin = false;\r\n }\r\n }\r\n /** If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag. */\r\n public setOriginFromGrowableXYZArrayIfNeeded(points: GrowableXYZArray) {\r\n if (this.needOrigin && points.length > 0) {\r\n points.getPoint3dAtCheckedPointIndex(0, this.origin);\r\n this.needOrigin = false;\r\n }\r\n }\r\n /** If `this.needOrigin` flag is set, copy `origin` to `this.origin` and clear the flag. */\r\n public setOriginXYZIfNeeded(x: number, y: number, z: number) {\r\n if (this.needOrigin) {\r\n this.origin.set(x, y, z);\r\n this.needOrigin = false;\r\n }\r\n }\r\n /** Radii of gyration (square roots of principal second moments). */\r\n public radiusOfGyration: Vector3d;\r\n /**\r\n * Principal quantity (e.g. length, area, or volume). This is undefined in raw moments, and becomes defined by\r\n * inertiaProductsToPrincipalAxes.\r\n */\r\n public absoluteQuantity?: number;\r\n /** Constructor. */\r\n private constructor() {\r\n this.origin = Point3d.createZero();\r\n this.sums = Matrix4d.createZero();\r\n this.localToWorldMap = Transform.createIdentity();\r\n this.radiusOfGyration = Vector3d.create();\r\n this.needOrigin = false;\r\n this.absoluteQuantity = 0.1; // so optimizer sees its type\r\n this.absoluteQuantity = undefined;\r\n }\r\n /**\r\n * Create moments with optional origin.\r\n * * Origin and needOrigin are quirky.\r\n * * (undefined, true) sets up to use first incoming point as origin.\r\n * * (origin) sets up to use that durable origin, set needsOrigin flag false.\r\n * * (origin, true) the \"true\" is meaningless.\r\n * * (undefined, false) makes 000 the durable origin.\r\n */\r\n public static create(origin?: Point3d | undefined, needOrigin: boolean = false): MomentData {\r\n const data = new MomentData();\r\n data.needOrigin = needOrigin;\r\n if (origin) {\r\n data.origin.setFromPoint3d(origin);\r\n data.needOrigin = false;\r\n }\r\n return data;\r\n }\r\n /**\r\n * Return the formal tensor of integrated values `[yy+zz,xy,xz][yx,xx+zz,yz][zx,xy,xx+yy]`.\r\n * @param products matrix of (integrated) `[xx,xy,xz][yx,yy,yz][zx,xy,zz]`.\r\n */\r\n public static momentTensorFromInertiaProducts(products: Matrix3d): Matrix3d {\r\n const rr = products.sumDiagonal();\r\n const result = Matrix3d.createScale(rr, rr, rr);\r\n result.addScaledInPlace(products, -1.0);\r\n return result;\r\n }\r\n /** Sort the columns of the matrix for increasing moments. */\r\n public static sortColumnsForIncreasingMoments(axes: Matrix3d, moments: Vector3d) {\r\n const points = [\r\n axes.indexedColumnWithWeight(0, moments.x),\r\n axes.indexedColumnWithWeight(1, moments.y),\r\n axes.indexedColumnWithWeight(2, moments.z),\r\n ].sort((dataA: Point4d, dataB: Point4d): number => {\r\n if (dataA.w < dataB.w) return -1;\r\n if (dataA.w > dataB.w) return 1;\r\n return 0;\r\n });\r\n axes.setColumnsPoint4dXYZ(points[0], points[1], points[2]);\r\n if (axes.determinant() < 0)\r\n axes.scaleColumnsInPlace(-1.0, -1.0, -1.0);\r\n // prefer x and z positive -- y falls wherever . ..\r\n if (axes.at(0, 0) < 0.0)\r\n axes.scaleColumnsInPlace(-1.0, -1.0, 1.0);\r\n if (axes.at(2, 2) < 0.0)\r\n axes.scaleColumnsInPlace(1.0, -1.0, -1.0);\r\n moments.set(points[0].w, points[1].w, points[2].w);\r\n }\r\n /**\r\n * Return the principal moment data for an array of points.\r\n * @param points array of points.\r\n */\r\n public static pointsToPrincipalAxes(points: Point3d[]): MomentData | undefined {\r\n const moments = new MomentData();\r\n if (points.length === 0)\r\n return moments;\r\n moments.clearSums(points[0]);\r\n moments.accumulatePointMomentsFromOrigin(points);\r\n return this.inertiaProductsToPrincipalAxes(moments.origin, moments.sums);\r\n }\r\n /**\r\n * Compute principal axes from inertial products.\r\n * * The radii of gyration are sorted smallest to largest.\r\n * * Hence x axis is long direction.\r\n * * Hence planar data generates large moment as Z.\r\n * @param origin The origin used for the inertia products.\r\n * @param inertiaProducts The inertia products: sums or integrals of [xx,xy,xz,xw; yx,yy, yz,yw; zx,zy,zz,zw; wx,wy,wz,w].\r\n */\r\n public static inertiaProductsToPrincipalAxes(origin: XYZ, inertiaProducts: Matrix4d): MomentData | undefined {\r\n const moments = new MomentData();\r\n moments.sums.setFrom(inertiaProducts);\r\n moments.origin.setFrom(origin);\r\n if (!moments.shiftOriginAndSumsToCentroidOfSums())\r\n return undefined;\r\n const products = moments.sums.matrixPart();\r\n const w = moments.sums.weight();\r\n if (w < 0.0)\r\n products.scaleColumnsInPlace(-1, -1, -1);\r\n const tensor = MomentData.momentTensorFromInertiaProducts(products);\r\n const moment2 = Vector3d.create();\r\n const axisVectors = Matrix3d.createZero();\r\n tensor.fastSymmetricEigenvalues(axisVectors, moment2);\r\n if (moment2.x < 0.0)\r\n return undefined;\r\n MomentData.sortColumnsForIncreasingMoments(axisVectors, moment2);\r\n if (w < 0.0)\r\n axisVectors.scaleColumnsInPlace(1, -1, -1);\r\n moments.localToWorldMap = Transform.createOriginAndMatrix(moments.origin, axisVectors);\r\n moments.radiusOfGyration.set(\r\n Math.sqrt(Math.abs(moment2.x)), Math.sqrt(Math.abs(moment2.y)), Math.sqrt(Math.abs(moment2.z)));\r\n moments.radiusOfGyration.scaleInPlace(1.0 / Math.sqrt(Math.abs(w)));\r\n moments.absoluteQuantity = Math.abs(w);\r\n return moments;\r\n }\r\n /**\r\n * Test for match among selected members as they exist after `inertiaProductsToPrincipalAxes`.\r\n * * The members considered are:\r\n * * origin of local to world map (i.e. centroid),\r\n * * radius of gyration,\r\n * * axes of localToWorldMap.\r\n * * Axis direction tests allow these quirks:\r\n * * opposite orientation is considered matched.\r\n * * Full xyz symmetry: If x,y,z radii are matched, axes are not tested.\r\n * * Symmetry in xy plane: If x and y radii are matched, the x and y axes area allowed to spin freely. Only Z direction\r\n * is tested.\r\n * * If either or both are undefined, returns false.\r\n * @param dataA first set of moments.\r\n * @param dataB second set of moments.\r\n */\r\n public static areEquivalentPrincipalAxes(dataA: MomentData | undefined, dataB: MomentData | undefined): boolean {\r\n if (dataA && dataB\r\n && Geometry.isSameCoordinate(dataA.quantitySum, dataB.quantitySum)) { // um.. need different tolerance for area, volume?)\r\n if (dataA.localToWorldMap.getOrigin().isAlmostEqual(dataB.localToWorldMap.getOrigin())\r\n && dataA.radiusOfGyration.isAlmostEqual(dataB.radiusOfGyration)) {\r\n if (Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.y)) {\r\n // We have at least xy symmetry ....\r\n if (Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.z))\r\n return true;\r\n // just xy.\r\n // allow opposite z directions.\r\n // If the z's are aligned, x an dy can spin freely.\r\n const zA = dataA.localToWorldMap.matrix.columnZ();\r\n const zB = dataB.localToWorldMap.matrix.columnZ();\r\n if (zA.isParallelTo(zB, true))\r\n return true;\r\n return false;\r\n }\r\n // no symmetry. Test all three axes.\r\n const vectorA = Vector3d.create();\r\n const vectorB = Vector3d.create();\r\n for (let i = 0; i < 3; i++) {\r\n dataA.localToWorldMap.matrix.getColumn(i, vectorA);\r\n dataB.localToWorldMap.matrix.getColumn(i, vectorB);\r\n if (!vectorA.isParallelTo(vectorB, true))\r\n return false;\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /** Clear the MomentData sums to zero, and establish a new origin. */\r\n public clearSums(origin?: Point3d) {\r\n this.sums.setZero();\r\n if (origin)\r\n this.origin.setFrom(origin);\r\n else\r\n this.origin.setZero();\r\n }\r\n /** Accumulate products-of-components for given points. */\r\n public accumulatePointMomentsFromOrigin(points: Point3d[]) {\r\n for (const p of points) {\r\n this.sums.addMomentsInPlace(\r\n p.x - this.origin.x,\r\n p.y - this.origin.y,\r\n p.z - this.origin.z,\r\n 1.0,\r\n );\r\n }\r\n }\r\n /** Revise the accumulated sums to be \"around the centroid\". */\r\n public shiftOriginAndSumsToCentroidOfSums(): boolean {\r\n const xyz = this.sums.columnW().realPoint();\r\n if (xyz) {\r\n this.shiftOriginAndSumsByXYZ(xyz.x, xyz.y, xyz.z);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Revise the accumulated sums.\r\n * * add ax,ay,ax to the origin coordinates.\r\n * * apply the negative translation to the sums.\r\n */\r\n public shiftOriginAndSumsByXYZ(ax: number, ay: number, az: number) {\r\n this.origin.addXYZInPlace(ax, ay, az);\r\n this.sums.multiplyTranslationSandwichInPlace(-ax, -ay, -az);\r\n }\r\n /** Revise the accumulated sums so they are based at a specified origin. */\r\n public shiftOriginAndSumsToNewOrigin(newOrigin: XYAndZ) {\r\n this.shiftOriginAndSumsByXYZ(newOrigin.x - this.origin.x, newOrigin.y - this.origin.y, newOrigin.z - this.origin.z);\r\n }\r\n /**\r\n * Compute moments of a triangle from the origin to the given line.\r\n * Accumulate them to this.sums.\r\n * * If `pointA` is undefined, use `this.origin` as pointA.\r\n * * If `this.needOrigin` is set, pointB is used\r\n */\r\n public accumulateTriangleMomentsXY(pointA: XAndY | undefined, pointB: XAndY, pointC: XAndY) {\r\n this.setOriginXYZIfNeeded(pointB.x, pointB.y, 0.0);\r\n const x0 = this.origin.x;\r\n const y0 = this.origin.y;\r\n const vectorA = MomentData._vectorA =\r\n pointA !== undefined ? Point4d.create(pointA.x - x0, pointA.y - y0, 0.0, 1.0, MomentData._vectorA)\r\n : Point4d.create(this.origin.x, this.origin.y, 0.0, 1.0, MomentData._vectorA);\r\n const vectorB = MomentData._vectorB = Point4d.create(pointB.x - x0, pointB.y - y0, 0.0, 1.0, MomentData._vectorB);\r\n const vectorC = MomentData._vectorC = Point4d.create(pointC.x - x0, pointC.y - y0, 0.0, 1.0, MomentData._vectorC);\r\n // accumulate Return product integrals I(0<=u<=1) I (0<=v<= u) (w*W + u *U + v * V)(w*W + u *U + v * V)^ du dv\r\n // where w = 1-u-v\r\n // W = column vector (point00.x, point00.y, point00.z, 1.0) etc.\r\n const detJ = Geometry.crossProductXYXY(vectorB.x - vectorA.x, vectorB.y - vectorA.y, vectorC.x - vectorA.x, vectorC.y - vectorA.y);\r\n if (detJ !== 0.0) {\r\n const r1_12 = detJ / 12.0;\r\n const r1_24 = detJ / 24.0;\r\n\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorA, r1_12);\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorB, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorC, r1_24);\r\n\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorA, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorB, r1_12);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorC, r1_24);\r\n\r\n this.sums.addScaledOuterProductInPlace(vectorC, vectorA, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorC, vectorB, r1_24);\r\n this.sums.addScaledOuterProductInPlace(vectorC, vectorC, r1_12);\r\n }\r\n }\r\n /** Add scaled outer product of (4d, unit weight) point to this.sums. */\r\n public accumulateScaledOuterProduct(point: XYAndZ, scaleFactor: number) {\r\n this.setOriginXYZIfNeeded(point.x, point.y, 0.0);\r\n const vectorA = MomentData._vectorA = Point4d.create(\r\n point.x - this.origin.x, point.y - this.origin.y, point.z - this.origin.z, 1.0, MomentData._vectorA,\r\n );\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorA, scaleFactor);\r\n }\r\n /** Accumulate wire moment integral from pointA to pointB */\r\n public accumulateLineMomentsXYZ(pointA: Point3d, pointB: Point3d) {\r\n this.setOriginXYZIfNeeded(pointA.x, pointA.y, pointA.z);\r\n const x0 = this.origin.x;\r\n const y0 = this.origin.y;\r\n const z0 = this.origin.z;\r\n const vectorA = MomentData._vectorA = Point4d.create(\r\n pointA.x - x0, pointA.y - y0, pointA.z - z0, 1.0, MomentData._vectorA,\r\n );\r\n const vectorB = MomentData._vectorB = Point4d.create(\r\n pointB.x - x0, pointB.y - y0, pointB.z - z0, 1.0, MomentData._vectorB,\r\n );\r\n const detJ = pointA.distance(pointB);\r\n const r1_3 = detJ / 3.0;\r\n const r1_6 = detJ / 6.0;\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorA, r1_3);\r\n this.sums.addScaledOuterProductInPlace(vectorA, vectorB, r1_6);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorA, r1_6);\r\n this.sums.addScaledOuterProductInPlace(vectorB, vectorB, r1_3);\r\n }\r\n /**\r\n * Compute moments of triangles from a base point to the given linestring.\r\n * Accumulate them to this.sums.\r\n * * If `pointA` is undefined, use `this.origin` as pointA.\r\n * * If `this.needOrigin` is set, the first point of the array is captured as local origin for subsequent sums.\r\n *\r\n */\r\n public accumulateTriangleToLineStringMomentsXY(sweepBase: XAndY | undefined, points: GrowableXYZArray) {\r\n const n = points.length;\r\n if (n > 1) {\r\n points.getPoint3dAtUncheckedPointIndex(0, this._point0);\r\n for (let i = 1; i < n; i++) {\r\n points.getPoint3dAtUncheckedPointIndex(i, this._point1);\r\n this.accumulateTriangleMomentsXY(sweepBase, this._point0, this._point1);\r\n this._point0.setFromPoint3d(this._point1);\r\n }\r\n }\r\n }\r\n /**\r\n * * Assemble XX, YY, XY products into a full matrix form [xx,xy,0,0; xy,yy,0,0;0,0,0,0;0,0,0,1].\r\n * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin]. (Column weights 0001) (only xy\r\n * parts of vectors).\r\n * * scale by detJ for the xy-only determinant of the vectors.\r\n * @param productXX\r\n * @param productXY\r\n * @param productYY\r\n * @param area Area in caller's system.\r\n * @param origin Caller's origin.\r\n * @param vectorU Caller's U axis (not necessarily unit).\r\n * @param vectorV Caller's V axis (not necessarily unit).\r\n */\r\n public accumulateXYProductsInCentroidalFrame(\r\n productXX: number, productXY: number, productYY: number,\r\n area: number, origin: XAndY, vectorU: XAndY, vectorV: XAndY,\r\n ) {\r\n const centroidalProducts = Matrix4d.createRowValues(\r\n productXX, productXY, 0, 0,\r\n productXY, productYY, 0, 0,\r\n 0, 0, 0, 0,\r\n 0, 0, 0, area,\r\n );\r\n const detJ = Geometry.crossProductXYXY(vectorU.x, vectorV.x, vectorU.y, vectorV.y);\r\n const placement = Matrix4d.createRowValues(\r\n vectorU.x, vectorV.x, 0, origin.x - this.origin.x,\r\n vectorU.y, vectorV.y, 0, origin.y - this.origin.y,\r\n 0, 0, 0, 0,\r\n 0, 0, 0, 1,\r\n );\r\n const AB = placement.multiplyMatrixMatrix(centroidalProducts);\r\n const ABAT = AB.multiplyMatrixMatrixTranspose(placement);\r\n this.sums.addScaledInPlace(ABAT, detJ);\r\n }\r\n /**\r\n * Accumulate sums from other moments.\r\n * * Scale by given scaleFactor (e.g. sign to correct orientation).\r\n * * Pull the origin from `other` if `this` needs an origin.\r\n */\r\n public accumulateProducts(other: MomentData, scale: number) {\r\n this.setOriginIfNeeded(other.origin);\r\n this.sums.addTranslationSandwichInPlace(\r\n other.sums, this.origin.x - other.origin.x, this.origin.y - other.origin.y, this.origin.z - other.origin.z, scale,\r\n );\r\n }\r\n\r\n /**\r\n * Accumulate sums from Matrix4d and origin.\r\n * * Scale by given scaleFactor (e.g. sign to correct orientation).\r\n * * Trap the origin if `this` needs an origin.\r\n */\r\n public accumulateProductsFromOrigin(origin: Point3d, products: Matrix4d, scale: number) {\r\n this.setOriginIfNeeded(origin);\r\n this.sums.addTranslationSandwichInPlace(\r\n products, this.origin.x - origin.x, this.origin.y - origin.y, this.origin.z - origin.z, scale,\r\n );\r\n }\r\n /** Convert to a json data object. */\r\n public toJSON(): any {\r\n return {\r\n origin: this.origin,\r\n sums: this.sums.toJSON(),\r\n radiusOfGyration: this.radiusOfGyration.toJSON(),\r\n localToWorld: this.localToWorldMap.toJSON(),\r\n };\r\n }\r\n}\r\n"]}
@@ -280,11 +280,11 @@ export declare class AnalyticRoots {
280
280
  * * -1 -- beta, gamma are zero, alpha is not.There is no line defined.There are no solutions.
281
281
  * * 0 -- the line is well defined, but passes completely outside the unit circle.
282
282
  * * In this case, (c1, s1) is the circle point closest to the line and(c2, s2) is the line point closest to the circle.
283
- * * 1 -- the line is tangent to the unit circle.
284
- * * Tangency is determined by tolerances, which calls a "close approach" point a tangency.
285
- * * (c1, s1) is the closest circle point
286
- * * (c2, s2) is the line point.
287
- * * 2 -- two simple intersections.
283
+ * * 1 -- the line is tangent to the unit circle.
284
+ * * Tangency is determined by tolerances, which calls a "close approach" point a tangency.
285
+ * * (c1, s1) is the closest circle point
286
+ * * (c2, s2) is the line point.
287
+ * * 2 -- two simple intersections.
288
288
  * @param alpha constant coefficient on line
289
289
  * @param beta x cosine coefficient on line
290
290
  * @param gamma y sine coefficient on line
@@ -921,11 +921,11 @@ export class AnalyticRoots {
921
921
  * * -1 -- beta, gamma are zero, alpha is not.There is no line defined.There are no solutions.
922
922
  * * 0 -- the line is well defined, but passes completely outside the unit circle.
923
923
  * * In this case, (c1, s1) is the circle point closest to the line and(c2, s2) is the line point closest to the circle.
924
- * * 1 -- the line is tangent to the unit circle.
925
- * * Tangency is determined by tolerances, which calls a "close approach" point a tangency.
926
- * * (c1, s1) is the closest circle point
927
- * * (c2, s2) is the line point.
928
- * * 2 -- two simple intersections.
924
+ * * 1 -- the line is tangent to the unit circle.
925
+ * * Tangency is determined by tolerances, which calls a "close approach" point a tangency.
926
+ * * (c1, s1) is the closest circle point
927
+ * * (c2, s2) is the line point.
928
+ * * 2 -- two simple intersections.
929
929
  * @param alpha constant coefficient on line
930
930
  * @param beta x cosine coefficient on line
931
931
  * @param gamma y sine coefficient on line
@@ -1057,7 +1057,7 @@ export class TrigPolynomial {
1057
1057
  degree--;
1058
1058
  const roots = new GrowableFloat64Array();
1059
1059
  if (degree === -1) {
1060
- // do nothing
1060
+ // p(t) is identically zero (degenerate); do nothing.
1061
1061
  }
1062
1062
  else {
1063
1063
  if (degree === 0) {