@itwin/core-geometry 4.4.0-dev.8 → 4.5.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Geometry.d.ts +17 -0
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +14 -0
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/core-geometry.d.ts +3 -2
  7. package/lib/cjs/core-geometry.d.ts.map +1 -1
  8. package/lib/cjs/core-geometry.js +3 -2
  9. package/lib/cjs/core-geometry.js.map +1 -1
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +2 -2
  11. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +3 -3
  12. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  13. package/lib/cjs/curve/CurveExtendMode.d.ts +7 -6
  14. package/lib/cjs/curve/CurveExtendMode.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurveExtendMode.js +7 -6
  16. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  17. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  18. package/lib/cjs/curve/CurveLocationDetail.js +23 -18
  19. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  20. package/lib/cjs/curve/LineSegment3d.d.ts +14 -4
  21. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  22. package/lib/cjs/curve/LineSegment3d.js +107 -2
  23. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  24. package/lib/cjs/curve/LineString3d.d.ts +41 -8
  25. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  26. package/lib/cjs/curve/LineString3d.js +53 -15
  27. package/lib/cjs/curve/LineString3d.js.map +1 -1
  28. package/lib/cjs/curve/Loop.js +1 -1
  29. package/lib/cjs/curve/Loop.js.map +1 -1
  30. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -2
  31. package/lib/cjs/curve/Query/PlanarSubdivision.js +2 -2
  32. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  33. package/lib/cjs/curve/RegionOps.d.ts +1 -2
  34. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  35. package/lib/cjs/curve/RegionOps.js.map +1 -1
  36. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +5 -8
  37. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  38. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +12 -12
  39. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  40. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +2 -2
  41. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  42. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  43. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  44. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +2 -3
  45. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  46. package/lib/cjs/geometry3d/GrowableXYZArray.js +1 -1
  47. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  48. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +18 -1
  49. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  50. package/lib/cjs/geometry3d/IndexedXYZCollection.js +13 -0
  51. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  52. package/lib/cjs/geometry3d/PointHelpers.d.ts +1 -2
  53. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  54. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  55. package/lib/cjs/geometry3d/PointStreaming.d.ts +1 -1
  56. package/lib/cjs/geometry3d/PointStreaming.d.ts.map +1 -1
  57. package/lib/cjs/geometry3d/PointStreaming.js +3 -1
  58. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  59. package/lib/cjs/geometry3d/PolygonOps.d.ts +68 -1
  60. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/PolygonOps.js +152 -4
  62. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  63. package/lib/cjs/geometry3d/PolylineOps.d.ts +23 -1
  64. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  65. package/lib/cjs/geometry3d/PolylineOps.js +73 -1
  66. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  67. package/lib/cjs/geometry3d/Range.d.ts +1 -1
  68. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  69. package/lib/cjs/geometry3d/Range.js.map +1 -1
  70. package/lib/cjs/geometry3d/Transform.js +1 -1
  71. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  72. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts +7 -5
  73. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  74. package/lib/cjs/geometry3d/YawPitchRollAngles.js +8 -6
  75. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  76. package/lib/cjs/numerics/Polynomials.d.ts +13 -1
  77. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  78. package/lib/cjs/numerics/Polynomials.js +13 -1
  79. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  80. package/lib/cjs/polyface/FacetLocationDetail.d.ts +28 -5
  81. package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -1
  82. package/lib/cjs/polyface/FacetLocationDetail.js +50 -15
  83. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  84. package/lib/cjs/polyface/Polyface.d.ts +1 -1
  85. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  86. package/lib/cjs/polyface/Polyface.js.map +1 -1
  87. package/lib/cjs/polyface/PolyfaceQuery.d.ts +7 -3
  88. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  89. package/lib/cjs/polyface/PolyfaceQuery.js +23 -0
  90. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  91. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.d.ts +52 -0
  92. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -0
  93. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js +78 -0
  94. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -0
  95. package/lib/cjs/polyface/RangeTree/MinimumValueTester.d.ts +60 -0
  96. package/lib/cjs/polyface/RangeTree/MinimumValueTester.d.ts.map +1 -0
  97. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js +96 -0
  98. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -0
  99. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +57 -0
  100. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -0
  101. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +73 -0
  102. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -0
  103. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +57 -0
  104. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -0
  105. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +84 -0
  106. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -0
  107. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +274 -0
  108. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -0
  109. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +505 -0
  110. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -0
  111. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +204 -0
  112. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -0
  113. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +383 -0
  114. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -0
  115. package/lib/cjs/serialization/GeometrySamples.d.ts +36 -3
  116. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  117. package/lib/cjs/serialization/GeometrySamples.js +93 -4
  118. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  119. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  120. package/lib/cjs/solid/LinearSweep.js +1 -1
  121. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  122. package/lib/cjs/solid/SweepContour.d.ts +2 -2
  123. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  124. package/lib/cjs/solid/SweepContour.js.map +1 -1
  125. package/lib/cjs/topology/Graph.d.ts +5 -6
  126. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  127. package/lib/cjs/topology/Graph.js +7 -6
  128. package/lib/cjs/topology/Graph.js.map +1 -1
  129. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +4 -4
  130. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +5 -5
  131. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  132. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +108 -71
  133. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  134. package/lib/cjs/topology/HalfEdgeGraphSearch.js +223 -109
  135. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  136. package/lib/cjs/topology/Merging.d.ts +1 -1
  137. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  138. package/lib/cjs/topology/Merging.js.map +1 -1
  139. package/lib/cjs/topology/SignedDataSummary.d.ts +13 -13
  140. package/lib/cjs/topology/SignedDataSummary.d.ts.map +1 -1
  141. package/lib/cjs/topology/SignedDataSummary.js +3 -3
  142. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  143. package/lib/cjs/topology/Triangulation.d.ts +1 -12
  144. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  145. package/lib/cjs/topology/Triangulation.js.map +1 -1
  146. package/lib/cjs/topology/XYParitySearchContext.d.ts +27 -21
  147. package/lib/cjs/topology/XYParitySearchContext.d.ts.map +1 -1
  148. package/lib/cjs/topology/XYParitySearchContext.js +73 -71
  149. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  150. package/lib/esm/Geometry.d.ts +17 -0
  151. package/lib/esm/Geometry.d.ts.map +1 -1
  152. package/lib/esm/Geometry.js +14 -0
  153. package/lib/esm/Geometry.js.map +1 -1
  154. package/lib/esm/core-geometry.d.ts +3 -2
  155. package/lib/esm/core-geometry.d.ts.map +1 -1
  156. package/lib/esm/core-geometry.js +3 -2
  157. package/lib/esm/core-geometry.js.map +1 -1
  158. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +2 -2
  159. package/lib/esm/curve/CurveChainWithDistanceIndex.js +3 -3
  160. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  161. package/lib/esm/curve/CurveExtendMode.d.ts +7 -6
  162. package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
  163. package/lib/esm/curve/CurveExtendMode.js +7 -6
  164. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  165. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  166. package/lib/esm/curve/CurveLocationDetail.js +23 -18
  167. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  168. package/lib/esm/curve/LineSegment3d.d.ts +14 -4
  169. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  170. package/lib/esm/curve/LineSegment3d.js +108 -3
  171. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  172. package/lib/esm/curve/LineString3d.d.ts +41 -8
  173. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  174. package/lib/esm/curve/LineString3d.js +53 -15
  175. package/lib/esm/curve/LineString3d.js.map +1 -1
  176. package/lib/esm/curve/Loop.js +1 -1
  177. package/lib/esm/curve/Loop.js.map +1 -1
  178. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -2
  179. package/lib/esm/curve/Query/PlanarSubdivision.js +2 -2
  180. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  181. package/lib/esm/curve/RegionOps.d.ts +1 -2
  182. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  183. package/lib/esm/curve/RegionOps.js +1 -1
  184. package/lib/esm/curve/RegionOps.js.map +1 -1
  185. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +5 -8
  186. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  187. package/lib/esm/curve/RegionOpsClassificationSweeps.js +12 -12
  188. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  189. package/lib/esm/geometry3d/GrowableXYArray.d.ts +2 -2
  190. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  191. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  192. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  193. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +2 -3
  194. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  195. package/lib/esm/geometry3d/GrowableXYZArray.js +1 -1
  196. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  197. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +18 -1
  198. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  199. package/lib/esm/geometry3d/IndexedXYZCollection.js +13 -0
  200. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  201. package/lib/esm/geometry3d/PointHelpers.d.ts +1 -2
  202. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  203. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  204. package/lib/esm/geometry3d/PointStreaming.d.ts +1 -1
  205. package/lib/esm/geometry3d/PointStreaming.d.ts.map +1 -1
  206. package/lib/esm/geometry3d/PointStreaming.js +3 -1
  207. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  208. package/lib/esm/geometry3d/PolygonOps.d.ts +68 -1
  209. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  210. package/lib/esm/geometry3d/PolygonOps.js +150 -3
  211. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  212. package/lib/esm/geometry3d/PolylineOps.d.ts +23 -1
  213. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  214. package/lib/esm/geometry3d/PolylineOps.js +73 -1
  215. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  216. package/lib/esm/geometry3d/Range.d.ts +1 -1
  217. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  218. package/lib/esm/geometry3d/Range.js.map +1 -1
  219. package/lib/esm/geometry3d/Transform.js +1 -1
  220. package/lib/esm/geometry3d/Transform.js.map +1 -1
  221. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts +7 -5
  222. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  223. package/lib/esm/geometry3d/YawPitchRollAngles.js +8 -6
  224. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  225. package/lib/esm/numerics/Polynomials.d.ts +13 -1
  226. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  227. package/lib/esm/numerics/Polynomials.js +13 -1
  228. package/lib/esm/numerics/Polynomials.js.map +1 -1
  229. package/lib/esm/polyface/FacetLocationDetail.d.ts +28 -5
  230. package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -1
  231. package/lib/esm/polyface/FacetLocationDetail.js +48 -14
  232. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  233. package/lib/esm/polyface/Polyface.d.ts +1 -1
  234. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  235. package/lib/esm/polyface/Polyface.js.map +1 -1
  236. package/lib/esm/polyface/PolyfaceQuery.d.ts +7 -3
  237. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  238. package/lib/esm/polyface/PolyfaceQuery.js +23 -0
  239. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  240. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.d.ts +52 -0
  241. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -0
  242. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js +74 -0
  243. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -0
  244. package/lib/esm/polyface/RangeTree/MinimumValueTester.d.ts +60 -0
  245. package/lib/esm/polyface/RangeTree/MinimumValueTester.d.ts.map +1 -0
  246. package/lib/esm/polyface/RangeTree/MinimumValueTester.js +92 -0
  247. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -0
  248. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +57 -0
  249. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -0
  250. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +69 -0
  251. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -0
  252. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +57 -0
  253. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -0
  254. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +80 -0
  255. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -0
  256. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +274 -0
  257. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -0
  258. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +497 -0
  259. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -0
  260. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +204 -0
  261. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -0
  262. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +374 -0
  263. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -0
  264. package/lib/esm/serialization/GeometrySamples.d.ts +36 -3
  265. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  266. package/lib/esm/serialization/GeometrySamples.js +93 -4
  267. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  268. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  269. package/lib/esm/solid/LinearSweep.js +1 -1
  270. package/lib/esm/solid/LinearSweep.js.map +1 -1
  271. package/lib/esm/solid/SweepContour.d.ts +2 -2
  272. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  273. package/lib/esm/solid/SweepContour.js.map +1 -1
  274. package/lib/esm/topology/Graph.d.ts +5 -6
  275. package/lib/esm/topology/Graph.d.ts.map +1 -1
  276. package/lib/esm/topology/Graph.js +7 -6
  277. package/lib/esm/topology/Graph.js.map +1 -1
  278. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +4 -4
  279. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +5 -5
  280. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  281. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +108 -71
  282. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  283. package/lib/esm/topology/HalfEdgeGraphSearch.js +223 -109
  284. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  285. package/lib/esm/topology/Merging.d.ts +1 -1
  286. package/lib/esm/topology/Merging.d.ts.map +1 -1
  287. package/lib/esm/topology/Merging.js.map +1 -1
  288. package/lib/esm/topology/SignedDataSummary.d.ts +13 -13
  289. package/lib/esm/topology/SignedDataSummary.d.ts.map +1 -1
  290. package/lib/esm/topology/SignedDataSummary.js +3 -3
  291. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  292. package/lib/esm/topology/Triangulation.d.ts +1 -12
  293. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  294. package/lib/esm/topology/Triangulation.js.map +1 -1
  295. package/lib/esm/topology/XYParitySearchContext.d.ts +27 -21
  296. package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
  297. package/lib/esm/topology/XYParitySearchContext.js +73 -71
  298. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  299. package/package.json +3 -3
@@ -39,6 +39,29 @@ export declare class PolygonLocationDetail {
39
39
  get isValid(): boolean;
40
40
  /** Whether this instance specifies a location inside or on the polygon. */
41
41
  get isInsideOrOn(): boolean;
42
+ /**
43
+ * Set point, index, and fraction for an "at vertex" or "along edge" PolygonLocationDetail.
44
+ * * Point is not captured; its coordinates are copied.
45
+ */
46
+ static createAtVertexOrEdge(point: Point3d, index: number, fraction?: number): PolygonLocationDetail;
47
+ }
48
+ /**
49
+ * A pair of PolygonLocationDetail.
50
+ * @public
51
+ */
52
+ export declare class PolygonLocationDetailPair {
53
+ /** The first of the two details. */
54
+ detailA: PolygonLocationDetail;
55
+ /** The second of the two details. */
56
+ detailB: PolygonLocationDetail;
57
+ /** Constructor, captures inputs */
58
+ private constructor();
59
+ /** Create an instance by capturing inputs */
60
+ static create(detailA: PolygonLocationDetail, detailB: PolygonLocationDetail, result?: PolygonLocationDetailPair): PolygonLocationDetailPair;
61
+ /** Make a deep copy of this PolygonLocationDetailPair */
62
+ clone(result?: PolygonLocationDetailPair): PolygonLocationDetailPair;
63
+ /** Swap the details of A, B */
64
+ swapDetails(): void;
42
65
  }
43
66
  /**
44
67
  * Carrier for a loop extracted from clip operation, annotated for sorting
@@ -268,18 +291,33 @@ export declare class PolygonOps {
268
291
  */
269
292
  static sortOuterAndHoleLoops(loops: IndexedReadWriteXYZCollection[], defaultNormal: Vector3d | undefined): IndexedReadWriteXYZCollection[][];
270
293
  /** Compute the closest point on the polygon boundary to the given point.
294
+ * * Compare to [[closestPoint]].
271
295
  * @param polygon points of the polygon, closure point optional
272
296
  * @param testPoint point p to project onto the polygon edges. Works best when p is in the plane of the polygon.
273
297
  * @param tolerance optional distance tolerance to determine point-vertex and point-edge coincidence.
274
298
  * @param result optional pre-allocated object to fill and return
275
299
  * @returns details d of the closest point `d.point`:
276
300
  * * `d.isValid()` returns true if and only if the polygon is nontrivial.
277
- * * `d.edgeIndex` and `d.edgeParam` specify the location of the closest point, within `distTol`.
301
+ * * `d.edgeIndex` and `d.edgeParam` specify the location of the closest point.
278
302
  * * `d.code` classifies the closest point as a vertex (`PolygonLocation.OnPolygonVertex`) or as a point on an edge (`PolygonLocation.OnPolygonEdgeInterior`).
279
303
  * * `d.a` is the distance from testPoint to the closest point.
280
304
  * * `d.v` can be used to classify p (if p and polygon are coplanar): if n is the polygon normal then `d.v.dotProduct(n)` is +/-/0 if and only if p is inside/outside/on the polygon.
281
305
  */
282
306
  static closestPointOnBoundary(polygon: Point3d[] | IndexedXYZCollection, testPoint: Point3d, tolerance?: number, result?: PolygonLocationDetail): PolygonLocationDetail;
307
+ /**
308
+ * Compute the closest point on the polygon boundary or its interior to the given point.
309
+ * * Compare to [[closestPointOnBoundary]].
310
+ * @param polygon points of the polygon, closure point optional
311
+ * @param testPoint point p to project onto the polygon edges. Works best when p is in the plane of the polygon.
312
+ * @param tolerance optional distance tolerance for distinguishing boundary versus interior closest point.
313
+ * @param result optional pre-allocated object to fill and return
314
+ * @returns details d of the closest point `d.point`:
315
+ * * `d.isValid()` returns true if and only if the polygon is nontrivial.
316
+ * * `d.edgeIndex` and `d.edgeParam` specify the location of the (nearest) boundary point.
317
+ * * `d.code` classifies the closest point: `PolygonLocation.OnPolygonVertex`, `PolygonLocation.OnPolygonEdgeInterior`, `PolygonLocation.InsidePolygonProjectsToVertex`, or `PolygonLocation.InsidePolygonProjectsToEdgeInterior`.
318
+ * * `d.a` is the distance from testPoint to the closest point.
319
+ */
320
+ static closestPoint(polygon: Point3d[] | IndexedXYZCollection, testPoint: Point3d, tolerance?: number, result?: PolygonLocationDetail): PolygonLocationDetail;
283
321
  private static _workXYZ?;
284
322
  private static _workXY0?;
285
323
  private static _workXY1?;
@@ -343,6 +381,35 @@ export declare class PolygonOps {
343
381
  * @see BarycentricTriangle.pointToFraction
344
382
  */
345
383
  static convexBarycentricCoordinates(polygon: Point3d[] | IndexedXYZCollection, point: Point3d, tolerance?: number): number[] | undefined;
384
+ /**
385
+ * Force the polygon to be closed.
386
+ * * If first and last points are not within tolerance, push copy of first point
387
+ * * If first and last points are within tolerance, set last point equal to first
388
+ * @param polygon input polygon
389
+ * @param tolerance closure distance tolerance
390
+ */
391
+ static forceClosure(polygon: Point3d[] | GrowableXYZArray, tolerance?: number): void;
392
+ /**
393
+ * Return a closed polygon, cloning only if necessary.
394
+ * * If the first and last points are not identical, call [[forceClosure]] on a clone of the polygon and return it.
395
+ * * If the first and last points are already identical, just return the input.
396
+ * @param polygon input polygon
397
+ * @param tolerance closure distance tolerance
398
+ */
399
+ static ensureClosed(polygon: Point3d[] | IndexedXYZCollection, tolerance?: number): Point3d[] | IndexedXYZCollection;
400
+ private static _workCLDPair?;
401
+ /**
402
+ * Find smallest distance between polygons.
403
+ * * For efficiency, input polygons should include closure edge.
404
+ * * If searching interiors for close approaches, the polygons are assumed to be convex.
405
+ * @param polygonA first polygon
406
+ * @param polygonB second polygon
407
+ * @param dMax optional largest approach distance to consider
408
+ * @param _searchInterior If true, include (convex) polygon interiors in computations (currently unimplemented).
409
+ * If false (default): return closest approach between polygon boundaries only, using [[PolylineOps.closestApproach]].
410
+ * @return pair of details, one per polygon. The `a` field of each detail stores the closest approach distance.
411
+ */
412
+ static closestApproach(polygonA: Point3d[] | IndexedXYZCollection, polygonB: Point3d[] | IndexedXYZCollection, dMax?: number, _searchInterior?: boolean): PolygonLocationDetailPair | undefined;
346
413
  }
347
414
  /**
348
415
  * `IndexedXYZCollectionPolygonOps` class contains _static_ methods for typical operations on polygons carried as `IndexedXYZCollection`
@@ -1 +1 @@
1
- {"version":3,"file":"PolygonOps.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PolygonOps.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG7F,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAU,MAAM,YAAY,CAAC;AAE3C;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,sCAAsC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAC3B,CAAC,EAAE,QAAQ,CAAC;IACnB,iFAAiF;IAC1E,IAAI,EAAE,eAAe,CAAC;IAC7B,wEAAwE;IACjE,gBAAgB,EAAE,MAAM,CAAC;IAChC,mEAAmE;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IAEhC,OAAO;IASP,8BAA8B;IACvB,UAAU;IASjB;;OAEG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAQ3E;;OAEG;IACI,gBAAgB,CAAC,KAAK,EAAE,qBAAqB;IASpD,oCAAoC;IACpC,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED,2EAA2E;IA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AC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI;IAI9G;;;;;OAKG;WACW,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,SAAS,GAAE,MAAqC;CA0CpK"}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Point3dArrayPolygonOps = exports.IndexedXYZCollectionPolygonOps = exports.PolygonOps = exports.CutLoopMergeContext = exports.CutLoop = exports.PolygonLocationDetail = void 0;
7
+ exports.Point3dArrayPolygonOps = exports.IndexedXYZCollectionPolygonOps = exports.PolygonOps = exports.CutLoopMergeContext = exports.CutLoop = exports.PolygonLocationDetailPair = exports.PolygonLocationDetail = void 0;
8
8
  /** @packageDocumentation
9
9
  * @module CartesianGeometry
10
10
  */
@@ -21,6 +21,7 @@ const Plane3dByOriginAndUnitNormal_1 = require("./Plane3dByOriginAndUnitNormal")
21
21
  const Point2dVector2d_1 = require("./Point2dVector2d");
22
22
  const Point3dArrayCarrier_1 = require("./Point3dArrayCarrier");
23
23
  const Point3dVector3d_1 = require("./Point3dVector3d");
24
+ const PolylineOps_1 = require("./PolylineOps");
24
25
  const Ray3d_1 = require("./Ray3d");
25
26
  const SortablePolygon_1 = require("./SortablePolygon");
26
27
  /**
@@ -76,8 +77,54 @@ class PolygonLocationDetail {
76
77
  this.code === Geometry_1.PolygonLocation.OnPolygonVertex || this.code === Geometry_1.PolygonLocation.OnPolygonEdgeInterior ||
77
78
  this.code === Geometry_1.PolygonLocation.InsidePolygonProjectsToVertex || this.code === Geometry_1.PolygonLocation.InsidePolygonProjectsToEdgeInterior;
78
79
  }
80
+ /**
81
+ * Set point, index, and fraction for an "at vertex" or "along edge" PolygonLocationDetail.
82
+ * * Point is not captured; its coordinates are copied.
83
+ */
84
+ static createAtVertexOrEdge(point, index, fraction = 0) {
85
+ const detail = new PolygonLocationDetail();
86
+ detail.point.setFrom(point);
87
+ detail.closestEdgeIndex = index;
88
+ detail.closestEdgeParam = fraction;
89
+ fraction = Geometry_1.Geometry.clamp(fraction, 0, 1);
90
+ detail.code = (fraction > 0 && fraction < 1) ? Geometry_1.PolygonLocation.OnPolygonEdgeInterior : Geometry_1.PolygonLocation.OnPolygonVertex;
91
+ return detail;
92
+ }
79
93
  }
80
94
  exports.PolygonLocationDetail = PolygonLocationDetail;
95
+ /**
96
+ * A pair of PolygonLocationDetail.
97
+ * @public
98
+ */
99
+ class PolygonLocationDetailPair {
100
+ /** Constructor, captures inputs */
101
+ constructor(detailA, detailB) {
102
+ this.detailA = detailA ? detailA : PolygonLocationDetail.create();
103
+ this.detailB = detailB ? detailB : PolygonLocationDetail.create();
104
+ }
105
+ /** Create an instance by capturing inputs */
106
+ static create(detailA, detailB, result) {
107
+ if (!result)
108
+ return new PolygonLocationDetailPair(detailA, detailB);
109
+ result.detailA = detailA;
110
+ result.detailB = detailB;
111
+ return result;
112
+ }
113
+ /** Make a deep copy of this PolygonLocationDetailPair */
114
+ clone(result) {
115
+ result = result ? result : new PolygonLocationDetailPair();
116
+ result.detailA.copyContentsFrom(this.detailA);
117
+ result.detailB.copyContentsFrom(this.detailB);
118
+ return result;
119
+ }
120
+ /** Swap the details of A, B */
121
+ swapDetails() {
122
+ const q = this.detailA;
123
+ this.detailA = this.detailB;
124
+ this.detailB = q;
125
+ }
126
+ }
127
+ exports.PolygonLocationDetailPair = PolygonLocationDetailPair;
81
128
  /**
82
129
  * Carrier for a loop extracted from clip operation, annotated for sorting
83
130
  * @internal
@@ -800,13 +847,14 @@ class PolygonOps {
800
847
  return sortedLoopsArray;
801
848
  }
802
849
  /** Compute the closest point on the polygon boundary to the given point.
850
+ * * Compare to [[closestPoint]].
803
851
  * @param polygon points of the polygon, closure point optional
804
852
  * @param testPoint point p to project onto the polygon edges. Works best when p is in the plane of the polygon.
805
853
  * @param tolerance optional distance tolerance to determine point-vertex and point-edge coincidence.
806
854
  * @param result optional pre-allocated object to fill and return
807
855
  * @returns details d of the closest point `d.point`:
808
856
  * * `d.isValid()` returns true if and only if the polygon is nontrivial.
809
- * * `d.edgeIndex` and `d.edgeParam` specify the location of the closest point, within `distTol`.
857
+ * * `d.edgeIndex` and `d.edgeParam` specify the location of the closest point.
810
858
  * * `d.code` classifies the closest point as a vertex (`PolygonLocation.OnPolygonVertex`) or as a point on an edge (`PolygonLocation.OnPolygonEdgeInterior`).
811
859
  * * `d.a` is the distance from testPoint to the closest point.
812
860
  * * `d.v` can be used to classify p (if p and polygon are coplanar): if n is the polygon normal then `d.v.dotProduct(n)` is +/-/0 if and only if p is inside/outside/on the polygon.
@@ -859,7 +907,7 @@ class PolygonOps {
859
907
  }
860
908
  if (distToStart2 < minDist2) {
861
909
  if (polygon.dotProductIndexIndexXYAndZ(iBase, iPrev, testPoint) <= 0.0) {
862
- // update candidate (to edge start) only if previous edge was NOOP
910
+ // update candidate (to edge start) only if testPoint projected beyond previous edge end
863
911
  polygon.getPoint3dAtUncheckedPointIndex(iBase, result.point);
864
912
  result.a = Math.sqrt(distToStart2);
865
913
  polygon.crossProductIndexIndexIndex(iBase, iPrev, iNext, result.v);
@@ -923,6 +971,41 @@ class PolygonOps {
923
971
  }
924
972
  return result;
925
973
  }
974
+ /**
975
+ * Compute the closest point on the polygon boundary or its interior to the given point.
976
+ * * Compare to [[closestPointOnBoundary]].
977
+ * @param polygon points of the polygon, closure point optional
978
+ * @param testPoint point p to project onto the polygon edges. Works best when p is in the plane of the polygon.
979
+ * @param tolerance optional distance tolerance for distinguishing boundary versus interior closest point.
980
+ * @param result optional pre-allocated object to fill and return
981
+ * @returns details d of the closest point `d.point`:
982
+ * * `d.isValid()` returns true if and only if the polygon is nontrivial.
983
+ * * `d.edgeIndex` and `d.edgeParam` specify the location of the (nearest) boundary point.
984
+ * * `d.code` classifies the closest point: `PolygonLocation.OnPolygonVertex`, `PolygonLocation.OnPolygonEdgeInterior`, `PolygonLocation.InsidePolygonProjectsToVertex`, or `PolygonLocation.InsidePolygonProjectsToEdgeInterior`.
985
+ * * `d.a` is the distance from testPoint to the closest point.
986
+ */
987
+ static closestPoint(polygon, testPoint, tolerance = Geometry_1.Geometry.smallMetricDistance, result) {
988
+ if (!(polygon instanceof IndexedXYZCollection_1.IndexedXYZCollection))
989
+ return this.closestPoint(new Point3dArrayCarrier_1.Point3dArrayCarrier(polygon), testPoint, tolerance, result);
990
+ if (!this.unitNormal(polygon, this._normal))
991
+ return PolygonLocationDetail.create(result); // invalid
992
+ const polygonPlane = this._workPlane = Plane3dByOriginAndUnitNormal_1.Plane3dByOriginAndUnitNormal.createXYZUVW(polygon.getXAtUncheckedPointIndex(0), polygon.getYAtUncheckedPointIndex(0), polygon.getZAtUncheckedPointIndex(0), this._normal.x, this._normal.y, this._normal.z, this._workPlane);
993
+ const planePoint = this._workXYZ = polygonPlane.projectPointToPlane(testPoint, this._workXYZ);
994
+ result = this.closestPointOnBoundary(polygon, planePoint, tolerance, result);
995
+ if (result.isValid) {
996
+ const dot = result.v.dotProduct(this._normal);
997
+ if (dot > 0.0) { // planePoint is inside, so return it instead of the closest boundary point
998
+ result.point.setFrom(planePoint);
999
+ if (Geometry_1.PolygonLocation.OnPolygonVertex === result.code)
1000
+ result.code = Geometry_1.PolygonLocation.InsidePolygonProjectsToVertex;
1001
+ else if (Geometry_1.PolygonLocation.OnPolygonEdgeInterior === result.code)
1002
+ result.code = Geometry_1.PolygonLocation.InsidePolygonProjectsToEdgeInterior;
1003
+ }
1004
+ result.a = testPoint.distance(result.point);
1005
+ result.v.setZero(); // not relevant
1006
+ }
1007
+ return result;
1008
+ }
926
1009
  /** Compute the intersection of a line (parameterized as a ray) with the plane of this polygon.
927
1010
  * @param polygon points of the polygon, closure point optional
928
1011
  * @param ray infinite line to intersect, as a ray
@@ -940,7 +1023,7 @@ class PolygonOps {
940
1023
  if (!this.unitNormal(polygon, this._normal))
941
1024
  return PolygonLocationDetail.create(result); // invalid
942
1025
  this._workPlane = Plane3dByOriginAndUnitNormal_1.Plane3dByOriginAndUnitNormal.createXYZUVW(polygon.getXAtUncheckedPointIndex(0), polygon.getYAtUncheckedPointIndex(0), polygon.getZAtUncheckedPointIndex(0), this._normal.x, this._normal.y, this._normal.z, this._workPlane);
943
- const intersectionPoint = Point3dVector3d_1.Point3d.createZero(this._workXYZ);
1026
+ const intersectionPoint = this._workXYZ = Point3dVector3d_1.Point3d.createZero(this._workXYZ);
944
1027
  const rayParam = ray.intersectionWithPlane(this._workPlane, intersectionPoint);
945
1028
  if (undefined === rayParam)
946
1029
  return PolygonLocationDetail.create(result);
@@ -1113,6 +1196,71 @@ class PolygonOps {
1113
1196
  coords[i] *= scale; // normalized
1114
1197
  return coords;
1115
1198
  }
1199
+ /**
1200
+ * Force the polygon to be closed.
1201
+ * * If first and last points are not within tolerance, push copy of first point
1202
+ * * If first and last points are within tolerance, set last point equal to first
1203
+ * @param polygon input polygon
1204
+ * @param tolerance closure distance tolerance
1205
+ */
1206
+ static forceClosure(polygon, tolerance = Geometry_1.Geometry.smallMetricDistance) {
1207
+ if (polygon.length >= 2) {
1208
+ if (polygon instanceof GrowableXYZArray_1.GrowableXYZArray) {
1209
+ polygon.forceClosure(tolerance);
1210
+ }
1211
+ else if (polygon[0].distance(polygon[polygon.length - 1]) > tolerance) {
1212
+ polygon.push(polygon[0].clone());
1213
+ }
1214
+ else {
1215
+ polygon[polygon.length - 1].setFromPoint3d(polygon[0]);
1216
+ }
1217
+ }
1218
+ }
1219
+ /**
1220
+ * Return a closed polygon, cloning only if necessary.
1221
+ * * If the first and last points are not identical, call [[forceClosure]] on a clone of the polygon and return it.
1222
+ * * If the first and last points are already identical, just return the input.
1223
+ * @param polygon input polygon
1224
+ * @param tolerance closure distance tolerance
1225
+ */
1226
+ static ensureClosed(polygon, tolerance = Geometry_1.Geometry.smallMetricDistance) {
1227
+ if (polygon.length >= 2) {
1228
+ let forceClosure = false;
1229
+ if (polygon instanceof IndexedXYZCollection_1.IndexedXYZCollection)
1230
+ forceClosure = !polygon.almostEqualIndexIndex(0, polygon.length - 1, 0.0);
1231
+ else
1232
+ forceClosure = !polygon[0].isExactEqual(polygon[polygon.length - 1]);
1233
+ if (forceClosure) {
1234
+ const cloned = GrowableXYZArray_1.GrowableXYZArray.create(polygon);
1235
+ this.forceClosure(cloned, tolerance);
1236
+ polygon = cloned;
1237
+ }
1238
+ }
1239
+ return polygon;
1240
+ }
1241
+ /**
1242
+ * Find smallest distance between polygons.
1243
+ * * For efficiency, input polygons should include closure edge.
1244
+ * * If searching interiors for close approaches, the polygons are assumed to be convex.
1245
+ * @param polygonA first polygon
1246
+ * @param polygonB second polygon
1247
+ * @param dMax optional largest approach distance to consider
1248
+ * @param _searchInterior If true, include (convex) polygon interiors in computations (currently unimplemented).
1249
+ * If false (default): return closest approach between polygon boundaries only, using [[PolylineOps.closestApproach]].
1250
+ * @return pair of details, one per polygon. The `a` field of each detail stores the closest approach distance.
1251
+ */
1252
+ static closestApproach(polygonA, polygonB, dMax = Number.MAX_VALUE, _searchInterior = false) {
1253
+ // TODO: handle interior close approaches as well...
1254
+ let result;
1255
+ const polyA = this.ensureClosed(polygonA);
1256
+ const polyB = this.ensureClosed(polygonB);
1257
+ const cld = this._workCLDPair = PolylineOps_1.PolylineOps.closestApproach(polyA, false, polyB, false, dMax, this._workCLDPair);
1258
+ if (cld && cld.detailA.childDetail && cld.detailB.childDetail) {
1259
+ result = PolygonLocationDetailPair.create(PolygonLocationDetail.createAtVertexOrEdge(cld.detailA.point, cld.detailA.childDetail.a, cld.detailA.childDetail.fraction), PolygonLocationDetail.createAtVertexOrEdge(cld.detailB.point, cld.detailB.childDetail.a, cld.detailB.childDetail.fraction));
1260
+ result.detailA.a = result.detailB.a = cld.detailA.a;
1261
+ }
1262
+ return result;
1263
+ }
1116
1264
  }
1117
1265
  /** These values are the integrated area moment products [xx,xy,xz, x]
1118
1266
  * for a right triangle in the first quadrant at the origin -- (0,0),(1,0),(0,1)