@itwin/core-geometry 5.1.0-dev.3 → 5.1.0-dev.32

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 (770) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.d.ts +8 -0
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js +10 -0
  6. package/lib/cjs/Geometry.js.map +1 -1
  7. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  8. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurve.js +7 -1
  11. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  13. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  14. package/lib/cjs/bspline/BSplineSurface.d.ts +2 -1
  15. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  16. package/lib/cjs/bspline/BSplineSurface.js +2 -1
  17. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  18. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  19. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  20. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  21. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  22. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  23. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  24. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  25. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  26. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  27. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  28. package/lib/cjs/clipping/ClipPlane.d.ts +7 -5
  29. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  30. package/lib/cjs/clipping/ClipPlane.js +9 -5
  31. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  32. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  33. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  34. package/lib/cjs/clipping/ClipUtils.js +5 -3
  35. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  36. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  37. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -2
  38. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  39. package/lib/cjs/clipping/ConvexClipPlaneSet.js +13 -25
  40. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  41. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  42. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  43. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  44. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  45. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  46. package/lib/cjs/core-geometry.d.ts +1 -0
  47. package/lib/cjs/core-geometry.d.ts.map +1 -1
  48. package/lib/cjs/core-geometry.js +1 -0
  49. package/lib/cjs/core-geometry.js.map +1 -1
  50. package/lib/cjs/curve/Arc3d.d.ts +54 -32
  51. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  52. package/lib/cjs/curve/Arc3d.js +56 -37
  53. package/lib/cjs/curve/Arc3d.js.map +1 -1
  54. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  55. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  56. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  57. package/lib/cjs/curve/CurveCollection.d.ts +33 -1
  58. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  59. package/lib/cjs/curve/CurveCollection.js +79 -0
  60. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  61. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  62. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  63. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  64. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  65. package/lib/cjs/curve/CurveLocationDetail.d.ts +24 -24
  66. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  67. package/lib/cjs/curve/CurveLocationDetail.js +24 -24
  68. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  69. package/lib/cjs/curve/CurveOps.js.map +1 -1
  70. package/lib/cjs/curve/CurvePrimitive.d.ts +2 -2
  71. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  72. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  73. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  74. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  75. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  76. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  77. package/lib/cjs/curve/LineString3d.js.map +1 -1
  78. package/lib/cjs/curve/Loop.js.map +1 -1
  79. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  80. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  81. package/lib/cjs/curve/Path.js.map +1 -1
  82. package/lib/cjs/curve/PointString3d.js.map +1 -1
  83. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  84. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  85. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
  86. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  87. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  88. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  89. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  90. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +9 -5
  91. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  92. package/lib/cjs/curve/Query/PlanarSubdivision.js +27 -11
  93. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  94. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  95. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  96. package/lib/cjs/curve/RegionMomentsXY.d.ts +15 -21
  97. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  98. package/lib/cjs/curve/RegionMomentsXY.js +39 -59
  99. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  100. package/lib/cjs/curve/RegionOps.d.ts +82 -39
  101. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  102. package/lib/cjs/curve/RegionOps.js +154 -48
  103. package/lib/cjs/curve/RegionOps.js.map +1 -1
  104. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +27 -26
  105. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  106. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +70 -54
  107. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  108. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  109. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  110. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  111. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  112. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  113. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  114. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  115. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  116. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  117. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  118. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  119. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  120. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  121. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  122. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  123. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  124. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  125. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  126. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  127. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  128. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  129. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  130. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  131. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +0 -1
  132. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  133. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  134. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  135. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  136. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js +34 -0
  137. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  138. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  139. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  140. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  141. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  142. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  143. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  144. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  145. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  146. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  147. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  148. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  149. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  150. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  151. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  152. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  153. package/lib/cjs/geometry3d/AngleSweep.d.ts +24 -17
  154. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  155. package/lib/cjs/geometry3d/AngleSweep.js +31 -17
  156. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  157. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  158. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  159. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  160. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  161. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +19 -25
  162. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  163. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  164. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  165. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  166. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  167. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  168. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  169. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  170. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +7 -2
  171. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  172. package/lib/cjs/geometry3d/GrowableXYZArray.js +20 -2
  173. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  174. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  175. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  176. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +2 -1
  177. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  178. package/lib/cjs/geometry3d/IndexedXYZCollection.js +7 -3
  179. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  180. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  181. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  182. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  183. package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
  184. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  185. package/lib/cjs/geometry3d/Plane3d.js +6 -1
  186. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  187. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  188. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  189. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  190. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  191. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  192. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  193. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  194. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  195. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  196. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  197. package/lib/cjs/geometry3d/Point2dVector2d.js +0 -2
  198. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  199. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  200. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
  201. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  202. package/lib/cjs/geometry3d/Point3dVector3d.js +7 -8
  203. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  204. package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
  205. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  206. package/lib/cjs/geometry3d/PointHelpers.js +66 -26
  207. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  208. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  209. package/lib/cjs/geometry3d/PolygonOps.d.ts +57 -9
  210. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  211. package/lib/cjs/geometry3d/PolygonOps.js +57 -17
  212. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  213. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  214. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  215. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  216. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  217. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
  218. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  219. package/lib/cjs/geometry3d/PolylineOps.js +5 -4
  220. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  221. package/lib/cjs/geometry3d/Range.d.ts +18 -10
  222. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  223. package/lib/cjs/geometry3d/Range.js +32 -10
  224. package/lib/cjs/geometry3d/Range.js.map +1 -1
  225. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  226. package/lib/cjs/geometry3d/Ray2d.js +0 -1
  227. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  228. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  229. package/lib/cjs/geometry3d/Ray3d.js +11 -23
  230. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  231. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  232. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  233. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  234. package/lib/cjs/geometry3d/Transform.d.ts +21 -2
  235. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  236. package/lib/cjs/geometry3d/Transform.js +32 -13
  237. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  238. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  239. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  240. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  241. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  242. package/lib/cjs/geometry4d/Matrix4d.d.ts +7 -7
  243. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  244. package/lib/cjs/geometry4d/Matrix4d.js +9 -9
  245. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  246. package/lib/cjs/geometry4d/MomentData.d.ts +32 -34
  247. package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
  248. package/lib/cjs/geometry4d/MomentData.js +56 -57
  249. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  250. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  251. package/lib/cjs/geometry4d/Point4d.d.ts +7 -4
  252. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  253. package/lib/cjs/geometry4d/Point4d.js +26 -15
  254. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  255. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  256. package/lib/cjs/numerics/BezierPolynomials.d.ts +2 -0
  257. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  258. package/lib/cjs/numerics/BezierPolynomials.js +11 -0
  259. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  260. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  261. package/lib/cjs/numerics/Complex.js.map +1 -1
  262. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  263. package/lib/cjs/numerics/Newton.js.map +1 -1
  264. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  265. package/lib/cjs/numerics/PolarData.js.map +1 -1
  266. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  267. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  268. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  269. package/lib/cjs/numerics/SmallSystem.d.ts +77 -36
  270. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  271. package/lib/cjs/numerics/SmallSystem.js +129 -73
  272. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  273. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  274. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  275. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  276. package/lib/cjs/polyface/AuxData.js.map +1 -1
  277. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  278. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  279. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  280. package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
  281. package/lib/cjs/polyface/FacetOrientation.js +1 -1
  282. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  283. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  284. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
  285. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  286. package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
  287. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  288. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  289. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  290. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
  291. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  292. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  293. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  294. package/lib/cjs/polyface/IndexedPolyfaceWalker.js +47 -32
  295. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  296. package/lib/cjs/polyface/Polyface.d.ts +17 -3
  297. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  298. package/lib/cjs/polyface/Polyface.js +16 -0
  299. package/lib/cjs/polyface/Polyface.js.map +1 -1
  300. package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
  301. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  302. package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
  303. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  304. package/lib/cjs/polyface/PolyfaceClip.js +39 -42
  305. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  306. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  307. package/lib/cjs/polyface/PolyfaceQuery.d.ts +116 -75
  308. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  309. package/lib/cjs/polyface/PolyfaceQuery.js +312 -228
  310. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  311. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  312. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  313. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  314. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  315. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  316. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  317. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  318. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
  319. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  320. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  321. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  322. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  323. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  324. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  325. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  326. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  327. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  328. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  329. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  330. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  331. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  332. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  333. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  334. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  335. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  336. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  337. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  338. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  339. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  340. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  341. package/lib/cjs/serialization/GeometrySamples.js +2 -2
  342. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  343. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  344. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  345. package/lib/cjs/solid/Box.js.map +1 -1
  346. package/lib/cjs/solid/Cone.js.map +1 -1
  347. package/lib/cjs/solid/LinearSweep.d.ts +2 -3
  348. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  349. package/lib/cjs/solid/LinearSweep.js +2 -3
  350. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  351. package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
  352. package/lib/cjs/solid/RotationalSweep.js +2 -2
  353. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  354. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  355. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  356. package/lib/cjs/solid/Sphere.js.map +1 -1
  357. package/lib/cjs/solid/SweepContour.js.map +1 -1
  358. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  359. package/lib/cjs/topology/ChainMerge.d.ts +1 -1
  360. package/lib/cjs/topology/ChainMerge.js +1 -1
  361. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  362. package/lib/cjs/topology/Graph.js.map +1 -1
  363. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  364. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +1 -0
  365. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  366. package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -0
  367. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  368. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  369. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  370. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  371. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  372. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  373. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  374. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  375. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  376. package/lib/cjs/topology/MaskManager.js.map +1 -1
  377. package/lib/cjs/topology/Merging.d.ts +0 -1
  378. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  379. package/lib/cjs/topology/Merging.js +49 -46
  380. package/lib/cjs/topology/Merging.js.map +1 -1
  381. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  382. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  383. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  384. package/lib/cjs/topology/Triangulation.js.map +1 -1
  385. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  386. package/lib/esm/Constant.js.map +1 -1
  387. package/lib/esm/Geometry.d.ts +8 -0
  388. package/lib/esm/Geometry.d.ts.map +1 -1
  389. package/lib/esm/Geometry.js +10 -0
  390. package/lib/esm/Geometry.js.map +1 -1
  391. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  392. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  393. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  394. package/lib/esm/bspline/BSplineCurve.js +7 -1
  395. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  396. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  397. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  398. package/lib/esm/bspline/BSplineSurface.d.ts +2 -1
  399. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  400. package/lib/esm/bspline/BSplineSurface.js +2 -1
  401. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  402. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  403. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  404. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  405. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  406. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  407. package/lib/esm/bspline/KnotVector.js.map +1 -1
  408. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  409. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  410. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  411. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  412. package/lib/esm/clipping/ClipPlane.d.ts +7 -5
  413. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  414. package/lib/esm/clipping/ClipPlane.js +9 -5
  415. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  416. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  417. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  418. package/lib/esm/clipping/ClipUtils.js +5 -3
  419. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  420. package/lib/esm/clipping/ClipVector.js.map +1 -1
  421. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -2
  422. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  423. package/lib/esm/clipping/ConvexClipPlaneSet.js +13 -25
  424. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  425. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  426. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  427. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  428. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  429. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  430. package/lib/esm/core-geometry.d.ts +1 -0
  431. package/lib/esm/core-geometry.d.ts.map +1 -1
  432. package/lib/esm/core-geometry.js +1 -0
  433. package/lib/esm/core-geometry.js.map +1 -1
  434. package/lib/esm/curve/Arc3d.d.ts +54 -32
  435. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  436. package/lib/esm/curve/Arc3d.js +56 -37
  437. package/lib/esm/curve/Arc3d.js.map +1 -1
  438. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  439. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  440. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  441. package/lib/esm/curve/CurveCollection.d.ts +33 -1
  442. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  443. package/lib/esm/curve/CurveCollection.js +79 -0
  444. package/lib/esm/curve/CurveCollection.js.map +1 -1
  445. package/lib/esm/curve/CurveCurve.js.map +1 -1
  446. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  447. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  448. package/lib/esm/curve/CurveFactory.js.map +1 -1
  449. package/lib/esm/curve/CurveLocationDetail.d.ts +24 -24
  450. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  451. package/lib/esm/curve/CurveLocationDetail.js +24 -24
  452. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  453. package/lib/esm/curve/CurveOps.js.map +1 -1
  454. package/lib/esm/curve/CurvePrimitive.d.ts +2 -2
  455. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  456. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  457. package/lib/esm/curve/CurveTypes.js.map +1 -1
  458. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  459. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  460. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  461. package/lib/esm/curve/LineString3d.js.map +1 -1
  462. package/lib/esm/curve/Loop.js.map +1 -1
  463. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  464. package/lib/esm/curve/ParityRegion.js.map +1 -1
  465. package/lib/esm/curve/Path.js.map +1 -1
  466. package/lib/esm/curve/PointString3d.js.map +1 -1
  467. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  468. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  469. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
  470. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  471. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  472. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  473. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  474. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +9 -5
  475. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  476. package/lib/esm/curve/Query/PlanarSubdivision.js +27 -11
  477. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  478. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  479. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  480. package/lib/esm/curve/RegionMomentsXY.d.ts +15 -21
  481. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  482. package/lib/esm/curve/RegionMomentsXY.js +39 -59
  483. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  484. package/lib/esm/curve/RegionOps.d.ts +82 -39
  485. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  486. package/lib/esm/curve/RegionOps.js +155 -49
  487. package/lib/esm/curve/RegionOps.js.map +1 -1
  488. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +27 -26
  489. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  490. package/lib/esm/curve/RegionOpsClassificationSweeps.js +70 -54
  491. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  492. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  493. package/lib/esm/curve/UnionRegion.js.map +1 -1
  494. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  495. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  496. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  497. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  498. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  499. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  500. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  501. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  502. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  503. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  504. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  505. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  506. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  507. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  508. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  509. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  510. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  511. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  512. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  513. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  514. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  515. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +0 -1
  516. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  517. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  518. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  519. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  520. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js +30 -0
  521. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  522. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  523. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  524. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  525. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  526. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  527. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  528. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  529. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  530. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  531. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  532. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  533. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  534. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  535. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  536. package/lib/esm/geometry3d/Angle.js.map +1 -1
  537. package/lib/esm/geometry3d/AngleSweep.d.ts +24 -17
  538. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  539. package/lib/esm/geometry3d/AngleSweep.js +31 -17
  540. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  541. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  542. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  543. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  544. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  545. package/lib/esm/geometry3d/CoincidentGeometryOps.js +19 -25
  546. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  547. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  548. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  549. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  550. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  551. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  552. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  553. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  554. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +7 -2
  555. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  556. package/lib/esm/geometry3d/GrowableXYZArray.js +20 -2
  557. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  558. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  559. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  560. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +2 -1
  561. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  562. package/lib/esm/geometry3d/IndexedXYZCollection.js +7 -3
  563. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  564. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  565. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  566. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  567. package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
  568. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  569. package/lib/esm/geometry3d/Plane3d.js +6 -1
  570. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  571. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  572. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  573. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  574. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  575. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  576. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  577. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  578. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  579. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  580. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  581. package/lib/esm/geometry3d/Point2dVector2d.js +0 -2
  582. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  583. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  584. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
  585. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  586. package/lib/esm/geometry3d/Point3dVector3d.js +7 -8
  587. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  588. package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
  589. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  590. package/lib/esm/geometry3d/PointHelpers.js +66 -26
  591. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  592. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  593. package/lib/esm/geometry3d/PolygonOps.d.ts +57 -9
  594. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  595. package/lib/esm/geometry3d/PolygonOps.js +57 -17
  596. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  597. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  598. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  599. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  600. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  601. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
  602. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  603. package/lib/esm/geometry3d/PolylineOps.js +5 -4
  604. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  605. package/lib/esm/geometry3d/Range.d.ts +18 -10
  606. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  607. package/lib/esm/geometry3d/Range.js +32 -10
  608. package/lib/esm/geometry3d/Range.js.map +1 -1
  609. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  610. package/lib/esm/geometry3d/Ray2d.js +0 -1
  611. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  612. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  613. package/lib/esm/geometry3d/Ray3d.js +11 -23
  614. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  615. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  616. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  617. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  618. package/lib/esm/geometry3d/Transform.d.ts +21 -2
  619. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  620. package/lib/esm/geometry3d/Transform.js +32 -13
  621. package/lib/esm/geometry3d/Transform.js.map +1 -1
  622. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  623. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  624. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  625. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  626. package/lib/esm/geometry4d/Matrix4d.d.ts +7 -7
  627. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  628. package/lib/esm/geometry4d/Matrix4d.js +9 -9
  629. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  630. package/lib/esm/geometry4d/MomentData.d.ts +32 -34
  631. package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
  632. package/lib/esm/geometry4d/MomentData.js +56 -57
  633. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  634. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  635. package/lib/esm/geometry4d/Point4d.d.ts +7 -4
  636. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  637. package/lib/esm/geometry4d/Point4d.js +26 -15
  638. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  639. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  640. package/lib/esm/numerics/BezierPolynomials.d.ts +2 -0
  641. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  642. package/lib/esm/numerics/BezierPolynomials.js +11 -0
  643. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  644. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  645. package/lib/esm/numerics/Complex.js.map +1 -1
  646. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  647. package/lib/esm/numerics/Newton.js.map +1 -1
  648. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  649. package/lib/esm/numerics/PolarData.js.map +1 -1
  650. package/lib/esm/numerics/Polynomials.js.map +1 -1
  651. package/lib/esm/numerics/Quadrature.js.map +1 -1
  652. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  653. package/lib/esm/numerics/SmallSystem.d.ts +77 -36
  654. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  655. package/lib/esm/numerics/SmallSystem.js +129 -73
  656. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  657. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  658. package/lib/esm/numerics/UnionFind.js.map +1 -1
  659. package/lib/esm/numerics/UsageSums.js.map +1 -1
  660. package/lib/esm/polyface/AuxData.js.map +1 -1
  661. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  662. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  663. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  664. package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
  665. package/lib/esm/polyface/FacetOrientation.js +1 -1
  666. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  667. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  668. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
  669. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  670. package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
  671. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  672. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  673. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  674. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
  675. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  676. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  677. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  678. package/lib/esm/polyface/IndexedPolyfaceWalker.js +47 -32
  679. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  680. package/lib/esm/polyface/Polyface.d.ts +17 -3
  681. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  682. package/lib/esm/polyface/Polyface.js +16 -0
  683. package/lib/esm/polyface/Polyface.js.map +1 -1
  684. package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
  685. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  686. package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
  687. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  688. package/lib/esm/polyface/PolyfaceClip.js +39 -42
  689. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  690. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  691. package/lib/esm/polyface/PolyfaceQuery.d.ts +116 -75
  692. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  693. package/lib/esm/polyface/PolyfaceQuery.js +313 -229
  694. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  695. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  696. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  697. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  698. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  699. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  700. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  701. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  702. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
  703. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  704. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  705. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  706. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  707. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  708. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  709. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  710. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  711. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  712. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  713. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  714. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  715. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  716. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  717. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  718. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  719. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  720. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  721. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  722. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  723. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  724. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  725. package/lib/esm/serialization/GeometrySamples.js +2 -2
  726. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  727. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  728. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  729. package/lib/esm/solid/Box.js.map +1 -1
  730. package/lib/esm/solid/Cone.js.map +1 -1
  731. package/lib/esm/solid/LinearSweep.d.ts +2 -3
  732. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  733. package/lib/esm/solid/LinearSweep.js +2 -3
  734. package/lib/esm/solid/LinearSweep.js.map +1 -1
  735. package/lib/esm/solid/RotationalSweep.d.ts +2 -2
  736. package/lib/esm/solid/RotationalSweep.js +2 -2
  737. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  738. package/lib/esm/solid/RuledSweep.js.map +1 -1
  739. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  740. package/lib/esm/solid/Sphere.js.map +1 -1
  741. package/lib/esm/solid/SweepContour.js.map +1 -1
  742. package/lib/esm/solid/TorusPipe.js.map +1 -1
  743. package/lib/esm/topology/ChainMerge.d.ts +1 -1
  744. package/lib/esm/topology/ChainMerge.js +1 -1
  745. package/lib/esm/topology/ChainMerge.js.map +1 -1
  746. package/lib/esm/topology/Graph.js.map +1 -1
  747. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  748. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +1 -0
  749. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  750. package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -0
  751. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  752. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  753. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  754. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  755. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  756. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  757. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  758. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  759. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  760. package/lib/esm/topology/MaskManager.js.map +1 -1
  761. package/lib/esm/topology/Merging.d.ts +0 -1
  762. package/lib/esm/topology/Merging.d.ts.map +1 -1
  763. package/lib/esm/topology/Merging.js +49 -46
  764. package/lib/esm/topology/Merging.js.map +1 -1
  765. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  766. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  767. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  768. package/lib/esm/topology/Triangulation.js.map +1 -1
  769. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  770. package/package.json +3 -3
@@ -18,6 +18,7 @@ import { CurveCurve } from "./CurveCurve";
18
18
  import { CurveLocationDetail } from "./CurveLocationDetail";
19
19
  import { GeometryQuery } from "./GeometryQuery";
20
20
  import { PlaneAltitudeRangeContext } from "./internalContexts/PlaneAltitudeRangeContext";
21
+ import { TransferWithSplitArcs } from "./internalContexts/TransferWithSplitArcs";
21
22
  import { LineSegment3d } from "./LineSegment3d";
22
23
  import { Loop } from "./Loop";
23
24
  import { ParityRegion } from "./ParityRegion";
@@ -40,14 +41,22 @@ import { UnionRegion } from "./UnionRegion";
40
41
  * @internal
41
42
  */
42
43
  class RegionOpsFaceToFaceSearchCallbacks {
43
- /** Announce a representative node on the outer face of a component */
44
- startComponent(_node) { return true; }
45
- /** Announce return to outer face */
46
- finishComponent(_node) { return true; }
47
- /** Announce face entry */
48
- enterFace(_facePathStack, _newFaceNode) { return true; }
49
- /** Announce face exit */
50
- leaveFace(_facePathStack, _newFaceNode) { return true; }
44
+ /** Announce a representative node on the outer face of a component. */
45
+ startComponent(_node) {
46
+ return true;
47
+ }
48
+ /** Announce return to outer face. */
49
+ finishComponent(_node) {
50
+ return true;
51
+ }
52
+ /** Announce face entry. */
53
+ enterFace(_facePathStack, _newFaceNode) {
54
+ return true;
55
+ }
56
+ /** Announce face exit. */
57
+ leaveFace(_facePathStack, _newFaceNode) {
58
+ return true;
59
+ }
51
60
  }
52
61
  /**
53
62
  * Implementation of `RegionOpsFaceToFaceSearchCallbacks` for binary boolean sweep with polygonal regions.
@@ -110,14 +119,14 @@ class RegionOpsBinaryBooleanSweepCallbacks extends RegionOpsFaceToFaceSearchCall
110
119
  */
111
120
  export class RegionOpsFaceToFaceSearch {
112
121
  /**
113
- * run a DFS with face-to-face step announcements.
122
+ * Run a DFS with face-to-face step announcements.
114
123
  * * false return from any function terminates search immediately.
115
124
  * * all reachable nodes assumed to have both visit masks clear.
116
125
  * @param graph containing graph.
117
126
  * @param seed first node to visit.
118
127
  * @param faceHasBeenVisited mask marking faces that have been seen.
119
128
  * @param nodeHasBeenVisited mask marking node-to-node step around face.
120
- *
129
+ * @param callbacks callbacks.
121
130
  */
122
131
  static faceToFaceSearchFromOuterLoop(_graph, seed, faceHasBeenVisited, nodeHasBeenVisited, callbacks) {
123
132
  if (seed.isMaskSet(faceHasBeenVisited))
@@ -131,10 +140,10 @@ export class RegionOpsFaceToFaceSearch {
131
140
  let entryNode = faceWalker;
132
141
  let mate = faceWalker.edgeMate;
133
142
  if (!mate.isMaskSet(faceHasBeenVisited)) {
134
- // the faceWalker seed is always on the base of the stack.
135
- // the stack then contains even-odd pairs of (entryNode, currentNode)
136
- // * entryNode is the node where a face was entered.
137
- // * faceNode is another node around that face.
143
+ // The faceWalker seed is always on the base of the stack.
144
+ // The stack then contains even-odd pairs of (entryNode, faceNode).
145
+ // entryNode is the node where a face was entered.
146
+ // faceNode is another node around that face.
138
147
  facePathStack.push(faceWalker);
139
148
  facePathStack.push(mate);
140
149
  let faceNode = mate.faceSuccessor;
@@ -165,13 +174,13 @@ export class RegionOpsFaceToFaceSearch {
165
174
  entryNode = facePathStack[facePathStack.length - 1];
166
175
  }
167
176
  if (faceNode.isMaskSet(nodeHasBeenVisited)) {
168
- // this is disaster !!!
177
+ // this is disaster
169
178
  return;
170
179
  }
171
180
  }
172
181
  }
173
182
  }
174
- // continue at outermost level .....
183
+ // continue at outermost level
175
184
  faceWalker = faceWalker.faceSuccessor;
176
185
  } while (faceWalker !== seed);
177
186
  callbacks.finishComponent(seed);
@@ -301,7 +310,9 @@ class RegionGroupMember {
301
310
  this.parentGroup = parentGroup;
302
311
  this.sweepState = 0;
303
312
  }
304
- clearState() { this.sweepState = 0; }
313
+ clearState() {
314
+ this.sweepState = 0;
315
+ }
305
316
  }
306
317
  /**
307
318
  * A `RegionGroup` is
@@ -340,8 +351,7 @@ export class RegionGroup {
340
351
  }
341
352
  return range;
342
353
  }
343
- /** Ask if the current _numIn count qualifies as an "in" for this operation type.
344
- */
354
+ /** Ask if the current _numIn count qualifies as an "in" for this operation type. */
345
355
  getInOut() {
346
356
  // UNION is true if one or more members are IN
347
357
  if (this.groupOpType === RegionGroupOpType.Union)
@@ -357,8 +367,9 @@ export class RegionGroup {
357
367
  // push new members into the group.
358
368
  addMember(data, allowLineSegment = false) {
359
369
  if (data instanceof Loop || data instanceof ParityRegion) {
360
- const cleanerData = data.clone();
370
+ let cleanerData = data.clone();
361
371
  RegionOps.consolidateAdjacentPrimitives(cleanerData);
372
+ cleanerData = TransferWithSplitArcs.clone(cleanerData);
362
373
  this.members.push(new RegionGroupMember(cleanerData, this));
363
374
  }
364
375
  else if (data instanceof UnionRegion) {
@@ -388,28 +399,29 @@ export class RegionGroup {
388
399
  /**
389
400
  * A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.
390
401
  * * In the binary operation OP (union, intersection, parity, difference), the left and right operands
391
- * are each a composite union, difference, or parity among multiple inputs, i.e.
402
+ * are each a composite union, difference, or parity among multiple inputs, i.e.,
392
403
  * * (operationA among Ai) OP (operationB among Bi)
393
404
  * * where the Ai are one set of regions, being combined by operationA
394
- * * and the Bi are the another set of regions, being combined by operationB
395
- * * Each group of Ai and Bi is a `RegionGroup`
405
+ * * and the Bi are the another set of regions, being combined by operationB.
406
+ * * Each group of Ai and Bi is a `RegionGroup`.
396
407
  * * This is an extremely delicate structure.
397
408
  * * Members are public because of the unique variety of queries, but should only be used for queries.
398
409
  * * The graph and curves in the booleans are connected by an extended pointer chain:
399
- * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail
400
- * * (CurveLocationDetail).curve points to a curve
401
- * * (Curve).parent points to RegionGroupMember
402
- * * (RegionGroupMember) points to RegionGroup
403
- * * (RegionGroup) points to RegionBooleanBinaryContext
404
- * * So..when a graph sweep crosses an edge,
405
- * * the chain leads to a parity count in the RegionGroupMember
406
- * * that can change the number of members active in the RegionGroup
410
+ * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail.
411
+ * * (CurveLocationDetail).curve points to a curve.
412
+ * * (Curve).parent points to RegionGroupMember.
413
+ * * (RegionGroupMember) points to RegionGroup.
414
+ * * (RegionGroup) points to RegionBooleanBinaryContext.
415
+ * * So when a graph sweep crosses an edge
416
+ * * the chain leads to a parity count in the RegionGroupMember.
417
+ * * that can change the number of members active in the RegionGroup.
407
418
  * * which can change the state of the context.
408
419
  * @internal
409
420
  */
410
421
  export class RegionBooleanContext {
411
422
  groupA;
412
423
  groupB;
424
+ /** bridge edges */
413
425
  extraGeometry;
414
426
  graph;
415
427
  faceAreaFunction;
@@ -418,7 +430,7 @@ export class RegionBooleanContext {
418
430
  this.groupA = new RegionGroup(this, groupTypeA);
419
431
  this.groupB = new RegionGroup(this, groupTypeB);
420
432
  this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);
421
- this.binaryOp = RegionBinaryOpType.Union; // it will be revised on can calls.
433
+ this.binaryOp = RegionBinaryOpType.Union; // revised in runClassificationSweep
422
434
  }
423
435
  /**
424
436
  * Create a context with both A and B groups empty.
@@ -432,8 +444,6 @@ export class RegionBooleanContext {
432
444
  addMembers(dataA, dataB) {
433
445
  this.groupA.addMember(dataA);
434
446
  this.groupB.addMember(dataB);
435
- // const doConnectives = 1;
436
- // if (doConnectives !== 0)
437
447
  this.addConnectives();
438
448
  }
439
449
  _workSegment;
@@ -477,12 +487,12 @@ export class RegionBooleanContext {
477
487
  }
478
488
  const ray = Ray3d.createZero();
479
489
  for (const p of maxPoints) {
480
- // Make a line from...
481
- // 1) exactly the max point of the loops to
482
- // 2) a point clearly outside the big range
483
- // If p came from some inner loop this will...
484
- // 1) create a bridge from the inner loop through any containing loops (always)
485
- // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)
490
+ // Make a line from
491
+ // 1) exactly the max point of the loops to
492
+ // 2) a point clearly outside the big range
493
+ // If p came from some inner loop this will
494
+ // 1) create a bridge from the inner loop through any containing loops (always)
495
+ // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)
486
496
  const bridgeLength = margin + Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;
487
497
  const outside = Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);
488
498
  const bridgeLine = LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);
@@ -499,7 +509,7 @@ export class RegionBooleanContext {
499
509
  */
500
510
  annotateAndMergeCurvesInGraph(mergeTolerance = Geometry.smallMetricDistance) {
501
511
  const allPrimitives = [];
502
- // ASSUME loops have fine-grained types -- no linestrings !!
512
+ // ASSUME loops have fine-grained types (no linestrings)
503
513
  for (const group of [this.groupA, this.groupB, this.extraGeometry]) {
504
514
  for (const member of group.members) {
505
515
  let k = allPrimitives.length;
@@ -510,7 +520,6 @@ export class RegionBooleanContext {
510
520
  }
511
521
  }
512
522
  }
513
- // const range = RegionOps.curveArrayRange(allPrimitives);
514
523
  const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);
515
524
  const graph = PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);
516
525
  this.graph = graph;
@@ -529,9 +538,8 @@ export class RegionBooleanContext {
529
538
  this._announceFaceFunction = announceFaceFunction;
530
539
  this.binaryOp = binaryOp;
531
540
  this.graph.clearMask(HalfEdgeMask.EXTERIOR);
532
- for (const group of [this.groupA, this.groupB]) {
541
+ for (const group of [this.groupA, this.groupB])
533
542
  group.clearState();
534
- }
535
543
  const faceHasBeenVisitedMask = this.graph.grabMask();
536
544
  const nodeHasBeenVisitedMask = this.graph.grabMask();
537
545
  const componentArray = GraphComponentArray.create(this.graph);
@@ -612,18 +620,19 @@ export class RegionBooleanContext {
612
620
  return undefined;
613
621
  }
614
622
  // obligations to act as sweep callback ...
615
- /** Announce a representative node on the outer face of a component */
623
+ /** Announce a representative node on the outer face of a component. */
616
624
  startComponent(outerFaceNode) {
617
625
  outerFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);
618
626
  if (this._announceFaceFunction)
619
627
  this._announceFaceFunction(this.graph, outerFaceNode, -1, faceAreaFromCurvedEdgeData(outerFaceNode));
620
628
  return true;
621
629
  }
622
- /** Announce return to outer face */
630
+ /** Announce return to outer face. */
623
631
  finishComponent(_node) {
624
632
  return true;
625
633
  }
626
- /** Announce entry to a graph face.
634
+ /**
635
+ * Announce entry to a graph face.
627
636
  * * Both both sides of a graph edge are from the same RegionGroupMember.
628
637
  * * Hence "crossing that edge" changes the parity count for the RegionGroupMember that owns that edge by 1.
629
638
  * * The parity count for other RegionGroupMembers are never affected by this crossing.
@@ -644,8 +653,9 @@ export class RegionBooleanContext {
644
653
  return true;
645
654
  }
646
655
  }
647
- /** return xy area between a (part of a) curve and the x axis through a reference point.
648
- * If detail is undefined or does not have both start and end fractions, just do trapezoid area
656
+ /**
657
+ * Return xy area between (part of) a curve and the x axis through a reference point.
658
+ * If detail is undefined or does not have both start and end fractions, just do trapezoid area.
649
659
  */
650
660
  function areaUnderPartialCurveXY(detail, xyStart, xyEnd, referencePoint) {
651
661
  // area between trapezoid and axis
@@ -659,15 +669,21 @@ function areaUnderPartialCurveXY(detail, xyStart, xyEnd, referencePoint) {
659
669
  let areaToChord = 0.0;
660
670
  if (detail && detail.curve && detail.hasFraction1) {
661
671
  if (detail.curve instanceof LineSegment3d) {
662
- // ah .. nothing to do for a line segment
672
+ // nothing to do for a line segment
663
673
  }
664
674
  else if (detail.curve instanceof Arc3d) {
665
675
  areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1);
666
676
  }
677
+ else {
678
+ const partial = detail.curve.clonePartialCurve(detail.fraction, detail.fraction1);
679
+ areaToChord = partial ?
680
+ RegionOps.computeXYArea(Loop.create(partial, LineSegment3d.create(detail.point1, detail.point))) ?? 0
681
+ : 0;
682
+ }
667
683
  }
668
684
  return trapezoidArea + areaToChord;
669
685
  }
670
- /** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves */
686
+ /** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves. */
671
687
  function faceAreaFromCurvedEdgeData(faceSeed) {
672
688
  let area = 0.0;
673
689
  let edge = faceSeed;
@@ -690,8 +706,7 @@ export class GraphComponent {
690
706
  this.faceAreas = [];
691
707
  }
692
708
  /**
693
- * visit all vertices and edges in the component to build face area array and composite range.
694
- *
709
+ * Visit all vertices and edges in the component to build face area array and composite range.
695
710
  * @param extendRangeForEdge optional function to compute edge range. If undefined, linear edge is assumed.
696
711
  * @param faceAreaFunction optional function to compute face area. If undefined, linear edges are assumed.
697
712
  */
@@ -715,7 +730,8 @@ export class GraphComponent {
715
730
  }
716
731
  }
717
732
  }
718
- /** build and hold an array of component data for a HalfEdgeGraph.
733
+ /**
734
+ * Build and hold an array of component data for a HalfEdgeGraph.
719
735
  * @internal
720
736
  */
721
737
  export class GraphComponentArray {
@@ -1 +1 @@
1
- {"version":3,"file":"RegionOpsClassificationSweeps.js","sourceRoot":"","sources":["../../../src/curve/RegionOpsClassificationSweeps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAY,aAAa,EAAE,YAAY,EAAwB,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2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mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACxE,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CACF;AACD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IACvB,UAAU,CAAmB;IAC7B,KAAK,CAAgB;IAC5B,YAAoB,KAAoB;QACtC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,KAAoB,EAAE,kBAA6D;QACtG,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,eAAe,GAAG,mBAAmB,CAAC,iDAAiD,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAChH,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;YACrD,SAAS,CAAC,aAAa,CAAC,kBAAkB,EAAE,0BAA0B,CAAC,CAAC;YACxE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { MultiLineStringDataVariant } from \"../geometry3d/IndexedXYZCollection\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range2d, Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { XAndY } from \"../geometry3d/XYZProps\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, NodeToNumberFunction } from \"../topology/Graph\";\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\nimport { HalfEdgeGraphMerge } from \"../topology/Merging\";\nimport { RegularizationContext } from \"../topology/RegularizeFace\";\nimport { Arc3d } from \"./Arc3d\";\nimport { CurveCurve } from \"./CurveCurve\";\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\nimport { CurvePrimitive } from \"./CurvePrimitive\";\nimport { AnyRegion } from \"./CurveTypes\";\nimport { GeometryQuery } from \"./GeometryQuery\";\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\nimport { LineSegment3d } from \"./LineSegment3d\";\nimport { Loop } from \"./Loop\";\nimport { ParityRegion } from \"./ParityRegion\";\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\nimport { GraphCheckPointFunction, RegionBinaryOpType, RegionOps } from \"./RegionOps\";\nimport { UnionRegion } from \"./UnionRegion\";\n\n/**\n * base class for callbacks during region sweeps.\n * * At start of a component, `startComponent(node)` is called announcing a representative node on the outermost face.\n * * A Component in this usage is a component that is edge connected when ignoring \"exterior bridge edges\".\n * * As each face is entered, `enterFace(facePathStack, newFaceNode)` is called\n * * facePathStack[0] is the outermost node of the path from the outer face.\n * * facePathStack[1] is its inside mate.\n * * facePathStack[2k] is the outside node at crossing to face at depth k.\n * * facePathStack[2k+1] is the node where face at depth k was entered.\n * * newFaceNode is the entry node (redundant of stack tip)\n * * On retreat from a face, `leaveFace(facePathStack, faceNode)` is called.\n * * At end of component, `finishComponent (node)` is called.\n * * The base class is fully implemented to do nothing during the sweep.\n * @internal\n */\nabstract class RegionOpsFaceToFaceSearchCallbacks {\n /** Announce a representative node on the outer face of a component */\n public startComponent(_node: HalfEdge): boolean { return true; }\n /** Announce return to outer face */\n public finishComponent(_node: HalfEdge): boolean { return true; }\n /** Announce face entry */\n public enterFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean { return true; }\n /** Announce face exit */\n public leaveFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean { return true; }\n}\n/** Function signature to test if a pair of boolean states is to be accepted by area booleans (during face-to-face sweeps)\n * @internal\n */\ntype BinaryBooleanAcceptFunction = (stateA: boolean, stateB: boolean) => boolean;\n/** Function signature ot announce classification of a face.\n * The `faceType` parameters are\n * * -1 for a fully exterior face. This is a negative area face.\n * * 0 for a positive area face classified as \"out\" for the boolean.\n * * 1 for a positive area face classified as \"in\" for the boolean.\n */\ntype AnnounceClassifiedFace = (graph: HalfEdgeGraph, faceSeed: HalfEdge, faceType: -1 | 0 | 1, area: number) => void;\n/**\n * Implementation of `RegionOpsFaceToFaceSearchCallbacks` for binary boolean sweep with polygonal regions.\n * * For this linear-boundary case the boundary geometry is carried entirely from the coordinates in the half edges.\n * * This assumes the each node in the graph has edgeTag set to:\n * * `edgeTag === undefined` if the edge crossing does not change classification.\n * * for example, an edge added by regularization\n * * `edgeTag === 1` if this is a boundary for the first of the boolean input regions\n * * `edgeTag === 2` if this is a boundary for the second of the boolean input regions\n * * constructor\n * * takes caller-supplied function to decide whether to accept a face given its state relative to the two boolean terms.\n * * sets the in/out status of both terms to false.\n * * `startComponent` marks the entire outer face as `EXTERIOR`\n * * `enterFace`\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\n * * ask the faceAcceptFunction if the current term states combine to in/out for the result\n * * if out, set the `EXTERIOR` mask around the face.\n * * `leaveFace`\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\n * * `finishComponent` is not reimplemented.\n * @internal\n */\nclass RegionOpsBinaryBooleanSweepCallbacks extends RegionOpsFaceToFaceSearchCallbacks {\n private _faceSelectFunction: BinaryBooleanAcceptFunction;\n private _inComponent: boolean[];\n private _exteriorMask: HalfEdgeMask;\n public constructor(acceptFaceFunction: BinaryBooleanAcceptFunction, exteriorMask: HalfEdgeMask) {\n super();\n this._inComponent = [false, false, false]; // entry 0 is never reused.\n this._exteriorMask = exteriorMask;\n this._faceSelectFunction = acceptFaceFunction;\n }\n /** Mark this face as exterior */\n public override startComponent(node: HalfEdge): boolean { node.setMaskAroundFace(this._exteriorMask); return true; }\n /**\n * * If necessary, toggle a term state.\n * * if indicated, mark this face exterior.\n */\n public override enterFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\n const thisFaceIndex = node.edgeTag;\n if (node.edgeTag === 1 || node.edgeTag === 2)\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\n if (!this._faceSelectFunction(this._inComponent[1], this._inComponent[2]))\n node.setMaskAroundFace(this._exteriorMask);\n return true;\n }\n /**\n * * If necessary, toggle a term state.\n */\n public override leaveFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\n const thisFaceIndex = node.edgeTag;\n if (node.edgeTag === 1 || node.edgeTag === 2)\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\n return true;\n }\n}\n/**\n * Low level graph search for face classification.\n * @internal\n */\nexport class RegionOpsFaceToFaceSearch {\n /**\n * run a DFS with face-to-face step announcements.\n * * false return from any function terminates search immediately.\n * * all reachable nodes assumed to have both visit masks clear.\n * @param graph containing graph.\n * @param seed first node to visit.\n * @param faceHasBeenVisited mask marking faces that have been seen.\n * @param nodeHasBeenVisited mask marking node-to-node step around face.\n *\n */\n public static faceToFaceSearchFromOuterLoop(_graph: HalfEdgeGraph, seed: HalfEdge, faceHasBeenVisited: HalfEdgeMask, nodeHasBeenVisited: HalfEdgeMask, callbacks: RegionOpsFaceToFaceSearchCallbacks) {\n if (seed.isMaskSet(faceHasBeenVisited))\n return;\n if (!callbacks.startComponent(seed))\n return;\n const facePathStack = [];\n seed.setMaskAroundFace(faceHasBeenVisited);\n let faceWalker = seed;\n do {\n let entryNode = faceWalker;\n let mate = faceWalker.edgeMate;\n if (!mate.isMaskSet(faceHasBeenVisited)) {\n // the faceWalker seed is always on the base of the stack.\n // the stack then contains even-odd pairs of (entryNode, currentNode)\n // * entryNode is the node where a face was entered.\n // * faceNode is another node around that face.\n facePathStack.push(faceWalker);\n facePathStack.push(mate);\n let faceNode = mate.faceSuccessor;\n mate.setMaskAroundFace(faceHasBeenVisited);\n entryNode = mate;\n if (callbacks.enterFace(facePathStack, mate)) {\n for (; ;) {\n mate = faceNode.edgeMate;\n if (!mate.isMaskSet(faceHasBeenVisited)) {\n mate.setMaskAroundFace(faceHasBeenVisited);\n if (!callbacks.enterFace(facePathStack, mate))\n return;\n facePathStack.push(faceNode);\n facePathStack.push(mate);\n faceNode = mate;\n entryNode = mate;\n }\n faceNode.setMask(nodeHasBeenVisited);\n faceNode = faceNode.faceSuccessor;\n if (faceNode === entryNode) {\n callbacks.leaveFace(facePathStack, faceNode);\n if (facePathStack.length <= 2) {\n break;\n }\n facePathStack.pop();\n faceNode = facePathStack[facePathStack.length - 1];\n facePathStack.pop();\n entryNode = facePathStack[facePathStack.length - 1];\n }\n if (faceNode.isMaskSet(nodeHasBeenVisited)) {\n // this is disaster !!!\n return;\n }\n }\n }\n }\n // continue at outermost level .....\n faceWalker = faceWalker.faceSuccessor;\n } while (faceWalker !== seed);\n callbacks.finishComponent(seed);\n }\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\n * * Each of the binary input terms is a collection of loops\n * * Within the binary term, in/out is determined by edge-crossing parity rules.\n * * Processing steps are\n * * Build the loops for each set.\n * * Each edge labeled with 1 or 2 as binary term identifier.\n * * find crossings among the edges.\n * * Edges are split as needed, but split preserves the edgeTag\n * * sort edges around vertices\n * * add regularization edges so holes are connected to their parent.\n */\n public static doPolygonBoolean(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, faceSelectFunction: (inA: boolean, inB: boolean) => boolean, graphCheckPoint?: GraphCheckPointFunction): HalfEdgeGraph | undefined {\n const graph = new HalfEdgeGraph();\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\n const seedA = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsA, baseMask, 1);\n const seedB = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsB, baseMask, 2);\n if (graphCheckPoint)\n graphCheckPoint(\"unmerged loops\", graph, \"U\");\n if (seedA || seedB) {\n // split edges where they cross . . .\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\n if (graphCheckPoint)\n graphCheckPoint(\"After splitIntersectingEdges\", graph, \"S\");\n // sort radially around vertices.\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\n if (graphCheckPoint)\n graphCheckPoint(\"After clusterAndMergeXYTheta\", graph, \"M\");\n // add edges to connect various components (e.g. holes!!!)\n const context = new RegularizationContext(graph);\n context.regularizeGraph(true, true);\n if (graphCheckPoint)\n graphCheckPoint(\"After regularize\", graph, \"MR\");\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(graph);\n if (exteriorHalfEdge === undefined)\n return undefined;\n const exteriorMask = HalfEdgeMask.EXTERIOR;\n const faceVisitedMask = graph.grabMask();\n const nodeVisitedMask = graph.grabMask();\n const allMasksToClear = exteriorMask | faceVisitedMask | nodeVisitedMask;\n graph.clearMask(allMasksToClear);\n const callbacks = new RegionOpsBinaryBooleanSweepCallbacks(faceSelectFunction, exteriorMask);\n this.faceToFaceSearchFromOuterLoop(graph, exteriorHalfEdge, faceVisitedMask, nodeVisitedMask, callbacks);\n if (graphCheckPoint)\n graphCheckPoint(\"After faceToFaceSearchFromOuterLoop\", graph, \"MRX\");\n graph.dropMask(faceVisitedMask);\n graph.dropMask(nodeVisitedMask);\n return graph;\n }\n return undefined;\n }\n\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\n * * the manyLoopsAndParitySets input is an array.\n * * Each entry is one or more loops.\n * * An entry that is \"just points\" is a simple loop.\n * * An entry that is itself an array of arrays of points is a set of loops with \"parity\" -- relation:\n * * typically the first is an outer loop an others are holes.\n * * but if there is self intersection or multiple outer loops, parity rules are applied to decide inner and outer.\n * * Processing steps are\n * * Build the loops for each set.\n * * Each edge labeled with index to the outer array.\n * * find crossings among the edges.\n * * Edges are split as needed, but split preserves the edgeTag\n * * sort edges around vertices\n * * add regularization edges so holes are connected to their parent.\n * * assign inside/outside by parity within each set and overall union.\n */\n public static doBinaryBooleanBetweenMultiLoopInputs(\n dataA: MultiLineStringDataVariant[],\n opA: RegionGroupOpType,\n binaryOp: RegionBinaryOpType,\n dataB: MultiLineStringDataVariant[],\n opB: RegionGroupOpType,\n purgeSliverExteriorFaces: boolean,\n ): HalfEdgeGraph | undefined {\n const graph = new HalfEdgeGraph();\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\n const callbacks = RegionBooleanContext.create(opA, opB);\n callbacks.graph = graph;\n callbacks.faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\n\n // Add all the members in groupA ..\n for (const data of dataA) {\n if (data.length > 2) {\n const member = new RegionGroupMember(data, callbacks.groupA);\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\n }\n }\n for (const data of dataB) {\n if (data.length > 2) {\n const member = new RegionGroupMember(data, callbacks.groupB);\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\n }\n }\n // split edges where they cross . . .\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\n // sort radially around vertices.\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\n // add edges to connect various components (e.g. holes!!!)\n const context = new RegularizationContext(graph);\n context.regularizeGraph(true, true);\n callbacks.runClassificationSweep(binaryOp);\n if (purgeSliverExteriorFaces)\n callbacks.unmaskMaskedNullFaces(HalfEdgeMask.EXTERIOR);\n return graph;\n }\n}\n\n/**\n * Enumeration of operation types \"within a group operand\" for a `RegionBooleanContext`.\n * @internal\n */\nexport enum RegionGroupOpType {\n Union = 0,\n Parity = 1,\n Intersection = 2,\n NonBounding = -1,\n}\n/**\n * Each loop or parity region in a `RegionBooleanContext` is recorded as a `RegionGroupMember`, which carries\n * * the Loop or parityRegion object\n * * a numeric indication of the sweep state (parity) during the classification search.\n * * a reference to the parent group (which in turn leads back to the `RegionBooleanContext`)\n * @internal\n */\nclass RegionGroupMember {\n public region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant;\n public sweepState: number;\n public parentGroup: RegionGroup;\n public constructor(region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant, parentGroup: RegionGroup) {\n this.region = region;\n this.parentGroup = parentGroup;\n this.sweepState = 0;\n }\n public clearState() { this.sweepState = 0; }\n}\n/**\n * A `RegionGroup` is\n * * An array of `RegionGroupMembers`, carrying the regions of the Ai or Bi part of the boolean expression.\n * * The `RegionGroupOpType` to be applied among those members.\n * * Pointer to the containing context\n * * The count of number of regions known to be \"in\" as the search progresses.\n * @internal\n */\nexport class RegionGroup {\n public members: RegionGroupMember[];\n public groupOpType: RegionGroupOpType;\n public parent: RegionBooleanContext;\n private _numIn: number;\n public constructor(parent: RegionBooleanContext, groupOpType: RegionGroupOpType) {\n this.members = [];\n this.parent = parent;\n this.groupOpType = groupOpType;\n this._numIn = 0;\n }\n /** deep clear of state data -- group header plus all members */\n public clearState() {\n for (const member of this.members)\n member.clearState();\n this._numIn = 0;\n }\n public range(): Range3d {\n const range = Range3d.createNull();\n for (const m of this.members) {\n if (m.region instanceof GeometryQuery)\n m.region.extendRange(range);\n else {\n const range1 = Range3d.createFromVariantData(m.region);\n range.extendRange(range1);\n }\n }\n return range;\n }\n /** Ask if the current _numIn count qualifies as an \"in\" for this operation type.\n */\n public getInOut(): boolean {\n // UNION is true if one or more members are IN\n if (this.groupOpType === RegionGroupOpType.Union)\n return this._numIn > 0;\n // PARITY is true if an odd number of regions are IN\n if (this.groupOpType === RegionGroupOpType.Parity)\n return Geometry.isOdd(this._numIn);\n // INTERSECTION is true if ALL the regions are IN\n if (this.groupOpType === RegionGroupOpType.Intersection)\n return this._numIn === this.members.length;\n return false;\n }\n // push new members into the group.\n public addMember(data: AnyRegion | AnyRegion[] | LineSegment3d | undefined, allowLineSegment: boolean = false) {\n if (data instanceof Loop || data instanceof ParityRegion) {\n const cleanerData = data.clone() as (ParityRegion | Loop);\n RegionOps.consolidateAdjacentPrimitives(cleanerData);\n this.members.push(new RegionGroupMember(cleanerData, this));\n } else if (data instanceof UnionRegion) {\n for (const child of data.children) {\n this.addMember(child);\n }\n } else if (Array.isArray(data)) {\n for (const item of data) {\n this.addMember(item);\n }\n } else if (allowLineSegment && data instanceof LineSegment3d) {\n this.members.push(new RegionGroupMember(data, this));\n\n }\n }\n // update the \"in\" count _numIn according to old and new states (parity counts) for some member region.\n public recordMemberStateChange(oldState: number, newState: number) {\n const oldIn = Geometry.isOdd(oldState);\n const newIn = Geometry.isOdd(newState);\n if (!oldIn && newIn)\n this._numIn++;\n else if (oldIn && !newIn)\n this._numIn--;\n }\n}\n/**\n * A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.\n * * In the binary operation OP (union, intersection, parity, difference), the left and right operands\n * are each a composite union, difference, or parity among multiple inputs, i.e.\n * * (operationA among Ai) OP (operationB among Bi)\n * * where the Ai are one set of regions, being combined by operationA\n * * and the Bi are the another set of regions, being combined by operationB\n * * Each group of Ai and Bi is a `RegionGroup`\n * * This is an extremely delicate structure.\n * * Members are public because of the unique variety of queries, but should only be used for queries.\n * * The graph and curves in the booleans are connected by an extended pointer chain:\n * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail\n * * (CurveLocationDetail).curve points to a curve\n * * (Curve).parent points to RegionGroupMember\n * * (RegionGroupMember) points to RegionGroup\n * * (RegionGroup) points to RegionBooleanBinaryContext\n * * So..when a graph sweep crosses an edge,\n * * the chain leads to a parity count in the RegionGroupMember\n * * that can change the number of members active in the RegionGroup\n * * which can change the state of the context.\n * @internal\n */\nexport class RegionBooleanContext implements RegionOpsFaceToFaceSearchCallbacks {\n public groupA!: RegionGroup;\n public groupB!: RegionGroup;\n public extraGeometry!: RegionGroup;\n public graph!: HalfEdgeGraph;\n public faceAreaFunction!: NodeToNumberFunction;\n public binaryOp: RegionBinaryOpType;\n\n private constructor(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType) {\n this.groupA = new RegionGroup(this, groupTypeA);\n this.groupB = new RegionGroup(this, groupTypeB);\n this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);\n this.binaryOp = RegionBinaryOpType.Union; // it will be revised on can calls.\n }\n /**\n * Create a context with both A and B groups empty.\n * * Caller follows up by calls to `context.groupA.addMember (loopOrParityRegion)` or `context.groupB.addMember (loopOrParityRegion)`\n * @param groupTypeA\n * @param groupTypeB\n */\n public static create(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType): RegionBooleanContext {\n return new RegionBooleanContext(groupTypeA, groupTypeB);\n }\n public addMembers(dataA: AnyRegion | AnyRegion[] | undefined, dataB: AnyRegion | AnyRegion[] | undefined) {\n this.groupA.addMember(dataA);\n this.groupB.addMember(dataB);\n // const doConnectives = 1;\n // if (doConnectives !== 0)\n this.addConnectives();\n }\n\n private _workSegment?: LineSegment3d;\n private static _bridgeDirection = Vector3d.createNormalized(1.0, -0.12328974132467)!; // magic unit direction to minimize vertex hits\n /**\n * The sweep operations require access to all geometry by edge crossings and face walk.\n * If input loops are non-overlapping, there may be disconnected islands not reachable.\n * This method:\n * * finds the total range\n * * creates parallel rays from the extreme point of each loop and extending beyond the overall range\n * * places those lines in the extraGeometry group\n */\n public addConnectives() {\n const rangeA = this.groupA.range();\n const rangeB = this.groupB.range();\n const rangeAB = rangeA.union(rangeB);\n const areaTol = RegionOps.computeXYAreaTolerance(rangeAB);\n let margin = 0.1;\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);\n if (this._workSegment)\n margin *= this._workSegment.point0Ref.distanceXY(this._workSegment.point1Ref); // how much further to extend each bridge ray\n\n const maxPoints: Point3d[] = [];\n const findExtremePointsInLoop = (region: Loop) => {\n const area = RegionOps.computeXYArea(region);\n if (area === undefined || Math.abs(area) < areaTol)\n return; // avoid bridging trivial faces\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);\n if (this._workSegment)\n maxPoints.push(this._workSegment.point1Ref);\n };\n\n for (const groupMembers of [this.groupA.members, this.groupB.members]) {\n for (const m of groupMembers) {\n if (m.region instanceof Loop) {\n findExtremePointsInLoop(m.region);\n } else if (m.region instanceof ParityRegion) {\n for (const loop of m.region.children)\n findExtremePointsInLoop(loop);\n }\n }\n }\n\n const ray = Ray3d.createZero();\n for (const p of maxPoints) {\n // Make a line from...\n // 1) exactly the max point of the loops to\n // 2) a point clearly outside the big range\n // If p came from some inner loop this will...\n // 1) create a bridge from the inner loop through any containing loops (always)\n // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)\n const bridgeLength = margin + Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;\n const outside = Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);\n const bridgeLine = LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);\n this.extraGeometry.addMember(bridgeLine, true);\n }\n }\n\n /**\n * Markup and assembly steps for geometry in the RegionGroups.\n * * Annotate connection from group to curves.\n * * groups with point data but no curves get no further annotation.\n * * compute intersections.\n * * assemble and merge the HalfEdgeGraph.\n * @param mergeTolerance absolute distance tolerance for merging loops\n */\n public annotateAndMergeCurvesInGraph(mergeTolerance: number = Geometry.smallMetricDistance) {\n const allPrimitives: CurvePrimitive[] = [];\n // ASSUME loops have fine-grained types -- no linestrings !!\n for (const group of [this.groupA, this.groupB, this.extraGeometry]) {\n for (const member of group.members) {\n let k = allPrimitives.length;\n if (member.region instanceof GeometryQuery) {\n RegionOps.collectCurvePrimitives(member.region, allPrimitives, true, true);\n for (; k < allPrimitives.length; k++)\n allPrimitives[k].parent = member;\n }\n }\n }\n // const range = RegionOps.curveArrayRange(allPrimitives);\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);\n this.graph = graph;\n this.faceAreaFunction = faceAreaFromCurvedEdgeData;\n }\n private _announceFaceFunction?: AnnounceClassifiedFace;\n /**\n * Sweep through the graph to assign in/out classifications to all faces.\n * * the classification is announced in two ways:\n * * the EXTERNAL mask is set on all half edges that are NOT interior faces.\n * * the announceFaceFunction is called once for each face.\n * @param binaryOp\n * @param announceFaceFunction\n */\n public runClassificationSweep(\n binaryOp: RegionBinaryOpType,\n announceFaceFunction?: AnnounceClassifiedFace) {\n this._announceFaceFunction = announceFaceFunction;\n this.binaryOp = binaryOp;\n this.graph.clearMask(HalfEdgeMask.EXTERIOR);\n for (const group of [this.groupA, this.groupB]) {\n group.clearState();\n }\n const faceHasBeenVisitedMask = this.graph.grabMask();\n const nodeHasBeenVisitedMask = this.graph.grabMask();\n const componentArray = GraphComponentArray.create(this.graph);\n for (const component of componentArray.components) {\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(component.faces, this.faceAreaFunction);\n if (exteriorHalfEdge) {\n const exteriorMask = HalfEdgeMask.EXTERIOR;\n const allMasksToClear = exteriorMask | faceHasBeenVisitedMask | nodeHasBeenVisitedMask;\n this.graph.clearMask(allMasksToClear);\n RegionOpsFaceToFaceSearch.faceToFaceSearchFromOuterLoop(this.graph, exteriorHalfEdge, faceHasBeenVisitedMask, nodeHasBeenVisitedMask, this);\n }\n }\n this.graph.dropMask(faceHasBeenVisitedMask);\n this.graph.dropMask(nodeHasBeenVisitedMask);\n }\n // search the graph for faces with\n // .. exactly 2 edges\n // .. both with given mask\n // .. at least one mate is not exterior.\n // .. clear that mark\n public unmaskMaskedNullFaces(mask: number) {\n for (const nodeA of this.graph.allHalfEdges) {\n const nodeB = nodeA.faceSuccessor;\n if (nodeB.faceSuccessor === nodeA) {\n if (nodeA.getMask(mask) && nodeB.getMask(mask)) {\n if (!nodeA.edgeMate.getMask(mask) || !nodeB.edgeMate.getMask(mask)) {\n nodeA.clearMask(mask);\n nodeB.clearMask(mask);\n }\n }\n }\n }\n }\n private getInOut(): boolean {\n if (this.binaryOp === RegionBinaryOpType.Union)\n return this.groupA.getInOut() || this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.Intersection)\n return this.groupA.getInOut() && this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.AMinusB)\n return this.groupA.getInOut() && !this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.BMinusA)\n return !this.groupA.getInOut() && this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.Parity)\n return this.groupA.getInOut() !== this.groupB.getInOut();\n return false;\n }\n /**\n * Record transition across an edge as entry or exit from a RegionGroup.\n * * Work backward from the node to a RegionGroup. This path can be:\n * * If the node points to a CurveLocationDetail of a (possibly partial) curve, the path is (take a deep breath)\n * * node points to CurveLocation Detail\n * * CurveLocationDetail points to curve\n * * curve points to RegionGroupMember\n * * If the node points directly to a RegionGroup, it's ready to go!!!\n * @param node\n * @param delta\n */\n private recordTransitionAcrossEdge(node: HalfEdge, delta: number): RegionGroupMember | undefined {\n const updateRegionGroupMemberState = (member: RegionGroupMember): RegionGroupMember => {\n if (member.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\n return member; // no transition across a bridge edge\n if (delta !== 0) {\n const oldSweepState = member.sweepState;\n member.sweepState += delta;\n member.parentGroup.recordMemberStateChange(oldSweepState, member.sweepState);\n }\n return member;\n };\n\n const data = node.edgeTag;\n if (data instanceof RegionGroupMember)\n return updateRegionGroupMemberState(data);\n\n if (data instanceof CurveLocationDetail) {\n // We trust that the caller has linked from the graph node to a curve which has a RegionGroupMember as its parent.\n const member = data.curve!.parent;\n if (member instanceof RegionGroupMember)\n return updateRegionGroupMemberState(member);\n }\n return undefined;\n }\n // obligations to act as sweep callback ...\n /** Announce a representative node on the outer face of a component */\n public startComponent(outerFaceNode: HalfEdge): boolean {\n outerFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\n if (this._announceFaceFunction)\n this._announceFaceFunction(this.graph, outerFaceNode, -1, faceAreaFromCurvedEdgeData(outerFaceNode));\n return true;\n }\n /** Announce return to outer face */\n public finishComponent(_node: HalfEdge): boolean {\n return true;\n }\n /** Announce entry to a graph face.\n * * Both both sides of a graph edge are from the same RegionGroupMember.\n * * Hence \"crossing that edge\" changes the parity count for the RegionGroupMember that owns that edge by 1.\n * * The parity count for other RegionGroupMembers are never affected by this crossing.\n * * Crossing a bridge edge does not change the parity count.\n */\n public enterFace(_facePathStack: HalfEdge[], newFaceNode: HalfEdge): boolean {\n this.recordTransitionAcrossEdge(newFaceNode, 1);\n const state = this.getInOut();\n if (!state)\n newFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\n if (this._announceFaceFunction)\n this._announceFaceFunction(this.graph, newFaceNode, state ? 1 : 0, faceAreaFromCurvedEdgeData(newFaceNode));\n return true;\n }\n /** Announce face exit */\n public leaveFace(_facePathStack: HalfEdge[], oldFaceNode: HalfEdge): boolean {\n this.recordTransitionAcrossEdge(oldFaceNode, -1);\n return true;\n }\n}\n/** return xy area between a (part of a) curve and the x axis through a reference point.\n * If detail is undefined or does not have both start and end fractions, just do trapezoid area\n */\nfunction areaUnderPartialCurveXY(detail: CurveLocationDetail | undefined, xyStart: XAndY, xyEnd: XAndY, referencePoint: XAndY): number {\n // area between trapezoid and axis\n let trapezoidArea;\n if (detail && detail.point1) {\n trapezoidArea = -(detail.point1.x - detail.point.x) * (0.5 * (detail.point.y + detail.point1.y) - referencePoint.y);\n } else {\n trapezoidArea = -(xyEnd.x - xyStart.x) * (0.5 * (xyStart.y + xyEnd.y) - referencePoint.y);\n }\n let areaToChord = 0.0;\n if (detail && detail.curve && detail.hasFraction1) {\n\n if (detail.curve instanceof LineSegment3d) {\n // ah .. nothing to do for a line segment\n } else if (detail.curve instanceof Arc3d) {\n areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1!);\n }\n }\n return trapezoidArea + areaToChord;\n}\n/** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves */\nfunction faceAreaFromCurvedEdgeData(faceSeed: HalfEdge): number {\n let area = 0.0;\n let edge = faceSeed;\n do {\n area += (edge.sortData as number) * areaUnderPartialCurveXY((edge.edgeTag as CurveLocationDetail), edge, edge.faceSuccessor, faceSeed);\n } while ((edge = edge.faceSuccessor) !== faceSeed);\n return area;\n}\n\n/**\n * Function to accumulate area under edges\n * Array of nodes representing faces in a subset of a graph.\n * @internal\n */\nexport type NodeAndRangeFunction = (edge: HalfEdge, range: Range2d) => void;\n/**\n * Array of nodes representing faces in a subset of a graph.\n * @internal\n */\nexport class GraphComponent {\n public faces: HalfEdge[];\n public faceAreas: number[];\n public range: Range2d;\n public constructor(faces: HalfEdge[]) {\n this.faces = faces;\n this.range = Range2d.createNull();\n this.faceAreas = [];\n }\n /**\n * visit all vertices and edges in the component to build face area array and composite range.\n *\n * @param extendRangeForEdge optional function to compute edge range. If undefined, linear edge is assumed.\n * @param faceAreaFunction optional function to compute face area. If undefined, linear edges are assumed.\n */\n public buildFaceData(extendRangeForEdge: NodeAndRangeFunction | undefined, faceAreaFunction: NodeToNumberFunction | undefined) {\n const vertexFunction = (node: HalfEdge) => {\n if (extendRangeForEdge)\n extendRangeForEdge(node, this.range);\n else\n this.range.extendXY(node.x, node.y);\n return 0;\n };\n this.range.setNull();\n for (const f of this.faces) {\n f.sumAroundFace(vertexFunction);\n }\n this.faceAreas.length = 0;\n if (!faceAreaFunction)\n faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\n for (const f of this.faces) {\n this.faceAreas.push(faceAreaFunction(f));\n }\n }\n}\n/** build and hold an array of component data for a HalfEdgeGraph.\n * @internal\n */\nexport class GraphComponentArray {\n public components: GraphComponent[];\n public graph: HalfEdgeGraph;\n private constructor(graph: HalfEdgeGraph) {\n this.graph = graph;\n this.components = [];\n }\n public static create(graph: HalfEdgeGraph, extendRangeForEdge?: (edge: HalfEdge, range: Range2d) => void): GraphComponentArray {\n const result = new GraphComponentArray(graph);\n const componentArrays = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\n for (const componentFaces of componentArrays) {\n const component = new GraphComponent(componentFaces);\n component.buildFaceData(extendRangeForEdge, faceAreaFromCurvedEdgeData);\n result.components.push(component);\n }\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"RegionOpsClassificationSweeps.js","sourceRoot":"","sources":["../../../src/curve/RegionOpsClassificationSweeps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAY,aAAa,EAAE,YAAY,EAAwB,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,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C,cAAc,CAAC,CAAC;YACrD,SAAS,CAAC,aAAa,CAAC,kBAAkB,EAAE,0BAA0B,CAAC,CAAC;YACxE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { MultiLineStringDataVariant } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range2d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { XAndY } from \"../geometry3d/XYZProps\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, NodeToNumberFunction } from \"../topology/Graph\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { HalfEdgeGraphMerge } from \"../topology/Merging\";\r\nimport { RegularizationContext } from \"../topology/RegularizeFace\";\r\nimport { Arc3d } from \"./Arc3d\";\r\nimport { CurveCurve } from \"./CurveCurve\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { TransferWithSplitArcs } from \"./internalContexts/TransferWithSplitArcs\";\r\nimport { LineSegment3d } from \"./LineSegment3d\";\r\nimport { Loop } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\r\nimport { GraphCheckPointFunction, RegionBinaryOpType, RegionOps } from \"./RegionOps\";\r\nimport { UnionRegion } from \"./UnionRegion\";\r\n\r\n/**\r\n * base class for callbacks during region sweeps.\r\n * * At start of a component, `startComponent(node)` is called announcing a representative node on the outermost face.\r\n * * A Component in this usage is a component that is edge connected when ignoring \"exterior bridge edges\".\r\n * * As each face is entered, `enterFace(facePathStack, newFaceNode)` is called\r\n * * facePathStack[0] is the outermost node of the path from the outer face.\r\n * * facePathStack[1] is its inside mate.\r\n * * facePathStack[2k] is the outside node at crossing to face at depth k.\r\n * * facePathStack[2k+1] is the node where face at depth k was entered.\r\n * * newFaceNode is the entry node (redundant of stack tip)\r\n * * On retreat from a face, `leaveFace(facePathStack, faceNode)` is called.\r\n * * At end of component, `finishComponent (node)` is called.\r\n * * The base class is fully implemented to do nothing during the sweep.\r\n * @internal\r\n */\r\nabstract class RegionOpsFaceToFaceSearchCallbacks {\r\n /** Announce a representative node on the outer face of a component. */\r\n public startComponent(_node: HalfEdge): boolean {\r\n return true;\r\n }\r\n /** Announce return to outer face. */\r\n public finishComponent(_node: HalfEdge): boolean {\r\n return true;\r\n }\r\n /** Announce face entry. */\r\n public enterFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean {\r\n return true;\r\n }\r\n /** Announce face exit. */\r\n public leaveFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean {\r\n return true;\r\n }\r\n}\r\n/** Function signature to test if a pair of boolean states is to be accepted by area booleans (during face-to-face sweeps)\r\n * @internal\r\n */\r\ntype BinaryBooleanAcceptFunction = (stateA: boolean, stateB: boolean) => boolean;\r\n/** Function signature ot announce classification of a face.\r\n * The `faceType` parameters are\r\n * * -1 for a fully exterior face. This is a negative area face.\r\n * * 0 for a positive area face classified as \"out\" for the boolean.\r\n * * 1 for a positive area face classified as \"in\" for the boolean.\r\n */\r\ntype AnnounceClassifiedFace = (graph: HalfEdgeGraph, faceSeed: HalfEdge, faceType: -1 | 0 | 1, area: number) => void;\r\n/**\r\n * Implementation of `RegionOpsFaceToFaceSearchCallbacks` for binary boolean sweep with polygonal regions.\r\n * * For this linear-boundary case the boundary geometry is carried entirely from the coordinates in the half edges.\r\n * * This assumes the each node in the graph has edgeTag set to:\r\n * * `edgeTag === undefined` if the edge crossing does not change classification.\r\n * * for example, an edge added by regularization\r\n * * `edgeTag === 1` if this is a boundary for the first of the boolean input regions\r\n * * `edgeTag === 2` if this is a boundary for the second of the boolean input regions\r\n * * constructor\r\n * * takes caller-supplied function to decide whether to accept a face given its state relative to the two boolean terms.\r\n * * sets the in/out status of both terms to false.\r\n * * `startComponent` marks the entire outer face as `EXTERIOR`\r\n * * `enterFace`\r\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\r\n * * ask the faceAcceptFunction if the current term states combine to in/out for the result\r\n * * if out, set the `EXTERIOR` mask around the face.\r\n * * `leaveFace`\r\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\r\n * * `finishComponent` is not reimplemented.\r\n * @internal\r\n */\r\nclass RegionOpsBinaryBooleanSweepCallbacks extends RegionOpsFaceToFaceSearchCallbacks {\r\n private _faceSelectFunction: BinaryBooleanAcceptFunction;\r\n private _inComponent: boolean[];\r\n private _exteriorMask: HalfEdgeMask;\r\n public constructor(acceptFaceFunction: BinaryBooleanAcceptFunction, exteriorMask: HalfEdgeMask) {\r\n super();\r\n this._inComponent = [false, false, false]; // entry 0 is never reused.\r\n this._exteriorMask = exteriorMask;\r\n this._faceSelectFunction = acceptFaceFunction;\r\n }\r\n /** Mark this face as exterior */\r\n public override startComponent(node: HalfEdge): boolean { node.setMaskAroundFace(this._exteriorMask); return true; }\r\n /**\r\n * * If necessary, toggle a term state.\r\n * * if indicated, mark this face exterior.\r\n */\r\n public override enterFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\r\n const thisFaceIndex = node.edgeTag;\r\n if (node.edgeTag === 1 || node.edgeTag === 2)\r\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\r\n if (!this._faceSelectFunction(this._inComponent[1], this._inComponent[2]))\r\n node.setMaskAroundFace(this._exteriorMask);\r\n return true;\r\n }\r\n /**\r\n * * If necessary, toggle a term state.\r\n */\r\n public override leaveFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\r\n const thisFaceIndex = node.edgeTag;\r\n if (node.edgeTag === 1 || node.edgeTag === 2)\r\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\r\n return true;\r\n }\r\n}\r\n/**\r\n * Low level graph search for face classification.\r\n * @internal\r\n */\r\nexport class RegionOpsFaceToFaceSearch {\r\n /**\r\n * Run a DFS with face-to-face step announcements.\r\n * * false return from any function terminates search immediately.\r\n * * all reachable nodes assumed to have both visit masks clear.\r\n * @param graph containing graph.\r\n * @param seed first node to visit.\r\n * @param faceHasBeenVisited mask marking faces that have been seen.\r\n * @param nodeHasBeenVisited mask marking node-to-node step around face.\r\n * @param callbacks callbacks.\r\n */\r\n public static faceToFaceSearchFromOuterLoop(\r\n _graph: HalfEdgeGraph,\r\n seed: HalfEdge,\r\n faceHasBeenVisited: HalfEdgeMask,\r\n nodeHasBeenVisited: HalfEdgeMask,\r\n callbacks: RegionOpsFaceToFaceSearchCallbacks,\r\n ): void {\r\n if (seed.isMaskSet(faceHasBeenVisited))\r\n return;\r\n if (!callbacks.startComponent(seed))\r\n return;\r\n const facePathStack = [];\r\n seed.setMaskAroundFace(faceHasBeenVisited);\r\n let faceWalker = seed;\r\n do {\r\n let entryNode = faceWalker;\r\n let mate = faceWalker.edgeMate;\r\n if (!mate.isMaskSet(faceHasBeenVisited)) {\r\n // The faceWalker seed is always on the base of the stack.\r\n // The stack then contains even-odd pairs of (entryNode, faceNode).\r\n // entryNode is the node where a face was entered.\r\n // faceNode is another node around that face.\r\n facePathStack.push(faceWalker);\r\n facePathStack.push(mate);\r\n let faceNode = mate.faceSuccessor;\r\n mate.setMaskAroundFace(faceHasBeenVisited);\r\n entryNode = mate;\r\n if (callbacks.enterFace(facePathStack, mate)) {\r\n for (; ;) {\r\n mate = faceNode.edgeMate;\r\n if (!mate.isMaskSet(faceHasBeenVisited)) {\r\n mate.setMaskAroundFace(faceHasBeenVisited);\r\n if (!callbacks.enterFace(facePathStack, mate))\r\n return;\r\n facePathStack.push(faceNode);\r\n facePathStack.push(mate);\r\n faceNode = mate;\r\n entryNode = mate;\r\n }\r\n faceNode.setMask(nodeHasBeenVisited);\r\n faceNode = faceNode.faceSuccessor;\r\n if (faceNode === entryNode) {\r\n callbacks.leaveFace(facePathStack, faceNode);\r\n if (facePathStack.length <= 2) {\r\n break;\r\n }\r\n facePathStack.pop();\r\n faceNode = facePathStack[facePathStack.length - 1];\r\n facePathStack.pop();\r\n entryNode = facePathStack[facePathStack.length - 1];\r\n }\r\n if (faceNode.isMaskSet(nodeHasBeenVisited)) {\r\n // this is disaster\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // continue at outermost level\r\n faceWalker = faceWalker.faceSuccessor;\r\n } while (faceWalker !== seed);\r\n callbacks.finishComponent(seed);\r\n }\r\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\r\n * * Each of the binary input terms is a collection of loops\r\n * * Within the binary term, in/out is determined by edge-crossing parity rules.\r\n * * Processing steps are\r\n * * Build the loops for each set.\r\n * * Each edge labeled with 1 or 2 as binary term identifier.\r\n * * find crossings among the edges.\r\n * * Edges are split as needed, but split preserves the edgeTag\r\n * * sort edges around vertices\r\n * * add regularization edges so holes are connected to their parent.\r\n */\r\n public static doPolygonBoolean(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, faceSelectFunction: (inA: boolean, inB: boolean) => boolean, graphCheckPoint?: GraphCheckPointFunction): HalfEdgeGraph | undefined {\r\n const graph = new HalfEdgeGraph();\r\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\r\n const seedA = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsA, baseMask, 1);\r\n const seedB = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsB, baseMask, 2);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"unmerged loops\", graph, \"U\");\r\n if (seedA || seedB) {\r\n // split edges where they cross . . .\r\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After splitIntersectingEdges\", graph, \"S\");\r\n // sort radially around vertices.\r\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After clusterAndMergeXYTheta\", graph, \"M\");\r\n // add edges to connect various components (e.g. holes!!!)\r\n const context = new RegularizationContext(graph);\r\n context.regularizeGraph(true, true);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After regularize\", graph, \"MR\");\r\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(graph);\r\n if (exteriorHalfEdge === undefined)\r\n return undefined;\r\n const exteriorMask = HalfEdgeMask.EXTERIOR;\r\n const faceVisitedMask = graph.grabMask();\r\n const nodeVisitedMask = graph.grabMask();\r\n const allMasksToClear = exteriorMask | faceVisitedMask | nodeVisitedMask;\r\n graph.clearMask(allMasksToClear);\r\n const callbacks = new RegionOpsBinaryBooleanSweepCallbacks(faceSelectFunction, exteriorMask);\r\n this.faceToFaceSearchFromOuterLoop(graph, exteriorHalfEdge, faceVisitedMask, nodeVisitedMask, callbacks);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After faceToFaceSearchFromOuterLoop\", graph, \"MRX\");\r\n graph.dropMask(faceVisitedMask);\r\n graph.dropMask(nodeVisitedMask);\r\n return graph;\r\n }\r\n return undefined;\r\n }\r\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\r\n * * the manyLoopsAndParitySets input is an array.\r\n * * Each entry is one or more loops.\r\n * * An entry that is \"just points\" is a simple loop.\r\n * * An entry that is itself an array of arrays of points is a set of loops with \"parity\" -- relation:\r\n * * typically the first is an outer loop an others are holes.\r\n * * but if there is self intersection or multiple outer loops, parity rules are applied to decide inner and outer.\r\n * * Processing steps are\r\n * * Build the loops for each set.\r\n * * Each edge labeled with index to the outer array.\r\n * * find crossings among the edges.\r\n * * Edges are split as needed, but split preserves the edgeTag\r\n * * sort edges around vertices\r\n * * add regularization edges so holes are connected to their parent.\r\n * * assign inside/outside by parity within each set and overall union.\r\n */\r\n public static doBinaryBooleanBetweenMultiLoopInputs(\r\n dataA: MultiLineStringDataVariant[],\r\n opA: RegionGroupOpType,\r\n binaryOp: RegionBinaryOpType,\r\n dataB: MultiLineStringDataVariant[],\r\n opB: RegionGroupOpType,\r\n purgeSliverExteriorFaces: boolean,\r\n ): HalfEdgeGraph | undefined {\r\n const graph = new HalfEdgeGraph();\r\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\r\n const callbacks = RegionBooleanContext.create(opA, opB);\r\n callbacks.graph = graph;\r\n callbacks.faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\r\n\r\n // Add all the members in groupA ..\r\n for (const data of dataA) {\r\n if (data.length > 2) {\r\n const member = new RegionGroupMember(data, callbacks.groupA);\r\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\r\n }\r\n }\r\n for (const data of dataB) {\r\n if (data.length > 2) {\r\n const member = new RegionGroupMember(data, callbacks.groupB);\r\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\r\n }\r\n }\r\n // split edges where they cross . . .\r\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\r\n // sort radially around vertices.\r\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\r\n // add edges to connect various components (e.g. holes!!!)\r\n const context = new RegularizationContext(graph);\r\n context.regularizeGraph(true, true);\r\n callbacks.runClassificationSweep(binaryOp);\r\n if (purgeSliverExteriorFaces)\r\n callbacks.unmaskMaskedNullFaces(HalfEdgeMask.EXTERIOR);\r\n return graph;\r\n }\r\n}\r\n\r\n/**\r\n * Enumeration of operation types \"within a group operand\" for a `RegionBooleanContext`.\r\n * @internal\r\n */\r\nexport enum RegionGroupOpType {\r\n Union = 0,\r\n Parity = 1,\r\n Intersection = 2,\r\n NonBounding = -1,\r\n}\r\n\r\n/**\r\n * Each loop or parity region in a `RegionBooleanContext` is recorded as a `RegionGroupMember`, which carries\r\n * * the Loop or parityRegion object\r\n * * a numeric indication of the sweep state (parity) during the classification search.\r\n * * a reference to the parent group (which in turn leads back to the `RegionBooleanContext`)\r\n * @internal\r\n */\r\nclass RegionGroupMember {\r\n public region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant;\r\n public sweepState: number;\r\n public parentGroup: RegionGroup;\r\n public constructor(region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant, parentGroup: RegionGroup) {\r\n this.region = region;\r\n this.parentGroup = parentGroup;\r\n this.sweepState = 0;\r\n }\r\n public clearState() {\r\n this.sweepState = 0;\r\n }\r\n}\r\n\r\n/**\r\n * A `RegionGroup` is\r\n * * An array of `RegionGroupMembers`, carrying the regions of the Ai or Bi part of the boolean expression.\r\n * * The `RegionGroupOpType` to be applied among those members.\r\n * * Pointer to the containing context\r\n * * The count of number of regions known to be \"in\" as the search progresses.\r\n * @internal\r\n */\r\nexport class RegionGroup {\r\n public members: RegionGroupMember[];\r\n public groupOpType: RegionGroupOpType;\r\n public parent: RegionBooleanContext;\r\n private _numIn: number;\r\n public constructor(parent: RegionBooleanContext, groupOpType: RegionGroupOpType) {\r\n this.members = [];\r\n this.parent = parent;\r\n this.groupOpType = groupOpType;\r\n this._numIn = 0;\r\n }\r\n /** deep clear of state data -- group header plus all members */\r\n public clearState() {\r\n for (const member of this.members)\r\n member.clearState();\r\n this._numIn = 0;\r\n }\r\n public range(): Range3d {\r\n const range = Range3d.createNull();\r\n for (const m of this.members) {\r\n if (m.region instanceof GeometryQuery)\r\n m.region.extendRange(range);\r\n else {\r\n const range1 = Range3d.createFromVariantData(m.region);\r\n range.extendRange(range1);\r\n }\r\n }\r\n return range;\r\n }\r\n /** Ask if the current _numIn count qualifies as an \"in\" for this operation type. */\r\n public getInOut(): boolean {\r\n // UNION is true if one or more members are IN\r\n if (this.groupOpType === RegionGroupOpType.Union)\r\n return this._numIn > 0;\r\n // PARITY is true if an odd number of regions are IN\r\n if (this.groupOpType === RegionGroupOpType.Parity)\r\n return Geometry.isOdd(this._numIn);\r\n // INTERSECTION is true if ALL the regions are IN\r\n if (this.groupOpType === RegionGroupOpType.Intersection)\r\n return this._numIn === this.members.length;\r\n return false;\r\n }\r\n // push new members into the group.\r\n public addMember(data: AnyRegion | AnyRegion[] | LineSegment3d | undefined, allowLineSegment: boolean = false) {\r\n if (data instanceof Loop || data instanceof ParityRegion) {\r\n let cleanerData = data.clone() as (ParityRegion | Loop);\r\n RegionOps.consolidateAdjacentPrimitives(cleanerData);\r\n cleanerData = TransferWithSplitArcs.clone(cleanerData) as (ParityRegion | Loop);\r\n this.members.push(new RegionGroupMember(cleanerData, this));\r\n } else if (data instanceof UnionRegion) {\r\n for (const child of data.children) {\r\n this.addMember(child);\r\n }\r\n } else if (Array.isArray(data)) {\r\n for (const item of data) {\r\n this.addMember(item);\r\n }\r\n } else if (allowLineSegment && data instanceof LineSegment3d) {\r\n this.members.push(new RegionGroupMember(data, this));\r\n }\r\n }\r\n // update the \"in\" count _numIn according to old and new states (parity counts) for some member region.\r\n public recordMemberStateChange(oldState: number, newState: number) {\r\n const oldIn = Geometry.isOdd(oldState);\r\n const newIn = Geometry.isOdd(newState);\r\n if (!oldIn && newIn)\r\n this._numIn++;\r\n else if (oldIn && !newIn)\r\n this._numIn--;\r\n }\r\n}\r\n/**\r\n * A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.\r\n * * In the binary operation OP (union, intersection, parity, difference), the left and right operands\r\n * are each a composite union, difference, or parity among multiple inputs, i.e.,\r\n * * (operationA among Ai) OP (operationB among Bi)\r\n * * where the Ai are one set of regions, being combined by operationA\r\n * * and the Bi are the another set of regions, being combined by operationB.\r\n * * Each group of Ai and Bi is a `RegionGroup`.\r\n * * This is an extremely delicate structure.\r\n * * Members are public because of the unique variety of queries, but should only be used for queries.\r\n * * The graph and curves in the booleans are connected by an extended pointer chain:\r\n * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail.\r\n * * (CurveLocationDetail).curve points to a curve.\r\n * * (Curve).parent points to RegionGroupMember.\r\n * * (RegionGroupMember) points to RegionGroup.\r\n * * (RegionGroup) points to RegionBooleanBinaryContext.\r\n * * So when a graph sweep crosses an edge\r\n * * the chain leads to a parity count in the RegionGroupMember.\r\n * * that can change the number of members active in the RegionGroup.\r\n * * which can change the state of the context.\r\n * @internal\r\n */\r\nexport class RegionBooleanContext implements RegionOpsFaceToFaceSearchCallbacks {\r\n public groupA!: RegionGroup;\r\n public groupB!: RegionGroup;\r\n /** bridge edges */\r\n public extraGeometry!: RegionGroup;\r\n public graph!: HalfEdgeGraph;\r\n public faceAreaFunction!: NodeToNumberFunction;\r\n public binaryOp: RegionBinaryOpType;\r\n private constructor(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType) {\r\n this.groupA = new RegionGroup(this, groupTypeA);\r\n this.groupB = new RegionGroup(this, groupTypeB);\r\n this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);\r\n this.binaryOp = RegionBinaryOpType.Union; // revised in runClassificationSweep\r\n }\r\n /**\r\n * Create a context with both A and B groups empty.\r\n * * Caller follows up by calls to `context.groupA.addMember (loopOrParityRegion)` or `context.groupB.addMember (loopOrParityRegion)`\r\n * @param groupTypeA\r\n * @param groupTypeB\r\n */\r\n public static create(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType): RegionBooleanContext {\r\n return new RegionBooleanContext(groupTypeA, groupTypeB);\r\n }\r\n public addMembers(dataA: AnyRegion | AnyRegion[] | undefined, dataB: AnyRegion | AnyRegion[] | undefined) {\r\n this.groupA.addMember(dataA);\r\n this.groupB.addMember(dataB);\r\n this.addConnectives();\r\n }\r\n private _workSegment?: LineSegment3d;\r\n private static _bridgeDirection = Vector3d.createNormalized(1.0, -0.12328974132467)!; // magic unit direction to minimize vertex hits\r\n /**\r\n * The sweep operations require access to all geometry by edge crossings and face walk.\r\n * If input loops are non-overlapping, there may be disconnected islands not reachable.\r\n * This method:\r\n * * finds the total range\r\n * * creates parallel rays from the extreme point of each loop and extending beyond the overall range\r\n * * places those lines in the extraGeometry group\r\n */\r\n public addConnectives() {\r\n const rangeA = this.groupA.range();\r\n const rangeB = this.groupB.range();\r\n const rangeAB = rangeA.union(rangeB);\r\n const areaTol = RegionOps.computeXYAreaTolerance(rangeAB);\r\n let margin = 0.1;\r\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);\r\n if (this._workSegment)\r\n margin *= this._workSegment.point0Ref.distanceXY(this._workSegment.point1Ref); // how much further to extend each bridge ray\r\n const maxPoints: Point3d[] = [];\r\n const findExtremePointsInLoop = (region: Loop) => {\r\n const area = RegionOps.computeXYArea(region);\r\n if (area === undefined || Math.abs(area) < areaTol)\r\n return; // avoid bridging trivial faces\r\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);\r\n if (this._workSegment)\r\n maxPoints.push(this._workSegment.point1Ref);\r\n };\r\n for (const groupMembers of [this.groupA.members, this.groupB.members]) {\r\n for (const m of groupMembers) {\r\n if (m.region instanceof Loop) {\r\n findExtremePointsInLoop(m.region);\r\n } else if (m.region instanceof ParityRegion) {\r\n for (const loop of m.region.children)\r\n findExtremePointsInLoop(loop);\r\n }\r\n }\r\n }\r\n const ray = Ray3d.createZero();\r\n for (const p of maxPoints) {\r\n // Make a line from\r\n // 1) exactly the max point of the loops to\r\n // 2) a point clearly outside the big range\r\n // If p came from some inner loop this will\r\n // 1) create a bridge from the inner loop through any containing loops (always)\r\n // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)\r\n const bridgeLength = margin + Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;\r\n const outside = Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);\r\n const bridgeLine = LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);\r\n this.extraGeometry.addMember(bridgeLine, true);\r\n }\r\n }\r\n /**\r\n * Markup and assembly steps for geometry in the RegionGroups.\r\n * * Annotate connection from group to curves.\r\n * * groups with point data but no curves get no further annotation.\r\n * * compute intersections.\r\n * * assemble and merge the HalfEdgeGraph.\r\n * @param mergeTolerance absolute distance tolerance for merging loops\r\n */\r\n public annotateAndMergeCurvesInGraph(mergeTolerance: number = Geometry.smallMetricDistance) {\r\n const allPrimitives: CurvePrimitive[] = [];\r\n // ASSUME loops have fine-grained types (no linestrings)\r\n for (const group of [this.groupA, this.groupB, this.extraGeometry]) {\r\n for (const member of group.members) {\r\n let k = allPrimitives.length;\r\n if (member.region instanceof GeometryQuery) {\r\n RegionOps.collectCurvePrimitives(member.region, allPrimitives, true, true);\r\n for (; k < allPrimitives.length; k++)\r\n allPrimitives[k].parent = member;\r\n }\r\n }\r\n }\r\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);\r\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);\r\n this.graph = graph;\r\n this.faceAreaFunction = faceAreaFromCurvedEdgeData;\r\n }\r\n private _announceFaceFunction?: AnnounceClassifiedFace;\r\n /**\r\n * Sweep through the graph to assign in/out classifications to all faces.\r\n * * the classification is announced in two ways:\r\n * * the EXTERNAL mask is set on all half edges that are NOT interior faces.\r\n * * the announceFaceFunction is called once for each face.\r\n * @param binaryOp\r\n * @param announceFaceFunction\r\n */\r\n public runClassificationSweep(binaryOp: RegionBinaryOpType, announceFaceFunction?: AnnounceClassifiedFace): void {\r\n this._announceFaceFunction = announceFaceFunction;\r\n this.binaryOp = binaryOp;\r\n this.graph.clearMask(HalfEdgeMask.EXTERIOR);\r\n for (const group of [this.groupA, this.groupB])\r\n group.clearState();\r\n const faceHasBeenVisitedMask = this.graph.grabMask();\r\n const nodeHasBeenVisitedMask = this.graph.grabMask();\r\n const componentArray = GraphComponentArray.create(this.graph);\r\n for (const component of componentArray.components) {\r\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(component.faces, this.faceAreaFunction);\r\n if (exteriorHalfEdge) {\r\n const exteriorMask = HalfEdgeMask.EXTERIOR;\r\n const allMasksToClear = exteriorMask | faceHasBeenVisitedMask | nodeHasBeenVisitedMask;\r\n this.graph.clearMask(allMasksToClear);\r\n RegionOpsFaceToFaceSearch.faceToFaceSearchFromOuterLoop(\r\n this.graph, exteriorHalfEdge, faceHasBeenVisitedMask, nodeHasBeenVisitedMask, this,\r\n );\r\n }\r\n }\r\n this.graph.dropMask(faceHasBeenVisitedMask);\r\n this.graph.dropMask(nodeHasBeenVisitedMask);\r\n }\r\n // search the graph for faces with\r\n // .. exactly 2 edges\r\n // .. both with given mask\r\n // .. at least one mate is not exterior.\r\n // .. clear that mark\r\n public unmaskMaskedNullFaces(mask: number) {\r\n for (const nodeA of this.graph.allHalfEdges) {\r\n const nodeB = nodeA.faceSuccessor;\r\n if (nodeB.faceSuccessor === nodeA) {\r\n if (nodeA.getMask(mask) && nodeB.getMask(mask)) {\r\n if (!nodeA.edgeMate.getMask(mask) || !nodeB.edgeMate.getMask(mask)) {\r\n nodeA.clearMask(mask);\r\n nodeB.clearMask(mask);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n private getInOut(): boolean {\r\n if (this.binaryOp === RegionBinaryOpType.Union)\r\n return this.groupA.getInOut() || this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.Intersection)\r\n return this.groupA.getInOut() && this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.AMinusB)\r\n return this.groupA.getInOut() && !this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.BMinusA)\r\n return !this.groupA.getInOut() && this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.Parity)\r\n return this.groupA.getInOut() !== this.groupB.getInOut();\r\n return false;\r\n }\r\n /**\r\n * Record transition across an edge as entry or exit from a RegionGroup.\r\n * * Work backward from the node to a RegionGroup. This path can be:\r\n * * If the node points to a CurveLocationDetail of a (possibly partial) curve, the path is (take a deep breath)\r\n * * node points to CurveLocation Detail\r\n * * CurveLocationDetail points to curve\r\n * * curve points to RegionGroupMember\r\n * * If the node points directly to a RegionGroup, it's ready to go!!!\r\n * @param node\r\n * @param delta\r\n */\r\n private recordTransitionAcrossEdge(node: HalfEdge, delta: number): RegionGroupMember | undefined {\r\n const updateRegionGroupMemberState = (member: RegionGroupMember): RegionGroupMember => {\r\n if (member.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\r\n return member; // no transition across a bridge edge\r\n if (delta !== 0) {\r\n const oldSweepState = member.sweepState;\r\n member.sweepState += delta;\r\n member.parentGroup.recordMemberStateChange(oldSweepState, member.sweepState);\r\n }\r\n return member;\r\n };\r\n\r\n const data = node.edgeTag;\r\n if (data instanceof RegionGroupMember)\r\n return updateRegionGroupMemberState(data);\r\n\r\n if (data instanceof CurveLocationDetail) {\r\n // We trust that the caller has linked from the graph node to a curve which has a RegionGroupMember as its parent.\r\n const member = data.curve!.parent;\r\n if (member instanceof RegionGroupMember)\r\n return updateRegionGroupMemberState(member);\r\n }\r\n return undefined;\r\n }\r\n // obligations to act as sweep callback ...\r\n /** Announce a representative node on the outer face of a component. */\r\n public startComponent(outerFaceNode: HalfEdge): boolean {\r\n outerFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\r\n if (this._announceFaceFunction)\r\n this._announceFaceFunction(this.graph, outerFaceNode, -1, faceAreaFromCurvedEdgeData(outerFaceNode));\r\n return true;\r\n }\r\n /** Announce return to outer face. */\r\n public finishComponent(_node: HalfEdge): boolean {\r\n return true;\r\n }\r\n /**\r\n * Announce entry to a graph face.\r\n * * Both both sides of a graph edge are from the same RegionGroupMember.\r\n * * Hence \"crossing that edge\" changes the parity count for the RegionGroupMember that owns that edge by 1.\r\n * * The parity count for other RegionGroupMembers are never affected by this crossing.\r\n * * Crossing a bridge edge does not change the parity count.\r\n */\r\n public enterFace(_facePathStack: HalfEdge[], newFaceNode: HalfEdge): boolean {\r\n this.recordTransitionAcrossEdge(newFaceNode, 1);\r\n const state = this.getInOut();\r\n if (!state)\r\n newFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\r\n if (this._announceFaceFunction)\r\n this._announceFaceFunction(this.graph, newFaceNode, state ? 1 : 0, faceAreaFromCurvedEdgeData(newFaceNode));\r\n return true;\r\n }\r\n /** Announce face exit */\r\n public leaveFace(_facePathStack: HalfEdge[], oldFaceNode: HalfEdge): boolean {\r\n this.recordTransitionAcrossEdge(oldFaceNode, -1);\r\n return true;\r\n }\r\n}\r\n/**\r\n * Return xy area between (part of) a curve and the x axis through a reference point.\r\n * If detail is undefined or does not have both start and end fractions, just do trapezoid area.\r\n */\r\nfunction areaUnderPartialCurveXY(\r\n detail: CurveLocationDetail | undefined, xyStart: XAndY, xyEnd: XAndY, referencePoint: XAndY,\r\n): number {\r\n // area between trapezoid and axis\r\n let trapezoidArea;\r\n if (detail && detail.point1) {\r\n trapezoidArea = -(detail.point1.x - detail.point.x) * (0.5 * (detail.point.y + detail.point1.y) - referencePoint.y);\r\n } else {\r\n trapezoidArea = -(xyEnd.x - xyStart.x) * (0.5 * (xyStart.y + xyEnd.y) - referencePoint.y);\r\n }\r\n let areaToChord = 0.0;\r\n if (detail && detail.curve && detail.hasFraction1) {\r\n if (detail.curve instanceof LineSegment3d) {\r\n // nothing to do for a line segment\r\n } else if (detail.curve instanceof Arc3d) {\r\n areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1!);\r\n } else {\r\n const partial = detail.curve.clonePartialCurve(detail.fraction, detail.fraction1!);\r\n areaToChord = partial ?\r\n RegionOps.computeXYArea(Loop.create(partial, LineSegment3d.create(detail.point1!, detail.point))) ?? 0\r\n : 0;\r\n }\r\n }\r\n return trapezoidArea + areaToChord;\r\n}\r\n/** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves. */\r\nfunction faceAreaFromCurvedEdgeData(faceSeed: HalfEdge): number {\r\n let area = 0.0;\r\n let edge = faceSeed;\r\n do {\r\n area += (edge.sortData as number) * areaUnderPartialCurveXY((edge.edgeTag as CurveLocationDetail), edge, edge.faceSuccessor, faceSeed);\r\n } while ((edge = edge.faceSuccessor) !== faceSeed);\r\n return area;\r\n}\r\n\r\n/**\r\n * Function to accumulate area under edges.\r\n * Array of nodes representing faces in a subset of a graph.\r\n * @internal\r\n */\r\nexport type NodeAndRangeFunction = (edge: HalfEdge, range: Range2d) => void;\r\n/**\r\n * Array of nodes representing faces in a subset of a graph.\r\n * @internal\r\n */\r\nexport class GraphComponent {\r\n public faces: HalfEdge[];\r\n public faceAreas: number[];\r\n public range: Range2d;\r\n public constructor(faces: HalfEdge[]) {\r\n this.faces = faces;\r\n this.range = Range2d.createNull();\r\n this.faceAreas = [];\r\n }\r\n /**\r\n * Visit all vertices and edges in the component to build face area array and composite range.\r\n * @param extendRangeForEdge optional function to compute edge range. If undefined, linear edge is assumed.\r\n * @param faceAreaFunction optional function to compute face area. If undefined, linear edges are assumed.\r\n */\r\n public buildFaceData(extendRangeForEdge: NodeAndRangeFunction | undefined, faceAreaFunction: NodeToNumberFunction | undefined) {\r\n const vertexFunction = (node: HalfEdge) => {\r\n if (extendRangeForEdge)\r\n extendRangeForEdge(node, this.range);\r\n else\r\n this.range.extendXY(node.x, node.y);\r\n return 0;\r\n };\r\n this.range.setNull();\r\n for (const f of this.faces) {\r\n f.sumAroundFace(vertexFunction);\r\n }\r\n this.faceAreas.length = 0;\r\n if (!faceAreaFunction)\r\n faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\r\n for (const f of this.faces) {\r\n this.faceAreas.push(faceAreaFunction(f));\r\n }\r\n }\r\n}\r\n/**\r\n * Build and hold an array of component data for a HalfEdgeGraph.\r\n * @internal\r\n */\r\nexport class GraphComponentArray {\r\n public components: GraphComponent[];\r\n public graph: HalfEdgeGraph;\r\n private constructor(graph: HalfEdgeGraph) {\r\n this.graph = graph;\r\n this.components = [];\r\n }\r\n public static create(\r\n graph: HalfEdgeGraph, extendRangeForEdge?: (edge: HalfEdge, range: Range2d) => void,\r\n ): GraphComponentArray {\r\n const result = new GraphComponentArray(graph);\r\n const componentArrays = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\r\n for (const componentFaces of componentArrays) {\r\n const component = new GraphComponent(componentFaces);\r\n component.buildFaceData(extendRangeForEdge, faceAreaFromCurvedEdgeData);\r\n result.components.push(component);\r\n }\r\n return result;\r\n }\r\n}\r\n"]}