@itwin/core-geometry 4.1.0-dev.8 → 4.1.0-dev.81

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 (676) hide show
  1. package/CHANGELOG.md +87 -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/AlternatingConvexClipTree.d.ts +15 -17
  16. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  17. package/lib/cjs/clipping/AlternatingConvexClipTree.js +24 -20
  18. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  19. package/lib/cjs/clipping/BooleanClipFactory.d.ts +28 -28
  20. package/lib/cjs/clipping/BooleanClipFactory.d.ts.map +1 -1
  21. package/lib/cjs/clipping/BooleanClipFactory.js +28 -28
  22. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  23. package/lib/cjs/clipping/BooleanClipNode.d.ts +11 -11
  24. package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
  25. package/lib/cjs/clipping/BooleanClipNode.js +11 -11
  26. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  27. package/lib/cjs/clipping/ClipPlane.d.ts +73 -76
  28. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  29. package/lib/cjs/clipping/ClipPlane.js +105 -86
  30. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  31. package/lib/cjs/clipping/ClipPrimitive.d.ts +78 -47
  32. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  33. package/lib/cjs/clipping/ClipPrimitive.js +112 -54
  34. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  35. package/lib/cjs/clipping/ClipUtils.d.ts +54 -44
  36. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  37. package/lib/cjs/clipping/ClipUtils.js +33 -29
  38. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  39. package/lib/cjs/clipping/ClipVector.d.ts +39 -25
  40. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  41. package/lib/cjs/clipping/ClipVector.js +35 -23
  42. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  43. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +61 -38
  44. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  45. package/lib/cjs/clipping/ConvexClipPlaneSet.js +64 -41
  46. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  47. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +49 -30
  48. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  49. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +50 -30
  50. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  51. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +2 -2
  52. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  53. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  54. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  55. package/lib/cjs/core-geometry.d.ts +5 -1
  56. package/lib/cjs/core-geometry.d.ts.map +1 -1
  57. package/lib/cjs/core-geometry.js +5 -1
  58. package/lib/cjs/core-geometry.js.map +1 -1
  59. package/lib/cjs/curve/Arc3d.d.ts +4 -3
  60. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  61. package/lib/cjs/curve/Arc3d.js +7 -5
  62. package/lib/cjs/curve/Arc3d.js.map +1 -1
  63. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +62 -42
  64. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  65. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +71 -48
  66. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  67. package/lib/cjs/curve/CurveCollection.d.ts +36 -26
  68. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  69. package/lib/cjs/curve/CurveCollection.js +46 -39
  70. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  71. package/lib/cjs/curve/CurveCurve.d.ts +6 -2
  72. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  73. package/lib/cjs/curve/CurveCurve.js +13 -9
  74. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  75. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts +74 -68
  76. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +1 -1
  77. package/lib/cjs/curve/CurveCurveCloseApproachXY.js +100 -108
  78. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +1 -1
  79. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts +46 -48
  80. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  81. package/lib/cjs/curve/CurveCurveIntersectXY.js +72 -61
  82. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  83. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts +32 -38
  84. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  85. package/lib/cjs/curve/CurveCurveIntersectXYZ.js +86 -97
  86. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
  87. package/lib/cjs/curve/CurveFactory.d.ts +67 -3
  88. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  89. package/lib/cjs/curve/CurveFactory.js +75 -7
  90. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  91. package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
  92. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  93. package/lib/cjs/curve/CurveLocationDetail.js +9 -7
  94. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  95. package/lib/cjs/curve/CurveOps.d.ts +77 -0
  96. package/lib/cjs/curve/CurveOps.d.ts.map +1 -0
  97. package/lib/cjs/curve/CurveOps.js +160 -0
  98. package/lib/cjs/curve/CurveOps.js.map +1 -0
  99. package/lib/cjs/curve/CurvePrimitive.d.ts +26 -18
  100. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  101. package/lib/cjs/curve/CurvePrimitive.js +4 -3
  102. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  103. package/lib/cjs/curve/GeometryQuery.d.ts +2 -2
  104. package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
  105. package/lib/cjs/curve/GeometryQuery.js +2 -2
  106. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  107. package/lib/cjs/curve/LineSegment3d.d.ts +7 -5
  108. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  109. package/lib/cjs/curve/LineSegment3d.js +6 -6
  110. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  111. package/lib/cjs/curve/LineString3d.d.ts +2 -2
  112. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  113. package/lib/cjs/curve/LineString3d.js +3 -3
  114. package/lib/cjs/curve/LineString3d.js.map +1 -1
  115. package/lib/cjs/curve/Loop.d.ts +7 -5
  116. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  117. package/lib/cjs/curve/Loop.js +18 -6
  118. package/lib/cjs/curve/Loop.js.map +1 -1
  119. package/lib/cjs/curve/OffsetOptions.d.ts +97 -0
  120. package/lib/cjs/curve/OffsetOptions.d.ts.map +1 -0
  121. package/lib/cjs/curve/OffsetOptions.js +166 -0
  122. package/lib/cjs/curve/OffsetOptions.js.map +1 -0
  123. package/lib/cjs/curve/ParityRegion.d.ts +7 -7
  124. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  125. package/lib/cjs/curve/ParityRegion.js +19 -11
  126. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  127. package/lib/cjs/curve/Path.d.ts +6 -6
  128. package/lib/cjs/curve/Path.d.ts.map +1 -1
  129. package/lib/cjs/curve/Path.js +15 -9
  130. package/lib/cjs/curve/Path.js.map +1 -1
  131. package/lib/cjs/curve/ProxyCurve.d.ts +5 -7
  132. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  133. package/lib/cjs/curve/ProxyCurve.js +7 -7
  134. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  135. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  136. package/lib/cjs/curve/RegionOps.d.ts +76 -56
  137. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  138. package/lib/cjs/curve/RegionOps.js +83 -60
  139. package/lib/cjs/curve/RegionOps.js.map +1 -1
  140. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +2 -2
  141. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  142. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  143. package/lib/cjs/curve/StrokeOptions.js +6 -2
  144. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  145. package/lib/cjs/curve/UnionRegion.d.ts +6 -5
  146. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  147. package/lib/cjs/curve/UnionRegion.js +17 -8
  148. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  149. package/lib/cjs/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
  150. package/lib/cjs/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
  151. package/lib/cjs/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
  152. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -0
  153. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
  154. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  155. package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
  156. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  157. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +59 -70
  158. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  159. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +130 -220
  160. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  161. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  162. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  163. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  164. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  165. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
  166. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  167. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +89 -178
  168. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  169. package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  170. package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
  171. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  172. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -1
  173. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  174. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  175. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  176. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +2 -2
  177. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  178. package/lib/cjs/curve/spiral/XYCurveEvaluator.js +1 -1
  179. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  180. package/lib/cjs/geometry3d/Angle.d.ts +9 -0
  181. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  182. package/lib/cjs/geometry3d/Angle.js +13 -0
  183. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  184. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  185. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  186. package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
  187. package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
  188. package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
  189. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  190. package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
  191. package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
  192. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  193. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  194. package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
  195. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  196. package/lib/cjs/geometry3d/GeometryHandler.d.ts +103 -97
  197. package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
  198. package/lib/cjs/geometry3d/GeometryHandler.js +247 -124
  199. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  200. package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
  201. package/lib/cjs/geometry3d/GrowableBlockedArray.js +1 -1
  202. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  203. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  204. package/lib/cjs/geometry3d/GrowableFloat64Array.js +1 -1
  205. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  206. package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
  207. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  208. package/lib/cjs/geometry3d/Matrix3d.js +32 -5
  209. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  210. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  211. package/lib/cjs/geometry3d/Plane3d.d.ts +41 -32
  212. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  213. package/lib/cjs/geometry3d/Plane3d.js +11 -8
  214. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  215. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
  216. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  217. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
  218. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  219. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  220. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  221. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +37 -32
  222. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  223. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +8 -9
  224. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  225. package/lib/cjs/geometry3d/Point2dVector2d.js +9 -10
  226. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  227. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  228. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +12 -4
  229. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  230. package/lib/cjs/geometry3d/Point3dVector3d.js +18 -5
  231. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  232. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  233. package/lib/cjs/geometry3d/PointHelpers.js +5 -5
  234. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  235. package/lib/cjs/geometry3d/PolygonOps.d.ts +6 -2
  236. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  237. package/lib/cjs/geometry3d/PolygonOps.js +31 -22
  238. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  239. package/lib/cjs/geometry3d/PolylineOps.d.ts +16 -1
  240. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  241. package/lib/cjs/geometry3d/PolylineOps.js +55 -0
  242. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  243. package/lib/cjs/geometry3d/Range.d.ts +134 -94
  244. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  245. package/lib/cjs/geometry3d/Range.js +297 -145
  246. package/lib/cjs/geometry3d/Range.js.map +1 -1
  247. package/lib/cjs/geometry3d/Ray2d.d.ts +69 -0
  248. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -0
  249. package/lib/cjs/geometry3d/Ray2d.js +146 -0
  250. package/lib/cjs/geometry3d/Ray2d.js.map +1 -0
  251. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  252. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  253. package/lib/cjs/geometry3d/Transform.d.ts +10 -3
  254. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  255. package/lib/cjs/geometry3d/Transform.js +18 -6
  256. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  257. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  258. package/lib/cjs/numerics/ConvexPolygon2d.d.ts +7 -49
  259. package/lib/cjs/numerics/ConvexPolygon2d.d.ts.map +1 -1
  260. package/lib/cjs/numerics/ConvexPolygon2d.js +16 -107
  261. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  262. package/lib/cjs/numerics/Newton.js.map +1 -1
  263. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  264. package/lib/cjs/numerics/Polynomials.js +0 -2
  265. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  266. package/lib/cjs/numerics/Quadrature.js +5 -5
  267. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  268. package/lib/cjs/polyface/IndexedEdgeMatcher.js +1 -1
  269. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  270. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  271. package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
  272. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  273. package/lib/cjs/polyface/PolyfaceQuery.d.ts +93 -14
  274. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  275. package/lib/cjs/polyface/PolyfaceQuery.js +173 -34
  276. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  277. package/lib/cjs/polyface/TaggedNumericData.js +1 -1
  278. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  279. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
  280. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  281. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.d.ts +27 -19
  282. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.d.ts.map +1 -1
  283. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js +30 -12
  284. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  285. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.d.ts +12 -8
  286. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.d.ts.map +1 -1
  287. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js +18 -4
  288. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  289. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.d.ts +3 -4
  290. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.d.ts.map +1 -1
  291. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js +3 -5
  292. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  293. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  294. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.d.ts +15 -12
  295. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.d.ts.map +1 -1
  296. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  297. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +38 -0
  298. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  299. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +104 -1
  300. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  301. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  302. package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
  303. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  304. package/lib/cjs/serialization/GeometrySamples.js +30 -0
  305. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  306. package/lib/cjs/serialization/IModelJsonSchema.d.ts +2 -7
  307. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  308. package/lib/cjs/serialization/IModelJsonSchema.js +2 -7
  309. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  310. package/lib/cjs/solid/LinearSweep.d.ts +2 -1
  311. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  312. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  313. package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
  314. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  315. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  316. package/lib/cjs/solid/RuledSweep.d.ts +2 -1
  317. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  318. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  319. package/lib/cjs/solid/SweepContour.d.ts +2 -2
  320. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  321. package/lib/cjs/solid/SweepContour.js +9 -0
  322. package/lib/cjs/solid/SweepContour.js.map +1 -1
  323. package/lib/cjs/topology/ChainMerge.js +1 -1
  324. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  325. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  326. package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -1
  327. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  328. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +1 -1
  329. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  330. package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  331. package/lib/cjs/topology/HalfEdgePriorityQueue.js +1 -1
  332. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  333. package/lib/cjs/topology/RegularizeFace.js +3 -3
  334. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  335. package/lib/cjs/topology/Triangulation.js +1 -1
  336. package/lib/cjs/topology/Triangulation.js.map +1 -1
  337. package/lib/esm/Geometry.js.map +1 -1
  338. package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
  339. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  340. package/lib/esm/bspline/BSplineCurve.js +1 -1
  341. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  342. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  343. package/lib/esm/bspline/BSplineSurface.js +1 -1
  344. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  345. package/lib/esm/bspline/BezierCurveBase.d.ts +1 -1
  346. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  347. package/lib/esm/bspline/BezierCurveBase.js +1 -1
  348. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  349. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  350. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +15 -17
  351. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  352. package/lib/esm/clipping/AlternatingConvexClipTree.js +24 -20
  353. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  354. package/lib/esm/clipping/BooleanClipFactory.d.ts +28 -28
  355. package/lib/esm/clipping/BooleanClipFactory.d.ts.map +1 -1
  356. package/lib/esm/clipping/BooleanClipFactory.js +28 -28
  357. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  358. package/lib/esm/clipping/BooleanClipNode.d.ts +11 -11
  359. package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
  360. package/lib/esm/clipping/BooleanClipNode.js +11 -11
  361. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  362. package/lib/esm/clipping/ClipPlane.d.ts +73 -76
  363. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  364. package/lib/esm/clipping/ClipPlane.js +105 -86
  365. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  366. package/lib/esm/clipping/ClipPrimitive.d.ts +78 -47
  367. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  368. package/lib/esm/clipping/ClipPrimitive.js +112 -54
  369. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  370. package/lib/esm/clipping/ClipUtils.d.ts +54 -44
  371. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  372. package/lib/esm/clipping/ClipUtils.js +33 -29
  373. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  374. package/lib/esm/clipping/ClipVector.d.ts +39 -25
  375. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  376. package/lib/esm/clipping/ClipVector.js +35 -23
  377. package/lib/esm/clipping/ClipVector.js.map +1 -1
  378. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +61 -38
  379. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  380. package/lib/esm/clipping/ConvexClipPlaneSet.js +64 -41
  381. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  382. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +49 -30
  383. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  384. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +50 -30
  385. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  386. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +2 -2
  387. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  388. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  389. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  390. package/lib/esm/core-geometry.d.ts +5 -1
  391. package/lib/esm/core-geometry.d.ts.map +1 -1
  392. package/lib/esm/core-geometry.js +5 -1
  393. package/lib/esm/core-geometry.js.map +1 -1
  394. package/lib/esm/curve/Arc3d.d.ts +4 -3
  395. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  396. package/lib/esm/curve/Arc3d.js +6 -4
  397. package/lib/esm/curve/Arc3d.js.map +1 -1
  398. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +62 -42
  399. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  400. package/lib/esm/curve/CurveChainWithDistanceIndex.js +70 -47
  401. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  402. package/lib/esm/curve/CurveCollection.d.ts +36 -26
  403. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  404. package/lib/esm/curve/CurveCollection.js +46 -39
  405. package/lib/esm/curve/CurveCollection.js.map +1 -1
  406. package/lib/esm/curve/CurveCurve.d.ts +6 -2
  407. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  408. package/lib/esm/curve/CurveCurve.js +13 -9
  409. package/lib/esm/curve/CurveCurve.js.map +1 -1
  410. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts +74 -68
  411. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +1 -1
  412. package/lib/esm/curve/CurveCurveCloseApproachXY.js +100 -108
  413. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +1 -1
  414. package/lib/esm/curve/CurveCurveIntersectXY.d.ts +46 -48
  415. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  416. package/lib/esm/curve/CurveCurveIntersectXY.js +72 -61
  417. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  418. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts +32 -38
  419. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  420. package/lib/esm/curve/CurveCurveIntersectXYZ.js +86 -97
  421. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
  422. package/lib/esm/curve/CurveFactory.d.ts +67 -3
  423. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  424. package/lib/esm/curve/CurveFactory.js +74 -6
  425. package/lib/esm/curve/CurveFactory.js.map +1 -1
  426. package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
  427. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  428. package/lib/esm/curve/CurveLocationDetail.js +9 -7
  429. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  430. package/lib/esm/curve/CurveOps.d.ts +77 -0
  431. package/lib/esm/curve/CurveOps.d.ts.map +1 -0
  432. package/lib/esm/curve/CurveOps.js +156 -0
  433. package/lib/esm/curve/CurveOps.js.map +1 -0
  434. package/lib/esm/curve/CurvePrimitive.d.ts +26 -18
  435. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  436. package/lib/esm/curve/CurvePrimitive.js +4 -3
  437. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  438. package/lib/esm/curve/GeometryQuery.d.ts +2 -2
  439. package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
  440. package/lib/esm/curve/GeometryQuery.js +2 -2
  441. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  442. package/lib/esm/curve/LineSegment3d.d.ts +7 -5
  443. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  444. package/lib/esm/curve/LineSegment3d.js +5 -5
  445. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  446. package/lib/esm/curve/LineString3d.d.ts +2 -2
  447. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  448. package/lib/esm/curve/LineString3d.js +2 -2
  449. package/lib/esm/curve/LineString3d.js.map +1 -1
  450. package/lib/esm/curve/Loop.d.ts +7 -5
  451. package/lib/esm/curve/Loop.d.ts.map +1 -1
  452. package/lib/esm/curve/Loop.js +18 -6
  453. package/lib/esm/curve/Loop.js.map +1 -1
  454. package/lib/esm/curve/OffsetOptions.d.ts +97 -0
  455. package/lib/esm/curve/OffsetOptions.d.ts.map +1 -0
  456. package/lib/esm/curve/OffsetOptions.js +161 -0
  457. package/lib/esm/curve/OffsetOptions.js.map +1 -0
  458. package/lib/esm/curve/ParityRegion.d.ts +7 -7
  459. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  460. package/lib/esm/curve/ParityRegion.js +19 -11
  461. package/lib/esm/curve/ParityRegion.js.map +1 -1
  462. package/lib/esm/curve/Path.d.ts +6 -6
  463. package/lib/esm/curve/Path.d.ts.map +1 -1
  464. package/lib/esm/curve/Path.js +15 -9
  465. package/lib/esm/curve/Path.js.map +1 -1
  466. package/lib/esm/curve/ProxyCurve.d.ts +5 -7
  467. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  468. package/lib/esm/curve/ProxyCurve.js +7 -7
  469. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  470. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  471. package/lib/esm/curve/RegionOps.d.ts +76 -56
  472. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  473. package/lib/esm/curve/RegionOps.js +84 -61
  474. package/lib/esm/curve/RegionOps.js.map +1 -1
  475. package/lib/esm/curve/RegionOpsClassificationSweeps.js +2 -2
  476. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  477. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  478. package/lib/esm/curve/StrokeOptions.js +6 -2
  479. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  480. package/lib/esm/curve/UnionRegion.d.ts +6 -5
  481. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  482. package/lib/esm/curve/UnionRegion.js +17 -8
  483. package/lib/esm/curve/UnionRegion.js.map +1 -1
  484. package/lib/esm/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
  485. package/lib/esm/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
  486. package/lib/esm/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
  487. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -0
  488. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
  489. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  490. package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
  491. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  492. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +59 -70
  493. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  494. package/lib/esm/curve/internalContexts/MultiChainCollector.js +129 -218
  495. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  496. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  497. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  498. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  499. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  500. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
  501. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  502. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +86 -173
  503. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  504. package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  505. package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
  506. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  507. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -1
  508. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  509. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  510. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  511. package/lib/esm/curve/spiral/TransitionSpiral3d.js +1 -1
  512. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  513. package/lib/esm/curve/spiral/XYCurveEvaluator.js +1 -1
  514. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  515. package/lib/esm/geometry3d/Angle.d.ts +9 -0
  516. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  517. package/lib/esm/geometry3d/Angle.js +13 -0
  518. package/lib/esm/geometry3d/Angle.js.map +1 -1
  519. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  520. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  521. package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
  522. package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
  523. package/lib/esm/geometry3d/BilinearPatch.js +51 -55
  524. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  525. package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
  526. package/lib/esm/geometry3d/Ellipsoid.js +1 -1
  527. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  528. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  529. package/lib/esm/geometry3d/FrameBuilder.js +13 -11
  530. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  531. package/lib/esm/geometry3d/GeometryHandler.d.ts +103 -97
  532. package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
  533. package/lib/esm/geometry3d/GeometryHandler.js +247 -124
  534. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  535. package/lib/esm/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
  536. package/lib/esm/geometry3d/GrowableBlockedArray.js +1 -1
  537. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  538. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  539. package/lib/esm/geometry3d/GrowableFloat64Array.js +1 -1
  540. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  541. package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
  542. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  543. package/lib/esm/geometry3d/Matrix3d.js +32 -5
  544. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  545. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  546. package/lib/esm/geometry3d/Plane3d.d.ts +41 -32
  547. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  548. package/lib/esm/geometry3d/Plane3d.js +11 -8
  549. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  550. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
  551. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  552. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
  553. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  554. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  555. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  556. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +37 -32
  557. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  558. package/lib/esm/geometry3d/Point2dVector2d.d.ts +8 -9
  559. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  560. package/lib/esm/geometry3d/Point2dVector2d.js +9 -10
  561. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  562. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  563. package/lib/esm/geometry3d/Point3dVector3d.d.ts +12 -4
  564. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  565. package/lib/esm/geometry3d/Point3dVector3d.js +18 -5
  566. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  567. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  568. package/lib/esm/geometry3d/PointHelpers.js +5 -5
  569. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  570. package/lib/esm/geometry3d/PolygonOps.d.ts +6 -2
  571. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  572. package/lib/esm/geometry3d/PolygonOps.js +31 -22
  573. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  574. package/lib/esm/geometry3d/PolylineOps.d.ts +16 -1
  575. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  576. package/lib/esm/geometry3d/PolylineOps.js +56 -1
  577. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  578. package/lib/esm/geometry3d/Range.d.ts +134 -94
  579. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  580. package/lib/esm/geometry3d/Range.js +297 -145
  581. package/lib/esm/geometry3d/Range.js.map +1 -1
  582. package/lib/esm/geometry3d/Ray2d.d.ts +69 -0
  583. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -0
  584. package/lib/esm/geometry3d/Ray2d.js +142 -0
  585. package/lib/esm/geometry3d/Ray2d.js.map +1 -0
  586. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  587. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  588. package/lib/esm/geometry3d/Transform.d.ts +10 -3
  589. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  590. package/lib/esm/geometry3d/Transform.js +18 -6
  591. package/lib/esm/geometry3d/Transform.js.map +1 -1
  592. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  593. package/lib/esm/numerics/ConvexPolygon2d.d.ts +7 -49
  594. package/lib/esm/numerics/ConvexPolygon2d.d.ts.map +1 -1
  595. package/lib/esm/numerics/ConvexPolygon2d.js +14 -104
  596. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  597. package/lib/esm/numerics/Newton.js.map +1 -1
  598. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  599. package/lib/esm/numerics/Polynomials.js +0 -2
  600. package/lib/esm/numerics/Polynomials.js.map +1 -1
  601. package/lib/esm/numerics/Quadrature.js +5 -5
  602. package/lib/esm/numerics/Quadrature.js.map +1 -1
  603. package/lib/esm/polyface/IndexedEdgeMatcher.js +1 -1
  604. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  605. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  606. package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
  607. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  608. package/lib/esm/polyface/PolyfaceQuery.d.ts +93 -14
  609. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  610. package/lib/esm/polyface/PolyfaceQuery.js +173 -35
  611. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  612. package/lib/esm/polyface/TaggedNumericData.js +1 -1
  613. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  614. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
  615. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  616. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.d.ts +27 -19
  617. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.d.ts.map +1 -1
  618. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js +30 -12
  619. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  620. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.d.ts +12 -8
  621. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.d.ts.map +1 -1
  622. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js +18 -4
  623. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  624. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.d.ts +3 -4
  625. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.d.ts.map +1 -1
  626. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js +3 -5
  627. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  628. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  629. package/lib/esm/polyface/multiclip/Range2dSearchInterface.d.ts +15 -12
  630. package/lib/esm/polyface/multiclip/Range2dSearchInterface.d.ts.map +1 -1
  631. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  632. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +38 -0
  633. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  634. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +102 -1
  635. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  636. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  637. package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
  638. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  639. package/lib/esm/serialization/GeometrySamples.js +30 -0
  640. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  641. package/lib/esm/serialization/IModelJsonSchema.d.ts +2 -7
  642. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  643. package/lib/esm/serialization/IModelJsonSchema.js +2 -7
  644. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  645. package/lib/esm/solid/LinearSweep.d.ts +2 -1
  646. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  647. package/lib/esm/solid/LinearSweep.js.map +1 -1
  648. package/lib/esm/solid/RotationalSweep.d.ts +2 -1
  649. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  650. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  651. package/lib/esm/solid/RuledSweep.d.ts +2 -1
  652. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  653. package/lib/esm/solid/RuledSweep.js.map +1 -1
  654. package/lib/esm/solid/SweepContour.d.ts +2 -2
  655. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  656. package/lib/esm/solid/SweepContour.js +9 -0
  657. package/lib/esm/solid/SweepContour.js.map +1 -1
  658. package/lib/esm/topology/ChainMerge.js +1 -1
  659. package/lib/esm/topology/ChainMerge.js.map +1 -1
  660. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  661. package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -1
  662. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  663. package/lib/esm/topology/HalfEdgeGraphSpineContext.js +1 -1
  664. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  665. package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  666. package/lib/esm/topology/HalfEdgePriorityQueue.js +1 -1
  667. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  668. package/lib/esm/topology/RegularizeFace.js +3 -3
  669. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  670. package/lib/esm/topology/Triangulation.js +1 -1
  671. package/lib/esm/topology/Triangulation.js.map +1 -1
  672. package/package.json +6 -17
  673. package/lib/cjs/curve/ChainCollectorContext.d.ts.map +0 -1
  674. package/lib/cjs/curve/ChainCollectorContext.js.map +0 -1
  675. package/lib/esm/curve/ChainCollectorContext.d.ts.map +0 -1
  676. package/lib/esm/curve/ChainCollectorContext.js.map +0 -1
@@ -19,16 +19,17 @@ import { PolyfaceBuilder } from "../polyface/PolyfaceBuilder";
19
19
  import { HalfEdgeMask } from "../topology/Graph";
20
20
  import { HalfEdgeGraphSearch } from "../topology/HalfEdgeGraphSearch";
21
21
  import { Triangulator } from "../topology/Triangulation";
22
- import { ChainCollectorContext } from "./ChainCollectorContext";
23
22
  import { BagOfCurves, CurveChain, CurveCollection } from "./CurveCollection";
24
23
  import { CurveCurve } from "./CurveCurve";
24
+ import { CurveOps } from "./CurveOps";
25
25
  import { CurvePrimitive } from "./CurvePrimitive";
26
26
  import { CurveWireMomentsXYZ } from "./CurveWireMomentsXYZ";
27
27
  import { GeometryQuery } from "./GeometryQuery";
28
- import { OffsetHelpers } from "./internalContexts/MultiChainCollector";
29
- import { CurveChainWireOffsetContext, PolygonWireOffsetContext } from "./internalContexts/PolygonOffsetContext";
28
+ import { ChainCollectorContext } from "./internalContexts/ChainCollectorContext";
29
+ import { PolygonWireOffsetContext } from "./internalContexts/PolygonOffsetContext";
30
30
  import { LineString3d } from "./LineString3d";
31
31
  import { Loop } from "./Loop";
32
+ import { OffsetOptions } from "./OffsetOptions";
32
33
  import { ParityRegion } from "./ParityRegion";
33
34
  import { Path } from "./Path";
34
35
  import { ConsolidateAdjacentCurvePrimitivesContext } from "./Query/ConsolidateAdjacentPrimitivesContext";
@@ -57,7 +58,8 @@ export var RegionBinaryOpType;
57
58
  * * `ParityRegion` -- a collection of loops, interpreted by parity rules.
58
59
  * The common "One outer loop and many Inner loops" is a parity region.
59
60
  * * `UnionRegion` -- a collection of `Loop` and `ParityRegion` objects understood as a (probably disjoint) union.
60
- * * Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has been rotated parallel to the xy-plane.
61
+ * * **NOTE:** Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has
62
+ * been rotated parallel to the xy-plane.
61
63
  * @public
62
64
  */
63
65
  export class RegionOps {
@@ -76,7 +78,8 @@ export class RegionOps {
76
78
  }
77
79
  return undefined;
78
80
  }
79
- /** Return an area tolerance for a given xy-range and optional distance tolerance.
81
+ /**
82
+ * Return an area tolerance for a given xy-range and optional distance tolerance.
80
83
  * @param range range of planar region to tolerance
81
84
  * @param distanceTolerance optional absolute distance tolerance
82
85
  */
@@ -99,7 +102,8 @@ export class RegionOps {
99
102
  }
100
103
  return undefined;
101
104
  }
102
- /** Return MomentData with the sums of wire moments.
105
+ /**
106
+ * Return MomentData with the sums of wire moments.
103
107
  * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with
104
108
  * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
105
109
  * @param root any CurveCollection or CurvePrimitive.
@@ -112,7 +116,7 @@ export class RegionOps {
112
116
  return result;
113
117
  }
114
118
  /**
115
- * * create loops in the graph.
119
+ * Create loops in the graph.
116
120
  * @internal
117
121
  */
118
122
  static addLoopsToGraph(graph, data, announceIsolatedLoop) {
@@ -156,7 +160,8 @@ export class RegionOps {
156
160
  }
157
161
  }
158
162
  }
159
- /** Add multiple loops to a graph.
163
+ /**
164
+ * Add multiple loops to a graph.
160
165
  * * Apply edgeTag and mask to each edge.
161
166
  * @internal
162
167
  */
@@ -175,7 +180,6 @@ export class RegionOps {
175
180
  /**
176
181
  * Given a graph just produced by booleans, convert to a polyface
177
182
  * * "just produced" implies exterior face markup.
178
- *
179
183
  * @param graph
180
184
  * @param triangulate
181
185
  */
@@ -236,7 +240,8 @@ export class RegionOps {
236
240
  * @param loopsB second set of loops
237
241
  * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA
238
242
  * @param mergeTolerance absolute distance tolerance for merging loops
239
- * @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added to connect interior loops to exterior loops.
243
+ * @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added
244
+ * to connect interior loops to exterior loops.
240
245
  */
241
246
  static regionBooleanXY(loopsA, loopsB, operation, mergeTolerance = Geometry.smallMetricDistance) {
242
247
  const result = UnionRegion.create();
@@ -303,34 +308,33 @@ export class RegionOps {
303
308
  }
304
309
  return RegionOps.sortOuterAndHoleLoopsXY(allLoops);
305
310
  }
306
- /** Construct a wire (not area!!) that is offset from given polyline or polygon.
307
- * * This is a simple wire offset, not an area.
308
- * * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not guarantee a simple area offset.
309
- * * The construction algorithm is subject to being changed, resulting in different (hopefully better) self-intersection behavior on the future.
311
+ /**
312
+ * Construct a wire that is offset from the given polyline or polygon.
313
+ * * This is a simple wire offset, not an area offset.
314
+ * * Since z-coordinates are ignored, for best results the input points should lie in (a plane parallel to)
315
+ * the xy-plane.
316
+ * * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not
317
+ * guarantee a simple area offset.
310
318
  * @param points a single loop or path
311
319
  * @param wrap true to include wraparound
312
- * @param offsetDistance distance of offset from wire. Positive is left.
320
+ * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions
321
+ * object.
313
322
  */
314
- static constructPolygonWireXYOffset(points, wrap, offsetDistance) {
323
+ static constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions) {
315
324
  const context = new PolygonWireOffsetContext();
316
- return context.constructPolygonWireXYOffset(points, wrap, offsetDistance);
325
+ return context.constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions);
317
326
  }
318
327
  /**
319
- * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
320
- * * The construction will remove "some" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.
321
- * * If offsetDistance is given as a number, default OffsetOptions are applied.
322
- * * When the offset needs to do an "outside" turn, the first applicable construction is applied:
323
- * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.
324
- * * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.
325
- * * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:
326
- * * outside the arc
327
- * * have uniform turn angle less than `options.maxChamferDegrees`
328
- * * each line segment (except first and last) touches the arc at its midpoint.
329
- * @param curves base curves.
330
- * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
331
- */
328
+ * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
329
+ * * The construction will remove "some" local effects of features smaller than the offset distance, but will
330
+ * not detect self intersection among widely separated edges.
331
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset
332
+ * @param curves base curves.
333
+ * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
334
+ */
332
335
  static constructCurveXYOffset(curves, offsetDistanceOrOptions) {
333
- return CurveChainWireOffsetContext.constructCurveXYOffset(curves, offsetDistanceOrOptions);
336
+ const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);
337
+ return CurveOps.constructCurveXYOffset(curves, offsetOptions);
334
338
  }
335
339
  /**
336
340
  * Test if point (x,y) is IN, OUT or ON a region.
@@ -342,7 +346,8 @@ export class RegionOps {
342
346
  static testPointInOnOutRegionXY(curves, x, y) {
343
347
  return PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);
344
348
  }
345
- /** Create curve collection of subtype determined by gaps between the input curves.
349
+ /**
350
+ * Create curve collection of subtype determined by gaps between the input curves.
346
351
  * * If (a) wrap is requested and (b) all curves connect head-to-tail (including wraparound), assemble as a `loop`.
347
352
  * * If all curves connect head-to-tail except for closure, return a `Path`.
348
353
  * * If there are internal gaps, return a `BagOfCurves`
@@ -379,7 +384,9 @@ export class RegionOps {
379
384
  * Announce Checkpoint function for use during booleans
380
385
  * @internal
381
386
  */
382
- static setCheckPointFunction(f) { this._graphCheckPointFunction = f; }
387
+ static setCheckPointFunction(f) {
388
+ this._graphCheckPointFunction = f;
389
+ }
383
390
  /**
384
391
  * Find all intersections among curves in `curvesToCut` and `cutterCurves` and return fragments of `curvesToCut`.
385
392
  * * For a `Loop`, `ParityRegion`, or `UnionRegion` in `curvesToCut`:
@@ -394,7 +401,8 @@ export class RegionOps {
394
401
  }
395
402
  /**
396
403
  * Create paths assembled from many curves.
397
- * * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by [[cloneCurvesWithXYSplits]].
404
+ * * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by
405
+ * [[cloneCurvesWithXYSplits]].
398
406
  * * Return simplest form -- single primitive, single path, or bag of curves.
399
407
  */
400
408
  static splitToPathsBetweenBreaks(source, makeClones) {
@@ -411,27 +419,29 @@ export class RegionOps {
411
419
  return chainCollector.grabResult();
412
420
  }
413
421
  /**
414
- * Restructure curve fragments as chains, and construct (left and right) chain offsets in the xy-plane.
415
- * * BEWARE that if the input is not a loop, the classification of outputs is suspect.
416
- * @param fragments fragments to be chained, z-coordinates ignored
417
- * @param offsetDistance offset distance
418
- * @param gapTolerance absolute endpoint tolerance for computing chains
422
+ * Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains.
423
+ * * If the inputs do not form Loop(s), the classification of offsets is suspect.
424
+ * * For best offset results, the inputs should be parallel to the xy-plane.
425
+ * @param fragments fragments to be chained and offset
426
+ * @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves.
427
+ * @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail
419
428
  * @returns object with named chains, insideOffsets, outsideOffsets
420
429
  */
421
430
  static collectInsideAndOutsideOffsets(fragments, offsetDistance, gapTolerance) {
422
- return OffsetHelpers.collectInsideAndOutsideOffsets(fragments, offsetDistance, gapTolerance);
431
+ return CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);
423
432
  }
424
433
  /**
425
- * Restructure curve fragments as chains.
434
+ * Restructure curve fragments as Paths and Loops.
426
435
  * @param fragments fragments to be chained
427
- * @param gapTolerance absolute endpoint tolerance for computing chains
428
- * @returns chains, possibly wrapped in BagOfCurves if there multiple chains
436
+ * @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail
437
+ * @returns chains, possibly wrapped in a [[BagOfCurves]].
429
438
  */
430
439
  static collectChains(fragments, gapTolerance = Geometry.smallMetricDistance) {
431
- return OffsetHelpers.collectChains(fragments, gapTolerance);
440
+ return CurveOps.collectChains(fragments, gapTolerance);
432
441
  }
433
442
  /**
434
- * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments of `curvesToCut`.
443
+ * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments
444
+ * of `curvesToCut`.
435
445
  * * Break `curvesToCut` into parts inside, outside, and coincident.
436
446
  * @returns output object with all fragments split among `insideParts`, `outsideParts`, and `coincidentParts`
437
447
  */
@@ -457,7 +467,8 @@ export class RegionOps {
457
467
  }
458
468
  return result;
459
469
  }
460
- /** If `data` is one of several forms of a rectangle, return its edge Transform.
470
+ /**
471
+ * If `data` is one of several forms of a rectangle, return its edge Transform.
461
472
  * * Points are considered a rectangle if, within the first 4 points:
462
473
  * * vectors from 0 to 1 and 0 to 3 are perpendicular and have a non-zero cross product
463
474
  * * vectors from 0 to 3 and 1 to 2 are the same
@@ -468,7 +479,8 @@ export class RegionOps {
468
479
  * * Array of Point3d[]
469
480
  * * IndexedXYZCollection
470
481
  * @param requireClosurePoint whether to require a 5th point equal to the 1st point.
471
- * @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit normal in z column. If not a rectangle, return undefined.
482
+ * @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit
483
+ * normal in z column. If not a rectangle, return undefined.
472
484
  */
473
485
  static rectangleEdgeTransform(data, requireClosurePoint = true) {
474
486
  if (data instanceof LineString3d) {
@@ -528,9 +540,10 @@ export class RegionOps {
528
540
  * * Contiguous `LineSegment3d` and `LineString3d` objects.
529
541
  * * collect all points
530
542
  * * eliminate duplicated points
531
- * * eliminate points colinear with surrounding points.
532
- * * Contiguous concentric circular or elliptic arcs
543
+ * * eliminate points colinear with surrounding points
544
+ * * contiguous concentric circular or elliptic arcs
533
545
  * * combine angular ranges
546
+ * * This function can be used to compress adjacent LineSegment3ds into a LineString3d
534
547
  * @param curves Path or loop (or larger collection containing paths and loops) to be simplified
535
548
  * @param options options for tolerance and selective simplification.
536
549
  */
@@ -544,8 +557,10 @@ export class RegionOps {
544
557
  * @returns a region that captures the input pointers. This region is a:
545
558
  * * `Loop` if there is exactly one input loop. It is oriented counterclockwise.
546
559
  * * `ParityRegion` if input consists of exactly one outer loop with at least one hole loop.
547
- * Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented clockwise.
548
- * * `UnionRegion` if any other input configuration. Its children are individually ordered/oriented as in the above cases.
560
+ * Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented
561
+ * clockwise.
562
+ * * `UnionRegion` if any other input configuration. Its children are individually ordered/oriented as in
563
+ * the above cases.
549
564
  * @see [[PolygonOps.sortOuterAndHoleLoopsXY]]
550
565
  */
551
566
  static sortOuterAndHoleLoopsXY(loops) {
@@ -562,17 +577,22 @@ export class RegionOps {
562
577
  }
563
578
  /**
564
579
  * Find all areas bounded by the unstructured, possibly intersecting curves.
565
- * * A common use case of this method is to assemble the bounding "exterior" loop (or loops) containing the input curves.
566
- * * This method does not add bridge edges to connect outer loops to inner loops. Each disconnected loop, regardless
567
- * of its containment, is returned as its own SignedLoops object. Pre-process with [[regionBooleanXY]] to add bridge edges so that
568
- * [[constructAllXYRegionLoops]] will return outer and inner loops in the same SignedLoops object.
569
- * @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve primitives.
580
+ * * A common use case of this method is to assemble the bounding "exterior" loop (or loops) containing the
581
+ * input curves.
582
+ * * This method does not add bridge edges to connect outer loops to inner loops. Each disconnected loop,
583
+ * regardless of its containment, is returned as its own SignedLoops object. Pre-process with [[regionBooleanXY]]
584
+ * to add bridge edges so that [[constructAllXYRegionLoops]] will return outer and inner loops in the same
585
+ * SignedLoops object.
586
+ * @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve
587
+ * primitives.
570
588
  * @param tolerance optional distance tolerance for coincidence
571
589
  * @returns array of [[SignedLoops]], each entry of which describes the faces in a single connected component:
572
- * * `positiveAreaLoops` contains "interior" loops, _including holes in ParityRegion input_. These loops have positive area and counterclockwise orientation.
590
+ * * `positiveAreaLoops` contains "interior" loops, _including holes in ParityRegion input_. These loops have
591
+ * positive area and counterclockwise orientation.
573
592
  * * `negativeAreaLoops` contains (probably just one) "exterior" loop which is ordered clockwise.
574
593
  * * `slivers` contains sliver loops that have zero area, such as appear between coincident curves.
575
- * * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent to the edge and a constituent curve in each.
594
+ * * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent
595
+ * to the edge and a constituent curve in each.
576
596
  */
577
597
  static constructAllXYRegionLoops(curvesAndRegions, tolerance = Geometry.smallMetricDistance) {
578
598
  const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);
@@ -588,8 +608,10 @@ export class RegionOps {
588
608
  * * Optionally recurses into hidden primitives if `smallestPossiblePrimitives` is true.
589
609
  * @param candidates input curves
590
610
  * @param collectorArray optional pre-defined output array. If defined, it is NOT cleared: primitives are appended.
591
- * @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If false, push the [[CurveChainWithDistanceIndex]] instead.
592
- * @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false, push the [[LineString3d]] instead.
611
+ * @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If
612
+ * false, push the [[CurveChainWithDistanceIndex]] instead.
613
+ * @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false,
614
+ * push the [[LineString3d]] instead.
593
615
  */
594
616
  static collectCurvePrimitives(candidates, collectorArray, smallestPossiblePrimitives = false, explodeLinestrings = false) {
595
617
  const results = collectorArray === undefined ? [] : collectorArray;
@@ -607,7 +629,8 @@ export class RegionOps {
607
629
  return results;
608
630
  }
609
631
  /**
610
- * Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed instances of [[LineSegment3d]].
632
+ * Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed
633
+ * instances of [[LineSegment3d]].
611
634
  * @param candidates input curves
612
635
  * @return copied (captured) inputs except for the linestrings, which are exploded
613
636
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RegionOps.js","sourceRoot":"","sources":["../../../src/curve/RegionOps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO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C;qBACzC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;oBACvB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;aAC5D;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,gBAAgB;AAChB,SAAS,mBAAmB,CAAC,KAAe,EAAE,MAAc,EAAE,aAAyB,EAAE,MAAkB,EAAE,aAAyB;IACpI,IAAI,MAAM,GAAG,CAAC;QACZ,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACvB,IAAI,MAAM,GAAG,CAAC;QACjB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;QAE1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","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 Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolylineCompressionContext } from \"../geometry3d/PolylineCompressionByEdgeOffset\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { SortablePolygon } from \"../geometry3d/SortablePolygon\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { MomentData } from \"../geometry4d/MomentData\";\r\nimport { Polyface } from \"../polyface/Polyface\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { LineStringDataVariant, MultiLineStringDataVariant, Triangulator } from \"../topology/Triangulation\";\r\nimport { ChainCollectorContext } from \"./ChainCollectorContext\";\r\nimport { AnyCurve, AnyRegion } from \"./CurveChain\";\r\nimport { BagOfCurves, ConsolidateAdjacentCurvePrimitivesOptions, CurveChain, CurveCollection } from \"./CurveCollection\";\r\nimport { CurveCurve } from \"./CurveCurve\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { CurveWireMomentsXYZ } from \"./CurveWireMomentsXYZ\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { OffsetHelpers } from \"./internalContexts/MultiChainCollector\";\r\nimport { CurveChainWireOffsetContext, JointOptions, OffsetOptions, PolygonWireOffsetContext } from \"./internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { Loop, SignedLoops } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { Path } from \"./Path\";\r\nimport { ConsolidateAdjacentCurvePrimitivesContext } from \"./Query/ConsolidateAdjacentPrimitivesContext\";\r\nimport { CurveSplitContext } from \"./Query/CurveSplitContext\";\r\nimport { PointInOnOutContext } from \"./Query/InOutTests\";\r\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\r\nimport { RegionMomentsXY } from \"./RegionMomentsXY\";\r\nimport { RegionBooleanContext, RegionGroupOpType, RegionOpsFaceToFaceSearch } from \"./RegionOpsClassificationSweeps\";\r\nimport { UnionRegion } from \"./UnionRegion\";\r\n\r\n/**\r\n * Possible return types from [[splitToPathsBetweenBreaks]], [[collectInsideAndOutsideOffsets]] and [[collectChains]].\r\n * @public\r\n */\r\nexport type ChainTypes = CurvePrimitive | Path | BagOfCurves | Loop | undefined;\r\n\r\n/**\r\n * * `properties` is a string with special characters indicating\r\n * * \"U\" -- contains unmerged stick data\r\n * * \"M\" -- merged\r\n * * \"R\" -- regularized\r\n * * \"X\" -- has exterior markup\r\n * @internal\r\n */\r\nexport type GraphCheckPointFunction = (name: string, graph: HalfEdgeGraph, properties: string, extraData?: any) => any;\r\n/**\r\n * Enumeration of the binary operation types for a booleans among regions\r\n * @public\r\n */\r\nexport enum RegionBinaryOpType {\r\n Union = 0,\r\n Parity = 1,\r\n Intersection = 2,\r\n AMinusB = 3,\r\n BMinusA = 4,\r\n}\r\n\r\n/**\r\n * Class `RegionOps` has static members for calculations on regions (areas).\r\n * * Regions are represented by these `CurveCollection` subclasses:\r\n * * `Loop` -- a single loop\r\n * * `ParityRegion` -- a collection of loops, interpreted by parity rules.\r\n * The common \"One outer loop and many Inner loops\" is a parity region.\r\n * * `UnionRegion` -- a collection of `Loop` and `ParityRegion` objects understood as a (probably disjoint) union.\r\n * * Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has been rotated parallel to the xy-plane.\r\n * @public\r\n */\r\nexport class RegionOps {\r\n /**\r\n * Return moment sums for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYAreaMoments(root: AnyRegion): MomentData | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n /** Return an area tolerance for a given xy-range and optional distance tolerance.\r\n * @param range range of planar region to tolerance\r\n * @param distanceTolerance optional absolute distance tolerance\r\n */\r\n public static computeXYAreaTolerance(range: Range3d, distanceTolerance: number = Geometry.smallMetricDistance): number {\r\n // if A = bh and e is distance tolerance, then A' := (b+e/2)(h+e/2) = A + e/2(b+h+e/2), so A'-A = e/2(b+h+e/2).\r\n const halfDistTol = 0.5 * distanceTolerance;\r\n return halfDistTol * (range.xLength() + range.yLength() + halfDistTol);\r\n }\r\n /**\r\n * Return an xy area for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYArea(root: AnyRegion): number | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n return result.quantitySum;\r\n }\r\n return undefined;\r\n }\r\n /** Return MomentData with the sums of wire moments.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any CurveCollection or CurvePrimitive.\r\n */\r\n public static computeXYZWireMomentSums(root: AnyCurve): MomentData | undefined {\r\n const handler = new CurveWireMomentsXYZ();\r\n handler.visitLeaves(root);\r\n const result = handler.momentData;\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n\r\n /**\r\n * * create loops in the graph.\r\n * @internal\r\n */\r\n public static addLoopsToGraph(graph: HalfEdgeGraph, data: MultiLineStringDataVariant, announceIsolatedLoop: (graph: HalfEdgeGraph, seed: HalfEdge) => void) {\r\n if (data instanceof Loop) {\r\n const points = data.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n } else if (data instanceof ParityRegion) {\r\n for (const child of data.children) {\r\n const points = child.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n }\r\n } else if (data instanceof IndexedXYZCollection) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n } else if (Array.isArray(data)) {\r\n if (data.length > 0) {\r\n if (Point3d.isAnyImmediatePointType(data[0])) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data as LineStringDataVariant);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n\r\n } else if (data[0] instanceof IndexedXYZCollection) {\r\n for (const loop of data) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, loop as IndexedXYZCollection);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n }\r\n } else {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.addLoopsToGraph(graph, child as MultiLineStringDataVariant, announceIsolatedLoop);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Add multiple loops to a graph.\r\n * * Apply edgeTag and mask to each edge.\r\n * @internal\r\n */\r\n public static addLoopsWithEdgeTagToGraph(graph: HalfEdgeGraph, data: MultiLineStringDataVariant, mask: HalfEdgeMask, edgeTag: any): HalfEdge[] | undefined {\r\n const loopSeeds: HalfEdge[] = [];\r\n this.addLoopsToGraph(graph, data, (_graph: HalfEdgeGraph, seed: HalfEdge) => {\r\n if (seed) {\r\n loopSeeds.push(seed);\r\n seed.setMaskAndEdgeTagAroundFace(mask, edgeTag, true);\r\n }\r\n });\r\n if (loopSeeds.length > 0)\r\n return loopSeeds;\r\n return undefined;\r\n }\r\n /**\r\n * Given a graph just produced by booleans, convert to a polyface\r\n * * \"just produced\" implies exterior face markup.\r\n *\r\n * @param graph\r\n * @param triangulate\r\n */\r\n private static finishGraphToPolyface(graph: HalfEdgeGraph | undefined, triangulate: boolean): Polyface | undefined {\r\n if (graph) {\r\n if (triangulate) {\r\n Triangulator.triangulateAllPositiveAreaFaces(graph);\r\n Triangulator.flipTriangles(graph);\r\n }\r\n return PolyfaceBuilder.graphToPolyface(graph);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a polyface containing the area intersection of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaIntersectLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB,\r\n (inA: boolean, inB: boolean) => (inA && inB),\r\n this._graphCheckPointFunction);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n\r\n /**\r\n * Return a polyface containing the area union of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaUnionLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB,\r\n (inA: boolean, inB: boolean) => (inA || inB),\r\n this._graphCheckPointFunction);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return a polyface containing the area difference of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaDifferenceLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB,\r\n (inA: boolean, inB: boolean) => (inA && !inB),\r\n this._graphCheckPointFunction);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n\r\n /**\r\n * Return areas defined by a boolean operation.\r\n * * If there are multiple regions in loopsA, they are treated as a union.\r\n * * If there are multiple regions in loopsB, they are treated as a union.\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param mergeTolerance absolute distance tolerance for merging loops\r\n * @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added to connect interior loops to exterior loops.\r\n */\r\n public static regionBooleanXY(loopsA: AnyRegion | AnyRegion[] | undefined, loopsB: AnyRegion | AnyRegion[] | undefined, operation: RegionBinaryOpType, mergeTolerance: number = Geometry.smallMetricDistance): AnyRegion | undefined {\r\n const result = UnionRegion.create();\r\n const context = RegionBooleanContext.create(RegionGroupOpType.Union, RegionGroupOpType.Union);\r\n context.addMembers(loopsA, loopsB);\r\n context.annotateAndMergeCurvesInGraph(mergeTolerance);\r\n const range = context.groupA.range().union(context.groupB.range());\r\n const areaTol = this.computeXYAreaTolerance(range, mergeTolerance);\r\n context.runClassificationSweep(operation, (_graph: HalfEdgeGraph, face: HalfEdge, faceType: -1 | 0 | 1, area: number) => {\r\n // ignore danglers and null faces, but not 2-edge \"banana\" faces with nonzero area\r\n if (face.countEdgesAroundFace() < 2)\r\n return;\r\n if (Math.abs(area) < areaTol)\r\n return;\r\n if (faceType === 1) {\r\n const loop = PlanarSubdivision.createLoopInFace(face);\r\n if (loop)\r\n result.tryAddChild(loop);\r\n }\r\n });\r\n return result;\r\n }\r\n\r\n /**\r\n * Return a polyface whose facets are a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonBooleanXYToPolyface(inputA: MultiLineStringDataVariant[], operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[], triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA, RegionGroupOpType.Union,\r\n operation,\r\n inputB, RegionGroupOpType.Union, true);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return loops of linestrings around areas of a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n */\r\n public static polygonBooleanXYToLoops(\r\n inputA: MultiLineStringDataVariant[],\r\n operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[]): AnyRegion | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA, RegionGroupOpType.Union,\r\n operation,\r\n inputB, RegionGroupOpType.Union, true);\r\n if (!graph)\r\n return undefined;\r\n const loopEdges = HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, HalfEdgeMask.EXTERIOR);\r\n const allLoops: Loop[] = [];\r\n for (const graphLoop of loopEdges) {\r\n const points = new GrowableXYZArray();\r\n for (const edge of graphLoop)\r\n points.pushXYZ(edge.x, edge.y, edge.z);\r\n points.pushWrap(1);\r\n const loop = Loop.create();\r\n loop.tryAddChild(LineString3d.createCapture(points));\r\n allLoops.push(loop);\r\n }\r\n return RegionOps.sortOuterAndHoleLoopsXY(allLoops);\r\n }\r\n\r\n /** Construct a wire (not area!!) that is offset from given polyline or polygon.\r\n * * This is a simple wire offset, not an area.\r\n * * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not guarantee a simple area offset.\r\n * * The construction algorithm is subject to being changed, resulting in different (hopefully better) self-intersection behavior on the future.\r\n * @param points a single loop or path\r\n * @param wrap true to include wraparound\r\n * @param offsetDistance distance of offset from wire. Positive is left.\r\n */\r\n public static constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, offsetDistance: number): CurveCollection | undefined {\r\n const context = new PolygonWireOffsetContext();\r\n return context.constructPolygonWireXYOffset(points, wrap, offsetDistance);\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * When the offset needs to do an \"outside\" turn, the first applicable construction is applied:\r\n * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.\r\n * * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.\r\n * * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:\r\n * * outside the arc\r\n * * have uniform turn angle less than `options.maxChamferDegrees`\r\n * * each line segment (except first and last) touches the arc at its midpoint.\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions): CurveCollection | undefined {\r\n return CurveChainWireOffsetContext.constructCurveXYOffset(curves, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Test if point (x,y) is IN, OUT or ON a region.\r\n * @return (1) for in, (-1) for OUT, (0) for ON\r\n * @param curves input region\r\n * @param x x coordinate of point to test\r\n * @param y y coordinate of point to test\r\n */\r\n public static testPointInOnOutRegionXY(curves: AnyRegion, x: number, y: number): number {\r\n return PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);\r\n }\r\n /** Create curve collection of subtype determined by gaps between the input curves.\r\n * * If (a) wrap is requested and (b) all curves connect head-to-tail (including wraparound), assemble as a `loop`.\r\n * * If all curves connect head-to-tail except for closure, return a `Path`.\r\n * * If there are internal gaps, return a `BagOfCurves`\r\n * * If input array has zero length, return undefined.\r\n * @param curves input curves\r\n * @param wrap whether to create a Loop (true) or Path (false) if maximum gap is minimal\r\n * @param consolidateAdjacentPrimitives whether to simplify the result by calling [[consolidateAdjacentPrimitives]]\r\n */\r\n public static createLoopPathOrBagOfCurves(curves: CurvePrimitive[], wrap: boolean = true, consolidateAdjacentPrimitives: boolean = false): CurveCollection | undefined {\r\n const n = curves.length;\r\n if (n === 0)\r\n return undefined;\r\n let maxGap = 0.0;\r\n let isPath = false;\r\n if (wrap)\r\n maxGap = Geometry.maxXY(maxGap, curves[0].startPoint().distance(curves[n - 1].endPoint()));\r\n for (let i = 0; i + 1 < n; i++)\r\n maxGap = Geometry.maxXY(maxGap, curves[i].endPoint().distance(curves[i + 1].startPoint()));\r\n let collection: Loop | Path | BagOfCurves;\r\n if (Geometry.isSmallMetricDistance(maxGap)) {\r\n collection = wrap ? Loop.create() : Path.create();\r\n isPath = true;\r\n } else {\r\n collection = BagOfCurves.create();\r\n }\r\n for (const c of curves)\r\n collection.tryAddChild(c);\r\n if (isPath && consolidateAdjacentPrimitives)\r\n RegionOps.consolidateAdjacentPrimitives(collection);\r\n return collection;\r\n }\r\n\r\n private static _graphCheckPointFunction?: GraphCheckPointFunction;\r\n /**\r\n * Announce Checkpoint function for use during booleans\r\n * @internal\r\n */\r\n public static setCheckPointFunction(f?: GraphCheckPointFunction) { this._graphCheckPointFunction = f; }\r\n /**\r\n * Find all intersections among curves in `curvesToCut` and `cutterCurves` and return fragments of `curvesToCut`.\r\n * * For a `Loop`, `ParityRegion`, or `UnionRegion` in `curvesToCut`:\r\n * * if it is never cut by any `cutter` curve, it will be left unchanged.\r\n * * if cut, the input is downgraded to a set of `Path` curves joining at the cut points.\r\n * * All cutting is \"as viewed in the xy plane\"\r\n * @param curvesToCut input curves to be fragmented at intersections with `cutterCurves`\r\n * @param cutterCurves input curves to intersect with `curvesToCut`\r\n */\r\n public static cloneCurvesWithXYSplits(curvesToCut: AnyCurve | undefined, cutterCurves: CurveCollection): AnyCurve | undefined {\r\n return CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);\r\n }\r\n /**\r\n * Create paths assembled from many curves.\r\n * * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by [[cloneCurvesWithXYSplits]].\r\n * * Return simplest form -- single primitive, single path, or bag of curves.\r\n */\r\n public static splitToPathsBetweenBreaks(source: AnyCurve | undefined, makeClones: boolean): ChainTypes {\r\n if (source === undefined)\r\n return undefined;\r\n if (source instanceof CurvePrimitive)\r\n return source;\r\n // source is a collection . ..\r\n const primitives = source.collectCurvePrimitives();\r\n const chainCollector = new ChainCollectorContext(makeClones);\r\n for (const primitive of primitives) {\r\n chainCollector.announceCurvePrimitive(primitive);\r\n }\r\n return chainCollector.grabResult();\r\n }\r\n /**\r\n * Restructure curve fragments as chains, and construct (left and right) chain offsets in the xy-plane.\r\n * * BEWARE that if the input is not a loop, the classification of outputs is suspect.\r\n * @param fragments fragments to be chained, z-coordinates ignored\r\n * @param offsetDistance offset distance\r\n * @param gapTolerance absolute endpoint tolerance for computing chains\r\n * @returns object with named chains, insideOffsets, outsideOffsets\r\n */\r\n public static collectInsideAndOutsideOffsets(fragments: AnyCurve[], offsetDistance: number, gapTolerance: number): { insideOffsets: AnyCurve[], outsideOffsets: AnyCurve[], chains: ChainTypes } {\r\n return OffsetHelpers.collectInsideAndOutsideOffsets(fragments, offsetDistance, gapTolerance);\r\n }\r\n /**\r\n * Restructure curve fragments as chains.\r\n * @param fragments fragments to be chained\r\n * @param gapTolerance absolute endpoint tolerance for computing chains\r\n * @returns chains, possibly wrapped in BagOfCurves if there multiple chains\r\n */\r\n public static collectChains(fragments: AnyCurve[], gapTolerance: number = Geometry.smallMetricDistance): ChainTypes {\r\n return OffsetHelpers.collectChains(fragments, gapTolerance);\r\n }\r\n\r\n /**\r\n * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments of `curvesToCut`.\r\n * * Break `curvesToCut` into parts inside, outside, and coincident.\r\n * @returns output object with all fragments split among `insideParts`, `outsideParts`, and `coincidentParts`\r\n */\r\n public static splitPathsByRegionInOnOutXY(curvesToCut: AnyCurve | undefined, region: AnyRegion): { insideParts: AnyCurve[], outsideParts: AnyCurve[], coincidentParts: AnyCurve[] } {\r\n const result = { insideParts: [], outsideParts: [], coincidentParts: [] };\r\n const pathWithIntersectionMarkup = RegionOps.cloneCurvesWithXYSplits(curvesToCut, region);\r\n const splitPaths = RegionOps.splitToPathsBetweenBreaks(pathWithIntersectionMarkup, true);\r\n if (splitPaths instanceof CurveCollection) {\r\n for (const child of splitPaths.children) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(child, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n } else if (splitPaths instanceof CurvePrimitive) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(splitPaths, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n return result;\r\n }\r\n /** If `data` is one of several forms of a rectangle, return its edge Transform.\r\n * * Points are considered a rectangle if, within the first 4 points:\r\n * * vectors from 0 to 1 and 0 to 3 are perpendicular and have a non-zero cross product\r\n * * vectors from 0 to 3 and 1 to 2 are the same\r\n * @param data points in one of several formats:\r\n * * LineString\r\n * * Loop containing rectangle content\r\n * * Path containing rectangle content\r\n * * Array of Point3d[]\r\n * * IndexedXYZCollection\r\n * @param requireClosurePoint whether to require a 5th point equal to the 1st point.\r\n * @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit normal in z column. If not a rectangle, return undefined.\r\n */\r\n public static rectangleEdgeTransform(data: AnyCurve | Point3d[] | IndexedXYZCollection, requireClosurePoint: boolean = true): Transform | undefined {\r\n if (data instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.packedPoints);\r\n } else if (data instanceof IndexedXYZCollection) {\r\n let dataToUse;\r\n if (requireClosurePoint && data.length === 5) {\r\n if (!Geometry.isSmallMetricDistance(data.distanceIndexIndex(0, 4)!))\r\n return undefined;\r\n dataToUse = data;\r\n } else if (!requireClosurePoint && data.length === 4) {\r\n dataToUse = data;\r\n } else if (data.length < (requireClosurePoint ? 5 : 4)) {\r\n return undefined;\r\n } else {\r\n dataToUse = GrowableXYZArray.create(data);\r\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, Geometry.smallMetricDistance);\r\n if (dataToUse.length < (requireClosurePoint ? 5 : 4))\r\n return undefined;\r\n }\r\n const vector01 = dataToUse.vectorIndexIndex(0, 1)!;\r\n const vector03 = dataToUse.vectorIndexIndex(0, 3)!;\r\n const vector12 = dataToUse.vectorIndexIndex(1, 2)!;\r\n const normalVector = vector01.crossProduct(vector03);\r\n if (normalVector.normalizeInPlace()\r\n && vector12.isAlmostEqual(vector03)\r\n && vector01.isPerpendicularTo(vector03)) {\r\n return Transform.createOriginAndMatrixColumns(dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector);\r\n }\r\n } else if (Array.isArray(data)) {\r\n return this.rectangleEdgeTransform(new Point3dArrayCarrier(data), requireClosurePoint);\r\n } else if (data instanceof Loop && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, true);\r\n } else if (data instanceof Path && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, requireClosurePoint);\r\n } else if (data instanceof CurveChain) {\r\n if (!data.checkForNonLinearPrimitives()) {\r\n // const linestring = LineString3d.create();\r\n const strokes = data.getPackedStrokes();\r\n if (strokes) {\r\n return this.rectangleEdgeTransform(strokes);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Look for and simplify:\r\n * * Contiguous `LineSegment3d` and `LineString3d` objects.\r\n * * collect all points\r\n * * eliminate duplicated points\r\n * * eliminate points colinear with surrounding points.\r\n * * Contiguous concentric circular or elliptic arcs\r\n * * combine angular ranges\r\n * @param curves Path or loop (or larger collection containing paths and loops) to be simplified\r\n * @param options options for tolerance and selective simplification.\r\n */\r\n public static consolidateAdjacentPrimitives(curves: CurveCollection, options?: ConsolidateAdjacentCurvePrimitivesOptions) {\r\n const context = new ConsolidateAdjacentCurvePrimitivesContext(options);\r\n curves.dispatchToGeometryHandler(context);\r\n }\r\n /**\r\n * Reverse and reorder loops in the xy-plane for consistency and containment.\r\n * @param loops multiple loops in any order and orientation, z-coordinates ignored\r\n * @returns a region that captures the input pointers. This region is a:\r\n * * `Loop` if there is exactly one input loop. It is oriented counterclockwise.\r\n * * `ParityRegion` if input consists of exactly one outer loop with at least one hole loop.\r\n * Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented clockwise.\r\n * * `UnionRegion` if any other input configuration. Its children are individually ordered/oriented as in the above cases.\r\n * @see [[PolygonOps.sortOuterAndHoleLoopsXY]]\r\n */\r\n public static sortOuterAndHoleLoopsXY(loops: Array<Loop | IndexedXYZCollection>): AnyRegion {\r\n const loopAndArea: SortablePolygon[] = [];\r\n for (const candidate of loops) {\r\n if (candidate instanceof Loop)\r\n SortablePolygon.pushLoop(loopAndArea, candidate);\r\n else if (candidate instanceof IndexedXYZCollection) {\r\n const loop = Loop.createPolygon(candidate);\r\n SortablePolygon.pushLoop(loopAndArea, loop);\r\n }\r\n }\r\n return SortablePolygon.sortAsAnyRegion(loopAndArea);\r\n }\r\n /**\r\n * Find all areas bounded by the unstructured, possibly intersecting curves.\r\n * * A common use case of this method is to assemble the bounding \"exterior\" loop (or loops) containing the input curves.\r\n * * This method does not add bridge edges to connect outer loops to inner loops. Each disconnected loop, regardless\r\n * of its containment, is returned as its own SignedLoops object. Pre-process with [[regionBooleanXY]] to add bridge edges so that\r\n * [[constructAllXYRegionLoops]] will return outer and inner loops in the same SignedLoops object.\r\n * @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve primitives.\r\n * @param tolerance optional distance tolerance for coincidence\r\n * @returns array of [[SignedLoops]], each entry of which describes the faces in a single connected component:\r\n * * `positiveAreaLoops` contains \"interior\" loops, _including holes in ParityRegion input_. These loops have positive area and counterclockwise orientation.\r\n * * `negativeAreaLoops` contains (probably just one) \"exterior\" loop which is ordered clockwise.\r\n * * `slivers` contains sliver loops that have zero area, such as appear between coincident curves.\r\n * * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent to the edge and a constituent curve in each.\r\n */\r\n public static constructAllXYRegionLoops(curvesAndRegions: AnyCurve | AnyCurve[], tolerance: number = Geometry.smallMetricDistance): SignedLoops[] {\r\n const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);\r\n const range = this.curveArrayRange(primitives);\r\n const areaTol = this.computeXYAreaTolerance(range, tolerance);\r\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);\r\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);\r\n return PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);\r\n }\r\n\r\n /**\r\n * Collect all `CurvePrimitives` in loosely typed input.\r\n * * Always recurses into primitives within explicit collections (Path, Loop, ParityRegion, UnionRegion).\r\n * * Optionally recurses into hidden primitives if `smallestPossiblePrimitives` is true.\r\n * @param candidates input curves\r\n * @param collectorArray optional pre-defined output array. If defined, it is NOT cleared: primitives are appended.\r\n * @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If false, push the [[CurveChainWithDistanceIndex]] instead.\r\n * @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false, push the [[LineString3d]] instead.\r\n */\r\n public static collectCurvePrimitives(candidates: AnyCurve | AnyCurve[], collectorArray?: CurvePrimitive[],\r\n smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n if (candidates instanceof CurvePrimitive) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (candidates instanceof CurveCollection) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (Array.isArray(candidates)) {\r\n for (const c of candidates) {\r\n this.collectCurvePrimitives(c, results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n return results;\r\n }\r\n /**\r\n * Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed instances of [[LineSegment3d]].\r\n * @param candidates input curves\r\n * @return copied (captured) inputs except for the linestrings, which are exploded\r\n */\r\n public static expandLineStrings(candidates: CurvePrimitive[]): CurvePrimitive[] {\r\n const result: CurvePrimitive[] = [];\r\n for (const c of candidates) {\r\n if (c instanceof LineString3d) {\r\n for (let i = 0; i + 1 < c.packedPoints.length; i++) {\r\n const q = c.getIndexedSegment(i);\r\n if (q !== undefined)\r\n result.push(q);\r\n }\r\n } else {\r\n result.push(c);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return the overall range of given curves.\r\n * @param data candidate curves\r\n * @param worldToLocal transform to apply to data before computing its range\r\n */\r\n public static curveArrayRange(data: any, worldToLocal?: Transform): Range3d {\r\n const range = Range3d.create();\r\n if (data instanceof GeometryQuery)\r\n data.extendRange(range, worldToLocal);\r\n else if (Array.isArray(data)) {\r\n for (const c of data) {\r\n if (c instanceof GeometryQuery)\r\n c.extendRange(range, worldToLocal);\r\n else if (c instanceof Point3d)\r\n range.extendPoint(c, worldToLocal);\r\n else if (c instanceof GrowableXYZArray)\r\n range.extendRange(c.getRange(worldToLocal));\r\n else if (Array.isArray(c))\r\n range.extendRange(this.curveArrayRange(c, worldToLocal));\r\n }\r\n }\r\n return range;\r\n }\r\n}\r\n\r\n/** @internal */\r\nfunction pushToInOnOutArrays(curve: AnyCurve, select: number, arrayNegative: AnyCurve[], array0: AnyCurve[], arrayPositive: AnyCurve[]) {\r\n if (select > 0)\r\n arrayPositive.push(curve);\r\n else if (select < 0)\r\n arrayNegative.push(curve);\r\n else\r\n array0.push(curve);\r\n}\r\n"]}
1
+ {"version":3,"file":"RegionOps.js","sourceRoot":"","sources":["../../../src/curve/RegionOps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAA2B,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,mBAAm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,CAAC,CAAC;qBACzC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;oBACvB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;aAC5D;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AACD,gBAAgB;AAChB,SAAS,mBAAmB,CAC1B,KAAe,EAAE,MAAc,EAAE,aAAyB,EAAE,MAAkB,EAAE,aAAyB;IAEzG,IAAI,MAAM,GAAG,CAAC;QACZ,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACvB,IAAI,MAAM,GAAG,CAAC;QACjB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;QAE1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","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 Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolylineCompressionContext } from \"../geometry3d/PolylineCompressionByEdgeOffset\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { SortablePolygon } from \"../geometry3d/SortablePolygon\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { MomentData } from \"../geometry4d/MomentData\";\r\nimport { Polyface } from \"../polyface/Polyface\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { LineStringDataVariant, MultiLineStringDataVariant, Triangulator } from \"../topology/Triangulation\";\r\nimport { AnyCurve, AnyRegion } from \"./CurveChain\";\r\nimport { BagOfCurves, ConsolidateAdjacentCurvePrimitivesOptions, CurveChain, CurveCollection } from \"./CurveCollection\";\r\nimport { CurveCurve } from \"./CurveCurve\";\r\nimport { CurveOps } from \"./CurveOps\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { CurveWireMomentsXYZ } from \"./CurveWireMomentsXYZ\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { ChainCollectorContext } from \"./internalContexts/ChainCollectorContext\";\r\nimport { PolygonWireOffsetContext } from \"./internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { Loop, SignedLoops } from \"./Loop\";\r\nimport { JointOptions, OffsetOptions } from \"./OffsetOptions\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { Path } from \"./Path\";\r\nimport { ConsolidateAdjacentCurvePrimitivesContext } from \"./Query/ConsolidateAdjacentPrimitivesContext\";\r\nimport { CurveSplitContext } from \"./Query/CurveSplitContext\";\r\nimport { PointInOnOutContext } from \"./Query/InOutTests\";\r\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\r\nimport { RegionMomentsXY } from \"./RegionMomentsXY\";\r\nimport { RegionBooleanContext, RegionGroupOpType, RegionOpsFaceToFaceSearch } from \"./RegionOpsClassificationSweeps\";\r\nimport { UnionRegion } from \"./UnionRegion\";\r\n\r\n/**\r\n * Possible return types from [[splitToPathsBetweenBreaks]], [[collectInsideAndOutsideOffsets]] and\r\n * [[collectChains]].\r\n * @public\r\n */\r\nexport type ChainTypes = CurvePrimitive | Path | BagOfCurves | Loop | undefined;\r\n\r\n/**\r\n * * `properties` is a string with special characters indicating\r\n * * \"U\" -- contains unmerged stick data\r\n * * \"M\" -- merged\r\n * * \"R\" -- regularized\r\n * * \"X\" -- has exterior markup\r\n * @internal\r\n */\r\nexport type GraphCheckPointFunction = (name: string, graph: HalfEdgeGraph, properties: string, extraData?: any) => any;\r\n\r\n/**\r\n * Enumeration of the binary operation types for a booleans among regions\r\n * @public\r\n */\r\nexport enum RegionBinaryOpType {\r\n Union = 0,\r\n Parity = 1,\r\n Intersection = 2,\r\n AMinusB = 3,\r\n BMinusA = 4,\r\n}\r\n\r\n/**\r\n * Class `RegionOps` has static members for calculations on regions (areas).\r\n * * Regions are represented by these `CurveCollection` subclasses:\r\n * * `Loop` -- a single loop\r\n * * `ParityRegion` -- a collection of loops, interpreted by parity rules.\r\n * The common \"One outer loop and many Inner loops\" is a parity region.\r\n * * `UnionRegion` -- a collection of `Loop` and `ParityRegion` objects understood as a (probably disjoint) union.\r\n * * **NOTE:** Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has\r\n * been rotated parallel to the xy-plane.\r\n * @public\r\n */\r\nexport class RegionOps {\r\n /**\r\n * Return moment sums for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYAreaMoments(root: AnyRegion): MomentData | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return an area tolerance for a given xy-range and optional distance tolerance.\r\n * @param range range of planar region to tolerance\r\n * @param distanceTolerance optional absolute distance tolerance\r\n */\r\n public static computeXYAreaTolerance(range: Range3d, distanceTolerance: number = Geometry.smallMetricDistance): number {\r\n // if A = bh and e is distance tolerance, then A' := (b+e/2)(h+e/2) = A + e/2(b+h+e/2), so A'-A = e/2(b+h+e/2).\r\n const halfDistTol = 0.5 * distanceTolerance;\r\n return halfDistTol * (range.xLength() + range.yLength() + halfDistTol);\r\n }\r\n /**\r\n * Return an xy area for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYArea(root: AnyRegion): number | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n return result.quantitySum;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return MomentData with the sums of wire moments.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any CurveCollection or CurvePrimitive.\r\n */\r\n public static computeXYZWireMomentSums(root: AnyCurve): MomentData | undefined {\r\n const handler = new CurveWireMomentsXYZ();\r\n handler.visitLeaves(root);\r\n const result = handler.momentData;\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n /**\r\n * Create loops in the graph.\r\n * @internal\r\n */\r\n public static addLoopsToGraph(\r\n graph: HalfEdgeGraph,\r\n data: MultiLineStringDataVariant,\r\n announceIsolatedLoop: (graph: HalfEdgeGraph, seed: HalfEdge) => void,\r\n ): void {\r\n if (data instanceof Loop) {\r\n const points = data.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n } else if (data instanceof ParityRegion) {\r\n for (const child of data.children) {\r\n const points = child.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n }\r\n } else if (data instanceof IndexedXYZCollection) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n } else if (Array.isArray(data)) {\r\n if (data.length > 0) {\r\n if (Point3d.isAnyImmediatePointType(data[0])) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data as LineStringDataVariant);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n\r\n } else if (data[0] instanceof IndexedXYZCollection) {\r\n for (const loop of data) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, loop as IndexedXYZCollection);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n }\r\n } else {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.addLoopsToGraph(graph, child as MultiLineStringDataVariant, announceIsolatedLoop);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Add multiple loops to a graph.\r\n * * Apply edgeTag and mask to each edge.\r\n * @internal\r\n */\r\n public static addLoopsWithEdgeTagToGraph(\r\n graph: HalfEdgeGraph, data: MultiLineStringDataVariant, mask: HalfEdgeMask, edgeTag: any,\r\n ): HalfEdge[] | undefined {\r\n const loopSeeds: HalfEdge[] = [];\r\n this.addLoopsToGraph(graph, data, (_graph: HalfEdgeGraph, seed: HalfEdge) => {\r\n if (seed) {\r\n loopSeeds.push(seed);\r\n seed.setMaskAndEdgeTagAroundFace(mask, edgeTag, true);\r\n }\r\n });\r\n if (loopSeeds.length > 0)\r\n return loopSeeds;\r\n return undefined;\r\n }\r\n /**\r\n * Given a graph just produced by booleans, convert to a polyface\r\n * * \"just produced\" implies exterior face markup.\r\n * @param graph\r\n * @param triangulate\r\n */\r\n private static finishGraphToPolyface(graph: HalfEdgeGraph | undefined, triangulate: boolean): Polyface | undefined {\r\n if (graph) {\r\n if (triangulate) {\r\n Triangulator.triangulateAllPositiveAreaFaces(graph);\r\n Triangulator.flipTriangles(graph);\r\n }\r\n return PolyfaceBuilder.graphToPolyface(graph);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a polyface containing the area intersection of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaIntersectLoopsToPolyface(\r\n loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(\r\n loopsA,\r\n loopsB,\r\n (inA: boolean, inB: boolean) => (inA && inB),\r\n this._graphCheckPointFunction,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return a polyface containing the area union of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaUnionLoopsToPolyface(\r\n loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(\r\n loopsA,\r\n loopsB,\r\n (inA: boolean, inB: boolean) => (inA || inB),\r\n this._graphCheckPointFunction,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return a polyface containing the area difference of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaDifferenceLoopsToPolyface(\r\n loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(\r\n loopsA,\r\n loopsB,\r\n (inA: boolean, inB: boolean) => (inA && !inB),\r\n this._graphCheckPointFunction,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return areas defined by a boolean operation.\r\n * * If there are multiple regions in loopsA, they are treated as a union.\r\n * * If there are multiple regions in loopsB, they are treated as a union.\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param mergeTolerance absolute distance tolerance for merging loops\r\n * @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added\r\n * to connect interior loops to exterior loops.\r\n */\r\n public static regionBooleanXY(\r\n loopsA: AnyRegion | AnyRegion[] | undefined,\r\n loopsB: AnyRegion | AnyRegion[] | undefined,\r\n operation: RegionBinaryOpType,\r\n mergeTolerance: number = Geometry.smallMetricDistance,\r\n ): AnyRegion | undefined {\r\n const result = UnionRegion.create();\r\n const context = RegionBooleanContext.create(RegionGroupOpType.Union, RegionGroupOpType.Union);\r\n context.addMembers(loopsA, loopsB);\r\n context.annotateAndMergeCurvesInGraph(mergeTolerance);\r\n const range = context.groupA.range().union(context.groupB.range());\r\n const areaTol = this.computeXYAreaTolerance(range, mergeTolerance);\r\n context.runClassificationSweep(\r\n operation,\r\n (_graph: HalfEdgeGraph, face: HalfEdge, faceType: -1 | 0 | 1, area: number) => {\r\n // ignore danglers and null faces, but not 2-edge \"banana\" faces with nonzero area\r\n if (face.countEdgesAroundFace() < 2)\r\n return;\r\n if (Math.abs(area) < areaTol)\r\n return;\r\n if (faceType === 1) {\r\n const loop = PlanarSubdivision.createLoopInFace(face);\r\n if (loop)\r\n result.tryAddChild(loop);\r\n }\r\n },\r\n );\r\n return result;\r\n }\r\n /**\r\n * Return a polyface whose facets are a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonBooleanXYToPolyface(\r\n inputA: MultiLineStringDataVariant[],\r\n operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[],\r\n triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA, RegionGroupOpType.Union,\r\n operation,\r\n inputB, RegionGroupOpType.Union,\r\n true,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return loops of linestrings around areas of a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n */\r\n public static polygonBooleanXYToLoops(\r\n inputA: MultiLineStringDataVariant[],\r\n operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[],\r\n ): AnyRegion | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA,\r\n RegionGroupOpType.Union,\r\n operation,\r\n inputB,\r\n RegionGroupOpType.Union,\r\n true,\r\n );\r\n if (!graph)\r\n return undefined;\r\n const loopEdges = HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, HalfEdgeMask.EXTERIOR);\r\n const allLoops: Loop[] = [];\r\n for (const graphLoop of loopEdges) {\r\n const points = new GrowableXYZArray();\r\n for (const edge of graphLoop)\r\n points.pushXYZ(edge.x, edge.y, edge.z);\r\n points.pushWrap(1);\r\n const loop = Loop.create();\r\n loop.tryAddChild(LineString3d.createCapture(points));\r\n allLoops.push(loop);\r\n }\r\n return RegionOps.sortOuterAndHoleLoopsXY(allLoops);\r\n }\r\n /**\r\n * Construct a wire that is offset from the given polyline or polygon.\r\n * * This is a simple wire offset, not an area offset.\r\n * * Since z-coordinates are ignored, for best results the input points should lie in (a plane parallel to)\r\n * the xy-plane.\r\n * * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not\r\n * guarantee a simple area offset.\r\n * @param points a single loop or path\r\n * @param wrap true to include wraparound\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public static constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, offsetDistanceOrOptions: number | JointOptions,\r\n ): CurveChain | undefined {\r\n const context = new PolygonWireOffsetContext();\r\n return context.constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\r\n ): CurveCollection | undefined {\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n return CurveOps.constructCurveXYOffset(curves, offsetOptions);\r\n }\r\n /**\r\n * Test if point (x,y) is IN, OUT or ON a region.\r\n * @return (1) for in, (-1) for OUT, (0) for ON\r\n * @param curves input region\r\n * @param x x coordinate of point to test\r\n * @param y y coordinate of point to test\r\n */\r\n public static testPointInOnOutRegionXY(curves: AnyRegion, x: number, y: number): number {\r\n return PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);\r\n }\r\n /**\r\n * Create curve collection of subtype determined by gaps between the input curves.\r\n * * If (a) wrap is requested and (b) all curves connect head-to-tail (including wraparound), assemble as a `loop`.\r\n * * If all curves connect head-to-tail except for closure, return a `Path`.\r\n * * If there are internal gaps, return a `BagOfCurves`\r\n * * If input array has zero length, return undefined.\r\n * @param curves input curves\r\n * @param wrap whether to create a Loop (true) or Path (false) if maximum gap is minimal\r\n * @param consolidateAdjacentPrimitives whether to simplify the result by calling [[consolidateAdjacentPrimitives]]\r\n */\r\n public static createLoopPathOrBagOfCurves(\r\n curves: CurvePrimitive[], wrap: boolean = true, consolidateAdjacentPrimitives: boolean = false,\r\n ): CurveCollection | undefined {\r\n const n = curves.length;\r\n if (n === 0)\r\n return undefined;\r\n let maxGap = 0.0;\r\n let isPath = false;\r\n if (wrap)\r\n maxGap = Geometry.maxXY(maxGap, curves[0].startPoint().distance(curves[n - 1].endPoint()));\r\n for (let i = 0; i + 1 < n; i++)\r\n maxGap = Geometry.maxXY(maxGap, curves[i].endPoint().distance(curves[i + 1].startPoint()));\r\n let collection: Loop | Path | BagOfCurves;\r\n if (Geometry.isSmallMetricDistance(maxGap)) {\r\n collection = wrap ? Loop.create() : Path.create();\r\n isPath = true;\r\n } else {\r\n collection = BagOfCurves.create();\r\n }\r\n for (const c of curves)\r\n collection.tryAddChild(c);\r\n if (isPath && consolidateAdjacentPrimitives)\r\n RegionOps.consolidateAdjacentPrimitives(collection);\r\n return collection;\r\n }\r\n private static _graphCheckPointFunction?: GraphCheckPointFunction;\r\n /**\r\n * Announce Checkpoint function for use during booleans\r\n * @internal\r\n */\r\n public static setCheckPointFunction(f?: GraphCheckPointFunction) {\r\n this._graphCheckPointFunction = f;\r\n }\r\n /**\r\n * Find all intersections among curves in `curvesToCut` and `cutterCurves` and return fragments of `curvesToCut`.\r\n * * For a `Loop`, `ParityRegion`, or `UnionRegion` in `curvesToCut`:\r\n * * if it is never cut by any `cutter` curve, it will be left unchanged.\r\n * * if cut, the input is downgraded to a set of `Path` curves joining at the cut points.\r\n * * All cutting is \"as viewed in the xy plane\"\r\n * @param curvesToCut input curves to be fragmented at intersections with `cutterCurves`\r\n * @param cutterCurves input curves to intersect with `curvesToCut`\r\n */\r\n public static cloneCurvesWithXYSplits(\r\n curvesToCut: AnyCurve | undefined, cutterCurves: CurveCollection,\r\n ): AnyCurve | undefined {\r\n return CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);\r\n }\r\n /**\r\n * Create paths assembled from many curves.\r\n * * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by\r\n * [[cloneCurvesWithXYSplits]].\r\n * * Return simplest form -- single primitive, single path, or bag of curves.\r\n */\r\n public static splitToPathsBetweenBreaks(source: AnyCurve | undefined, makeClones: boolean): ChainTypes {\r\n if (source === undefined)\r\n return undefined;\r\n if (source instanceof CurvePrimitive)\r\n return source;\r\n // source is a collection . ..\r\n const primitives = source.collectCurvePrimitives();\r\n const chainCollector = new ChainCollectorContext(makeClones);\r\n for (const primitive of primitives) {\r\n chainCollector.announceCurvePrimitive(primitive);\r\n }\r\n return chainCollector.grabResult();\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains.\r\n * * If the inputs do not form Loop(s), the classification of offsets is suspect.\r\n * * For best offset results, the inputs should be parallel to the xy-plane.\r\n * @param fragments fragments to be chained and offset\r\n * @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves.\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail\r\n * @returns object with named chains, insideOffsets, outsideOffsets\r\n */\r\n public static collectInsideAndOutsideOffsets(\r\n fragments: AnyCurve[], offsetDistance: number, gapTolerance: number,\r\n ): { insideOffsets: AnyCurve[], outsideOffsets: AnyCurve[], chains: ChainTypes } {\r\n return CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops.\r\n * @param fragments fragments to be chained\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail\r\n * @returns chains, possibly wrapped in a [[BagOfCurves]].\r\n */\r\n public static collectChains(fragments: AnyCurve[], gapTolerance: number = Geometry.smallMetricDistance): ChainTypes {\r\n return CurveOps.collectChains(fragments, gapTolerance);\r\n }\r\n /**\r\n * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments\r\n * of `curvesToCut`.\r\n * * Break `curvesToCut` into parts inside, outside, and coincident.\r\n * @returns output object with all fragments split among `insideParts`, `outsideParts`, and `coincidentParts`\r\n */\r\n public static splitPathsByRegionInOnOutXY(\r\n curvesToCut: AnyCurve | undefined, region: AnyRegion,\r\n ): { insideParts: AnyCurve[], outsideParts: AnyCurve[], coincidentParts: AnyCurve[] } {\r\n const result = { insideParts: [], outsideParts: [], coincidentParts: [] };\r\n const pathWithIntersectionMarkup = RegionOps.cloneCurvesWithXYSplits(curvesToCut, region);\r\n const splitPaths = RegionOps.splitToPathsBetweenBreaks(pathWithIntersectionMarkup, true);\r\n if (splitPaths instanceof CurveCollection) {\r\n for (const child of splitPaths.children) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(child, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n } else if (splitPaths instanceof CurvePrimitive) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(splitPaths, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * If `data` is one of several forms of a rectangle, return its edge Transform.\r\n * * Points are considered a rectangle if, within the first 4 points:\r\n * * vectors from 0 to 1 and 0 to 3 are perpendicular and have a non-zero cross product\r\n * * vectors from 0 to 3 and 1 to 2 are the same\r\n * @param data points in one of several formats:\r\n * * LineString\r\n * * Loop containing rectangle content\r\n * * Path containing rectangle content\r\n * * Array of Point3d[]\r\n * * IndexedXYZCollection\r\n * @param requireClosurePoint whether to require a 5th point equal to the 1st point.\r\n * @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit\r\n * normal in z column. If not a rectangle, return undefined.\r\n */\r\n public static rectangleEdgeTransform(\r\n data: AnyCurve | Point3d[] | IndexedXYZCollection, requireClosurePoint: boolean = true,\r\n ): Transform | undefined {\r\n if (data instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.packedPoints);\r\n } else if (data instanceof IndexedXYZCollection) {\r\n let dataToUse;\r\n if (requireClosurePoint && data.length === 5) {\r\n if (!Geometry.isSmallMetricDistance(data.distanceIndexIndex(0, 4)!))\r\n return undefined;\r\n dataToUse = data;\r\n } else if (!requireClosurePoint && data.length === 4) {\r\n dataToUse = data;\r\n } else if (data.length < (requireClosurePoint ? 5 : 4)) {\r\n return undefined;\r\n } else {\r\n dataToUse = GrowableXYZArray.create(data);\r\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, Geometry.smallMetricDistance);\r\n if (dataToUse.length < (requireClosurePoint ? 5 : 4))\r\n return undefined;\r\n }\r\n const vector01 = dataToUse.vectorIndexIndex(0, 1)!;\r\n const vector03 = dataToUse.vectorIndexIndex(0, 3)!;\r\n const vector12 = dataToUse.vectorIndexIndex(1, 2)!;\r\n const normalVector = vector01.crossProduct(vector03);\r\n if (normalVector.normalizeInPlace()\r\n && vector12.isAlmostEqual(vector03)\r\n && vector01.isPerpendicularTo(vector03)) {\r\n return Transform.createOriginAndMatrixColumns(\r\n dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector,\r\n );\r\n }\r\n } else if (Array.isArray(data)) {\r\n return this.rectangleEdgeTransform(new Point3dArrayCarrier(data), requireClosurePoint);\r\n } else if (data instanceof Loop && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, true);\r\n } else if (data instanceof Path && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, requireClosurePoint);\r\n } else if (data instanceof CurveChain) {\r\n if (!data.checkForNonLinearPrimitives()) {\r\n // const linestring = LineString3d.create();\r\n const strokes = data.getPackedStrokes();\r\n if (strokes) {\r\n return this.rectangleEdgeTransform(strokes);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Look for and simplify:\r\n * * Contiguous `LineSegment3d` and `LineString3d` objects.\r\n * * collect all points\r\n * * eliminate duplicated points\r\n * * eliminate points colinear with surrounding points\r\n * * contiguous concentric circular or elliptic arcs\r\n * * combine angular ranges\r\n * * This function can be used to compress adjacent LineSegment3ds into a LineString3d\r\n * @param curves Path or loop (or larger collection containing paths and loops) to be simplified\r\n * @param options options for tolerance and selective simplification.\r\n */\r\n public static consolidateAdjacentPrimitives(\r\n curves: CurveCollection, options?: ConsolidateAdjacentCurvePrimitivesOptions,\r\n ): void {\r\n const context = new ConsolidateAdjacentCurvePrimitivesContext(options);\r\n curves.dispatchToGeometryHandler(context);\r\n }\r\n /**\r\n * Reverse and reorder loops in the xy-plane for consistency and containment.\r\n * @param loops multiple loops in any order and orientation, z-coordinates ignored\r\n * @returns a region that captures the input pointers. This region is a:\r\n * * `Loop` if there is exactly one input loop. It is oriented counterclockwise.\r\n * * `ParityRegion` if input consists of exactly one outer loop with at least one hole loop.\r\n * Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented\r\n * clockwise.\r\n * * `UnionRegion` if any other input configuration. Its children are individually ordered/oriented as in\r\n * the above cases.\r\n * @see [[PolygonOps.sortOuterAndHoleLoopsXY]]\r\n */\r\n public static sortOuterAndHoleLoopsXY(loops: Array<Loop | IndexedXYZCollection>): AnyRegion {\r\n const loopAndArea: SortablePolygon[] = [];\r\n for (const candidate of loops) {\r\n if (candidate instanceof Loop)\r\n SortablePolygon.pushLoop(loopAndArea, candidate);\r\n else if (candidate instanceof IndexedXYZCollection) {\r\n const loop = Loop.createPolygon(candidate);\r\n SortablePolygon.pushLoop(loopAndArea, loop);\r\n }\r\n }\r\n return SortablePolygon.sortAsAnyRegion(loopAndArea);\r\n }\r\n /**\r\n * Find all areas bounded by the unstructured, possibly intersecting curves.\r\n * * A common use case of this method is to assemble the bounding \"exterior\" loop (or loops) containing the\r\n * input curves.\r\n * * This method does not add bridge edges to connect outer loops to inner loops. Each disconnected loop,\r\n * regardless of its containment, is returned as its own SignedLoops object. Pre-process with [[regionBooleanXY]]\r\n * to add bridge edges so that [[constructAllXYRegionLoops]] will return outer and inner loops in the same\r\n * SignedLoops object.\r\n * @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve\r\n * primitives.\r\n * @param tolerance optional distance tolerance for coincidence\r\n * @returns array of [[SignedLoops]], each entry of which describes the faces in a single connected component:\r\n * * `positiveAreaLoops` contains \"interior\" loops, _including holes in ParityRegion input_. These loops have\r\n * positive area and counterclockwise orientation.\r\n * * `negativeAreaLoops` contains (probably just one) \"exterior\" loop which is ordered clockwise.\r\n * * `slivers` contains sliver loops that have zero area, such as appear between coincident curves.\r\n * * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent\r\n * to the edge and a constituent curve in each.\r\n */\r\n public static constructAllXYRegionLoops(\r\n curvesAndRegions: AnyCurve | AnyCurve[], tolerance: number = Geometry.smallMetricDistance,\r\n ): SignedLoops[] {\r\n const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);\r\n const range = this.curveArrayRange(primitives);\r\n const areaTol = this.computeXYAreaTolerance(range, tolerance);\r\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);\r\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);\r\n return PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);\r\n }\r\n /**\r\n * Collect all `CurvePrimitives` in loosely typed input.\r\n * * Always recurses into primitives within explicit collections (Path, Loop, ParityRegion, UnionRegion).\r\n * * Optionally recurses into hidden primitives if `smallestPossiblePrimitives` is true.\r\n * @param candidates input curves\r\n * @param collectorArray optional pre-defined output array. If defined, it is NOT cleared: primitives are appended.\r\n * @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If\r\n * false, push the [[CurveChainWithDistanceIndex]] instead.\r\n * @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false,\r\n * push the [[LineString3d]] instead.\r\n */\r\n public static collectCurvePrimitives(\r\n candidates: AnyCurve | AnyCurve[],\r\n collectorArray?: CurvePrimitive[],\r\n smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n if (candidates instanceof CurvePrimitive) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (candidates instanceof CurveCollection) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (Array.isArray(candidates)) {\r\n for (const c of candidates) {\r\n this.collectCurvePrimitives(c, results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n return results;\r\n }\r\n /**\r\n * Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed\r\n * instances of [[LineSegment3d]].\r\n * @param candidates input curves\r\n * @return copied (captured) inputs except for the linestrings, which are exploded\r\n */\r\n public static expandLineStrings(candidates: CurvePrimitive[]): CurvePrimitive[] {\r\n const result: CurvePrimitive[] = [];\r\n for (const c of candidates) {\r\n if (c instanceof LineString3d) {\r\n for (let i = 0; i + 1 < c.packedPoints.length; i++) {\r\n const q = c.getIndexedSegment(i);\r\n if (q !== undefined)\r\n result.push(q);\r\n }\r\n } else {\r\n result.push(c);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return the overall range of given curves.\r\n * @param data candidate curves\r\n * @param worldToLocal transform to apply to data before computing its range\r\n */\r\n public static curveArrayRange(data: any, worldToLocal?: Transform): Range3d {\r\n const range = Range3d.create();\r\n if (data instanceof GeometryQuery)\r\n data.extendRange(range, worldToLocal);\r\n else if (Array.isArray(data)) {\r\n for (const c of data) {\r\n if (c instanceof GeometryQuery)\r\n c.extendRange(range, worldToLocal);\r\n else if (c instanceof Point3d)\r\n range.extendPoint(c, worldToLocal);\r\n else if (c instanceof GrowableXYZArray)\r\n range.extendRange(c.getRange(worldToLocal));\r\n else if (Array.isArray(c))\r\n range.extendRange(this.curveArrayRange(c, worldToLocal));\r\n }\r\n }\r\n return range;\r\n }\r\n}\r\n/** @internal */\r\nfunction pushToInOnOutArrays(\r\n curve: AnyCurve, select: number, arrayNegative: AnyCurve[], array0: AnyCurve[], arrayPositive: AnyCurve[],\r\n): void {\r\n if (select > 0)\r\n arrayPositive.push(curve);\r\n else if (select < 0)\r\n arrayNegative.push(curve);\r\n else\r\n array0.push(curve);\r\n}\r\n"]}
@@ -244,7 +244,7 @@ export class RegionOpsFaceToFaceSearch {
244
244
  const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;
245
245
  const callbacks = RegionBooleanContext.create(opA, opB);
246
246
  callbacks.graph = graph;
247
- callbacks.faceAreaFunction = HalfEdgeGraphSearch.signedFaceArea;
247
+ callbacks.faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);
248
248
  // Add all the members in groupA ..
249
249
  for (const data of dataA) {
250
250
  if (data.length > 2) {
@@ -689,7 +689,7 @@ export class GraphComponent {
689
689
  }
690
690
  this.faceAreas.length = 0;
691
691
  if (!faceAreaFunction)
692
- faceAreaFunction = HalfEdgeGraphSearch.signedFaceArea;
692
+ faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);
693
693
  for (const f of this.faces) {
694
694
  this.faceAreas.push(faceAreaFunction(f));
695
695
  }