@itwin/core-geometry 4.1.0-dev.7 → 4.1.0-dev.70

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 (542) hide show
  1. package/CHANGELOG.md +82 -1
  2. package/lib/cjs/Geometry.js.map +1 -1
  3. package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
  4. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.js +2 -2
  6. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  7. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineSurface.js +1 -1
  9. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  10. package/lib/cjs/bspline/BezierCurveBase.d.ts +1 -1
  11. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BezierCurveBase.js +2 -2
  13. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  14. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  15. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  16. package/lib/cjs/clipping/ClipPrimitive.js +2 -0
  17. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  18. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  19. package/lib/cjs/core-geometry.d.ts +3 -1
  20. package/lib/cjs/core-geometry.d.ts.map +1 -1
  21. package/lib/cjs/core-geometry.js +3 -1
  22. package/lib/cjs/core-geometry.js.map +1 -1
  23. package/lib/cjs/curve/Arc3d.d.ts +2 -1
  24. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  25. package/lib/cjs/curve/Arc3d.js +3 -2
  26. package/lib/cjs/curve/Arc3d.js.map +1 -1
  27. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +62 -42
  28. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  29. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +71 -48
  30. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  31. package/lib/cjs/curve/CurveCollection.d.ts +36 -26
  32. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  33. package/lib/cjs/curve/CurveCollection.js +46 -39
  34. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  35. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  36. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  37. package/lib/cjs/curve/CurveFactory.d.ts +67 -3
  38. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  39. package/lib/cjs/curve/CurveFactory.js +75 -7
  40. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  41. package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
  42. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  43. package/lib/cjs/curve/CurveLocationDetail.js +9 -7
  44. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  45. package/lib/cjs/curve/CurveOps.d.ts +77 -0
  46. package/lib/cjs/curve/CurveOps.d.ts.map +1 -0
  47. package/lib/cjs/curve/CurveOps.js +160 -0
  48. package/lib/cjs/curve/CurveOps.js.map +1 -0
  49. package/lib/cjs/curve/CurvePrimitive.d.ts +17 -16
  50. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  51. package/lib/cjs/curve/CurvePrimitive.js +4 -3
  52. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  53. package/lib/cjs/curve/GeometryQuery.d.ts +2 -2
  54. package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
  55. package/lib/cjs/curve/GeometryQuery.js +2 -2
  56. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  57. package/lib/cjs/curve/LineSegment3d.d.ts +7 -5
  58. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  59. package/lib/cjs/curve/LineSegment3d.js +6 -6
  60. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  61. package/lib/cjs/curve/LineString3d.d.ts +2 -2
  62. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  63. package/lib/cjs/curve/LineString3d.js +3 -3
  64. package/lib/cjs/curve/LineString3d.js.map +1 -1
  65. package/lib/cjs/curve/Loop.d.ts +7 -5
  66. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  67. package/lib/cjs/curve/Loop.js +18 -6
  68. package/lib/cjs/curve/Loop.js.map +1 -1
  69. package/lib/cjs/curve/OffsetOptions.d.ts +97 -0
  70. package/lib/cjs/curve/OffsetOptions.d.ts.map +1 -0
  71. package/lib/cjs/curve/OffsetOptions.js +166 -0
  72. package/lib/cjs/curve/OffsetOptions.js.map +1 -0
  73. package/lib/cjs/curve/ParityRegion.d.ts +7 -7
  74. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  75. package/lib/cjs/curve/ParityRegion.js +19 -11
  76. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  77. package/lib/cjs/curve/Path.d.ts +6 -6
  78. package/lib/cjs/curve/Path.d.ts.map +1 -1
  79. package/lib/cjs/curve/Path.js +15 -9
  80. package/lib/cjs/curve/Path.js.map +1 -1
  81. package/lib/cjs/curve/ProxyCurve.d.ts +5 -7
  82. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  83. package/lib/cjs/curve/ProxyCurve.js +7 -7
  84. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  85. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  86. package/lib/cjs/curve/RegionOps.d.ts +76 -56
  87. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  88. package/lib/cjs/curve/RegionOps.js +83 -60
  89. package/lib/cjs/curve/RegionOps.js.map +1 -1
  90. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +2 -2
  91. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  92. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  93. package/lib/cjs/curve/StrokeOptions.js +6 -2
  94. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  95. package/lib/cjs/curve/UnionRegion.d.ts +6 -5
  96. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  97. package/lib/cjs/curve/UnionRegion.js +17 -8
  98. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  99. package/lib/cjs/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
  100. package/lib/cjs/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
  101. package/lib/cjs/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
  102. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -0
  103. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
  104. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  105. package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
  106. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  107. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +59 -70
  108. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  109. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +130 -220
  110. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  111. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  112. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  113. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  114. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  115. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
  116. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  117. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +89 -178
  118. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  119. package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  120. package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
  121. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  122. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -1
  123. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  124. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  125. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  126. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +2 -2
  127. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  128. package/lib/cjs/curve/spiral/XYCurveEvaluator.js +1 -1
  129. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  130. package/lib/cjs/geometry3d/Angle.d.ts +9 -0
  131. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  132. package/lib/cjs/geometry3d/Angle.js +13 -0
  133. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  134. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  135. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  136. package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
  137. package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
  138. package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
  139. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  140. package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
  141. package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
  142. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  143. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  144. package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
  145. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  146. package/lib/cjs/geometry3d/GeometryHandler.d.ts +5 -5
  147. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  148. package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
  149. package/lib/cjs/geometry3d/GrowableBlockedArray.js +1 -1
  150. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  151. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  152. package/lib/cjs/geometry3d/GrowableFloat64Array.js +1 -1
  153. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  154. package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
  155. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  156. package/lib/cjs/geometry3d/Matrix3d.js +32 -5
  157. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  158. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  159. package/lib/cjs/geometry3d/Plane3d.d.ts +41 -32
  160. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  161. package/lib/cjs/geometry3d/Plane3d.js +11 -8
  162. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  163. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
  164. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  165. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
  166. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  167. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  168. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  169. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +37 -32
  170. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  171. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +8 -9
  172. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  173. package/lib/cjs/geometry3d/Point2dVector2d.js +9 -10
  174. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  175. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  176. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +12 -4
  177. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  178. package/lib/cjs/geometry3d/Point3dVector3d.js +18 -5
  179. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  180. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  181. package/lib/cjs/geometry3d/PointHelpers.js +5 -5
  182. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  183. package/lib/cjs/geometry3d/PolygonOps.d.ts +1 -2
  184. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  185. package/lib/cjs/geometry3d/PolygonOps.js +2 -3
  186. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  187. package/lib/cjs/geometry3d/PolylineOps.d.ts +16 -1
  188. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  189. package/lib/cjs/geometry3d/PolylineOps.js +55 -0
  190. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  191. package/lib/cjs/geometry3d/Range.d.ts +134 -94
  192. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  193. package/lib/cjs/geometry3d/Range.js +297 -145
  194. package/lib/cjs/geometry3d/Range.js.map +1 -1
  195. package/lib/cjs/geometry3d/Ray2d.d.ts +69 -0
  196. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -0
  197. package/lib/cjs/geometry3d/Ray2d.js +146 -0
  198. package/lib/cjs/geometry3d/Ray2d.js.map +1 -0
  199. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  200. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  201. package/lib/cjs/geometry3d/Transform.d.ts +10 -3
  202. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  203. package/lib/cjs/geometry3d/Transform.js +18 -6
  204. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  205. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  206. package/lib/cjs/numerics/ConvexPolygon2d.d.ts +7 -49
  207. package/lib/cjs/numerics/ConvexPolygon2d.d.ts.map +1 -1
  208. package/lib/cjs/numerics/ConvexPolygon2d.js +16 -107
  209. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  210. package/lib/cjs/numerics/Newton.js.map +1 -1
  211. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  212. package/lib/cjs/numerics/Polynomials.js +0 -2
  213. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  214. package/lib/cjs/numerics/Quadrature.js +5 -5
  215. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  216. package/lib/cjs/polyface/IndexedEdgeMatcher.js +1 -1
  217. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  218. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  219. package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
  220. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  221. package/lib/cjs/polyface/PolyfaceQuery.d.ts +73 -12
  222. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  223. package/lib/cjs/polyface/PolyfaceQuery.js +117 -31
  224. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  225. package/lib/cjs/polyface/TaggedNumericData.js +1 -1
  226. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  227. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
  228. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  229. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  230. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
  231. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  232. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +79 -1
  233. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  234. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  235. package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
  236. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  237. package/lib/cjs/serialization/GeometrySamples.js +30 -0
  238. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  239. package/lib/cjs/serialization/IModelJsonSchema.d.ts +2 -7
  240. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  241. package/lib/cjs/serialization/IModelJsonSchema.js +2 -7
  242. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  243. package/lib/cjs/solid/LinearSweep.d.ts +2 -1
  244. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  245. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  246. package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
  247. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  248. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  249. package/lib/cjs/solid/RuledSweep.d.ts +2 -1
  250. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  251. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  252. package/lib/cjs/solid/SweepContour.d.ts +2 -2
  253. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  254. package/lib/cjs/solid/SweepContour.js +9 -0
  255. package/lib/cjs/solid/SweepContour.js.map +1 -1
  256. package/lib/cjs/topology/ChainMerge.js +1 -1
  257. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  258. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  259. package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -1
  260. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  261. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +1 -1
  262. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  263. package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  264. package/lib/cjs/topology/HalfEdgePriorityQueue.js +1 -1
  265. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  266. package/lib/cjs/topology/RegularizeFace.js +3 -3
  267. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  268. package/lib/cjs/topology/Triangulation.js +1 -1
  269. package/lib/cjs/topology/Triangulation.js.map +1 -1
  270. package/lib/esm/Geometry.js.map +1 -1
  271. package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
  272. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  273. package/lib/esm/bspline/BSplineCurve.js +1 -1
  274. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  275. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  276. package/lib/esm/bspline/BSplineSurface.js +1 -1
  277. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  278. package/lib/esm/bspline/BezierCurveBase.d.ts +1 -1
  279. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  280. package/lib/esm/bspline/BezierCurveBase.js +1 -1
  281. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  282. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  283. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  284. package/lib/esm/clipping/ClipPrimitive.js +2 -0
  285. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  286. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  287. package/lib/esm/core-geometry.d.ts +3 -1
  288. package/lib/esm/core-geometry.d.ts.map +1 -1
  289. package/lib/esm/core-geometry.js +3 -1
  290. package/lib/esm/core-geometry.js.map +1 -1
  291. package/lib/esm/curve/Arc3d.d.ts +2 -1
  292. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  293. package/lib/esm/curve/Arc3d.js +2 -1
  294. package/lib/esm/curve/Arc3d.js.map +1 -1
  295. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +62 -42
  296. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  297. package/lib/esm/curve/CurveChainWithDistanceIndex.js +70 -47
  298. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  299. package/lib/esm/curve/CurveCollection.d.ts +36 -26
  300. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  301. package/lib/esm/curve/CurveCollection.js +46 -39
  302. package/lib/esm/curve/CurveCollection.js.map +1 -1
  303. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  304. package/lib/esm/curve/CurveCurve.js.map +1 -1
  305. package/lib/esm/curve/CurveFactory.d.ts +67 -3
  306. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  307. package/lib/esm/curve/CurveFactory.js +74 -6
  308. package/lib/esm/curve/CurveFactory.js.map +1 -1
  309. package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
  310. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  311. package/lib/esm/curve/CurveLocationDetail.js +9 -7
  312. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  313. package/lib/esm/curve/CurveOps.d.ts +77 -0
  314. package/lib/esm/curve/CurveOps.d.ts.map +1 -0
  315. package/lib/esm/curve/CurveOps.js +156 -0
  316. package/lib/esm/curve/CurveOps.js.map +1 -0
  317. package/lib/esm/curve/CurvePrimitive.d.ts +17 -16
  318. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  319. package/lib/esm/curve/CurvePrimitive.js +4 -3
  320. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  321. package/lib/esm/curve/GeometryQuery.d.ts +2 -2
  322. package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
  323. package/lib/esm/curve/GeometryQuery.js +2 -2
  324. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  325. package/lib/esm/curve/LineSegment3d.d.ts +7 -5
  326. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  327. package/lib/esm/curve/LineSegment3d.js +5 -5
  328. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  329. package/lib/esm/curve/LineString3d.d.ts +2 -2
  330. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  331. package/lib/esm/curve/LineString3d.js +2 -2
  332. package/lib/esm/curve/LineString3d.js.map +1 -1
  333. package/lib/esm/curve/Loop.d.ts +7 -5
  334. package/lib/esm/curve/Loop.d.ts.map +1 -1
  335. package/lib/esm/curve/Loop.js +18 -6
  336. package/lib/esm/curve/Loop.js.map +1 -1
  337. package/lib/esm/curve/OffsetOptions.d.ts +97 -0
  338. package/lib/esm/curve/OffsetOptions.d.ts.map +1 -0
  339. package/lib/esm/curve/OffsetOptions.js +161 -0
  340. package/lib/esm/curve/OffsetOptions.js.map +1 -0
  341. package/lib/esm/curve/ParityRegion.d.ts +7 -7
  342. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  343. package/lib/esm/curve/ParityRegion.js +19 -11
  344. package/lib/esm/curve/ParityRegion.js.map +1 -1
  345. package/lib/esm/curve/Path.d.ts +6 -6
  346. package/lib/esm/curve/Path.d.ts.map +1 -1
  347. package/lib/esm/curve/Path.js +15 -9
  348. package/lib/esm/curve/Path.js.map +1 -1
  349. package/lib/esm/curve/ProxyCurve.d.ts +5 -7
  350. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  351. package/lib/esm/curve/ProxyCurve.js +7 -7
  352. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  353. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  354. package/lib/esm/curve/RegionOps.d.ts +76 -56
  355. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  356. package/lib/esm/curve/RegionOps.js +84 -61
  357. package/lib/esm/curve/RegionOps.js.map +1 -1
  358. package/lib/esm/curve/RegionOpsClassificationSweeps.js +2 -2
  359. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  360. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  361. package/lib/esm/curve/StrokeOptions.js +6 -2
  362. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  363. package/lib/esm/curve/UnionRegion.d.ts +6 -5
  364. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  365. package/lib/esm/curve/UnionRegion.js +17 -8
  366. package/lib/esm/curve/UnionRegion.js.map +1 -1
  367. package/lib/esm/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
  368. package/lib/esm/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
  369. package/lib/esm/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
  370. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -0
  371. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
  372. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  373. package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
  374. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  375. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +59 -70
  376. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  377. package/lib/esm/curve/internalContexts/MultiChainCollector.js +129 -218
  378. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  379. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  380. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  381. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  382. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  383. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
  384. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  385. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +86 -173
  386. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  387. package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  388. package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
  389. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  390. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -1
  391. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  392. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  393. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  394. package/lib/esm/curve/spiral/TransitionSpiral3d.js +1 -1
  395. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  396. package/lib/esm/curve/spiral/XYCurveEvaluator.js +1 -1
  397. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  398. package/lib/esm/geometry3d/Angle.d.ts +9 -0
  399. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  400. package/lib/esm/geometry3d/Angle.js +13 -0
  401. package/lib/esm/geometry3d/Angle.js.map +1 -1
  402. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  403. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  404. package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
  405. package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
  406. package/lib/esm/geometry3d/BilinearPatch.js +51 -55
  407. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  408. package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
  409. package/lib/esm/geometry3d/Ellipsoid.js +1 -1
  410. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  411. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  412. package/lib/esm/geometry3d/FrameBuilder.js +13 -11
  413. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  414. package/lib/esm/geometry3d/GeometryHandler.d.ts +5 -5
  415. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  416. package/lib/esm/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
  417. package/lib/esm/geometry3d/GrowableBlockedArray.js +1 -1
  418. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  419. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  420. package/lib/esm/geometry3d/GrowableFloat64Array.js +1 -1
  421. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  422. package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
  423. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  424. package/lib/esm/geometry3d/Matrix3d.js +32 -5
  425. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  426. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  427. package/lib/esm/geometry3d/Plane3d.d.ts +41 -32
  428. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  429. package/lib/esm/geometry3d/Plane3d.js +11 -8
  430. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  431. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
  432. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  433. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
  434. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  435. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  436. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  437. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +37 -32
  438. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  439. package/lib/esm/geometry3d/Point2dVector2d.d.ts +8 -9
  440. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  441. package/lib/esm/geometry3d/Point2dVector2d.js +9 -10
  442. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  443. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  444. package/lib/esm/geometry3d/Point3dVector3d.d.ts +12 -4
  445. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  446. package/lib/esm/geometry3d/Point3dVector3d.js +18 -5
  447. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  448. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  449. package/lib/esm/geometry3d/PointHelpers.js +5 -5
  450. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  451. package/lib/esm/geometry3d/PolygonOps.d.ts +1 -2
  452. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  453. package/lib/esm/geometry3d/PolygonOps.js +2 -3
  454. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  455. package/lib/esm/geometry3d/PolylineOps.d.ts +16 -1
  456. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  457. package/lib/esm/geometry3d/PolylineOps.js +56 -1
  458. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  459. package/lib/esm/geometry3d/Range.d.ts +134 -94
  460. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  461. package/lib/esm/geometry3d/Range.js +297 -145
  462. package/lib/esm/geometry3d/Range.js.map +1 -1
  463. package/lib/esm/geometry3d/Ray2d.d.ts +69 -0
  464. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -0
  465. package/lib/esm/geometry3d/Ray2d.js +142 -0
  466. package/lib/esm/geometry3d/Ray2d.js.map +1 -0
  467. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  468. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  469. package/lib/esm/geometry3d/Transform.d.ts +10 -3
  470. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  471. package/lib/esm/geometry3d/Transform.js +18 -6
  472. package/lib/esm/geometry3d/Transform.js.map +1 -1
  473. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  474. package/lib/esm/numerics/ConvexPolygon2d.d.ts +7 -49
  475. package/lib/esm/numerics/ConvexPolygon2d.d.ts.map +1 -1
  476. package/lib/esm/numerics/ConvexPolygon2d.js +14 -104
  477. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  478. package/lib/esm/numerics/Newton.js.map +1 -1
  479. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  480. package/lib/esm/numerics/Polynomials.js +0 -2
  481. package/lib/esm/numerics/Polynomials.js.map +1 -1
  482. package/lib/esm/numerics/Quadrature.js +5 -5
  483. package/lib/esm/numerics/Quadrature.js.map +1 -1
  484. package/lib/esm/polyface/IndexedEdgeMatcher.js +1 -1
  485. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  486. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  487. package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
  488. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  489. package/lib/esm/polyface/PolyfaceQuery.d.ts +73 -12
  490. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  491. package/lib/esm/polyface/PolyfaceQuery.js +117 -32
  492. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  493. package/lib/esm/polyface/TaggedNumericData.js +1 -1
  494. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  495. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
  496. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  497. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  498. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
  499. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  500. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +78 -1
  501. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  502. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  503. package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
  504. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  505. package/lib/esm/serialization/GeometrySamples.js +30 -0
  506. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  507. package/lib/esm/serialization/IModelJsonSchema.d.ts +2 -7
  508. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  509. package/lib/esm/serialization/IModelJsonSchema.js +2 -7
  510. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  511. package/lib/esm/solid/LinearSweep.d.ts +2 -1
  512. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  513. package/lib/esm/solid/LinearSweep.js.map +1 -1
  514. package/lib/esm/solid/RotationalSweep.d.ts +2 -1
  515. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  516. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  517. package/lib/esm/solid/RuledSweep.d.ts +2 -1
  518. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  519. package/lib/esm/solid/RuledSweep.js.map +1 -1
  520. package/lib/esm/solid/SweepContour.d.ts +2 -2
  521. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  522. package/lib/esm/solid/SweepContour.js +9 -0
  523. package/lib/esm/solid/SweepContour.js.map +1 -1
  524. package/lib/esm/topology/ChainMerge.js +1 -1
  525. package/lib/esm/topology/ChainMerge.js.map +1 -1
  526. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  527. package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -1
  528. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  529. package/lib/esm/topology/HalfEdgeGraphSpineContext.js +1 -1
  530. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  531. package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  532. package/lib/esm/topology/HalfEdgePriorityQueue.js +1 -1
  533. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  534. package/lib/esm/topology/RegularizeFace.js +3 -3
  535. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  536. package/lib/esm/topology/Triangulation.js +1 -1
  537. package/lib/esm/topology/Triangulation.js.map +1 -1
  538. package/package.json +6 -17
  539. package/lib/cjs/curve/ChainCollectorContext.d.ts.map +0 -1
  540. package/lib/cjs/curve/ChainCollectorContext.js.map +0 -1
  541. package/lib/esm/curve/ChainCollectorContext.d.ts.map +0 -1
  542. package/lib/esm/curve/ChainCollectorContext.js.map +0 -1
@@ -240,18 +240,20 @@ class FrameBuilder {
240
240
  return result;
241
241
  }
242
242
  }
243
- // try direct evaluation of curve primitives?
243
+ const evaluatePrimitiveFrame = (curve) => {
244
+ return curve.fractionToFrenetFrame(0.0);
245
+ };
246
+ // try direct evaluation of curve primitives using the above lambda
244
247
  for (const data of params) {
245
- if (data instanceof CurveCollection_1.CurveCollection) {
246
- const children = data.children;
247
- if (children) {
248
- for (const curve of children) {
249
- if (curve instanceof CurvePrimitive_1.CurvePrimitive) {
250
- const frenetFrame = curve.fractionToFrenetFrame(0.0);
251
- if (frenetFrame)
252
- return frenetFrame;
253
- }
254
- }
248
+ if (data instanceof CurvePrimitive_1.CurvePrimitive) {
249
+ return evaluatePrimitiveFrame(data);
250
+ }
251
+ else if (data instanceof CurveCollection_1.CurveCollection) {
252
+ const children = data.collectCurvePrimitives();
253
+ for (const curve of children) {
254
+ const frenetFrame = evaluatePrimitiveFrame(curve);
255
+ if (frenetFrame)
256
+ return frenetFrame;
255
257
  }
256
258
  }
257
259
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FrameBuilder.js","sourceRoot":"","sources":["../../../src/geometry3d/FrameBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,0DAAyD;AACzD,0EAAuE;AACvE,0CAAuC;AACvC,8DAA2D;AAC3D,4DAAyD;AACzD,0DAAuD;AACvD,wDAAqD;AACr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,GAAG,GAAG,CAAC;QACZ,IAAI,WAAW,KAAK,0BAAe,CAAC,qBAAqB,EAAE;YACzD,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,mBAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,iBAAiB,CAAC,CAAC;SACvF;aAAM,IAAI,WAAW,KAAK,0BAAe,CAAC,0BAA0B,EAAE;YACrE,CAAC,GAAG,mBAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,GAAG,mBAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACnH,CAAC,GAAG,mBAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,GAAG,mBAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACnH,CAAC,GAAG,mBAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,GAAG,mBAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACpH;QACD,OAAO,qBAAS,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,mBAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrH,CAAC;CAEF;AAnSD,oCAmSC","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 CartesianGeometry\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Point3dArray } from \"./PointHelpers\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\r\n *\r\n * * For the common case of building a right handed frame:\r\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\r\n * * the frame will be fully determined by an origin and two vectors.\r\n * * the first call to announcePoint will set the origin.\r\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\r\n * * After each announcement, call getValidatedFrame(false)\r\n * * getValidatedFrame will succeed when it has two independent vectors.\r\n * * to build a left handed frame,\r\n * * an origin and 3 independent vectors are required.\r\n * * announce as above, but query with getValidatedFrame (true).\r\n * * this will use the third vector to select right or left handed frame.\r\n * @public\r\n */\r\nexport class FrameBuilder {\r\n private _origin: undefined | Point3d;\r\n private _vector0: undefined | Vector3d;\r\n private _vector1: undefined | Vector3d;\r\n private _vector2: undefined | Vector3d;\r\n // test if both vectors are defined and have significant angle between.\r\n private areStronglyIndependentVectors(vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians): boolean {\r\n if (vector0 !== undefined && vector1 !== undefined) {\r\n const q = vector0.smallerUnorientedRadiansTo(vector1);\r\n return q > radiansTolerance;\r\n }\r\n return false;\r\n }\r\n /** clear all accumulated point and vector data */\r\n public clear() { this._origin = undefined; this._vector0 = undefined; this._vector1 = undefined; this._vector2 = undefined; }\r\n constructor() { this.clear(); }\r\n /** Try to assemble the data into a non-singular transform.\r\n *\r\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\r\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\r\n */\r\n public getValidatedFrame(allowLeftHanded: boolean = false): Transform | undefined {\r\n if (this._origin && this._vector0 && this._vector1) {\r\n if (!allowLeftHanded) {\r\n const matrix = Matrix3d.createRigidFromColumns(this._vector0, this._vector1, AxisOrder.XYZ);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(this._origin, matrix);\r\n // uh oh -- vector1 was not really independent. clear everything after vector0.\r\n this._vector1 = this._vector2 = undefined;\r\n } else if (this._vector2) {\r\n const matrix = Matrix3d.createRigidFromColumns(this._vector0, this._vector1, AxisOrder.XYZ);\r\n if (matrix) {\r\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\r\n matrix.scaleColumns(1.0, 1.0, -1.0);\r\n return Transform.createOriginAndMatrix(this._origin, matrix);\r\n }\r\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\r\n const vector2 = this._vector2;\r\n this._vector1 = this._vector2 = undefined;\r\n this.announceVector(vector2);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\r\n public applyDefaultUpVector(vector?: Vector3d) {\r\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\r\n this._vector1 = vector.crossProduct(this._vector0);\r\n }\r\n }\r\n /** Ask if there is a defined origin for the evolving frame */\r\n public get hasOrigin(): boolean { return this._origin !== undefined; }\r\n /** Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\r\n */\r\n public savedVectorCount(): number {\r\n if (!this._vector0)\r\n return 0;\r\n if (!this._vector1)\r\n return 1;\r\n if (!this._vector2)\r\n return 2;\r\n return 3;\r\n }\r\n /** announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.*/\r\n public announcePoint(point: Point3d): number {\r\n if (!this._origin) {\r\n this._origin = point.clone();\r\n return this.savedVectorCount();\r\n }\r\n // the new point may provide an additional vector\r\n if (this._origin.isAlmostEqual(point))\r\n return this.savedVectorCount();\r\n return this.announceVector(this._origin.vectorTo(point));\r\n }\r\n /** announce a new vector. */\r\n public announceVector(vector: Vector3d): number {\r\n if (vector.isAlmostZero)\r\n return this.savedVectorCount();\r\n\r\n if (!this._vector0) { this._vector0 = vector.clone(this._vector0); return 1; }\r\n\r\n if (!this._vector1) {\r\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\r\n this._vector1 = vector.clone(this._vector1);\r\n return 2;\r\n }\r\n return 1;\r\n }\r\n\r\n // vector0 and vector1 are independent.\r\n if (!this._vector2) {\r\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\r\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\r\n this._vector2 = vector.clone(this._vector2);\r\n return 3;\r\n }\r\n return 2;\r\n }\r\n // fall through if prior vectors are all there -- no need for the new one.\r\n return 3;\r\n }\r\n /** Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes\r\n * sufficient for a coordinate system.\r\n */\r\n public announce(data: any) {\r\n if (this.savedVectorCount() > 1) return;\r\n if (data instanceof Point3d)\r\n this.announcePoint(data);\r\n else if (data instanceof Vector3d)\r\n this.announceVector(data);\r\n else if (Array.isArray(data)) {\r\n for (const child of data) {\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n this.announce(child);\r\n }\r\n } else if (data instanceof CurvePrimitive) {\r\n if (data instanceof LineSegment3d) {\r\n this.announcePoint(data.startPoint());\r\n this.announcePoint(data.endPoint());\r\n } else if (data instanceof Arc3d) {\r\n const ray = data.fractionToPointAndDerivative(0.0);\r\n this.announcePoint(ray.origin);\r\n this.announceVector(ray.direction);\r\n this.announceVector(data.matrixRef.columnZCrossVector(ray.direction));\r\n } else if (data instanceof LineString3d) {\r\n for (const point of data.points) {\r\n this.announcePoint(point);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof BSplineCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPolePoint3d(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data instanceof InterpolationCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (i < data.options.fitPoints.length) {\r\n point.setFrom(data.options.fitPoints[i]);\r\n this.announcePoint(point);\r\n } else break;\r\n }\r\n } else { // unimplemented CurvePrimitive type\r\n const frame = data.fractionToFrenetFrame(0.0);\r\n if (undefined !== frame) {\r\n this.announcePoint(frame.getOrigin());\r\n this.announceVector(frame.matrix.getColumn(0));\r\n this.announceVector(frame.matrix.getColumn(1));\r\n }\r\n }\r\n } else if (data instanceof CurveCollection) {\r\n if (data.children)\r\n for (const child of data.children) {\r\n this.announce(child);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof GrowableXYZArray) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n }\r\n }\r\n /** create a localToWorld frame for the given data.\r\n *\r\n * * origin is at first point\r\n * * x axis in direction of first nonzero vector present or implied by the input.\r\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\r\n */\r\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n builder.applyDefaultUpVector(defaultUpVector);\r\n const result = builder.getValidatedFrame(false);\r\n if (result !== undefined) {\r\n if (defaultUpVector) {\r\n if (result.matrix.dotColumnZ(defaultUpVector) < 0.0)\r\n result.matrix.scaleColumnsInPlace(1, -1, -1);\r\n }\r\n return result;\r\n }\r\n }\r\n // try direct evaluation of curve primitives?\r\n for (const data of params) {\r\n if (data instanceof CurveCollection) {\r\n const children = data.children;\r\n if (children) {\r\n for (const curve of children) {\r\n if (curve instanceof CurvePrimitive) {\r\n const frenetFrame = curve.fractionToFrenetFrame(0.0);\r\n if (frenetFrame)\r\n return frenetFrame;\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n return undefined;\r\n }\r\n /** create a transform containing points or vectors in the given data.\r\n * * The xy columns of the transform contain the first points or vectors of the data.\r\n * * The z column is perpendicular to that xy plane.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n */\r\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n const localToWorld = builder.getValidatedFrame(false);\r\n if (localToWorld !== undefined)\r\n return localToWorld;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * try to create a frame whose xy plane is through points.\r\n *\r\n * * if 3 or more distinct points are present, the x axis is from the first point to the most distance, and y direction is toward the\r\n * point most distant from that line.\r\n * @param points array of points\r\n */\r\n public static createFrameToDistantPoints(points: Point3d[]): Transform | undefined {\r\n if (points.length > 2) {\r\n const origin = points[0].clone();\r\n const vector01 = Vector3d.create();\r\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\r\n const vector02 = Vector3d.create();\r\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\r\n const matrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ);\r\n if (matrix)\r\n return Transform.createRefs(origin, matrix);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\r\n *\r\n * * if 3 or more distinct points are present, the x axis is from the first point to the most distance, and y direction is toward the\r\n * point most distant from that line.\r\n * @param points array of points\r\n */\r\n public static createFrameWithCCWPolygon(points: Point3d[]): Transform | undefined {\r\n if (points.length > 2) {\r\n const ray = PolygonOps.centroidAreaNormal(points);\r\n if (ray) {\r\n return ray.toRigidZFrame();\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\r\n * @param range [in] range to inspect\r\n * @param fractionX [in] fractional coordinate of frame origin x\r\n * @param fractionY [in] fractional coordinate of frame origin y\r\n * @param fractionZ [in] fractional coordinate of frame origin z\r\n * @param scaleSelect [in] selects size of localToWorld axes.\r\n * @param defaultAxisLength [in] if true and any axis length is 0, that axis vector takes this physical length.\r\n */\r\n public static createLocalToWorldTransformInRange(\r\n range: Range3d,\r\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\r\n fractionX: number = 0,\r\n fractionY: number = 0,\r\n fractionZ: number = 0,\r\n defaultAxisLength: number = 1.0): Transform {\r\n if (range.isNull)\r\n return Transform.createIdentity();\r\n let a = 1.0;\r\n let b = 1.0;\r\n let c = 1.0;\r\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\r\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\r\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\r\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\r\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\r\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\r\n }\r\n return Transform.createRefs(range.fractionToPoint(fractionX, fractionY, fractionZ), Matrix3d.createScale(a, b, c));\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"FrameBuilder.js","sourceRoot":"","sources":["../../../src/geometry3d/FrameB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C,CAAC,CAAC;IACrH,CAAC;CAEF;AArSD,oCAqSC","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 CartesianGeometry\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Point3dArray } from \"./PointHelpers\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\r\n *\r\n * * For the common case of building a right handed frame:\r\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\r\n * * the frame will be fully determined by an origin and two vectors.\r\n * * the first call to announcePoint will set the origin.\r\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\r\n * * After each announcement, call getValidatedFrame(false)\r\n * * getValidatedFrame will succeed when it has two independent vectors.\r\n * * to build a left handed frame,\r\n * * an origin and 3 independent vectors are required.\r\n * * announce as above, but query with getValidatedFrame (true).\r\n * * this will use the third vector to select right or left handed frame.\r\n * @public\r\n */\r\nexport class FrameBuilder {\r\n private _origin: undefined | Point3d;\r\n private _vector0: undefined | Vector3d;\r\n private _vector1: undefined | Vector3d;\r\n private _vector2: undefined | Vector3d;\r\n // test if both vectors are defined and have significant angle between.\r\n private areStronglyIndependentVectors(vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians): boolean {\r\n if (vector0 !== undefined && vector1 !== undefined) {\r\n const q = vector0.smallerUnorientedRadiansTo(vector1);\r\n return q > radiansTolerance;\r\n }\r\n return false;\r\n }\r\n /** clear all accumulated point and vector data */\r\n public clear() { this._origin = undefined; this._vector0 = undefined; this._vector1 = undefined; this._vector2 = undefined; }\r\n constructor() { this.clear(); }\r\n /** Try to assemble the data into a non-singular transform.\r\n *\r\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\r\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\r\n */\r\n public getValidatedFrame(allowLeftHanded: boolean = false): Transform | undefined {\r\n if (this._origin && this._vector0 && this._vector1) {\r\n if (!allowLeftHanded) {\r\n const matrix = Matrix3d.createRigidFromColumns(this._vector0, this._vector1, AxisOrder.XYZ);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(this._origin, matrix);\r\n // uh oh -- vector1 was not really independent. clear everything after vector0.\r\n this._vector1 = this._vector2 = undefined;\r\n } else if (this._vector2) {\r\n const matrix = Matrix3d.createRigidFromColumns(this._vector0, this._vector1, AxisOrder.XYZ);\r\n if (matrix) {\r\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\r\n matrix.scaleColumns(1.0, 1.0, -1.0);\r\n return Transform.createOriginAndMatrix(this._origin, matrix);\r\n }\r\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\r\n const vector2 = this._vector2;\r\n this._vector1 = this._vector2 = undefined;\r\n this.announceVector(vector2);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\r\n public applyDefaultUpVector(vector?: Vector3d) {\r\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\r\n this._vector1 = vector.crossProduct(this._vector0);\r\n }\r\n }\r\n /** Ask if there is a defined origin for the evolving frame */\r\n public get hasOrigin(): boolean { return this._origin !== undefined; }\r\n /** Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\r\n */\r\n public savedVectorCount(): number {\r\n if (!this._vector0)\r\n return 0;\r\n if (!this._vector1)\r\n return 1;\r\n if (!this._vector2)\r\n return 2;\r\n return 3;\r\n }\r\n /** announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.*/\r\n public announcePoint(point: Point3d): number {\r\n if (!this._origin) {\r\n this._origin = point.clone();\r\n return this.savedVectorCount();\r\n }\r\n // the new point may provide an additional vector\r\n if (this._origin.isAlmostEqual(point))\r\n return this.savedVectorCount();\r\n return this.announceVector(this._origin.vectorTo(point));\r\n }\r\n /** announce a new vector. */\r\n public announceVector(vector: Vector3d): number {\r\n if (vector.isAlmostZero)\r\n return this.savedVectorCount();\r\n\r\n if (!this._vector0) { this._vector0 = vector.clone(this._vector0); return 1; }\r\n\r\n if (!this._vector1) {\r\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\r\n this._vector1 = vector.clone(this._vector1);\r\n return 2;\r\n }\r\n return 1;\r\n }\r\n\r\n // vector0 and vector1 are independent.\r\n if (!this._vector2) {\r\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\r\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\r\n this._vector2 = vector.clone(this._vector2);\r\n return 3;\r\n }\r\n return 2;\r\n }\r\n // fall through if prior vectors are all there -- no need for the new one.\r\n return 3;\r\n }\r\n /** Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes\r\n * sufficient for a coordinate system.\r\n */\r\n public announce(data: any) {\r\n if (this.savedVectorCount() > 1) return;\r\n if (data instanceof Point3d)\r\n this.announcePoint(data);\r\n else if (data instanceof Vector3d)\r\n this.announceVector(data);\r\n else if (Array.isArray(data)) {\r\n for (const child of data) {\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n this.announce(child);\r\n }\r\n } else if (data instanceof CurvePrimitive) {\r\n if (data instanceof LineSegment3d) {\r\n this.announcePoint(data.startPoint());\r\n this.announcePoint(data.endPoint());\r\n } else if (data instanceof Arc3d) {\r\n const ray = data.fractionToPointAndDerivative(0.0);\r\n this.announcePoint(ray.origin);\r\n this.announceVector(ray.direction);\r\n this.announceVector(data.matrixRef.columnZCrossVector(ray.direction));\r\n } else if (data instanceof LineString3d) {\r\n for (const point of data.points) {\r\n this.announcePoint(point);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof BSplineCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPolePoint3d(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data instanceof InterpolationCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (i < data.options.fitPoints.length) {\r\n point.setFrom(data.options.fitPoints[i]);\r\n this.announcePoint(point);\r\n } else break;\r\n }\r\n } else { // unimplemented CurvePrimitive type\r\n const frame = data.fractionToFrenetFrame(0.0);\r\n if (undefined !== frame) {\r\n this.announcePoint(frame.getOrigin());\r\n this.announceVector(frame.matrix.getColumn(0));\r\n this.announceVector(frame.matrix.getColumn(1));\r\n }\r\n }\r\n } else if (data instanceof CurveCollection) {\r\n if (data.children)\r\n for (const child of data.children) {\r\n this.announce(child);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof GrowableXYZArray) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n }\r\n }\r\n /** create a localToWorld frame for the given data.\r\n *\r\n * * origin is at first point\r\n * * x axis in direction of first nonzero vector present or implied by the input.\r\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\r\n */\r\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n builder.applyDefaultUpVector(defaultUpVector);\r\n const result = builder.getValidatedFrame(false);\r\n if (result !== undefined) {\r\n if (defaultUpVector) {\r\n if (result.matrix.dotColumnZ(defaultUpVector) < 0.0)\r\n result.matrix.scaleColumnsInPlace(1, -1, -1);\r\n }\r\n return result;\r\n }\r\n }\r\n\r\n const evaluatePrimitiveFrame = (curve: CurvePrimitive): Transform | undefined => {\r\n return curve.fractionToFrenetFrame(0.0);\r\n };\r\n\r\n // try direct evaluation of curve primitives using the above lambda\r\n for (const data of params) {\r\n if (data instanceof CurvePrimitive) {\r\n return evaluatePrimitiveFrame(data);\r\n } else if (data instanceof CurveCollection) {\r\n const children = data.collectCurvePrimitives();\r\n for (const curve of children) {\r\n const frenetFrame = evaluatePrimitiveFrame(curve);\r\n if (frenetFrame)\r\n return frenetFrame;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** create a transform containing points or vectors in the given data.\r\n * * The xy columns of the transform contain the first points or vectors of the data.\r\n * * The z column is perpendicular to that xy plane.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n */\r\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n const localToWorld = builder.getValidatedFrame(false);\r\n if (localToWorld !== undefined)\r\n return localToWorld;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * try to create a frame whose xy plane is through points.\r\n *\r\n * * if 3 or more distinct points are present, the x axis is from the first point to the most distance, and y direction is toward the\r\n * point most distant from that line.\r\n * @param points array of points\r\n */\r\n public static createFrameToDistantPoints(points: Point3d[]): Transform | undefined {\r\n if (points.length > 2) {\r\n const origin = points[0].clone();\r\n const vector01 = Vector3d.create();\r\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\r\n const vector02 = Vector3d.create();\r\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\r\n const matrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ);\r\n if (matrix)\r\n return Transform.createRefs(origin, matrix);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\r\n *\r\n * * if 3 or more distinct points are present, the x axis is from the first point to the most distance, and y direction is toward the\r\n * point most distant from that line.\r\n * @param points array of points\r\n */\r\n public static createFrameWithCCWPolygon(points: Point3d[]): Transform | undefined {\r\n if (points.length > 2) {\r\n const ray = PolygonOps.centroidAreaNormal(points);\r\n if (ray) {\r\n return ray.toRigidZFrame();\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\r\n * @param range [in] range to inspect\r\n * @param fractionX [in] fractional coordinate of frame origin x\r\n * @param fractionY [in] fractional coordinate of frame origin y\r\n * @param fractionZ [in] fractional coordinate of frame origin z\r\n * @param scaleSelect [in] selects size of localToWorld axes.\r\n * @param defaultAxisLength [in] if true and any axis length is 0, that axis vector takes this physical length.\r\n */\r\n public static createLocalToWorldTransformInRange(\r\n range: Range3d,\r\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\r\n fractionX: number = 0,\r\n fractionY: number = 0,\r\n fractionZ: number = 0,\r\n defaultAxisLength: number = 1.0): Transform {\r\n if (range.isNull)\r\n return Transform.createIdentity();\r\n let a = 1.0;\r\n let b = 1.0;\r\n let c = 1.0;\r\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\r\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\r\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\r\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\r\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\r\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\r\n }\r\n return Transform.createRefs(range.fractionToPoint(fractionX, fractionY, fractionZ), Matrix3d.createScale(a, b, c));\r\n }\r\n\r\n}\r\n"]}
@@ -304,18 +304,18 @@ export interface IStrokeHandler {
304
304
  */
305
305
  export interface UVSurface {
306
306
  /**
307
- * Convert fractional u and v coordinates to surface point
307
+ * Convert fractional u and v coordinates to surface point.
308
308
  * @param uFraction fractional coordinate in u direction
309
- * @param vFraction fractional coordinate in the v direction
309
+ * @param vFraction fractional coordinate in v direction
310
310
  * @param result optional pre-allocated point
311
311
  */
312
312
  uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d;
313
313
  /**
314
314
  * Convert fractional u and v coordinates to surface point and in-surface tangent directions.
315
- * * Remark: the vectors are expected to be non-zero tangents which can be crossed to get a normal.
316
- * * Hence the are NOT precisely either (a) partial derivatives or (b) frenet vectors
315
+ * * The vectors are expected to be non-zero tangents which can be crossed to get a normal.
316
+ * * Hence they are not necessarily (a) partial derivatives or (b) Frenet vectors.
317
317
  * @param uFraction fractional coordinate in u direction
318
- * @param vFraction fractional coordinate in the v direction
318
+ * @param vFraction fractional coordinate in v direction
319
319
  * @param result optional pre-allocated carrier for point and vectors
320
320
  */
321
321
  uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;
@@ -1 +1 @@
1
- {"version":3,"file":"GeometryHandler.js","sourceRoot":"","sources":["../../../src/geometry3d/GeometryHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAuC/F;;;;;GAKG;AACH,MA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O,SAAS,CAAC,CAAC,CAAC;IACpD,+BAA+B;IACxB,eAAe,CAAC,EAAa,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IAChE,+BAA+B;IACxB,iBAAiB,CAAC,EAAe,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IACpE,+BAA+B;IACxB,qBAAqB,CAAC,EAAmB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IAC5E,+BAA+B;IACxB,gBAAgB,CAAC,EAAc,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IAClE,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IACxE,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IACxE,+BAA+B;IACxB,oBAAoB,CAAC,EAAkB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;CAC3E;AAtED,wEAsEC","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 ArraysAndInterfaces\r\n */\r\n\r\nimport { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"../bspline/BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"../bspline/BezierCurveBase\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\r\nimport { BSplineSurface3d, BSplineSurface3dH } from \"../bspline/BSplineSurface\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CoordinateXYZ } from \"../curve/CoordinateXYZ\";\r\nimport { BagOfCurves, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { PointString3d } from \"../curve/PointString3d\";\r\nimport { TransitionSpiral3d } from \"../curve/spiral/TransitionSpiral3d\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { IndexedPolyface } from \"../polyface/Polyface\";\r\nimport { Box } from \"../solid/Box\";\r\nimport { Cone } from \"../solid/Cone\";\r\nimport { LinearSweep } from \"../solid/LinearSweep\";\r\nimport { RotationalSweep } from \"../solid/RotationalSweep\";\r\nimport { RuledSweep } from \"../solid/RuledSweep\";\r\nimport { Sphere } from \"../solid/Sphere\";\r\nimport { TorusPipe } from \"../solid/TorusPipe\";\r\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\r\nimport { Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n/**\r\n * * `GeometryHandler` defines the base abstract methods for double-dispatch geometry computation.\r\n * * User code that wants to handle one or all of the commonly known geometry types implements a handler class.\r\n * * User code that does not handle all types is most likely to start with `NullGeometryHandler`, which will provide no-action implementations for all types.\r\n * @public\r\n */\r\nexport abstract class GeometryHandler {\r\n /** handle strongly typed [[LineSegment3d]] */\r\n public abstract handleLineSegment3d(g: LineSegment3d): any;\r\n /** handle strongly typed [[LineString3d]] */\r\n public abstract handleLineString3d(g: LineString3d): any;\r\n /** handle strongly typed [[Arc3d]] */\r\n public abstract handleArc3d(g: Arc3d): any;\r\n /** handle strongly typed [[CurveCollection]] */\r\n public handleCurveCollection(_g: CurveCollection): any { }\r\n /** handle strongly typed [[BSplineCurve3d]] */\r\n public abstract handleBSplineCurve3d(g: BSplineCurve3d): any;\r\n /** handle strongly typed [[InterpolationCurve3d]] */\r\n public abstract handleInterpolationCurve3d(g: InterpolationCurve3d): any;\r\n /** handle strongly typed [[AkimaCurve3d]] */\r\n public abstract handleAkimaCurve3d(g: AkimaCurve3d): any;\r\n /** handle strongly typed [[BSplineCurve3dH]] */\r\n public abstract handleBSplineCurve3dH(g: BSplineCurve3dH): any;\r\n /** handle strongly typed [[BSplineSurface3d]] */\r\n public abstract handleBSplineSurface3d(g: BSplineSurface3d): any;\r\n /** handle strongly typed [[CoordinateXYZ]] */\r\n public abstract handleCoordinateXYZ(g: CoordinateXYZ): any;\r\n /** handle strongly typed [[BSplineSurface3dH]] */\r\n public abstract handleBSplineSurface3dH(g: BSplineSurface3dH): any;\r\n /** handle strongly typed [[IndexedPolyface]] */\r\n public abstract handleIndexedPolyface(g: IndexedPolyface): any;\r\n /** handle strongly typed [[TransitionSpiral3d]]\r\n * @alpha\r\n */\r\n public abstract handleTransitionSpiral(g: TransitionSpiral3d): any;\r\n\r\n /** handle strongly typed Path (base class method calls handleCurveCollection) */\r\n public handlePath(g: Path): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed Loop (base class method calls handleCurveCollection) */\r\n public handleLoop(g: Loop): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed ParityRegion (base class method calls handleCurveCollection) */\r\n public handleParityRegion(g: ParityRegion): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed UnionRegion (base class method calls handleCurveCollection) */\r\n public handleUnionRegion(g: UnionRegion): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed BagOfCurves (base class method calls handleCurveCollection) */\r\n public handleBagOfCurves(g: BagOfCurves): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed BagOfCurves (base class method calls handleCurveCollection) */\r\n /** handle strongly typed Sphere */\r\n public abstract handleSphere(g: Sphere): any;\r\n /** handle strongly typed Cone */\r\n public abstract handleCone(g: Cone): any;\r\n /** handle strongly typed Box */\r\n public abstract handleBox(g: Box): any;\r\n /** handle strongly typed TorusPipe */\r\n public abstract handleTorusPipe(g: TorusPipe): any;\r\n /** handle strongly typed LinearSweep */\r\n public abstract handleLinearSweep(g: LinearSweep): any;\r\n /** handle strongly typed RotationalSweep */\r\n public abstract handleRotationalSweep(g: RotationalSweep): any;\r\n /** handle strongly typed RuledSweep */\r\n public abstract handleRuledSweep(g: RuledSweep): any;\r\n /** handle strongly typed PointString3d */\r\n public abstract handlePointString3d(g: PointString3d): any;\r\n /** handle strongly typed BezierCurve3d */\r\n public abstract handleBezierCurve3d(g: BezierCurve3d): any;\r\n /** handle strongly typed BezierCurve3dH */\r\n public abstract handleBezierCurve3dH(g: BezierCurve3dH): any;\r\n}\r\n/**\r\n * `NullGeometryHandler` is a base class for dispatching various geometry types to\r\n * application specific implementation of some service.\r\n *\r\n * To use:\r\n * * Derive a class from `NullGeometryHandler`\r\n * * Reimplement any or all of the specific `handleXXXX` methods\r\n * * Create a handler instance `myHandler`\r\n * * To send a `GeometryQuery` object `candidateGeometry` through the (fast) dispatch, invoke `candidateGeometry.dispatchToHandler (myHandler)\r\n * * The appropriate method or methods will get called with a strongly typed `_g ` value.\r\n * @public\r\n */\r\nexport class NullGeometryHandler extends GeometryHandler {\r\n /** no-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLineString3d(_g: LineString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleArc3d(_g: Arc3d): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleCurveCollection(_g: CurveCollection): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any { return undefined; }\r\n /** no-action implementation\r\n * @alpha\r\n */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public override handlePath(_g: Path): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleLoop(_g: Loop): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleParityRegion(_g: ParityRegion): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleUnionRegion(_g: UnionRegion): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleBagOfCurves(_g: BagOfCurves): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public handleSphere(_g: Sphere): any { return undefined; }\r\n /** no-action implementation */\r\n public handleCone(_g: Cone): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBox(_g: Box): any { return undefined; }\r\n /** no-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handlePointString3d(_g: PointString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any { return undefined; }\r\n}\r\n/**\r\n * Implement GeometryHandler methods, with all curve collection methods recursing to children.\r\n * @public\r\n */\r\nexport class RecurseToCurvesGeometryHandler extends GeometryHandler {\r\n /** no-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLineString3d(_g: LineString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleArc3d(_g: Arc3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any { return undefined; }\r\n /** no-action implementation\r\n * @alpha\r\n */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any { return undefined; }\r\n /** Invoke `child.dispatchToGeometryHandler(this)` for each child in the array returned by the query `g.children` */\r\n public handleChildren(g: GeometryQuery): any {\r\n const children = g.children;\r\n if (children)\r\n for (const child of children) {\r\n child.dispatchToGeometryHandler(this);\r\n }\r\n }\r\n /** Recurse to children */\r\n public override handleCurveCollection(g: CurveCollection): any { return this.handleChildren(g); }\r\n\r\n /** Recurse to children */\r\n public override handlePath(g: Path): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleLoop(g: Loop): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleParityRegion(g: ParityRegion): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleUnionRegion(g: UnionRegion): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleBagOfCurves(g: BagOfCurves): any { return this.handleChildren(g); }\r\n\r\n /** no-action implementation */\r\n public handleSphere(_g: Sphere): any { return undefined; }\r\n /** no-action implementation */\r\n public handleCone(_g: Cone): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBox(_g: Box): any { return undefined; }\r\n /** no-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handlePointString3d(_g: PointString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any { return undefined; }\r\n}\r\n\r\n/** IStrokeHandler is an interface with methods to receive data about curves being stroked.\r\n * CurvePrimitives emitStrokes () methods emit calls to a handler object with these methods.\r\n * The various CurvePrimitive types are free to announce either single points (announcePoint), linear fragments,\r\n * or fractional intervals of the parent curve.\r\n * * handler.startCurvePrimitive (cp) -- announce the curve primitive whose strokes will follow.\r\n * * announcePointTangent (xyz, fraction, tangent) -- announce a single point on the curve.\r\n * * announceIntervalForUniformStepStrokes (cp, numStrokes, fraction0, fraction1) -- announce a fraction\r\n * interval in which the curve can be evaluated (e.g. the handler can call cp->fractionToPointAndDerivative ())\r\n * * announceSegmentInterval (cp, point0, point1, numStrokes, fraction0, fraction1) -- announce\r\n * that the fractional interval fraction0, fraction1 is a straight line which should be broken into\r\n * numStrokes strokes.\r\n * * A LineSegment would make a single call to this.\r\n * * A LineString would make one call to this for each of its segments, with fractions indicating position\r\n * within the linestring.\r\n * * endCurvePrimitive (cp) -- announce the end of the curve primitive.\r\n * @public\r\n */\r\nexport interface IStrokeHandler {\r\n /** announce a parent curve primitive\r\n * * startParentCurvePrimitive() ...endParentCurvePrimitive() are wrapped around startCurvePrimitive and endCurvePrimitive when the interior primitive is a proxy.\r\n */\r\n startParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce the curve primitive that will be described in subsequent calls. */\r\n startCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * announce a single point with its fraction and tangent.\r\n * * (IMPORTANT) the same Point3d and Vector3d will be reset and passed on multiple calls.\r\n * * (THEREFORE) if the implementation is saving coordinates, it must copy the xyz data out into its own data structure rather than save the references.\r\n */\r\n announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void;\r\n\r\n /** Announce that curve primitive cp should be evaluated in the specified fraction interval.\r\n * * Note that this method is permitted (expected) to provide pre-stroked data if available.\r\n * * In th pre-stroked case, the cp passed to the handler will be the stroked image, not the original.\r\n * * Callers that want summary data should implement (and return true from) needPrimaryDataForStrokes\r\n */\r\n announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void;\r\n /**\r\n * OPTIONAL method for a handler to indicate that it wants primary geometry (e.g. spirals) rather than strokes.\r\n * @returns true if primary geometry should be passed (rather than stroked or otherwise simplified)\r\n */\r\n needPrimaryGeometryForStrokes?(): boolean;\r\n /** Announce numPoints interpolated between point0 and point1, with associated fractions */\r\n announceSegmentInterval(\r\n cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void;\r\n /** Announce that all data about `cp` has been announced. */\r\n endCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce that all data about the parent primitive has been announced. */\r\n endParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * Announce a bezier curve fragment.\r\n * * this is usually a section of BsplineCurve\r\n * * If this function is missing, the same interval will be passed to announceIntervalForUniformSteps.\r\n * @param bezier bezier fragment\r\n * @param numStrokes suggested number of strokes (uniform in bezier interval 0..1)\r\n * @param parent parent curve\r\n * @param spanIndex spanIndex within parent\r\n * @param fraction0 start fraction on parent curve\r\n * @param fraction1 end fraction on parent curve\r\n */\r\n announceBezierCurve?(\r\n bezier: BezierCurveBase,\r\n numStrokes: number,\r\n parent: CurvePrimitive,\r\n spandex: number,\r\n fraction0: number,\r\n fraction1: number): void;\r\n}\r\n\r\n/**\r\n * Interface with methods for mapping (u,v) fractional coordinates to surface xyz and derivatives.\r\n * @public\r\n */\r\nexport interface UVSurface {\r\n /**\r\n * Convert fractional u and v coordinates to surface point\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in the v direction\r\n * @param result optional pre-allocated point\r\n */\r\n uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d;\r\n /**\r\n * Convert fractional u and v coordinates to surface point and in-surface tangent directions.\r\n * * Remark: the vectors are expected to be non-zero tangents which can be crossed to get a normal.\r\n * * Hence the are NOT precisely either (a) partial derivatives or (b) frenet vectors\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in the v direction\r\n * @param result optional pre-allocated carrier for point and vectors\r\n */\r\n uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n}\r\n/**\r\n * Interface for queries of distance-along in u and v directions\r\n * @public\r\n */\r\nexport interface UVSurfaceIsoParametricDistance {\r\n /**\r\n * * Return a vector whose x and y parts are \"size\" of the surface in the u and v directions.\r\n * * Sizes are use for applying scaling to mesh parameters\r\n * * These sizes are (reasonable approximations of) the max curve length along u and v isoparameter lines.\r\n * * e.g. for a sphere, these are:\r\n * * u direction = distance around the equator\r\n * * v direction = distance from south pole to north pole.\r\n */\r\n maxIsoParametricDistance(): Vector2d;\r\n}\r\n"]}
1
+ {"version":3,"file":"GeometryHandler.js","sourceRoot":"","sources":["../../../src/geometry3d/GeometryHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAuC/F;;;;;GAKG;AACH,MAAsB,eAAe;IAOnC,kDAA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AC;IACpD,+BAA+B;IACxB,eAAe,CAAC,EAAa,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IAChE,+BAA+B;IACxB,iBAAiB,CAAC,EAAe,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IACpE,+BAA+B;IACxB,qBAAqB,CAAC,EAAmB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IAC5E,+BAA+B;IACxB,gBAAgB,CAAC,EAAc,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IAClE,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IACxE,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;IACxE,+BAA+B;IACxB,oBAAoB,CAAC,EAAkB,IAAS,OAAO,SAAS,CAAC,CAAC,CAAC;CAC3E;AAtED,wEAsEC","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 ArraysAndInterfaces\r\n */\r\n\r\nimport { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"../bspline/BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"../bspline/BezierCurveBase\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\r\nimport { BSplineSurface3d, BSplineSurface3dH } from \"../bspline/BSplineSurface\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CoordinateXYZ } from \"../curve/CoordinateXYZ\";\r\nimport { BagOfCurves, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { PointString3d } from \"../curve/PointString3d\";\r\nimport { TransitionSpiral3d } from \"../curve/spiral/TransitionSpiral3d\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { IndexedPolyface } from \"../polyface/Polyface\";\r\nimport { Box } from \"../solid/Box\";\r\nimport { Cone } from \"../solid/Cone\";\r\nimport { LinearSweep } from \"../solid/LinearSweep\";\r\nimport { RotationalSweep } from \"../solid/RotationalSweep\";\r\nimport { RuledSweep } from \"../solid/RuledSweep\";\r\nimport { Sphere } from \"../solid/Sphere\";\r\nimport { TorusPipe } from \"../solid/TorusPipe\";\r\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\r\nimport { Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n/**\r\n * * `GeometryHandler` defines the base abstract methods for double-dispatch geometry computation.\r\n * * User code that wants to handle one or all of the commonly known geometry types implements a handler class.\r\n * * User code that does not handle all types is most likely to start with `NullGeometryHandler`, which will provide no-action implementations for all types.\r\n * @public\r\n */\r\nexport abstract class GeometryHandler {\r\n /** handle strongly typed [[LineSegment3d]] */\r\n public abstract handleLineSegment3d(g: LineSegment3d): any;\r\n /** handle strongly typed [[LineString3d]] */\r\n public abstract handleLineString3d(g: LineString3d): any;\r\n /** handle strongly typed [[Arc3d]] */\r\n public abstract handleArc3d(g: Arc3d): any;\r\n /** handle strongly typed [[CurveCollection]] */\r\n public handleCurveCollection(_g: CurveCollection): any { }\r\n /** handle strongly typed [[BSplineCurve3d]] */\r\n public abstract handleBSplineCurve3d(g: BSplineCurve3d): any;\r\n /** handle strongly typed [[InterpolationCurve3d]] */\r\n public abstract handleInterpolationCurve3d(g: InterpolationCurve3d): any;\r\n /** handle strongly typed [[AkimaCurve3d]] */\r\n public abstract handleAkimaCurve3d(g: AkimaCurve3d): any;\r\n /** handle strongly typed [[BSplineCurve3dH]] */\r\n public abstract handleBSplineCurve3dH(g: BSplineCurve3dH): any;\r\n /** handle strongly typed [[BSplineSurface3d]] */\r\n public abstract handleBSplineSurface3d(g: BSplineSurface3d): any;\r\n /** handle strongly typed [[CoordinateXYZ]] */\r\n public abstract handleCoordinateXYZ(g: CoordinateXYZ): any;\r\n /** handle strongly typed [[BSplineSurface3dH]] */\r\n public abstract handleBSplineSurface3dH(g: BSplineSurface3dH): any;\r\n /** handle strongly typed [[IndexedPolyface]] */\r\n public abstract handleIndexedPolyface(g: IndexedPolyface): any;\r\n /** handle strongly typed [[TransitionSpiral3d]]\r\n * @alpha\r\n */\r\n public abstract handleTransitionSpiral(g: TransitionSpiral3d): any;\r\n\r\n /** handle strongly typed Path (base class method calls handleCurveCollection) */\r\n public handlePath(g: Path): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed Loop (base class method calls handleCurveCollection) */\r\n public handleLoop(g: Loop): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed ParityRegion (base class method calls handleCurveCollection) */\r\n public handleParityRegion(g: ParityRegion): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed UnionRegion (base class method calls handleCurveCollection) */\r\n public handleUnionRegion(g: UnionRegion): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed BagOfCurves (base class method calls handleCurveCollection) */\r\n public handleBagOfCurves(g: BagOfCurves): any { return this.handleCurveCollection(g); }\r\n /** handle strongly typed BagOfCurves (base class method calls handleCurveCollection) */\r\n /** handle strongly typed Sphere */\r\n public abstract handleSphere(g: Sphere): any;\r\n /** handle strongly typed Cone */\r\n public abstract handleCone(g: Cone): any;\r\n /** handle strongly typed Box */\r\n public abstract handleBox(g: Box): any;\r\n /** handle strongly typed TorusPipe */\r\n public abstract handleTorusPipe(g: TorusPipe): any;\r\n /** handle strongly typed LinearSweep */\r\n public abstract handleLinearSweep(g: LinearSweep): any;\r\n /** handle strongly typed RotationalSweep */\r\n public abstract handleRotationalSweep(g: RotationalSweep): any;\r\n /** handle strongly typed RuledSweep */\r\n public abstract handleRuledSweep(g: RuledSweep): any;\r\n /** handle strongly typed PointString3d */\r\n public abstract handlePointString3d(g: PointString3d): any;\r\n /** handle strongly typed BezierCurve3d */\r\n public abstract handleBezierCurve3d(g: BezierCurve3d): any;\r\n /** handle strongly typed BezierCurve3dH */\r\n public abstract handleBezierCurve3dH(g: BezierCurve3dH): any;\r\n}\r\n/**\r\n * `NullGeometryHandler` is a base class for dispatching various geometry types to\r\n * application specific implementation of some service.\r\n *\r\n * To use:\r\n * * Derive a class from `NullGeometryHandler`\r\n * * Reimplement any or all of the specific `handleXXXX` methods\r\n * * Create a handler instance `myHandler`\r\n * * To send a `GeometryQuery` object `candidateGeometry` through the (fast) dispatch, invoke `candidateGeometry.dispatchToHandler (myHandler)\r\n * * The appropriate method or methods will get called with a strongly typed `_g ` value.\r\n * @public\r\n */\r\nexport class NullGeometryHandler extends GeometryHandler {\r\n /** no-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLineString3d(_g: LineString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleArc3d(_g: Arc3d): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleCurveCollection(_g: CurveCollection): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any { return undefined; }\r\n /** no-action implementation\r\n * @alpha\r\n */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public override handlePath(_g: Path): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleLoop(_g: Loop): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleParityRegion(_g: ParityRegion): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleUnionRegion(_g: UnionRegion): any { return undefined; }\r\n /** no-action implementation */\r\n public override handleBagOfCurves(_g: BagOfCurves): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public handleSphere(_g: Sphere): any { return undefined; }\r\n /** no-action implementation */\r\n public handleCone(_g: Cone): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBox(_g: Box): any { return undefined; }\r\n /** no-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handlePointString3d(_g: PointString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any { return undefined; }\r\n}\r\n/**\r\n * Implement GeometryHandler methods, with all curve collection methods recursing to children.\r\n * @public\r\n */\r\nexport class RecurseToCurvesGeometryHandler extends GeometryHandler {\r\n /** no-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLineString3d(_g: LineString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleArc3d(_g: Arc3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any { return undefined; }\r\n\r\n /** no-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any { return undefined; }\r\n /** no-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any { return undefined; }\r\n /** no-action implementation\r\n * @alpha\r\n */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any { return undefined; }\r\n /** Invoke `child.dispatchToGeometryHandler(this)` for each child in the array returned by the query `g.children` */\r\n public handleChildren(g: GeometryQuery): any {\r\n const children = g.children;\r\n if (children)\r\n for (const child of children) {\r\n child.dispatchToGeometryHandler(this);\r\n }\r\n }\r\n /** Recurse to children */\r\n public override handleCurveCollection(g: CurveCollection): any { return this.handleChildren(g); }\r\n\r\n /** Recurse to children */\r\n public override handlePath(g: Path): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleLoop(g: Loop): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleParityRegion(g: ParityRegion): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleUnionRegion(g: UnionRegion): any { return this.handleChildren(g); }\r\n /** Recurse to children */\r\n public override handleBagOfCurves(g: BagOfCurves): any { return this.handleChildren(g); }\r\n\r\n /** no-action implementation */\r\n public handleSphere(_g: Sphere): any { return undefined; }\r\n /** no-action implementation */\r\n public handleCone(_g: Cone): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBox(_g: Box): any { return undefined; }\r\n /** no-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any { return undefined; }\r\n /** no-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any { return undefined; }\r\n /** no-action implementation */\r\n public handlePointString3d(_g: PointString3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any { return undefined; }\r\n /** no-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any { return undefined; }\r\n}\r\n\r\n/** IStrokeHandler is an interface with methods to receive data about curves being stroked.\r\n * CurvePrimitives emitStrokes () methods emit calls to a handler object with these methods.\r\n * The various CurvePrimitive types are free to announce either single points (announcePoint), linear fragments,\r\n * or fractional intervals of the parent curve.\r\n * * handler.startCurvePrimitive (cp) -- announce the curve primitive whose strokes will follow.\r\n * * announcePointTangent (xyz, fraction, tangent) -- announce a single point on the curve.\r\n * * announceIntervalForUniformStepStrokes (cp, numStrokes, fraction0, fraction1) -- announce a fraction\r\n * interval in which the curve can be evaluated (e.g. the handler can call cp->fractionToPointAndDerivative ())\r\n * * announceSegmentInterval (cp, point0, point1, numStrokes, fraction0, fraction1) -- announce\r\n * that the fractional interval fraction0, fraction1 is a straight line which should be broken into\r\n * numStrokes strokes.\r\n * * A LineSegment would make a single call to this.\r\n * * A LineString would make one call to this for each of its segments, with fractions indicating position\r\n * within the linestring.\r\n * * endCurvePrimitive (cp) -- announce the end of the curve primitive.\r\n * @public\r\n */\r\nexport interface IStrokeHandler {\r\n /** announce a parent curve primitive\r\n * * startParentCurvePrimitive() ...endParentCurvePrimitive() are wrapped around startCurvePrimitive and endCurvePrimitive when the interior primitive is a proxy.\r\n */\r\n startParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce the curve primitive that will be described in subsequent calls. */\r\n startCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * announce a single point with its fraction and tangent.\r\n * * (IMPORTANT) the same Point3d and Vector3d will be reset and passed on multiple calls.\r\n * * (THEREFORE) if the implementation is saving coordinates, it must copy the xyz data out into its own data structure rather than save the references.\r\n */\r\n announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void;\r\n\r\n /** Announce that curve primitive cp should be evaluated in the specified fraction interval.\r\n * * Note that this method is permitted (expected) to provide pre-stroked data if available.\r\n * * In th pre-stroked case, the cp passed to the handler will be the stroked image, not the original.\r\n * * Callers that want summary data should implement (and return true from) needPrimaryDataForStrokes\r\n */\r\n announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void;\r\n /**\r\n * OPTIONAL method for a handler to indicate that it wants primary geometry (e.g. spirals) rather than strokes.\r\n * @returns true if primary geometry should be passed (rather than stroked or otherwise simplified)\r\n */\r\n needPrimaryGeometryForStrokes?(): boolean;\r\n /** Announce numPoints interpolated between point0 and point1, with associated fractions */\r\n announceSegmentInterval(\r\n cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void;\r\n /** Announce that all data about `cp` has been announced. */\r\n endCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce that all data about the parent primitive has been announced. */\r\n endParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * Announce a bezier curve fragment.\r\n * * this is usually a section of BsplineCurve\r\n * * If this function is missing, the same interval will be passed to announceIntervalForUniformSteps.\r\n * @param bezier bezier fragment\r\n * @param numStrokes suggested number of strokes (uniform in bezier interval 0..1)\r\n * @param parent parent curve\r\n * @param spanIndex spanIndex within parent\r\n * @param fraction0 start fraction on parent curve\r\n * @param fraction1 end fraction on parent curve\r\n */\r\n announceBezierCurve?(\r\n bezier: BezierCurveBase,\r\n numStrokes: number,\r\n parent: CurvePrimitive,\r\n spandex: number,\r\n fraction0: number,\r\n fraction1: number): void;\r\n}\r\n\r\n/**\r\n * Interface with methods for mapping (u,v) fractional coordinates to surface xyz and derivatives.\r\n * @public\r\n */\r\nexport interface UVSurface {\r\n /**\r\n * Convert fractional u and v coordinates to surface point.\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in v direction\r\n * @param result optional pre-allocated point\r\n */\r\n uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d;\r\n /**\r\n * Convert fractional u and v coordinates to surface point and in-surface tangent directions.\r\n * * The vectors are expected to be non-zero tangents which can be crossed to get a normal.\r\n * * Hence they are not necessarily (a) partial derivatives or (b) Frenet vectors.\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in v direction\r\n * @param result optional pre-allocated carrier for point and vectors\r\n */\r\n uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n}\r\n/**\r\n * Interface for queries of distance-along in u and v directions\r\n * @public\r\n */\r\nexport interface UVSurfaceIsoParametricDistance {\r\n /**\r\n * * Return a vector whose x and y parts are \"size\" of the surface in the u and v directions.\r\n * * Sizes are use for applying scaling to mesh parameters\r\n * * These sizes are (reasonable approximations of) the max curve length along u and v isoparameter lines.\r\n * * e.g. for a sphere, these are:\r\n * * u direction = distance around the equator\r\n * * v direction = distance from south pole to north pole.\r\n */\r\n maxIsoParametricDistance(): Vector2d;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GrowableBlockedArray.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableBlockedArray.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;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MAAM;IAa9E,2HAA2H;IACpH,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;CAYhH"}
@@ -165,7 +165,7 @@ class GrowableBlockedArray {
165
165
  return ia - ib; // so original order is maintained among duplicates !!!!
166
166
  }
167
167
  /** Return an array of block indices sorted per compareLexicalBlock function */
168
- sortIndicesLexical(compareBlocks = GrowableBlockedArray.compareLexicalBlock) {
168
+ sortIndicesLexical(compareBlocks = (dataArray, size, iA, iB) => GrowableBlockedArray.compareLexicalBlock(dataArray, size, iA, iB)) {
169
169
  const n = this._inUse;
170
170
  // let numCompare = 0;
171
171
  const result = new Uint32Array(n);
@@ -1 +1 @@
1
- {"version":3,"file":"GrowableBlockedArray.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableBlockedArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;GAIG;AACH,MAAa,oBAAoB;IAc/B;;;;;;;OAOG;IACH,YAAmB,SAAiB,EAAE,gBAAwB,CAAC,EAAE,YAAqB;QACpF,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,UAAU,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACO,QAAQ,CAAC,MAA+B,EAAE,WAAoB,EAAE,UAAmB;QAC3F,qDAAqD;QACrD,IAAI,QAAQ,GAAG,CAAC,SAAS,KAAK,UAAU,CAAC,CA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2H;IACpH,wBAAwB,CAAC,WAAmB,EAAE,WAAmB,EAAE,MAAc,EAAE,IAAY;QACpG,IAAI,EAAE,GAAG,GAAG,CAAC;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAClC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAChC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;CACF;AAhND,oDAgNC","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/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n\r\nimport { BlockComparisonFunction } from \"./GrowableFloat64Array\";\r\n\r\n/**\r\n * Array of contiguous doubles, indexed by block number and index within block.\r\n * * This is essentially a rectangular matrix (two dimensional array), with each block being a row of the matrix.\r\n * @public\r\n */\r\nexport class GrowableBlockedArray {\r\n /** underlying contiguous, oversized buffer. */\r\n protected _data: Float64Array;\r\n /** Number of blocks (matrix rows) in use. */\r\n protected _inUse: number;\r\n /** number of numbers per block in the array.\r\n * * If viewing the array as a two dimensional array, this is the row size.\r\n */\r\n protected _blockSize: number; // positive integer !!!\r\n /**\r\n * multiplier used by ensureBlockCapacity to expand requested reallocation size\r\n */\r\n protected _growthFactor: number;\r\n\r\n /**\r\n * Construct an array whose contents are in blocked (row-major) order, possibly with extra capacity.\r\n * * Total capacity is `this._data.length`\r\n * * Actual in-use count is `this._inUse * this._blockSize`\r\n * @param blockSize number of entries in each block, i.e., row size\r\n * @param initialBlocks initial capacity in blocks (default 8)\r\n * @param growthFactor used by ensureBlockCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n public constructor(blockSize: number, initialBlocks: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialBlocks * blockSize);\r\n this._inUse = 0;\r\n this._blockSize = blockSize > 0 ? blockSize : 1;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active block count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount blocks; all blocks if undefined\r\n * @param destOffset copy to instance array starting at this block index; zero if undefined\r\n * @return count and offset of blocks copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n // validate inputs and convert from blocks to entries\r\n let myOffset = (undefined !== destOffset) ? destOffset * this.numPerBlock : 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = (undefined !== sourceCount) ? sourceCount * this.numPerBlock : source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n if (myCount % this.numPerBlock !== 0)\r\n myCount -= myCount % this.numPerBlock;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount / this.numPerBlock, offset: myOffset / this.numPerBlock};\r\n }\r\n\r\n /**\r\n * Make a copy of the (active) blocks in this array.\r\n * (The clone does NOT get excess capacity)\r\n */\r\n public clone(): GrowableBlockedArray {\r\n const newBlocks = new GrowableBlockedArray(this.numPerBlock, this.numBlocks, this._growthFactor);\r\n newBlocks.copyData(this._data, this.numBlocks);\r\n newBlocks._inUse = this.numBlocks;\r\n return newBlocks;\r\n }\r\n\r\n /** computed property: length (in blocks, not doubles) */\r\n public get length(): number { return this._inUse; }\r\n /** computed property: length (in blocks, not doubles) */\r\n public get numBlocks(): number { return this._inUse; }\r\n /** property: number of data values per block */\r\n public get numPerBlock(): number { return this._blockSize; }\r\n /**\r\n * Return a single value indexed within a block. Indices are unchecked.\r\n * @param blockIndex index of block to read\r\n * @param indexInBlock offset within the block\r\n */\r\n public getWithinBlock(blockIndex: number, indexWithinBlock: number): number {\r\n return this._data[blockIndex * this._blockSize + indexWithinBlock];\r\n }\r\n /** clear the block count to zero, but maintain the allocated memory */\r\n public clear() { this._inUse = 0; }\r\n /** Return the capacity in blocks (not doubles) */\r\n public blockCapacity() {\r\n return this._data.length / this._blockSize;\r\n }\r\n /** ensure capacity (in blocks, not doubles) */\r\n public ensureBlockCapacity(blockCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (blockCapacity > this.blockCapacity()) {\r\n if (applyGrowthFactor)\r\n blockCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(blockCapacity * this._blockSize);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /** Add a new block of data.\r\n * * If newData has fewer than numPerBlock entries, the remaining part of the new block is zeros.\r\n * * If newData has more entries, only the first numPerBlock are taken.\r\n */\r\n public addBlock(newData: number[]) {\r\n const k0 = this.newBlockIndex();\r\n let numValue = newData.length;\r\n if (numValue > this._blockSize)\r\n numValue = this._blockSize;\r\n for (let i = 0; i < numValue; i++)\r\n this._data[k0 + i] = newData[i];\r\n }\r\n /**\r\n * Return the starting index of a block of (zero-initialized) doubles at the end.\r\n *\r\n * * this.data is reallocated if needed to include the new block.\r\n * * The inUse count is incremented to include the new block.\r\n * * The returned block is an index to the Float64Array (not a block index)\r\n */\r\n protected newBlockIndex(): number {\r\n const index = this._blockSize * this._inUse;\r\n if ((index + 1) > this._data.length)\r\n this.ensureBlockCapacity(1 + this._inUse);\r\n this._inUse++;\r\n for (let i = index; i < index + this._blockSize; i++)\r\n this._data[i] = 0.0;\r\n return index;\r\n }\r\n /** reduce the block count by one. */\r\n public popBlock() {\r\n if (this._inUse > 0)\r\n this._inUse--;\r\n }\r\n /** convert a block index to the simple index to the underlying Float64Array. */\r\n protected blockIndexToDoubleIndex(blockIndex: number) { return this._blockSize * blockIndex; }\r\n /** Access a single double at offset within a block, with index checking and return undefined if indexing is invalid. */\r\n public checkedComponent(blockIndex: number, componentIndex: number): number | undefined {\r\n if (blockIndex >= this._inUse || blockIndex < 0 || componentIndex < 0 || componentIndex >= this._blockSize)\r\n return undefined;\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** Access a single double at offset within a block. This has no index checking. */\r\n public component(blockIndex: number, componentIndex: number): number {\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** compare two blocks in simple lexical order.\r\n * @param data data array\r\n * @param blockSize number of items to compare\r\n * @param ia raw index (not block index) of first block\r\n * @param ib raw index (not block index) of second block\r\n */\r\n public static compareLexicalBlock(data: Float64Array, blockSize: number, ia: number, ib: number): number {\r\n let ax = 0;\r\n let bx = 0;\r\n for (let i = 0; i < blockSize; i++) {\r\n ax = data[ia + i];\r\n bx = data[ib + i];\r\n if (ax > bx) return 1;\r\n if (ax < bx) return -1;\r\n }\r\n return ia - ib; // so original order is maintained among duplicates !!!!\r\n }\r\n /** Return an array of block indices sorted per compareLexicalBlock function */\r\n public sortIndicesLexical(compareBlocks: BlockComparisonFunction = GrowableBlockedArray.compareLexicalBlock): Uint32Array {\r\n const n = this._inUse;\r\n // let numCompare = 0;\r\n const result = new Uint32Array(n);\r\n const data = this._data;\r\n const blockSize = this._blockSize;\r\n for (let i = 0; i < n; i++)result[i] = i;\r\n result.sort(\r\n (blockIndexA: number, blockIndexB: number) => {\r\n // numCompare++;\r\n return compareBlocks(data, blockSize, blockIndexA * blockSize, blockIndexB * blockSize);\r\n });\r\n // console.log (n, numCompare);\r\n return result;\r\n }\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between indicated blocks */\r\n public distanceBetweenBlocks(blockIndexA: number, blockIndexB: number): number {\r\n let dd = 0.0;\r\n let iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n let iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = 0; i < this._blockSize; i++) {\r\n a = data[iA++] - data[iB++];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between block entries `iBegin <= i < iEnd` of indicated blocks */\r\n public distanceBetweenSubBlocks(blockIndexA: number, blockIndexB: number, iBegin: number, iEnd: number): number {\r\n let dd = 0.0;\r\n const iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n const iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = iBegin; i < iEnd; i++) {\r\n a = data[iA + i] - data[iB + i];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GrowableBlockedArray.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableBlockedArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;GAIG;AACH,MAAa,oBAAoB;IAc/B;;;;;;;OAOG;IACH,YAAmB,SAAiB,EAAE,gBAAwB,CAAC,EAAE,YAAqB;QACpF,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,UAAU,GAAG,SAAS,GA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AW,CAAC,CAAC;QACnD,IAAI,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;YACxC,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5B,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAED,2HAA2H;IACpH,wBAAwB,CAAC,WAAmB,EAAE,WAAmB,EAAE,MAAc,EAAE,IAAY;QACpG,IAAI,EAAE,GAAG,GAAG,CAAC;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAClC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAChC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;CACF;AAhND,oDAgNC","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/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n\r\nimport { BlockComparisonFunction } from \"./GrowableFloat64Array\";\r\n\r\n/**\r\n * Array of contiguous doubles, indexed by block number and index within block.\r\n * * This is essentially a rectangular matrix (two dimensional array), with each block being a row of the matrix.\r\n * @public\r\n */\r\nexport class GrowableBlockedArray {\r\n /** underlying contiguous, oversized buffer. */\r\n protected _data: Float64Array;\r\n /** Number of blocks (matrix rows) in use. */\r\n protected _inUse: number;\r\n /** number of numbers per block in the array.\r\n * * If viewing the array as a two dimensional array, this is the row size.\r\n */\r\n protected _blockSize: number; // positive integer !!!\r\n /**\r\n * multiplier used by ensureBlockCapacity to expand requested reallocation size\r\n */\r\n protected _growthFactor: number;\r\n\r\n /**\r\n * Construct an array whose contents are in blocked (row-major) order, possibly with extra capacity.\r\n * * Total capacity is `this._data.length`\r\n * * Actual in-use count is `this._inUse * this._blockSize`\r\n * @param blockSize number of entries in each block, i.e., row size\r\n * @param initialBlocks initial capacity in blocks (default 8)\r\n * @param growthFactor used by ensureBlockCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n public constructor(blockSize: number, initialBlocks: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialBlocks * blockSize);\r\n this._inUse = 0;\r\n this._blockSize = blockSize > 0 ? blockSize : 1;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active block count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount blocks; all blocks if undefined\r\n * @param destOffset copy to instance array starting at this block index; zero if undefined\r\n * @return count and offset of blocks copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n // validate inputs and convert from blocks to entries\r\n let myOffset = (undefined !== destOffset) ? destOffset * this.numPerBlock : 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = (undefined !== sourceCount) ? sourceCount * this.numPerBlock : source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n if (myCount % this.numPerBlock !== 0)\r\n myCount -= myCount % this.numPerBlock;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount / this.numPerBlock, offset: myOffset / this.numPerBlock};\r\n }\r\n\r\n /**\r\n * Make a copy of the (active) blocks in this array.\r\n * (The clone does NOT get excess capacity)\r\n */\r\n public clone(): GrowableBlockedArray {\r\n const newBlocks = new GrowableBlockedArray(this.numPerBlock, this.numBlocks, this._growthFactor);\r\n newBlocks.copyData(this._data, this.numBlocks);\r\n newBlocks._inUse = this.numBlocks;\r\n return newBlocks;\r\n }\r\n\r\n /** computed property: length (in blocks, not doubles) */\r\n public get length(): number { return this._inUse; }\r\n /** computed property: length (in blocks, not doubles) */\r\n public get numBlocks(): number { return this._inUse; }\r\n /** property: number of data values per block */\r\n public get numPerBlock(): number { return this._blockSize; }\r\n /**\r\n * Return a single value indexed within a block. Indices are unchecked.\r\n * @param blockIndex index of block to read\r\n * @param indexInBlock offset within the block\r\n */\r\n public getWithinBlock(blockIndex: number, indexWithinBlock: number): number {\r\n return this._data[blockIndex * this._blockSize + indexWithinBlock];\r\n }\r\n /** clear the block count to zero, but maintain the allocated memory */\r\n public clear() { this._inUse = 0; }\r\n /** Return the capacity in blocks (not doubles) */\r\n public blockCapacity() {\r\n return this._data.length / this._blockSize;\r\n }\r\n /** ensure capacity (in blocks, not doubles) */\r\n public ensureBlockCapacity(blockCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (blockCapacity > this.blockCapacity()) {\r\n if (applyGrowthFactor)\r\n blockCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(blockCapacity * this._blockSize);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /** Add a new block of data.\r\n * * If newData has fewer than numPerBlock entries, the remaining part of the new block is zeros.\r\n * * If newData has more entries, only the first numPerBlock are taken.\r\n */\r\n public addBlock(newData: number[]) {\r\n const k0 = this.newBlockIndex();\r\n let numValue = newData.length;\r\n if (numValue > this._blockSize)\r\n numValue = this._blockSize;\r\n for (let i = 0; i < numValue; i++)\r\n this._data[k0 + i] = newData[i];\r\n }\r\n /**\r\n * Return the starting index of a block of (zero-initialized) doubles at the end.\r\n *\r\n * * this.data is reallocated if needed to include the new block.\r\n * * The inUse count is incremented to include the new block.\r\n * * The returned block is an index to the Float64Array (not a block index)\r\n */\r\n protected newBlockIndex(): number {\r\n const index = this._blockSize * this._inUse;\r\n if ((index + 1) > this._data.length)\r\n this.ensureBlockCapacity(1 + this._inUse);\r\n this._inUse++;\r\n for (let i = index; i < index + this._blockSize; i++)\r\n this._data[i] = 0.0;\r\n return index;\r\n }\r\n /** reduce the block count by one. */\r\n public popBlock() {\r\n if (this._inUse > 0)\r\n this._inUse--;\r\n }\r\n /** convert a block index to the simple index to the underlying Float64Array. */\r\n protected blockIndexToDoubleIndex(blockIndex: number) { return this._blockSize * blockIndex; }\r\n /** Access a single double at offset within a block, with index checking and return undefined if indexing is invalid. */\r\n public checkedComponent(blockIndex: number, componentIndex: number): number | undefined {\r\n if (blockIndex >= this._inUse || blockIndex < 0 || componentIndex < 0 || componentIndex >= this._blockSize)\r\n return undefined;\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** Access a single double at offset within a block. This has no index checking. */\r\n public component(blockIndex: number, componentIndex: number): number {\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** compare two blocks in simple lexical order.\r\n * @param data data array\r\n * @param blockSize number of items to compare\r\n * @param ia raw index (not block index) of first block\r\n * @param ib raw index (not block index) of second block\r\n */\r\n public static compareLexicalBlock(data: Float64Array, blockSize: number, ia: number, ib: number): number {\r\n let ax = 0;\r\n let bx = 0;\r\n for (let i = 0; i < blockSize; i++) {\r\n ax = data[ia + i];\r\n bx = data[ib + i];\r\n if (ax > bx) return 1;\r\n if (ax < bx) return -1;\r\n }\r\n return ia - ib; // so original order is maintained among duplicates !!!!\r\n }\r\n /** Return an array of block indices sorted per compareLexicalBlock function */\r\n public sortIndicesLexical(compareBlocks: BlockComparisonFunction = (dataArray, size, iA, iB) => GrowableBlockedArray.compareLexicalBlock(dataArray, size, iA, iB)): Uint32Array {\r\n const n = this._inUse;\r\n // let numCompare = 0;\r\n const result = new Uint32Array(n);\r\n const data = this._data;\r\n const blockSize = this._blockSize;\r\n for (let i = 0; i < n; i++)result[i] = i;\r\n result.sort(\r\n (blockIndexA: number, blockIndexB: number) => {\r\n // numCompare++;\r\n return compareBlocks(data, blockSize, blockIndexA * blockSize, blockIndexB * blockSize);\r\n });\r\n // console.log (n, numCompare);\r\n return result;\r\n }\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between indicated blocks */\r\n public distanceBetweenBlocks(blockIndexA: number, blockIndexB: number): number {\r\n let dd = 0.0;\r\n let iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n let iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = 0; i < this._blockSize; i++) {\r\n a = data[iA++] - data[iB++];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between block entries `iBegin <= i < iEnd` of indicated blocks */\r\n public distanceBetweenSubBlocks(blockIndexA: number, blockIndexB: number, iBegin: number, iEnd: number): number {\r\n let dd = 0.0;\r\n const iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n const iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = iBegin; i < iEnd; i++) {\r\n a = data[iA + i] - data[iB + i];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GrowableFloat64Array.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAC5E;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AACxH;;;;;;;;GAQG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAS;IAE9B;;;OAGG;gBACS,eAAe,GAAE,MAAU,EAAE,YAAY,CAAC,EAAE,MAAM;IAM9D;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC;IAwB/H;;;OAGG;WACW,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,EAAE,GAAG,oBAAoB;IAM7E;;;;;OAKG;WACW,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM;IAG7C;;;OAGG;IACI,KAAK,CAAC,sBAAsB,GAAE,OAAe,GAAG,oBAAoB;IAM3E;;;OAGG;IACH,IAAW,MAAM,WAEhB;IACD;;;;OAIG;IACI,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE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aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO7D,uFAAuF;IAChF,KAAK;IAGZ;;;OAGG;IACI,QAAQ;IAGf;;;;;OAKG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAE,OAAc;IAS5E;;;;;OAKG;IACI,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU;IASrD;;;;OAIG;IACI,GAAG;IAOV,4CAA4C;IACrC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAG9C,sDAAsD;IAC/C,KAAK;IAGZ,oDAAoD;IAC7C,IAAI;IAGX,2BAA2B;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAI5C;;;;OAIG;IACI,IAAI,CAAC,aAAa,GAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAqD;IAapG;;;;;OAKG;IACI,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAa9C;;;OAGG;IACI,0BAA0B,CAAC,SAAS,GAAE,MAAY;CAmB1D"}
@@ -215,7 +215,7 @@ class GrowableFloat64Array {
215
215
  * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays
216
216
  * @param compareMethod comparison method
217
217
  */
218
- sort(compareMethod = GrowableFloat64Array.compare) {
218
+ sort(compareMethod = (a, b) => GrowableFloat64Array.compare(a, b)) {
219
219
  for (let i = 0; i < this._inUse; i++) {
220
220
  for (let j = i + 1; j < this._inUse; j++) {
221
221
  const tempI = this._data[i];
@@ -1 +1 @@
1
- {"version":3,"file":"GrowableFloat64Array.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAgB/F;;;;;;;;GAQG;AACH,MAAa,oBAAoB;IAK/B;;;OAGG;IACH,YAAY,kBAA0B,CAAC,EAAE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SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC1B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAClB,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC;SACzB;QACD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,0BAA0B,CAAC,YAAoB,GAAG;QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO;QAET,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC1B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE;gBAC/B,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC,GAAG,CAAC,CAAC;aACP;SACF;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;CAEF;AAzQD,oDAyQC","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 ArraysAndInterfaces\r\n */\r\n\r\n/**\r\n * Type for a OptionalGrowableFloat64Array or undefined.\r\n * @public\r\n */\r\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\r\n/**\r\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\r\n * @public\r\n */\r\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\r\n/**\r\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\r\n * * In C++ terms, this is like an std::vector\r\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\r\n * * The reallocations leave unused space to accept further additional entries without reallocation.\r\n * * The `length` property returns the number of entries in use.\r\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\r\n * @public\r\n */\r\nexport class GrowableFloat64Array {\r\n private _data: Float64Array;\r\n private _inUse: number;\r\n private _growthFactor: number;\r\n\r\n /** Construct a GrowableFloat64Array.\r\n * @param initialCapacity initial capacity (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n constructor(initialCapacity: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialCapacity);\r\n this._inUse = 0;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active entry count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\r\n * @param destOffset copy to instance array starting at this index; zero if undefined\r\n * @return count and offset of entries copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n let myOffset = destOffset ?? 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = sourceCount ?? source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount, offset: myOffset};\r\n }\r\n\r\n /**\r\n * Create a GrowableFloat64Array with given contents.\r\n * @param contents data to copy into the array\r\n */\r\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(contents.length);\r\n out.copyData(contents);\r\n out._inUse = contents.length;\r\n return out;\r\n }\r\n /** sort-compatible comparison.\r\n * * Returns `(a-b)` which is\r\n * * negative if `a<b`\r\n * * zero if `a === b` (with exact equality)\r\n * * positive if `a>b`\r\n */\r\n public static compare(a: any, b: any): number {\r\n return a - b;\r\n }\r\n /** Return a new array with\r\n * * All active entries copied from this instance\r\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\r\n */\r\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\r\n out.copyData(this._data, this._inUse);\r\n out._inUse = this._inUse;\r\n return out;\r\n }\r\n /**\r\n * Returns the number of entries in use.\r\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\r\n */\r\n public get length() {\r\n return this._inUse;\r\n }\r\n /**\r\n * Set the value at specified index.\r\n * @param index index of entry to set\r\n * @param value value to set\r\n */\r\n public setAtUncheckedIndex(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * Move the value at index i to index j.\r\n * @param i source index\r\n * @param j destination index.\r\n */\r\n public move(i: number, j: number) {\r\n this._data[j] = this._data[i];\r\n }\r\n /**\r\n * swap the values at indices i and j\r\n * @param i first index\r\n * @param j second index\r\n */\r\n public swap(i: number, j: number) {\r\n const a = this._data[i];\r\n this._data[i] = this._data[j];\r\n this._data[j] = a;\r\n }\r\n\r\n /**\r\n * append a single value to the array.\r\n * @param toPush value to append to the active array.\r\n */\r\n public push(toPush: number) {\r\n this.ensureCapacity(this._inUse + 1);\r\n this._data[this._inUse] = toPush;\r\n this._inUse++;\r\n }\r\n /**\r\n * Push each value from an array.\r\n * @param data array of values to push\r\n */\r\n public pushArray(data: Float64Array | number[]) {\r\n this.ensureCapacity(this._inUse + data.length);\r\n this.copyData(data, data.length, this._inUse);\r\n this._inUse += data.length;\r\n }\r\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\r\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\r\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\r\n this.ensureCapacity(this._inUse + numToCopy);\r\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\r\n this._inUse += numToCopy;\r\n }\r\n }\r\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\r\n public clear() {\r\n this._inUse = 0;\r\n }\r\n /**\r\n * Returns the number of entries in the supporting Float64Array buffer.\r\n * * This number can be larger than the `length` property.\r\n */\r\n public capacity() {\r\n return this._data.length;\r\n }\r\n /**\r\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\r\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\r\n * @param newCapacity size of new array\r\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\r\n */\r\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (newCapacity > this.capacity()) {\r\n if (applyGrowthFactor)\r\n newCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(newCapacity);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /**\r\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\r\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\r\n * @param newLength new data count\r\n * @param padValue value to use for padding if the length increases.\r\n */\r\n public resize(newLength: number, padValue: number = 0) {\r\n if (newLength >= 0 && newLength < this._inUse)\r\n this._inUse = newLength;\r\n else if (newLength > this._inUse) {\r\n this.ensureCapacity(newLength, false);\r\n this._data.fill(padValue, this._inUse);\r\n this._inUse = newLength;\r\n }\r\n }\r\n /**\r\n * * Reduce the length by one.\r\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\r\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\r\n */\r\n public pop() {\r\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\r\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\r\n if (this._inUse > 0) {\r\n this._inUse--;\r\n }\r\n }\r\n /** Access by index, without bounds check */\r\n public atUncheckedIndex(index: number): number {\r\n return this._data[index];\r\n }\r\n /** Access the 0-index member, without bounds check */\r\n public front() {\r\n return this._data[0];\r\n }\r\n /** Access the final member, without bounds check */\r\n public back() {\r\n return this._data[this._inUse - 1];\r\n }\r\n /** set a value by index */\r\n public reassign(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * * Sort the array entries.\r\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\r\n * @param compareMethod comparison method\r\n */\r\n public sort(compareMethod: (a: any, b: any) => number = GrowableFloat64Array.compare) {\r\n for (let i = 0; i < this._inUse; i++) {\r\n for (let j = i + 1; j < this._inUse; j++) {\r\n const tempI = this._data[i];\r\n const tempJ = this._data[j];\r\n if (compareMethod(tempI, tempJ) > 0) {\r\n this._data[i] = tempJ;\r\n this._data[j] = tempI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * * compress out values not within the [a,b] interval.\r\n * * Note that if a is greater than b all values are rejected.\r\n * @param a low value for accepted interval\r\n * @param b high value for accepted interval\r\n */\r\n public restrictToInterval(a: number, b: number) {\r\n const data = this._data;\r\n const n = data.length;\r\n let numAccept = 0;\r\n let q = 0;\r\n for (let i = 0; i < n; i++) {\r\n q = data[i];\r\n if (q >= a && q <= b)\r\n data[numAccept++] = q;\r\n }\r\n this._inUse = numAccept;\r\n }\r\n\r\n /**\r\n * * compress out multiple copies of values.\r\n * * this is done in the current order of the array.\r\n */\r\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\r\n const data = this._data;\r\n const n = this._inUse;\r\n if (n === 0)\r\n return;\r\n\r\n let numAccepted = 1;\r\n let a = data[0];\r\n let b;\r\n for (let i = 1; i < n; i++) {\r\n b = data[i];\r\n if (Math.abs(b - a) > tolerance) {\r\n data[numAccepted++] = b;\r\n a = b;\r\n }\r\n }\r\n this._inUse = numAccepted;\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"GrowableFloat64Array.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAgB/F;;;;;;;;GAQG;AACH,MAAa,oBAAoB;IAK/B;;;OAGG;IACH,YAAY,kBAA0B,CAAC,EAAE,YAAqB;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACO,QAAQ,CAAC,MAA+B,EAAE,WAAoB,EAAE,UAAmB;QAC3F,IAAI,QAAQ,GAAG,UAAU,IAAI,CAAC,CAAC;QAC/B,IAAI,QAAQ,GAAG,CAAC;YACd,QAAQ,GAAG,CAAC,CAAC;QACf,IAAI,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM;YAC/B,OAAO,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC;QAC/B,IAAI,OAAO,GAAG,W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C;YACT,OAAO;QAET,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC1B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE;gBAC/B,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC,GAAG,CAAC,CAAC;aACP;SACF;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;CAEF;AAzQD,oDAyQC","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 ArraysAndInterfaces\r\n */\r\n\r\n/**\r\n * Type for a OptionalGrowableFloat64Array or undefined.\r\n * @public\r\n */\r\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\r\n/**\r\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\r\n * @public\r\n */\r\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\r\n/**\r\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\r\n * * In C++ terms, this is like an std::vector\r\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\r\n * * The reallocations leave unused space to accept further additional entries without reallocation.\r\n * * The `length` property returns the number of entries in use.\r\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\r\n * @public\r\n */\r\nexport class GrowableFloat64Array {\r\n private _data: Float64Array;\r\n private _inUse: number;\r\n private _growthFactor: number;\r\n\r\n /** Construct a GrowableFloat64Array.\r\n * @param initialCapacity initial capacity (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n constructor(initialCapacity: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialCapacity);\r\n this._inUse = 0;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active entry count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\r\n * @param destOffset copy to instance array starting at this index; zero if undefined\r\n * @return count and offset of entries copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n let myOffset = destOffset ?? 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = sourceCount ?? source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount, offset: myOffset};\r\n }\r\n\r\n /**\r\n * Create a GrowableFloat64Array with given contents.\r\n * @param contents data to copy into the array\r\n */\r\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(contents.length);\r\n out.copyData(contents);\r\n out._inUse = contents.length;\r\n return out;\r\n }\r\n /** sort-compatible comparison.\r\n * * Returns `(a-b)` which is\r\n * * negative if `a<b`\r\n * * zero if `a === b` (with exact equality)\r\n * * positive if `a>b`\r\n */\r\n public static compare(a: any, b: any): number {\r\n return a - b;\r\n }\r\n /** Return a new array with\r\n * * All active entries copied from this instance\r\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\r\n */\r\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\r\n out.copyData(this._data, this._inUse);\r\n out._inUse = this._inUse;\r\n return out;\r\n }\r\n /**\r\n * Returns the number of entries in use.\r\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\r\n */\r\n public get length() {\r\n return this._inUse;\r\n }\r\n /**\r\n * Set the value at specified index.\r\n * @param index index of entry to set\r\n * @param value value to set\r\n */\r\n public setAtUncheckedIndex(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * Move the value at index i to index j.\r\n * @param i source index\r\n * @param j destination index.\r\n */\r\n public move(i: number, j: number) {\r\n this._data[j] = this._data[i];\r\n }\r\n /**\r\n * swap the values at indices i and j\r\n * @param i first index\r\n * @param j second index\r\n */\r\n public swap(i: number, j: number) {\r\n const a = this._data[i];\r\n this._data[i] = this._data[j];\r\n this._data[j] = a;\r\n }\r\n\r\n /**\r\n * append a single value to the array.\r\n * @param toPush value to append to the active array.\r\n */\r\n public push(toPush: number) {\r\n this.ensureCapacity(this._inUse + 1);\r\n this._data[this._inUse] = toPush;\r\n this._inUse++;\r\n }\r\n /**\r\n * Push each value from an array.\r\n * @param data array of values to push\r\n */\r\n public pushArray(data: Float64Array | number[]) {\r\n this.ensureCapacity(this._inUse + data.length);\r\n this.copyData(data, data.length, this._inUse);\r\n this._inUse += data.length;\r\n }\r\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\r\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\r\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\r\n this.ensureCapacity(this._inUse + numToCopy);\r\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\r\n this._inUse += numToCopy;\r\n }\r\n }\r\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\r\n public clear() {\r\n this._inUse = 0;\r\n }\r\n /**\r\n * Returns the number of entries in the supporting Float64Array buffer.\r\n * * This number can be larger than the `length` property.\r\n */\r\n public capacity() {\r\n return this._data.length;\r\n }\r\n /**\r\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\r\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\r\n * @param newCapacity size of new array\r\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\r\n */\r\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (newCapacity > this.capacity()) {\r\n if (applyGrowthFactor)\r\n newCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(newCapacity);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /**\r\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\r\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\r\n * @param newLength new data count\r\n * @param padValue value to use for padding if the length increases.\r\n */\r\n public resize(newLength: number, padValue: number = 0) {\r\n if (newLength >= 0 && newLength < this._inUse)\r\n this._inUse = newLength;\r\n else if (newLength > this._inUse) {\r\n this.ensureCapacity(newLength, false);\r\n this._data.fill(padValue, this._inUse);\r\n this._inUse = newLength;\r\n }\r\n }\r\n /**\r\n * * Reduce the length by one.\r\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\r\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\r\n */\r\n public pop() {\r\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\r\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\r\n if (this._inUse > 0) {\r\n this._inUse--;\r\n }\r\n }\r\n /** Access by index, without bounds check */\r\n public atUncheckedIndex(index: number): number {\r\n return this._data[index];\r\n }\r\n /** Access the 0-index member, without bounds check */\r\n public front() {\r\n return this._data[0];\r\n }\r\n /** Access the final member, without bounds check */\r\n public back() {\r\n return this._data[this._inUse - 1];\r\n }\r\n /** set a value by index */\r\n public reassign(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * * Sort the array entries.\r\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\r\n * @param compareMethod comparison method\r\n */\r\n public sort(compareMethod: (a: any, b: any) => number = (a, b) => GrowableFloat64Array.compare(a, b)) {\r\n for (let i = 0; i < this._inUse; i++) {\r\n for (let j = i + 1; j < this._inUse; j++) {\r\n const tempI = this._data[i];\r\n const tempJ = this._data[j];\r\n if (compareMethod(tempI, tempJ) > 0) {\r\n this._data[i] = tempJ;\r\n this._data[j] = tempI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * * compress out values not within the [a,b] interval.\r\n * * Note that if a is greater than b all values are rejected.\r\n * @param a low value for accepted interval\r\n * @param b high value for accepted interval\r\n */\r\n public restrictToInterval(a: number, b: number) {\r\n const data = this._data;\r\n const n = data.length;\r\n let numAccept = 0;\r\n let q = 0;\r\n for (let i = 0; i < n; i++) {\r\n q = data[i];\r\n if (q >= a && q <= b)\r\n data[numAccept++] = q;\r\n }\r\n this._inUse = numAccept;\r\n }\r\n\r\n /**\r\n * * compress out multiple copies of values.\r\n * * this is done in the current order of the array.\r\n */\r\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\r\n const data = this._data;\r\n const n = this._inUse;\r\n if (n === 0)\r\n return;\r\n\r\n let numAccepted = 1;\r\n let a = data[0];\r\n let b;\r\n for (let i = 1; i < n; i++) {\r\n b = data[i];\r\n if (Math.abs(b - a) > tolerance) {\r\n data[numAccepted++] = b;\r\n a = b;\r\n }\r\n }\r\n this._inUse = numAccepted;\r\n }\r\n\r\n}\r\n"]}
@@ -688,6 +688,24 @@ export declare class Matrix3d implements BeJSONFunctions {
688
688
  * * Visualization can be found at itwinjs.org/sandbox/SaeedTorabi/DirectionalScale
689
689
  */
690
690
  static createDirectionalScale(direction: Vector3d, scale: number, result?: Matrix3d): Matrix3d;
691
+ /**
692
+ * Create a matrix which sweeps a vector along `sweepVector` until it hits the plane through the origin with the given normal.
693
+ * * To sweep an arbitrary vector U0 along direction W to the vector U1 in the plane through the origin with normal N:
694
+ * * `U1 = U0 + W * alpha`
695
+ * * `U1 DOT N = (U0 + W * alpha) DOT N = 0`
696
+ * * `U0 DOT N = - alpha * W DOT N`
697
+ * * `alpha = - U0 DOT N / W DOT N`
698
+ * * Insert the alpha definition in U1:
699
+ * * `U1 = U0 - W * N DOT U0 / W DOT N`
700
+ * * Write vector dot expression N DOT U0 as a matrix product (^T indicates transpose):
701
+ * * `U1 = U0 - W * N^T * U0 / W DOT N`
702
+ * * Note W * N^T is an outer product, i.e. a 3x3 matrix. By associativity of matrix multiplication:
703
+ * * `U1 = (I - W * N^T / W DOT N) * U0`
704
+ * * and the matrix to do the sweep for any vector in place of U0 is `I - W * N^T / W DOT N`.
705
+ * @param sweepVector sweep direction
706
+ * @param planeNormal normal to the target plane
707
+ */
708
+ static createFlattenAlongVectorToPlane(sweepVector: Vector3d, planeNormal: Vector3d): Matrix3d | undefined;
691
709
  /**
692
710
  * Multiply `matrix * point`, treating the point as a column vector on the right.
693
711
  * ```