@itwin/core-geometry 5.1.0-dev.9 → 5.2.0-dev.1

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 (598) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/lib/cjs/Geometry.d.ts +18 -10
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +13 -3
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSpline1dNd.d.ts +1 -1
  7. package/lib/cjs/bspline/BSpline1dNd.js +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/BSplineSurface.d.ts +4 -3
  13. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  14. package/lib/cjs/bspline/BSplineSurface.js +4 -5
  15. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  16. package/lib/cjs/clipping/ClipPlane.d.ts +7 -5
  17. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  18. package/lib/cjs/clipping/ClipPlane.js +9 -5
  19. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  20. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  21. package/lib/cjs/clipping/ClipUtils.js +5 -3
  22. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  23. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -2
  24. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  25. package/lib/cjs/clipping/ConvexClipPlaneSet.js +13 -25
  26. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  27. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  28. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  29. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  30. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  31. package/lib/cjs/core-geometry.d.ts +2 -0
  32. package/lib/cjs/core-geometry.d.ts.map +1 -1
  33. package/lib/cjs/core-geometry.js +2 -0
  34. package/lib/cjs/core-geometry.js.map +1 -1
  35. package/lib/cjs/curve/Arc3d.d.ts +54 -32
  36. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  37. package/lib/cjs/curve/Arc3d.js +56 -37
  38. package/lib/cjs/curve/Arc3d.js.map +1 -1
  39. package/lib/cjs/curve/CurveCollection.d.ts +40 -1
  40. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  41. package/lib/cjs/curve/CurveCollection.js +90 -0
  42. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  43. package/lib/cjs/curve/CurveFactory.d.ts +3 -2
  44. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  45. package/lib/cjs/curve/CurveFactory.js +6 -5
  46. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  47. package/lib/cjs/curve/CurveLocationDetail.d.ts +27 -25
  48. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  49. package/lib/cjs/curve/CurveLocationDetail.js +30 -25
  50. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  51. package/lib/cjs/curve/CurvePrimitive.d.ts +9 -2
  52. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurvePrimitive.js +11 -0
  54. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  55. package/lib/cjs/curve/CurveTypes.d.ts +1 -1
  56. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  57. package/lib/cjs/curve/LineSegment3d.d.ts +2 -0
  58. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  59. package/lib/cjs/curve/LineSegment3d.js +4 -0
  60. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  61. package/lib/cjs/curve/LineString3d.d.ts +7 -0
  62. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  63. package/lib/cjs/curve/LineString3d.js +15 -3
  64. package/lib/cjs/curve/LineString3d.js.map +1 -1
  65. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  66. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
  67. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  68. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +34 -8
  69. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  70. package/lib/cjs/curve/Query/PlanarSubdivision.js +129 -33
  71. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  72. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +4 -3
  73. package/lib/cjs/curve/Query/StrokeCountChain.d.ts.map +1 -1
  74. package/lib/cjs/curve/Query/StrokeCountChain.js +20 -9
  75. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  76. package/lib/cjs/curve/RegionMomentsXY.d.ts +2 -1
  77. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  78. package/lib/cjs/curve/RegionMomentsXY.js +26 -41
  79. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  80. package/lib/cjs/curve/RegionOps.d.ts +74 -39
  81. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  82. package/lib/cjs/curve/RegionOps.js +146 -46
  83. package/lib/cjs/curve/RegionOps.js.map +1 -1
  84. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +36 -27
  85. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  86. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +161 -55
  87. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  88. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  89. package/lib/cjs/curve/StrokeOptions.js +1 -1
  90. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  91. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  92. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
  93. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
  94. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  95. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  96. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  97. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  98. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  100. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +0 -1
  101. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  102. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  103. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  104. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js +34 -0
  105. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  106. package/lib/cjs/geometry3d/AngleSweep.d.ts +25 -18
  107. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/AngleSweep.js +32 -18
  109. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  110. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  111. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +19 -25
  113. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  114. package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
  115. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  116. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  117. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  118. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  119. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -3
  120. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  121. package/lib/cjs/geometry3d/GrowableXYZArray.js +21 -3
  122. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  123. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +11 -1
  124. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  125. package/lib/cjs/geometry3d/IndexedXYZCollection.js +21 -3
  126. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  127. package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
  128. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  129. package/lib/cjs/geometry3d/Plane3d.js +6 -1
  130. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  131. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  132. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  133. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  134. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  135. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  136. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  137. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  138. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  139. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  140. package/lib/cjs/geometry3d/Point2dVector2d.js +0 -2
  141. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  142. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
  143. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  144. package/lib/cjs/geometry3d/Point3dVector3d.js +4 -5
  145. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  146. package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
  147. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  148. package/lib/cjs/geometry3d/PointHelpers.js +66 -26
  149. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  150. package/lib/cjs/geometry3d/PolygonOps.d.ts +49 -2
  151. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  152. package/lib/cjs/geometry3d/PolygonOps.js +38 -2
  153. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  154. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  155. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  156. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  157. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  158. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
  159. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  160. package/lib/cjs/geometry3d/PolylineOps.js +5 -4
  161. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  162. package/lib/cjs/geometry3d/Range.d.ts +18 -10
  163. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  164. package/lib/cjs/geometry3d/Range.js +32 -10
  165. package/lib/cjs/geometry3d/Range.js.map +1 -1
  166. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  167. package/lib/cjs/geometry3d/Ray2d.js +0 -1
  168. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  169. package/lib/cjs/geometry3d/Ray3d.d.ts +7 -9
  170. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  171. package/lib/cjs/geometry3d/Ray3d.js +23 -45
  172. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  173. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +39 -29
  174. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  175. package/lib/cjs/geometry3d/ReusableObjectCache.js +49 -35
  176. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  177. package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -4
  178. package/lib/cjs/geometry3d/SortablePolygon.d.ts.map +1 -1
  179. package/lib/cjs/geometry3d/SortablePolygon.js +48 -43
  180. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  181. package/lib/cjs/geometry3d/Transform.d.ts +21 -2
  182. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  183. package/lib/cjs/geometry3d/Transform.js +32 -13
  184. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  185. package/lib/cjs/geometry4d/Point4d.d.ts +8 -5
  186. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  187. package/lib/cjs/geometry4d/Point4d.js +27 -16
  188. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  189. package/lib/cjs/numerics/BezierPolynomials.d.ts +2 -0
  190. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  191. package/lib/cjs/numerics/BezierPolynomials.js +11 -0
  192. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  193. package/lib/cjs/numerics/SmallSystem.d.ts +77 -36
  194. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  195. package/lib/cjs/numerics/SmallSystem.js +129 -73
  196. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  197. package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
  198. package/lib/cjs/polyface/FacetOrientation.js +1 -1
  199. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  200. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
  201. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  202. package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
  203. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  204. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  205. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  206. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
  207. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  208. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  209. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  210. package/lib/cjs/polyface/IndexedPolyfaceWalker.js +51 -32
  211. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  212. package/lib/cjs/polyface/Polyface.d.ts +19 -5
  213. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  214. package/lib/cjs/polyface/Polyface.js +18 -2
  215. package/lib/cjs/polyface/Polyface.js.map +1 -1
  216. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
  217. package/lib/cjs/polyface/PolyfaceBuilder.js +6 -6
  218. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  219. package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
  220. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  221. package/lib/cjs/polyface/PolyfaceClip.js +39 -42
  222. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  223. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  224. package/lib/cjs/polyface/PolyfaceData.js +1 -1
  225. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  226. package/lib/cjs/polyface/PolyfaceQuery.d.ts +119 -78
  227. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  228. package/lib/cjs/polyface/PolyfaceQuery.js +315 -231
  229. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  230. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  231. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  232. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
  233. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  234. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  235. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  236. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  237. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  238. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  239. package/lib/cjs/serialization/BGFBReader.js +2 -3
  240. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  241. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  242. package/lib/cjs/serialization/BGFBWriter.js +2 -4
  243. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  244. package/lib/cjs/serialization/GeometrySamples.d.ts +1 -1
  245. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  246. package/lib/cjs/serialization/GeometrySamples.js +3 -3
  247. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  248. package/lib/cjs/serialization/IModelJsonSchema.d.ts +3 -3
  249. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  250. package/lib/cjs/serialization/IModelJsonSchema.js +5 -5
  251. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  252. package/lib/cjs/solid/Box.d.ts.map +1 -1
  253. package/lib/cjs/solid/Box.js +7 -0
  254. package/lib/cjs/solid/Box.js.map +1 -1
  255. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  256. package/lib/cjs/solid/Cone.js +6 -0
  257. package/lib/cjs/solid/Cone.js.map +1 -1
  258. package/lib/cjs/solid/LinearSweep.d.ts +2 -3
  259. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  260. package/lib/cjs/solid/LinearSweep.js +11 -7
  261. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  262. package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
  263. package/lib/cjs/solid/RotationalSweep.js +2 -2
  264. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  265. package/lib/cjs/solid/RuledSweep.d.ts +1 -1
  266. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  267. package/lib/cjs/solid/RuledSweep.js +5 -1
  268. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  269. package/lib/cjs/solid/Sphere.d.ts.map +1 -1
  270. package/lib/cjs/solid/Sphere.js +6 -3
  271. package/lib/cjs/solid/Sphere.js.map +1 -1
  272. package/lib/cjs/solid/SweepContour.d.ts +1 -1
  273. package/lib/cjs/solid/SweepContour.js +1 -1
  274. package/lib/cjs/solid/SweepContour.js.map +1 -1
  275. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  276. package/lib/cjs/solid/TorusPipe.js +4 -0
  277. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  278. package/lib/cjs/topology/ChainMerge.d.ts +1 -1
  279. package/lib/cjs/topology/ChainMerge.js +1 -1
  280. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  281. package/lib/cjs/topology/Graph.d.ts +64 -14
  282. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  283. package/lib/cjs/topology/Graph.js +149 -32
  284. package/lib/cjs/topology/Graph.js.map +1 -1
  285. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +3 -2
  286. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  287. package/lib/cjs/topology/HalfEdgeGraphSearch.js +3 -2
  288. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  289. package/lib/cjs/topology/Merging.d.ts +0 -1
  290. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  291. package/lib/cjs/topology/Merging.js +49 -46
  292. package/lib/cjs/topology/Merging.js.map +1 -1
  293. package/lib/cjs/topology/RegularizeFace.d.ts.map +1 -1
  294. package/lib/cjs/topology/RegularizeFace.js +2 -1
  295. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  296. package/lib/cjs/topology/Triangulation.d.ts +9 -14
  297. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  298. package/lib/cjs/topology/Triangulation.js +29 -22
  299. package/lib/cjs/topology/Triangulation.js.map +1 -1
  300. package/lib/esm/Geometry.d.ts +18 -10
  301. package/lib/esm/Geometry.d.ts.map +1 -1
  302. package/lib/esm/Geometry.js +13 -3
  303. package/lib/esm/Geometry.js.map +1 -1
  304. package/lib/esm/bspline/BSpline1dNd.d.ts +1 -1
  305. package/lib/esm/bspline/BSpline1dNd.js +1 -1
  306. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  307. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  308. package/lib/esm/bspline/BSplineCurve.js +7 -1
  309. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  310. package/lib/esm/bspline/BSplineSurface.d.ts +4 -3
  311. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  312. package/lib/esm/bspline/BSplineSurface.js +4 -5
  313. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  314. package/lib/esm/clipping/ClipPlane.d.ts +7 -5
  315. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  316. package/lib/esm/clipping/ClipPlane.js +9 -5
  317. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  318. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  319. package/lib/esm/clipping/ClipUtils.js +5 -3
  320. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  321. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -2
  322. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  323. package/lib/esm/clipping/ConvexClipPlaneSet.js +13 -25
  324. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  325. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  326. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  327. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  328. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  329. package/lib/esm/core-geometry.d.ts +2 -0
  330. package/lib/esm/core-geometry.d.ts.map +1 -1
  331. package/lib/esm/core-geometry.js +2 -0
  332. package/lib/esm/core-geometry.js.map +1 -1
  333. package/lib/esm/curve/Arc3d.d.ts +54 -32
  334. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  335. package/lib/esm/curve/Arc3d.js +56 -37
  336. package/lib/esm/curve/Arc3d.js.map +1 -1
  337. package/lib/esm/curve/CurveCollection.d.ts +40 -1
  338. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  339. package/lib/esm/curve/CurveCollection.js +90 -0
  340. package/lib/esm/curve/CurveCollection.js.map +1 -1
  341. package/lib/esm/curve/CurveFactory.d.ts +3 -2
  342. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  343. package/lib/esm/curve/CurveFactory.js +6 -5
  344. package/lib/esm/curve/CurveFactory.js.map +1 -1
  345. package/lib/esm/curve/CurveLocationDetail.d.ts +27 -25
  346. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  347. package/lib/esm/curve/CurveLocationDetail.js +30 -25
  348. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  349. package/lib/esm/curve/CurvePrimitive.d.ts +9 -2
  350. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  351. package/lib/esm/curve/CurvePrimitive.js +11 -0
  352. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  353. package/lib/esm/curve/CurveTypes.d.ts +1 -1
  354. package/lib/esm/curve/CurveTypes.js.map +1 -1
  355. package/lib/esm/curve/LineSegment3d.d.ts +2 -0
  356. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  357. package/lib/esm/curve/LineSegment3d.js +4 -0
  358. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  359. package/lib/esm/curve/LineString3d.d.ts +7 -0
  360. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  361. package/lib/esm/curve/LineString3d.js +15 -3
  362. package/lib/esm/curve/LineString3d.js.map +1 -1
  363. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  364. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
  365. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  366. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +34 -8
  367. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  368. package/lib/esm/curve/Query/PlanarSubdivision.js +131 -35
  369. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  370. package/lib/esm/curve/Query/StrokeCountChain.d.ts +4 -3
  371. package/lib/esm/curve/Query/StrokeCountChain.d.ts.map +1 -1
  372. package/lib/esm/curve/Query/StrokeCountChain.js +20 -9
  373. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  374. package/lib/esm/curve/RegionMomentsXY.d.ts +2 -1
  375. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  376. package/lib/esm/curve/RegionMomentsXY.js +26 -41
  377. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  378. package/lib/esm/curve/RegionOps.d.ts +74 -39
  379. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  380. package/lib/esm/curve/RegionOps.js +146 -46
  381. package/lib/esm/curve/RegionOps.js.map +1 -1
  382. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +36 -27
  383. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  384. package/lib/esm/curve/RegionOpsClassificationSweeps.js +161 -56
  385. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  386. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  387. package/lib/esm/curve/StrokeOptions.js +1 -1
  388. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  389. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  390. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
  391. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
  392. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  393. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  394. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  395. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  396. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  397. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  398. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +0 -1
  399. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  400. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  401. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  402. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js +30 -0
  403. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  404. package/lib/esm/geometry3d/AngleSweep.d.ts +25 -18
  405. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  406. package/lib/esm/geometry3d/AngleSweep.js +32 -18
  407. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  408. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  409. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  410. package/lib/esm/geometry3d/CoincidentGeometryOps.js +19 -25
  411. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  412. package/lib/esm/geometry3d/Ellipsoid.js +1 -1
  413. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  414. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  415. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  416. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  417. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -3
  418. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  419. package/lib/esm/geometry3d/GrowableXYZArray.js +21 -3
  420. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  421. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +11 -1
  422. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  423. package/lib/esm/geometry3d/IndexedXYZCollection.js +21 -3
  424. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  425. package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
  426. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  427. package/lib/esm/geometry3d/Plane3d.js +6 -1
  428. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  429. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  430. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  431. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  432. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  433. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  434. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  435. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  436. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  437. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  438. package/lib/esm/geometry3d/Point2dVector2d.js +0 -2
  439. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  440. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
  441. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  442. package/lib/esm/geometry3d/Point3dVector3d.js +4 -5
  443. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  444. package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
  445. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  446. package/lib/esm/geometry3d/PointHelpers.js +66 -26
  447. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  448. package/lib/esm/geometry3d/PolygonOps.d.ts +49 -2
  449. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  450. package/lib/esm/geometry3d/PolygonOps.js +38 -2
  451. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  452. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  453. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  454. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  455. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  456. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
  457. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  458. package/lib/esm/geometry3d/PolylineOps.js +5 -4
  459. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  460. package/lib/esm/geometry3d/Range.d.ts +18 -10
  461. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  462. package/lib/esm/geometry3d/Range.js +32 -10
  463. package/lib/esm/geometry3d/Range.js.map +1 -1
  464. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  465. package/lib/esm/geometry3d/Ray2d.js +0 -1
  466. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  467. package/lib/esm/geometry3d/Ray3d.d.ts +7 -9
  468. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  469. package/lib/esm/geometry3d/Ray3d.js +23 -45
  470. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  471. package/lib/esm/geometry3d/ReusableObjectCache.d.ts +39 -29
  472. package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  473. package/lib/esm/geometry3d/ReusableObjectCache.js +47 -33
  474. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  475. package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -4
  476. package/lib/esm/geometry3d/SortablePolygon.d.ts.map +1 -1
  477. package/lib/esm/geometry3d/SortablePolygon.js +48 -43
  478. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  479. package/lib/esm/geometry3d/Transform.d.ts +21 -2
  480. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  481. package/lib/esm/geometry3d/Transform.js +32 -13
  482. package/lib/esm/geometry3d/Transform.js.map +1 -1
  483. package/lib/esm/geometry4d/Point4d.d.ts +8 -5
  484. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  485. package/lib/esm/geometry4d/Point4d.js +27 -16
  486. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  487. package/lib/esm/numerics/BezierPolynomials.d.ts +2 -0
  488. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  489. package/lib/esm/numerics/BezierPolynomials.js +11 -0
  490. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  491. package/lib/esm/numerics/SmallSystem.d.ts +77 -36
  492. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  493. package/lib/esm/numerics/SmallSystem.js +129 -73
  494. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  495. package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
  496. package/lib/esm/polyface/FacetOrientation.js +1 -1
  497. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  498. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
  499. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  500. package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
  501. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  502. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  503. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  504. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
  505. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  506. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  507. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  508. package/lib/esm/polyface/IndexedPolyfaceWalker.js +51 -32
  509. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  510. package/lib/esm/polyface/Polyface.d.ts +19 -5
  511. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  512. package/lib/esm/polyface/Polyface.js +18 -2
  513. package/lib/esm/polyface/Polyface.js.map +1 -1
  514. package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
  515. package/lib/esm/polyface/PolyfaceBuilder.js +6 -6
  516. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  517. package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
  518. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  519. package/lib/esm/polyface/PolyfaceClip.js +39 -42
  520. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  521. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  522. package/lib/esm/polyface/PolyfaceData.js +1 -1
  523. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  524. package/lib/esm/polyface/PolyfaceQuery.d.ts +119 -78
  525. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  526. package/lib/esm/polyface/PolyfaceQuery.js +316 -232
  527. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  528. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  529. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  530. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
  531. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  532. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  533. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  534. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  535. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  536. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  537. package/lib/esm/serialization/BGFBReader.js +2 -3
  538. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  539. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  540. package/lib/esm/serialization/BGFBWriter.js +2 -4
  541. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  542. package/lib/esm/serialization/GeometrySamples.d.ts +1 -1
  543. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  544. package/lib/esm/serialization/GeometrySamples.js +3 -3
  545. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  546. package/lib/esm/serialization/IModelJsonSchema.d.ts +3 -3
  547. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  548. package/lib/esm/serialization/IModelJsonSchema.js +5 -5
  549. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  550. package/lib/esm/solid/Box.d.ts.map +1 -1
  551. package/lib/esm/solid/Box.js +7 -0
  552. package/lib/esm/solid/Box.js.map +1 -1
  553. package/lib/esm/solid/Cone.d.ts.map +1 -1
  554. package/lib/esm/solid/Cone.js +6 -0
  555. package/lib/esm/solid/Cone.js.map +1 -1
  556. package/lib/esm/solid/LinearSweep.d.ts +2 -3
  557. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  558. package/lib/esm/solid/LinearSweep.js +11 -7
  559. package/lib/esm/solid/LinearSweep.js.map +1 -1
  560. package/lib/esm/solid/RotationalSweep.d.ts +2 -2
  561. package/lib/esm/solid/RotationalSweep.js +2 -2
  562. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  563. package/lib/esm/solid/RuledSweep.d.ts +1 -1
  564. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  565. package/lib/esm/solid/RuledSweep.js +5 -1
  566. package/lib/esm/solid/RuledSweep.js.map +1 -1
  567. package/lib/esm/solid/Sphere.d.ts.map +1 -1
  568. package/lib/esm/solid/Sphere.js +6 -3
  569. package/lib/esm/solid/Sphere.js.map +1 -1
  570. package/lib/esm/solid/SweepContour.d.ts +1 -1
  571. package/lib/esm/solid/SweepContour.js +1 -1
  572. package/lib/esm/solid/SweepContour.js.map +1 -1
  573. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  574. package/lib/esm/solid/TorusPipe.js +4 -0
  575. package/lib/esm/solid/TorusPipe.js.map +1 -1
  576. package/lib/esm/topology/ChainMerge.d.ts +1 -1
  577. package/lib/esm/topology/ChainMerge.js +1 -1
  578. package/lib/esm/topology/ChainMerge.js.map +1 -1
  579. package/lib/esm/topology/Graph.d.ts +64 -14
  580. package/lib/esm/topology/Graph.d.ts.map +1 -1
  581. package/lib/esm/topology/Graph.js +149 -32
  582. package/lib/esm/topology/Graph.js.map +1 -1
  583. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +3 -2
  584. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  585. package/lib/esm/topology/HalfEdgeGraphSearch.js +3 -2
  586. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  587. package/lib/esm/topology/Merging.d.ts +0 -1
  588. package/lib/esm/topology/Merging.d.ts.map +1 -1
  589. package/lib/esm/topology/Merging.js +49 -46
  590. package/lib/esm/topology/Merging.js.map +1 -1
  591. package/lib/esm/topology/RegularizeFace.d.ts.map +1 -1
  592. package/lib/esm/topology/RegularizeFace.js +2 -1
  593. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  594. package/lib/esm/topology/Triangulation.d.ts +9 -14
  595. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  596. package/lib/esm/topology/Triangulation.js +29 -22
  597. package/lib/esm/topology/Triangulation.js.map +1 -1
  598. package/package.json +7 -6
@@ -43,36 +43,37 @@ export declare class PolyfaceClip {
43
43
  * * Return all surviving clip as a new mesh.
44
44
  * * WARNING: The new mesh is "points only" -- parameters, normals, etc are not interpolated
45
45
  */
46
- static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): IndexedPolyface;
46
+ static clipPolyfaceClipPlaneWithClosureFace(source: Polyface | PolyfaceVisitor, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): IndexedPolyface;
47
47
  /** Clip each facet of polyface to the ClipPlane.
48
48
  * * Return all surviving clip as a new mesh.
49
49
  * * WARNING: The new mesh is "points only" -- parameters, normals, etc are not interpolated
50
50
  */
51
- static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): IndexedPolyface;
52
- /** Clip each facet of polyface to the ClipPlane.
53
- * * Return surviving clip as a new mesh.
51
+ static clipPolyfaceClipPlane(source: Polyface | PolyfaceVisitor, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): IndexedPolyface;
52
+ /**
53
+ * Clip each facet to the clipper.
54
+ * * Return surviving facets as a new mesh.
54
55
  * * WARNING: The new mesh is "points only".
55
56
  */
56
- static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): IndexedPolyface;
57
- /** Clip each facet of polyface to the the clippers.
57
+ static clipPolyfaceConvexClipPlaneSet(source: Polyface | PolyfaceVisitor, clipper: ConvexClipPlaneSet): IndexedPolyface;
58
+ /** Clip each facet to the clippers.
58
59
  * * Add inside, outside fragments to builderA, builderB
59
60
  * * This does not consider params, normals, colors. Just points.
60
61
  * * outputSelect determines how the clip output is structured
61
62
  * * 0 outputs all shards -- this may have many interior edges.
62
63
  * * 1 stitches shards together to get cleaner facets.
63
64
  */
64
- static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector?: number): void;
65
+ static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(source: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector?: number): void;
65
66
  private static addRegion;
66
67
  private static cleanupAndAddRegion;
67
68
  private static addPolygonToBuilderAndDropToCache;
68
69
  private static addPolygonArrayToBuilderAndDropToCache;
69
70
  private static createChainContextsForConvexClipPlaneSet;
70
- /** Clip each facet of polyface to the the clippers.
71
+ /** Clip each facet to the clippers.
71
72
  * * Add inside, outside fragments to builderA, builderB
72
73
  * * This does not consider params, normals, colors. Just points.
73
74
  * @internal
74
75
  */
75
- static clipPolyfaceConvexClipPlaneSetToBuilders(polyface: Polyface, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders): void;
76
+ static clipPolyfaceConvexClipPlaneSetToBuilders(source: Polyface | PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders): void;
76
77
  /**
77
78
  *
78
79
  * @param visitor visitor for all facets of interest (entire polyface)
@@ -102,26 +103,26 @@ export declare class PolyfaceClip {
102
103
  * @param destination
103
104
  */
104
105
  private static addClosureFacets;
105
- /** Clip each facet of polyface to the the clippers.
106
+ /** Clip each facet to the clippers.
106
107
  * * Add inside, outside fragments to builderA, builderB
107
108
  * * This does not consider params, normals, colors. Just points.
108
109
  * @internal
109
110
  */
110
- static clipPolyfaceClipPlaneToBuilders(polyface: Polyface, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders): void;
111
- /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet
111
+ static clipPolyfaceClipPlaneToBuilders(source: Polyface | PolyfaceVisitor, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders): void;
112
+ /** Clip each facet to the clipper.
112
113
  * * accumulate inside and outside facets -- to destination.builderA and destination.builderB
113
- * * if `destination.buildClosureFaces` is set, and also build closure facets
114
- * * This method parses the variant input types and calls a more specific method.
114
+ * * if `destination.buildClosureFaces` is set, also build closure facets.
115
+ * * This method parses the variant input types and calls a more specific method.
115
116
  * * WARNING: The new mesh is "points only".
116
117
  * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]
117
118
  */
118
- static clipPolyfaceInsideOutside(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelect?: number): void;
119
- /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet
119
+ static clipPolyfaceInsideOutside(source: Polyface | PolyfaceVisitor, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelect?: number): void;
120
+ /** Clip each facet to the clipper.
120
121
  * * This method parses the variant input types and calls a more specific method.
121
122
  * * To get both inside and outside parts, use clipPolyfaceInsideOutside
122
123
  * * WARNING: The new mesh is "points only".
123
124
  */
124
- static clipPolyface(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined;
125
+ static clipPolyface(source: Polyface | PolyfaceVisitor, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined;
125
126
  /**
126
127
  * Drape the region onto the mesh.
127
128
  * * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.
@@ -142,7 +143,7 @@ export declare class PolyfaceClip {
142
143
  /** Intersect each facet with the clip plane. (Producing intersection edges.)
143
144
  * * Return all edges chained as array of LineString3d.
144
145
  */
145
- static sectionPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane): LineString3d[];
146
+ static sectionPolyfaceClipPlane(source: Polyface | PolyfaceVisitor, clipper: ClipPlane): LineString3d[];
146
147
  /**
147
148
  * * Split facets of mesh "A" into parts that are
148
149
  * * under mesh "B"
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceClip.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAQlE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAgBpD;;;GAGG;AACH,qBAAa,uBAAuB;IAClC,0DAA0D;IACnD,QAAQ,CAAC,EAAE,eAAe,CAAC;IAClC,2DAA2D;IACpD,QAAQ,CAAC,EAAE,eAAe,CAAC;IAClC,qCAAqC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACnC,OAAO;IAKP;;;;;OAKG;WACW,MAAM,CAAC,UAAU,GAAE,OAAc,EAAE,WAAW,GAAE,OAAe,EAAE,cAAc,GAAE,OAAe;IAI9G;;;;;OAKG;IACI,aAAa,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,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,GAAG,kBAAkB,GAAG,QAAQ,GAAG,SAAS;IAQ7H;;;;;;;;OAQG;WACW,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS;IAgB5J;;;;;MAKE;IACF,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAYlC;;OAEG;WACW,wBAAwB,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,EAAE,OAAO,EAAE,SAAS,GAAG,YAAY,EAAE;IAe9G;;;;;;;;;;;;;;OAcG;WACW,+CAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,GAAG,SAAS,EAAE,aAAa,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI;IAsClN;;;;;;;;;;;;;;;;OAgBG;WACW,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG;QAAE,WAAW,EAAE,eAAe,CAAC;QAAC,UAAU,EAAE,eAAe,CAAA;KAAE;CAe5I"}
@@ -91,24 +91,26 @@ export class PolyfaceClip {
91
91
  * * Return all surviving clip as a new mesh.
92
92
  * * WARNING: The new mesh is "points only" -- parameters, normals, etc are not interpolated
93
93
  */
94
- static clipPolyfaceClipPlaneWithClosureFace(polyface, clipper, insideClip = true, buildClosureFaces = true) {
95
- return this.clipPolyfaceClipPlane(polyface, clipper, insideClip, buildClosureFaces);
94
+ static clipPolyfaceClipPlaneWithClosureFace(source, clipper, insideClip = true, buildClosureFaces = true) {
95
+ return this.clipPolyfaceClipPlane(source, clipper, insideClip, buildClosureFaces);
96
96
  }
97
97
  /** Clip each facet of polyface to the ClipPlane.
98
98
  * * Return all surviving clip as a new mesh.
99
99
  * * WARNING: The new mesh is "points only" -- parameters, normals, etc are not interpolated
100
100
  */
101
- static clipPolyfaceClipPlane(polyface, clipper, insideClip = true, buildClosureFaces = false) {
101
+ static clipPolyfaceClipPlane(source, clipper, insideClip = true, buildClosureFaces = false) {
102
102
  const builders = ClippedPolyfaceBuilders.create(insideClip, !insideClip, buildClosureFaces);
103
- this.clipPolyfaceInsideOutside(polyface, clipper, builders);
103
+ this.clipPolyfaceInsideOutside(source, clipper, builders);
104
104
  return builders.claimPolyface(insideClip ? 0 : 1, true);
105
105
  }
106
- /** Clip each facet of polyface to the ClipPlane.
107
- * * Return surviving clip as a new mesh.
106
+ /**
107
+ * Clip each facet to the clipper.
108
+ * * Return surviving facets as a new mesh.
108
109
  * * WARNING: The new mesh is "points only".
109
110
  */
110
- static clipPolyfaceConvexClipPlaneSet(polyface, clipper) {
111
- const visitor = polyface.createVisitor(0);
111
+ static clipPolyfaceConvexClipPlaneSet(source, clipper) {
112
+ const visitor = source instanceof Polyface ? source.createVisitor(0) : source;
113
+ visitor.setNumWrap(0);
112
114
  const builder = PolyfaceBuilder.create();
113
115
  const work = new GrowableXYZArray(10);
114
116
  for (visitor.reset(); visitor.moveToNextFacet();) {
@@ -118,21 +120,18 @@ export class PolyfaceClip {
118
120
  }
119
121
  return builder.claimPolyface(true);
120
122
  }
121
- /** Clip each facet of polyface to the the clippers.
123
+ /** Clip each facet to the clippers.
122
124
  * * Add inside, outside fragments to builderA, builderB
123
125
  * * This does not consider params, normals, colors. Just points.
124
126
  * * outputSelect determines how the clip output is structured
125
127
  * * 0 outputs all shards -- this may have many interior edges.
126
128
  * * 1 stitches shards together to get cleaner facets.
127
129
  */
128
- static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, allClippers, destination, outputSelector = 1) {
129
- if (polyface instanceof Polyface) {
130
- this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface.createVisitor(0), allClippers, destination, outputSelector);
131
- return;
132
- }
130
+ static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(source, allClippers, destination, outputSelector = 1) {
133
131
  const builderA = destination.builderA;
134
132
  const builderB = destination.builderB;
135
- const visitor = polyface; // alias; we have a visitor now
133
+ const visitor = source instanceof Polyface ? source.createVisitor(0) : source;
134
+ visitor.setNumWrap(0);
136
135
  const cache = new GrowableXYZArrayCache();
137
136
  const insideShards = [];
138
137
  const outsideShards = [];
@@ -263,24 +262,23 @@ export class PolyfaceClip {
263
262
  }
264
263
  return chainContexts;
265
264
  }
266
- /** Clip each facet of polyface to the the clippers.
265
+ /** Clip each facet to the clippers.
267
266
  * * Add inside, outside fragments to builderA, builderB
268
267
  * * This does not consider params, normals, colors. Just points.
269
268
  * @internal
270
269
  */
271
- static clipPolyfaceConvexClipPlaneSetToBuilders(polyface, clipper, destination) {
270
+ static clipPolyfaceConvexClipPlaneSetToBuilders(source, clipper, destination) {
272
271
  const builderA = destination.builderA;
273
272
  const builderB = destination.builderB;
274
- const visitor = polyface.createVisitor(0);
273
+ const visitor = source instanceof Polyface ? source.createVisitor(0) : source;
274
+ visitor.setNumWrap(0);
275
275
  const cache = new GrowableXYZArrayCache();
276
276
  const outsideParts = [];
277
277
  for (visitor.reset(); visitor.moveToNextFacet();) {
278
- // !!! currentCandidates and next candidates are empty at this point !!!
279
278
  const insidePart = clipper.clipInsidePushOutside(visitor.point, outsideParts, cache);
280
279
  if (insidePart === undefined) {
281
280
  // everything is out ... outsideParts might be fragmented. Save only the original polygon
282
281
  builderB?.addPolygonGrowableXYZArray(visitor.point);
283
- cache.dropToCache(insidePart);
284
282
  cache.dropAllToCache(outsideParts);
285
283
  }
286
284
  this.addPolygonToBuilderAndDropToCache(insidePart, builderA, cache);
@@ -416,15 +414,16 @@ export class PolyfaceClip {
416
414
  }
417
415
  }
418
416
  }
419
- /** Clip each facet of polyface to the the clippers.
417
+ /** Clip each facet to the clippers.
420
418
  * * Add inside, outside fragments to builderA, builderB
421
419
  * * This does not consider params, normals, colors. Just points.
422
420
  * @internal
423
421
  */
424
- static clipPolyfaceClipPlaneToBuilders(polyface, clipper, destination) {
422
+ static clipPolyfaceClipPlaneToBuilders(source, clipper, destination) {
425
423
  const builderA = destination.builderA;
426
424
  const builderB = destination.builderB;
427
- const visitor = polyface.createVisitor(0);
425
+ const visitor = source instanceof Polyface ? source.createVisitor(0) : source;
426
+ visitor.setNumWrap(0);
428
427
  const cache = new GrowableXYZArrayCache();
429
428
  const inside = cache.grabFromCache();
430
429
  const outside = cache.grabFromCache();
@@ -441,34 +440,31 @@ export class PolyfaceClip {
441
440
  cache.dropToCache(inside);
442
441
  cache.dropToCache(outside);
443
442
  }
444
- /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet
443
+ /** Clip each facet to the clipper.
445
444
  * * accumulate inside and outside facets -- to destination.builderA and destination.builderB
446
- * * if `destination.buildClosureFaces` is set, and also build closure facets
447
- * * This method parses the variant input types and calls a more specific method.
445
+ * * if `destination.buildClosureFaces` is set, also build closure facets.
446
+ * * This method parses the variant input types and calls a more specific method.
448
447
  * * WARNING: The new mesh is "points only".
449
448
  * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]
450
449
  */
451
- static clipPolyfaceInsideOutside(polyface, clipper, destination, outputSelect = 0) {
452
- if (clipper instanceof ClipPlane) {
453
- this.clipPolyfaceClipPlaneToBuilders(polyface, clipper, destination);
454
- }
455
- else if (clipper instanceof ConvexClipPlaneSet) {
456
- this.clipPolyfaceConvexClipPlaneSetToBuilders(polyface, clipper, destination);
457
- }
458
- else if (clipper instanceof UnionOfConvexClipPlaneSets) {
459
- this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, clipper, destination, outputSelect);
460
- }
450
+ static clipPolyfaceInsideOutside(source, clipper, destination, outputSelect = 0) {
451
+ if (clipper instanceof ClipPlane)
452
+ this.clipPolyfaceClipPlaneToBuilders(source, clipper, destination);
453
+ else if (clipper instanceof ConvexClipPlaneSet)
454
+ this.clipPolyfaceConvexClipPlaneSetToBuilders(source, clipper, destination);
455
+ else if (clipper instanceof UnionOfConvexClipPlaneSets)
456
+ this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(source, clipper, destination, outputSelect);
461
457
  }
462
- /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet
458
+ /** Clip each facet to the clipper.
463
459
  * * This method parses the variant input types and calls a more specific method.
464
460
  * * To get both inside and outside parts, use clipPolyfaceInsideOutside
465
461
  * * WARNING: The new mesh is "points only".
466
462
  */
467
- static clipPolyface(polyface, clipper) {
463
+ static clipPolyface(source, clipper) {
468
464
  if (clipper instanceof ClipPlane)
469
- return this.clipPolyfaceClipPlane(polyface, clipper);
465
+ return this.clipPolyfaceClipPlane(source, clipper);
470
466
  if (clipper instanceof ConvexClipPlaneSet)
471
- return this.clipPolyfaceConvexClipPlaneSet(polyface, clipper);
467
+ return this.clipPolyfaceConvexClipPlaneSet(source, clipper);
472
468
  // (The if tests exhaust the type space -- this line is unreachable.)
473
469
  return undefined;
474
470
  }
@@ -518,9 +514,10 @@ export class PolyfaceClip {
518
514
  /** Intersect each facet with the clip plane. (Producing intersection edges.)
519
515
  * * Return all edges chained as array of LineString3d.
520
516
  */
521
- static sectionPolyfaceClipPlane(polyface, clipper) {
517
+ static sectionPolyfaceClipPlane(source, clipper) {
522
518
  const chainContext = ChainMergeContext.create();
523
- const visitor = polyface.createVisitor(0);
519
+ const visitor = source instanceof Polyface ? source.createVisitor(0) : source;
520
+ visitor.setNumWrap(0);
524
521
  const work = new GrowableXYZArray(10);
525
522
  const point0 = Point3d.create();
526
523
  const point1 = Point3d.create();
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceClip.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,C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Ac,CAAC,KAAsB,EAAE,KAAsB;QACzE,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;QAC/C,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;QACxG,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,aAAa,CAAC,uBAAuB,EAAE,CAAC;QACxC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QACxG,OAAO;YACL,WAAW,EAAE,cAAc,CAAC,aAAa,EAAE;YAC3C,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE;SAC1C,CAAC;IACJ,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 Polyface\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { ClipPlane } from \"../clipping/ClipPlane\";\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\nimport { AnyRegion } from \"../curve/CurveTypes\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range2d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SweepContour } from \"../solid/SweepContour\";\nimport { ChainMergeContext } from \"../topology/ChainMerge\";\nimport { RangeSearch } from \"./multiclip/RangeSearch\";\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceBuilder } from \"./PolyfaceBuilder\";\nimport { PolyfaceQuery } from \"./PolyfaceQuery\";\n\n/**\n * carrier for a point array with an index into UnionOfConvexClipPlaneSets\n * @private\n */\nclass ClipCandidate {\n public nextConvexSetIndex: number;\n public points: GrowableXYZArray;\n public constructor(points: GrowableXYZArray, nextConvexSetIndex: number) {\n this.nextConvexSetIndex = nextConvexSetIndex;\n this.points = points;\n }\n}\n\n/**\n * A pair of [[PolyfaceBuilder]] objects, for use by clippers that emit inside and outside parts.\n * * @public\n */\nexport class ClippedPolyfaceBuilders {\n /** An available builder. Typically the \"inside\" parts */\n public builderA?: PolyfaceBuilder;\n /** An available builder. Typically the \"outside\" parts */\n public builderB?: PolyfaceBuilder;\n /** request to construct cut faces */\n public buildClosureFaces?: boolean;\n private constructor(builderA: PolyfaceBuilder | undefined, builderB: PolyfaceBuilder | undefined, buildClosureFaces: boolean = false) {\n this.builderA = builderA;\n this.builderB = builderB;\n this.buildClosureFaces = buildClosureFaces;\n }\n /**\n * Static constructor with default options for the builders.\n * @param keepInside whether to collect clipped facets inside the clipper to `this.builderA` (default true)\n * @param keepOutside whether to collect clipped facets outside the clipper to `this.builderB` (default false)\n * @param buildSideFaces whether to add side facets to active builders (default false)\n */\n public static create(keepInside: boolean = true, keepOutside: boolean = false, buildSideFaces: boolean = false) {\n return new ClippedPolyfaceBuilders(keepInside ? PolyfaceBuilder.create() : undefined, keepOutside ? PolyfaceBuilder.create() : undefined, buildSideFaces);\n }\n\n /**\n * Return the computed facets from the selected builder.\n * @param selector the polyface to return: 0 - builderA (typically inside facets), 1 - builderB (typically outside facets)\n * @param fixup whether to clean up the polyface\n * @param tolerance compression tolerance (default [[Geometry.smallMetricDistance]]).\n */\n public claimPolyface(selector: 0 | 1, fixup: boolean, tolerance: number = Geometry.smallMetricDistance): IndexedPolyface | undefined {\n const builder = selector === 0 ? this.builderA : this.builderB;\n if (builder) {\n let polyface = builder.claimPolyface(true, tolerance);\n if (fixup) {\n polyface = PolyfaceQuery.cloneWithTVertexFixup(polyface);\n polyface = PolyfaceQuery.cloneWithDanglingEdgesRemoved(polyface);\n }\n return polyface;\n }\n return undefined;\n }\n}\n/** PolyfaceClip is a static class gathering operations using Polyfaces and clippers.\n * @public\n */\nexport class PolyfaceClip {\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = true): IndexedPolyface {\n return this.clipPolyfaceClipPlane(polyface, clipper, insideClip, buildClosureFaces);\n }\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = false): IndexedPolyface {\n const builders = ClippedPolyfaceBuilders.create(insideClip, !insideClip, buildClosureFaces);\n this.clipPolyfaceInsideOutside(polyface, clipper, builders);\n return builders.claimPolyface(insideClip ? 0 : 1, true)!;\n }\n\n /** Clip each facet of polyface to the ClipPlane.\n * * Return surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): IndexedPolyface {\n const visitor = polyface.createVisitor(0);\n const builder = PolyfaceBuilder.create();\n const work = new GrowableXYZArray(10);\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work);\n if (visitor.point.length > 2)\n builder.addPolygonGrowableXYZArray(visitor.point);\n }\n return builder.claimPolyface(true);\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * * outputSelect determines how the clip output is structured\n * * 0 outputs all shards -- this may have many interior edges.\n * * 1 stitches shards together to get cleaner facets.\n */\n public static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector: number = 1) {\n if (polyface instanceof Polyface) {\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface.createVisitor(0), allClippers, destination, outputSelector);\n return;\n }\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface; // alias; we have a visitor now\n const cache = new GrowableXYZArrayCache();\n const insideShards: GrowableXYZArray[] = [];\n const outsideShards: GrowableXYZArray[] = [];\n const residualPolygons: ClipCandidate[] = [];\n let candidate: ClipCandidate | undefined;\n const outsideParts: GrowableXYZArray[] = [];\n\n const numConvexSet = allClippers.convexSets.length;\n for (visitor.reset(); visitor.moveToNextFacet();) {\n residualPolygons.push(new ClipCandidate(cache.grabAndFill(visitor.point), 0));\n while ((candidate = residualPolygons.pop()) !== undefined) {\n const convexSetIndex = candidate.nextConvexSetIndex;\n if (convexSetIndex >= numConvexSet) {\n // ths remnant polygon is OUT ...\n if (candidate.points.length > 2)\n outsideShards.push(candidate.points);\n } else {\n const clipper = allClippers.convexSets[convexSetIndex];\n outsideParts.length = 0; // NO NO -- why isn't it empty from prior step cleanup?\n const insidePart = clipper.clipInsidePushOutside(candidate.points, outsideParts, cache);\n if (insidePart) {\n if (insidePart.length > 2)\n insideShards.push(insidePart);\n // Keep outside parts active for clip by later facets . . .\n for (const outsidePolygon of outsideParts) {\n residualPolygons.push(new ClipCandidate(outsidePolygon, convexSetIndex + 1));\n }\n } else {\n // Nothing was insidePart. The outside parts might be split by intermediate steps -- but all the pieces are there.\n candidate.nextConvexSetIndex++;\n residualPolygons.push(candidate);\n }\n outsideParts.length = 0;\n }\n }\n if (outsideShards.length === 0) {\n builderA?.addPolygonGrowableXYZArray(visitor.point);\n } else if (insideShards.length === 0) {\n // the facet spanned clippers but is intact outside\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n } else {\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, visitor.point);\n let worldToLocal: Transform | undefined;\n if (outputSelector === 1 && localToWorld !== undefined\n && undefined !== (worldToLocal = localToWorld.inverse())) {\n this.cleanupAndAddRegion(builderA, insideShards, worldToLocal, localToWorld);\n this.cleanupAndAddRegion(builderB, outsideShards, worldToLocal, localToWorld);\n } else {\n for (const shard of insideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderA, cache);\n for (const shard of outsideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderB, cache);\n }\n }\n outsideShards.length = 0;\n insideShards.length = 0;\n }\n cache.dropAllToCache(outsideParts);\n if (destination.buildClosureFaces) {\n for (const clipper of allClippers.convexSets) {\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n }\n }\n private static addRegion(builder: PolyfaceBuilder | undefined, region: AnyRegion | undefined) {\n if (builder !== undefined && region !== undefined) {\n if (region instanceof Loop && region.children.length === 1 && region.children[0] instanceof LineString3d) {\n builder.addPolygonGrowableXYZArray(region.children[0].packedPoints);\n } else if (region instanceof UnionRegion) {\n for (const child of region.children)\n this.addRegion(builder, child);\n } else {\n assert(false, \"unexpected region encountered\");\n }\n }\n }\n // WARNING: shards are transformed into local system, not reverted!!!\n private static cleanupAndAddRegion(builder: PolyfaceBuilder | undefined, shards: GrowableXYZArray[],\n worldToLocal: Transform | undefined, localToWorld: Transform | undefined) {\n if (builder !== undefined && shards.length > 0) {\n if (worldToLocal)\n GrowableXYZArray.multiplyTransformInPlace(worldToLocal, shards);\n const outsidePieces = RegionOps.polygonBooleanXYToLoops(shards, RegionBinaryOpType.Union, []);\n if (outsidePieces && outsidePieces.children.length > 0) {\n RegionOps.consolidateAdjacentPrimitives(outsidePieces); // source of the T-vertices removed in claimPolyface\n const options = new StrokeOptions();\n options.maximizeConvexFacets = true;\n const localFacets = RegionOps.facetRegionXY(outsidePieces, options);\n if (localFacets) {\n // prefer to add non-convex facets\n builder.addIndexedPolyface(localFacets, false, localToWorld);\n } else { // failsafe; we don't expect to get here\n if (localToWorld)\n outsidePieces.tryTransformInPlace(localToWorld);\n this.addRegion(builder, outsidePieces); // possibly non-convex!\n }\n }\n }\n }\n private static addPolygonToBuilderAndDropToCache(polygon: GrowableXYZArray | undefined, builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\n if (polygon) {\n if (builder)\n builder.addPolygonGrowableXYZArray(polygon);\n cache.dropToCache(polygon);\n }\n }\n private static addPolygonArrayToBuilderAndDropToCache(polygonArray: GrowableXYZArray[], builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\n let polygon;\n while ((polygon = polygonArray.pop()) !== undefined) {\n this.addPolygonToBuilderAndDropToCache(polygon, builder, cache);\n }\n }\n private static createChainContextsForConvexClipPlaneSet(clipper: ConvexClipPlaneSet): ChainMergeContext[] {\n const chainContexts = [];\n for (const plane of clipper.planes) {\n if (!plane.interior) {\n const c = ChainMergeContext.create();\n c.plane = plane;\n c.convexClipper = clipper;\n chainContexts.push(c);\n }\n }\n return chainContexts;\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceConvexClipPlaneSetToBuilders(polyface: Polyface, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders) {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface.createVisitor(0);\n const cache = new GrowableXYZArrayCache();\n const outsideParts: GrowableXYZArray[] = [];\n for (visitor.reset(); visitor.moveToNextFacet();) {\n // !!! currentCandidates and next candidates are empty at this point !!!\n const insidePart = clipper.clipInsidePushOutside(visitor.point, outsideParts, cache);\n if (insidePart === undefined) {\n // everything is out ... outsideParts might be fragmented. Save only the original polygon\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n cache.dropToCache(insidePart);\n cache.dropAllToCache(outsideParts);\n }\n this.addPolygonToBuilderAndDropToCache(insidePart, builderA, cache);\n this.addPolygonArrayToBuilderAndDropToCache(outsideParts, builderB, cache);\n }\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForConvexSet(visitor: PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders,\n cache: GrowableXYZArrayCache) {\n if (destination.buildClosureFaces) {\n const chainContexts = this.createChainContextsForConvexClipPlaneSet(clipper);\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n for (const chainContext of chainContexts) {\n const plane = chainContext.plane;\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane!, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n for (const chainContext of chainContexts) {\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n }\n\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForPlane(visitor: PolyfaceVisitor, plane: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders,\n cache: GrowableXYZArrayCache) {\n if (destination.buildClosureFaces) {\n const chainContext = ChainMergeContext.create();\n chainContext.plane = plane;\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n private static evaluateInwardPlaneNormal(plane: PlaneAltitudeEvaluator, scale: number): Vector3d {\n return Vector3d.create(plane.velocityXYZ(scale, 0, 0), plane.velocityXYZ(0, scale, 0), plane.velocityXYZ(0, 0, scale));\n }\n /**\n * * Triangulate the contour.\n * * Add all the triangles to both builders\n * * reversed in builderB.\n */\n private static addClippedContour(contour: SweepContour, clipper: ConvexClipPlaneSet | undefined, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\n const polygonA = cache.grabFromCache();\n const polygonB = cache.grabFromCache();\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n contour.announceFacets((facets: IndexedPolyface) => {\n const visitor = facets.createVisitor();\n // The contour facets are convex .. easy clip ..\n for (visitor.reset(); visitor.moveToNextFacet();) {\n polygonA.clear();\n polygonA.pushFromGrowableXYZArray(visitor.point);\n clipper?.clipConvexPolygonInPlace(polygonA, polygonB);\n if (polygonA.length > 2) {\n destination.builderA?.addPolygonGrowableXYZArray(polygonA);\n destination.builderB?.addPolygonGrowableXYZArray(polygonA);\n }\n }\n }, undefined);\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n cache.dropToCache(polygonA);\n cache.dropToCache(polygonB);\n }\n\n /**\n * Gather loops out of the ChainMergeContext. Add to destination arrays.\n * @param chainContext ASSUMED TO HAVE A PLANE\n * @param destination\n */\n private static addClosureFacets(chainContext: ChainMergeContext, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\n const clipper = chainContext.convexClipper;\n const plane = chainContext.plane!;\n const outwardNormal = this.evaluateInwardPlaneNormal(plane, -1.0);\n chainContext.clusterAndMergeVerticesXYZ();\n const loops = chainContext.collectMaximalGrowableXYZArrays();\n if (loops.length > 1) {\n const loopSets = PolygonOps.sortOuterAndHoleLoops(loops, outwardNormal);\n for (const loopSet of loopSets) {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loopSet, outwardNormal);\n const contour = SweepContour.createForPolygon(loopSet, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n } else {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loops, outwardNormal);\n const contour = SweepContour.createForPolygon(loops, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceClipPlaneToBuilders(polyface: Polyface, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders) {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface.createVisitor(0);\n const cache = new GrowableXYZArrayCache();\n const inside = cache.grabFromCache();\n const outside = cache.grabFromCache();\n const range = Range1d.createNull();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n // !!! currentCandidates and next candidates are empty at this point !!!\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(clipper, visitor.point, inside, outside, range);\n if (builderA)\n builderA.addPolygonGrowableXYZArray(inside);\n if (builderB)\n builderB.addPolygonGrowableXYZArray(outside);\n }\n this.buildClosureFacesForPlane(visitor, clipper, destination, cache);\n cache.dropToCache(inside);\n cache.dropToCache(outside);\n }\n\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\n * * accumulate inside and outside facets -- to destination.builderA and destination.builderB\n * * if `destination.buildClosureFaces` is set, and also build closure facets\n * * This method parses the variant input types and calls a more specific method.\n * * WARNING: The new mesh is \"points only\".\n * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]\n */\n public static clipPolyfaceInsideOutside(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders,\n outputSelect: number = 0) {\n if (clipper instanceof ClipPlane) {\n this.clipPolyfaceClipPlaneToBuilders(polyface, clipper, destination);\n } else if (clipper instanceof ConvexClipPlaneSet) {\n this.clipPolyfaceConvexClipPlaneSetToBuilders(polyface, clipper, destination);\n } else if (clipper instanceof UnionOfConvexClipPlaneSets) {\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, clipper, destination, outputSelect);\n }\n }\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\n * * This method parses the variant input types and calls a more specific method.\n * * To get both inside and outside parts, use clipPolyfaceInsideOutside\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyface(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined {\n if (clipper instanceof ClipPlane)\n return this.clipPolyfaceClipPlane(polyface, clipper);\n if (clipper instanceof ConvexClipPlaneSet)\n return this.clipPolyfaceConvexClipPlaneSet(polyface, clipper);\n // (The if tests exhaust the type space -- this line is unreachable.)\n return undefined;\n }\n /**\n * Drape the region onto the mesh.\n * * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.\n * @param mesh input mesh, untouched\n * @param region planar region to drape onto mesh\n * @param sweepVector optional sweep direction for region, magnitude unused. If undefined, sweep is along the region normal.\n * @param options how to stroke the region boundary\n * @returns clipped facets. No other mesh data but vertices appear in output.\n */\n public static drapeRegion(mesh: Polyface | PolyfaceVisitor, region: AnyRegion, sweepVector?: Vector3d, options?: StrokeOptions): IndexedPolyface | undefined {\n if (mesh instanceof Polyface)\n return this.drapeRegion(mesh.createVisitor(0), region, sweepVector, options);\n const contour = SweepContour.createForLinearSweep(region);\n if (!contour)\n return undefined;\n let sweep = sweepVector;\n if (sweepVector && contour.localToWorld.matrix.dotColumnZ(sweepVector) < 0.0)\n sweep = sweepVector.scale(-1); // avoid inverted clipper\n const clipper = contour.sweepToUnionOfConvexClipPlaneSets(sweep, false, false, options);\n if (!clipper)\n return undefined;\n const builders = ClippedPolyfaceBuilders.create(true); // we want only the facets inside the clipper\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(mesh, clipper, builders, 1);\n return builders.claimPolyface(0, true);\n }\n /** Find consecutive points around a polygon (with implied closure edge) that are ON a plane\n * @param points array of points around polygon. Closure edge is implied.\n * @param chainContext context receiving edges\n * @param point0 work point\n * @param point1 work point\n */\n private static collectEdgesOnPlane(points: GrowableXYZArray, clipper: ClipPlane, chainContext: ChainMergeContext, point0: Point3d, point1: Point3d) {\n const n = points.length;\n if (n > 1) {\n points.getPoint3dAtUncheckedPointIndex(n - 1, point0);\n for (let i = 0; i < n; i++) {\n points.getPoint3dAtUncheckedPointIndex(i, point1);\n if (clipper.isPointOn(point0) && clipper.isPointOn(point1))\n chainContext.addSegment(point0, point1);\n point0.setFromPoint3d(point1);\n }\n }\n }\n /** Intersect each facet with the clip plane. (Producing intersection edges.)\n * * Return all edges chained as array of LineString3d.\n */\n public static sectionPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane): LineString3d[] {\n const chainContext = ChainMergeContext.create();\n\n const visitor = polyface.createVisitor(0);\n const work = new GrowableXYZArray(10);\n const point0 = Point3d.create();\n const point1 = Point3d.create();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work, true);\n this.collectEdgesOnPlane(visitor.point, clipper, chainContext, point0, point1);\n }\n chainContext.clusterAndMergeVerticesXYZ();\n return chainContext.collectMaximalChains();\n }\n\n /**\n * * Split facets of mesh \"A\" into parts that are\n * * under mesh \"B\"\n * * over mesh \"B\"\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are fed to caller-supplied builders.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * This step is commonly one-half of \"cut fill\".\n * * A \"cut fill\" wrapper will call this twice with the visitor and builder roles reversed.\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA: PolyfaceVisitor, visitorB: PolyfaceVisitor,\n builderAUnderB: PolyfaceBuilder | undefined,\n builderAOverB: PolyfaceBuilder | undefined) {\n const rangeDataA = PolyfaceQuery.collectRangeLengthData(visitorA);\n const searchA = RangeSearch.create2dSearcherForRangeLengthData<number>(rangeDataA);\n if (!searchA)\n return;\n const range = Range3d.create();\n for (visitorA.reset(); visitorA.moveToNextFacet();) {\n visitorA.point.setRange(range);\n searchA.addRange(range, visitorA.currentReadIndex());\n }\n const xyClip = new GrowableXYZArray(10);\n const workArray = new GrowableXYZArray(10);\n const xyFrustum = ConvexClipPlaneSet.createEmpty();\n const below = new GrowableXYZArray(10);\n const above = new GrowableXYZArray(10);\n const planeOfFacet = ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, 0)!;\n const altitudeRange = Range1d.createNull();\n\n for (visitorB.reset(); visitorB.moveToNextFacet();) {\n visitorB.point.setRange(range);\n ConvexClipPlaneSet.setPlaneAndXYLoopCCW(visitorB.point, planeOfFacet, xyFrustum);\n searchA.searchRange2d(range, (_rangeA: Range2d, readIndexA: number) => {\n visitorA.moveToReadIndex(readIndexA);\n xyFrustum.polygonClip(visitorA.point, xyClip, workArray);\n // builderAOverB.addPolygonGrowableXYZArray(xyClip);\n if (xyClip.length > 0) {\n // planeOfFacet.convexPolygonSplitInsideOutsideGrowableArrays(xyClip, below, above, altitudeRange);\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(planeOfFacet, xyClip, below, above, altitudeRange);\n if (below.length > 0 && builderAUnderB)\n builderAUnderB.addPolygonGrowableXYZArray(below);\n if (above.length > 0 && builderAOverB)\n builderAOverB.addPolygonGrowableXYZArray(above);\n }\n return true;\n });\n }\n }\n\n /**\n * * Split facets into vertically overlapping sections\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are returned as separate meshes.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * * Each output contains some facets from meshA and some from meshB:\n * * meshAUnderB -- areas where meshA is underneath mesh B.\n * * If A is \"design surface\" and B is existing DTM, this is \"cut\" volume\n * * meshAOverB -- areas where meshB is over meshB.\n * * If A is \"design surface\" and B is existing DTM, this is \"fill\" volume\n *\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static computeCutFill(meshA: IndexedPolyface, meshB: IndexedPolyface): { meshAUnderB: IndexedPolyface, meshAOverB: IndexedPolyface } {\n const visitorA = meshA.createVisitor();\n const visitorB = meshB.createVisitor();\n const builderAUnderB = PolyfaceBuilder.create();\n const builderAOverB = PolyfaceBuilder.create();\n builderAUnderB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA, visitorB, builderAUnderB, builderAOverB);\n builderAUnderB.toggleReversedFacetFlag();\n builderAOverB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorB, visitorA, builderAOverB, builderAUnderB);\n return {\n meshAUnderB: builderAUnderB.claimPolyface(),\n meshAOverB: builderAOverB.claimPolyface(),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"PolyfaceClip.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAA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AAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;QACxG,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,aAAa,CAAC,uBAAuB,EAAE,CAAC;QACxC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QACxG,OAAO;YACL,WAAW,EAAE,cAAc,CAAC,aAAa,EAAE;YAC3C,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE;SAC1C,CAAC;IACJ,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 Polyface\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { ClipPlane } from \"../clipping/ClipPlane\";\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\nimport { AnyRegion } from \"../curve/CurveTypes\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range2d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SweepContour } from \"../solid/SweepContour\";\nimport { ChainMergeContext } from \"../topology/ChainMerge\";\nimport { RangeSearch } from \"./multiclip/RangeSearch\";\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceBuilder } from \"./PolyfaceBuilder\";\nimport { PolyfaceQuery } from \"./PolyfaceQuery\";\n\n/**\n * carrier for a point array with an index into UnionOfConvexClipPlaneSets\n * @private\n */\nclass ClipCandidate {\n public nextConvexSetIndex: number;\n public points: GrowableXYZArray;\n public constructor(points: GrowableXYZArray, nextConvexSetIndex: number) {\n this.nextConvexSetIndex = nextConvexSetIndex;\n this.points = points;\n }\n}\n\n/**\n * A pair of [[PolyfaceBuilder]] objects, for use by clippers that emit inside and outside parts.\n * * @public\n */\nexport class ClippedPolyfaceBuilders {\n /** An available builder. Typically the \"inside\" parts */\n public builderA?: PolyfaceBuilder;\n /** An available builder. Typically the \"outside\" parts */\n public builderB?: PolyfaceBuilder;\n /** request to construct cut faces */\n public buildClosureFaces?: boolean;\n private constructor(builderA: PolyfaceBuilder | undefined, builderB: PolyfaceBuilder | undefined, buildClosureFaces: boolean = false) {\n this.builderA = builderA;\n this.builderB = builderB;\n this.buildClosureFaces = buildClosureFaces;\n }\n /**\n * Static constructor with default options for the builders.\n * @param keepInside whether to collect clipped facets inside the clipper to `this.builderA` (default true)\n * @param keepOutside whether to collect clipped facets outside the clipper to `this.builderB` (default false)\n * @param buildSideFaces whether to add side facets to active builders (default false)\n */\n public static create(keepInside: boolean = true, keepOutside: boolean = false, buildSideFaces: boolean = false): ClippedPolyfaceBuilders {\n return new ClippedPolyfaceBuilders(keepInside ? PolyfaceBuilder.create() : undefined, keepOutside ? PolyfaceBuilder.create() : undefined, buildSideFaces);\n }\n\n /**\n * Return the computed facets from the selected builder.\n * @param selector the polyface to return: 0 - builderA (typically inside facets), 1 - builderB (typically outside facets)\n * @param fixup whether to clean up the polyface\n * @param tolerance compression tolerance (default [[Geometry.smallMetricDistance]]).\n */\n public claimPolyface(selector: 0 | 1, fixup: boolean, tolerance: number = Geometry.smallMetricDistance): IndexedPolyface | undefined {\n const builder = selector === 0 ? this.builderA : this.builderB;\n if (builder) {\n let polyface = builder.claimPolyface(true, tolerance);\n if (fixup) {\n polyface = PolyfaceQuery.cloneWithTVertexFixup(polyface);\n polyface = PolyfaceQuery.cloneWithDanglingEdgesRemoved(polyface);\n }\n return polyface;\n }\n return undefined;\n }\n}\n/** PolyfaceClip is a static class gathering operations using Polyfaces and clippers.\n * @public\n */\nexport class PolyfaceClip {\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlaneWithClosureFace(source: Polyface | PolyfaceVisitor, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = true): IndexedPolyface {\n return this.clipPolyfaceClipPlane(source, clipper, insideClip, buildClosureFaces);\n }\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlane(source: Polyface | PolyfaceVisitor, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = false): IndexedPolyface {\n const builders = ClippedPolyfaceBuilders.create(insideClip, !insideClip, buildClosureFaces);\n this.clipPolyfaceInsideOutside(source, clipper, builders);\n return builders.claimPolyface(insideClip ? 0 : 1, true)!;\n }\n\n /**\n * Clip each facet to the clipper.\n * * Return surviving facets as a new mesh.\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyfaceConvexClipPlaneSet(source: Polyface | PolyfaceVisitor, clipper: ConvexClipPlaneSet): IndexedPolyface {\n const visitor = source instanceof Polyface ? source.createVisitor(0) : source;\n visitor.setNumWrap(0);\n const builder = PolyfaceBuilder.create();\n const work = new GrowableXYZArray(10);\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work);\n if (visitor.point.length > 2)\n builder.addPolygonGrowableXYZArray(visitor.point);\n }\n return builder.claimPolyface(true);\n }\n\n /** Clip each facet to the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * * outputSelect determines how the clip output is structured\n * * 0 outputs all shards -- this may have many interior edges.\n * * 1 stitches shards together to get cleaner facets.\n */\n public static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(source: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector: number = 1): void {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = source instanceof Polyface ? source.createVisitor(0) : source;\n visitor.setNumWrap(0);\n const cache = new GrowableXYZArrayCache();\n const insideShards: GrowableXYZArray[] = [];\n const outsideShards: GrowableXYZArray[] = [];\n const residualPolygons: ClipCandidate[] = [];\n let candidate: ClipCandidate | undefined;\n const outsideParts: GrowableXYZArray[] = [];\n\n const numConvexSet = allClippers.convexSets.length;\n for (visitor.reset(); visitor.moveToNextFacet();) {\n residualPolygons.push(new ClipCandidate(cache.grabAndFill(visitor.point), 0));\n while ((candidate = residualPolygons.pop()) !== undefined) {\n const convexSetIndex = candidate.nextConvexSetIndex;\n if (convexSetIndex >= numConvexSet) {\n // ths remnant polygon is OUT ...\n if (candidate.points.length > 2)\n outsideShards.push(candidate.points);\n } else {\n const clipper = allClippers.convexSets[convexSetIndex];\n outsideParts.length = 0; // NO NO -- why isn't it empty from prior step cleanup?\n const insidePart = clipper.clipInsidePushOutside(candidate.points, outsideParts, cache);\n if (insidePart) {\n if (insidePart.length > 2)\n insideShards.push(insidePart);\n // Keep outside parts active for clip by later facets . . .\n for (const outsidePolygon of outsideParts) {\n residualPolygons.push(new ClipCandidate(outsidePolygon, convexSetIndex + 1));\n }\n } else {\n // Nothing was insidePart. The outside parts might be split by intermediate steps -- but all the pieces are there.\n candidate.nextConvexSetIndex++;\n residualPolygons.push(candidate);\n }\n outsideParts.length = 0;\n }\n }\n if (outsideShards.length === 0) {\n builderA?.addPolygonGrowableXYZArray(visitor.point);\n } else if (insideShards.length === 0) {\n // the facet spanned clippers but is intact outside\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n } else {\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, visitor.point);\n let worldToLocal: Transform | undefined;\n if (outputSelector === 1 && localToWorld !== undefined\n && undefined !== (worldToLocal = localToWorld.inverse())) {\n this.cleanupAndAddRegion(builderA, insideShards, worldToLocal, localToWorld);\n this.cleanupAndAddRegion(builderB, outsideShards, worldToLocal, localToWorld);\n } else {\n for (const shard of insideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderA, cache);\n for (const shard of outsideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderB, cache);\n }\n }\n outsideShards.length = 0;\n insideShards.length = 0;\n }\n cache.dropAllToCache(outsideParts);\n if (destination.buildClosureFaces) {\n for (const clipper of allClippers.convexSets) {\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n }\n }\n private static addRegion(builder: PolyfaceBuilder | undefined, region: AnyRegion | undefined): void {\n if (builder !== undefined && region !== undefined) {\n if (region instanceof Loop && region.children.length === 1 && region.children[0] instanceof LineString3d) {\n builder.addPolygonGrowableXYZArray(region.children[0].packedPoints);\n } else if (region instanceof UnionRegion) {\n for (const child of region.children)\n this.addRegion(builder, child);\n } else {\n assert(false, \"unexpected region encountered\");\n }\n }\n }\n // WARNING: shards are transformed into local system, not reverted!!!\n private static cleanupAndAddRegion(builder: PolyfaceBuilder | undefined, shards: GrowableXYZArray[], worldToLocal: Transform | undefined, localToWorld: Transform | undefined): void {\n if (builder !== undefined && shards.length > 0) {\n if (worldToLocal)\n GrowableXYZArray.multiplyTransformInPlace(worldToLocal, shards);\n const outsidePieces = RegionOps.polygonBooleanXYToLoops(shards, RegionBinaryOpType.Union, []);\n if (outsidePieces && outsidePieces.children.length > 0) {\n RegionOps.consolidateAdjacentPrimitives(outsidePieces); // source of the T-vertices removed in claimPolyface\n const options = new StrokeOptions();\n options.maximizeConvexFacets = true;\n const localFacets = RegionOps.facetRegionXY(outsidePieces, options);\n if (localFacets) {\n // prefer to add non-convex facets\n builder.addIndexedPolyface(localFacets, false, localToWorld);\n } else { // failsafe; we don't expect to get here\n if (localToWorld)\n outsidePieces.tryTransformInPlace(localToWorld);\n this.addRegion(builder, outsidePieces); // possibly non-convex!\n }\n }\n }\n }\n private static addPolygonToBuilderAndDropToCache(polygon: GrowableXYZArray | undefined, builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache): void {\n if (polygon) {\n if (builder)\n builder.addPolygonGrowableXYZArray(polygon);\n cache.dropToCache(polygon);\n }\n }\n private static addPolygonArrayToBuilderAndDropToCache(polygonArray: GrowableXYZArray[], builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache): void {\n let polygon;\n while ((polygon = polygonArray.pop()) !== undefined) {\n this.addPolygonToBuilderAndDropToCache(polygon, builder, cache);\n }\n }\n private static createChainContextsForConvexClipPlaneSet(clipper: ConvexClipPlaneSet): ChainMergeContext[] {\n const chainContexts = [];\n for (const plane of clipper.planes) {\n if (!plane.interior) {\n const c = ChainMergeContext.create();\n c.plane = plane;\n c.convexClipper = clipper;\n chainContexts.push(c);\n }\n }\n return chainContexts;\n }\n\n /** Clip each facet to the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceConvexClipPlaneSetToBuilders(source: Polyface | PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders): void {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = source instanceof Polyface ? source.createVisitor(0) : source;\n visitor.setNumWrap(0);\n const cache = new GrowableXYZArrayCache();\n const outsideParts: GrowableXYZArray[] = [];\n for (visitor.reset(); visitor.moveToNextFacet();) {\n const insidePart = clipper.clipInsidePushOutside(visitor.point, outsideParts, cache);\n if (insidePart === undefined) {\n // everything is out ... outsideParts might be fragmented. Save only the original polygon\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n cache.dropAllToCache(outsideParts);\n }\n this.addPolygonToBuilderAndDropToCache(insidePart, builderA, cache);\n this.addPolygonArrayToBuilderAndDropToCache(outsideParts, builderB, cache);\n }\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForConvexSet(visitor: PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache): void {\n if (destination.buildClosureFaces) {\n const chainContexts = this.createChainContextsForConvexClipPlaneSet(clipper);\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n for (const chainContext of chainContexts) {\n const plane = chainContext.plane;\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane!, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n for (const chainContext of chainContexts) {\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n }\n\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForPlane(visitor: PolyfaceVisitor, plane: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache): void {\n if (destination.buildClosureFaces) {\n const chainContext = ChainMergeContext.create();\n chainContext.plane = plane;\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n private static evaluateInwardPlaneNormal(plane: PlaneAltitudeEvaluator, scale: number): Vector3d {\n return Vector3d.create(plane.velocityXYZ(scale, 0, 0), plane.velocityXYZ(0, scale, 0), plane.velocityXYZ(0, 0, scale));\n }\n /**\n * * Triangulate the contour.\n * * Add all the triangles to both builders\n * * reversed in builderB.\n */\n private static addClippedContour(contour: SweepContour, clipper: ConvexClipPlaneSet | undefined, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache): void {\n const polygonA = cache.grabFromCache();\n const polygonB = cache.grabFromCache();\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n contour.announceFacets((facets: IndexedPolyface) => {\n const visitor = facets.createVisitor();\n // The contour facets are convex .. easy clip ..\n for (visitor.reset(); visitor.moveToNextFacet();) {\n polygonA.clear();\n polygonA.pushFromGrowableXYZArray(visitor.point);\n clipper?.clipConvexPolygonInPlace(polygonA, polygonB);\n if (polygonA.length > 2) {\n destination.builderA?.addPolygonGrowableXYZArray(polygonA);\n destination.builderB?.addPolygonGrowableXYZArray(polygonA);\n }\n }\n }, undefined);\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n cache.dropToCache(polygonA);\n cache.dropToCache(polygonB);\n }\n\n /**\n * Gather loops out of the ChainMergeContext. Add to destination arrays.\n * @param chainContext ASSUMED TO HAVE A PLANE\n * @param destination\n */\n private static addClosureFacets(chainContext: ChainMergeContext, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache): void {\n const clipper = chainContext.convexClipper;\n const plane = chainContext.plane!;\n const outwardNormal = this.evaluateInwardPlaneNormal(plane, -1.0);\n chainContext.clusterAndMergeVerticesXYZ();\n const loops = chainContext.collectMaximalGrowableXYZArrays();\n if (loops.length > 1) {\n const loopSets = PolygonOps.sortOuterAndHoleLoops(loops, outwardNormal);\n for (const loopSet of loopSets) {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loopSet, outwardNormal);\n const contour = SweepContour.createForPolygon(loopSet, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n } else {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loops, outwardNormal);\n const contour = SweepContour.createForPolygon(loops, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n }\n\n /** Clip each facet to the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceClipPlaneToBuilders(source: Polyface | PolyfaceVisitor, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders): void {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = source instanceof Polyface ? source.createVisitor(0) : source;\n visitor.setNumWrap(0);\n const cache = new GrowableXYZArrayCache();\n const inside = cache.grabFromCache();\n const outside = cache.grabFromCache();\n const range = Range1d.createNull();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n // !!! currentCandidates and next candidates are empty at this point !!!\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(clipper, visitor.point, inside, outside, range);\n if (builderA)\n builderA.addPolygonGrowableXYZArray(inside);\n if (builderB)\n builderB.addPolygonGrowableXYZArray(outside);\n }\n this.buildClosureFacesForPlane(visitor, clipper, destination, cache);\n cache.dropToCache(inside);\n cache.dropToCache(outside);\n }\n\n /** Clip each facet to the clipper.\n * * accumulate inside and outside facets -- to destination.builderA and destination.builderB\n * * if `destination.buildClosureFaces` is set, also build closure facets.\n * * This method parses the variant input types and calls a more specific method.\n * * WARNING: The new mesh is \"points only\".\n * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]\n */\n public static clipPolyfaceInsideOutside(source: Polyface | PolyfaceVisitor, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelect: number = 0): void {\n if (clipper instanceof ClipPlane)\n this.clipPolyfaceClipPlaneToBuilders(source, clipper, destination);\n else if (clipper instanceof ConvexClipPlaneSet)\n this.clipPolyfaceConvexClipPlaneSetToBuilders(source, clipper, destination);\n else if (clipper instanceof UnionOfConvexClipPlaneSets)\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(source, clipper, destination, outputSelect);\n }\n /** Clip each facet to the clipper.\n * * This method parses the variant input types and calls a more specific method.\n * * To get both inside and outside parts, use clipPolyfaceInsideOutside\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyface(source: Polyface | PolyfaceVisitor, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined {\n if (clipper instanceof ClipPlane)\n return this.clipPolyfaceClipPlane(source, clipper);\n if (clipper instanceof ConvexClipPlaneSet)\n return this.clipPolyfaceConvexClipPlaneSet(source, clipper);\n // (The if tests exhaust the type space -- this line is unreachable.)\n return undefined;\n }\n /**\n * Drape the region onto the mesh.\n * * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.\n * @param mesh input mesh, untouched\n * @param region planar region to drape onto mesh\n * @param sweepVector optional sweep direction for region, magnitude unused. If undefined, sweep is along the region normal.\n * @param options how to stroke the region boundary\n * @returns clipped facets. No other mesh data but vertices appear in output.\n */\n public static drapeRegion(mesh: Polyface | PolyfaceVisitor, region: AnyRegion, sweepVector?: Vector3d, options?: StrokeOptions): IndexedPolyface | undefined {\n if (mesh instanceof Polyface)\n return this.drapeRegion(mesh.createVisitor(0), region, sweepVector, options);\n const contour = SweepContour.createForLinearSweep(region);\n if (!contour)\n return undefined;\n let sweep = sweepVector;\n if (sweepVector && contour.localToWorld.matrix.dotColumnZ(sweepVector) < 0.0)\n sweep = sweepVector.scale(-1); // avoid inverted clipper\n const clipper = contour.sweepToUnionOfConvexClipPlaneSets(sweep, false, false, options);\n if (!clipper)\n return undefined;\n const builders = ClippedPolyfaceBuilders.create(true); // we want only the facets inside the clipper\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(mesh, clipper, builders, 1);\n return builders.claimPolyface(0, true);\n }\n /** Find consecutive points around a polygon (with implied closure edge) that are ON a plane\n * @param points array of points around polygon. Closure edge is implied.\n * @param chainContext context receiving edges\n * @param point0 work point\n * @param point1 work point\n */\n private static collectEdgesOnPlane(points: GrowableXYZArray, clipper: ClipPlane, chainContext: ChainMergeContext, point0: Point3d, point1: Point3d): void {\n const n = points.length;\n if (n > 1) {\n points.getPoint3dAtUncheckedPointIndex(n - 1, point0);\n for (let i = 0; i < n; i++) {\n points.getPoint3dAtUncheckedPointIndex(i, point1);\n if (clipper.isPointOn(point0) && clipper.isPointOn(point1))\n chainContext.addSegment(point0, point1);\n point0.setFromPoint3d(point1);\n }\n }\n }\n /** Intersect each facet with the clip plane. (Producing intersection edges.)\n * * Return all edges chained as array of LineString3d.\n */\n public static sectionPolyfaceClipPlane(source: Polyface | PolyfaceVisitor, clipper: ClipPlane): LineString3d[] {\n const chainContext = ChainMergeContext.create();\n const visitor = source instanceof Polyface ? source.createVisitor(0) : source;\n visitor.setNumWrap(0);\n const work = new GrowableXYZArray(10);\n const point0 = Point3d.create();\n const point1 = Point3d.create();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work, true);\n this.collectEdgesOnPlane(visitor.point, clipper, chainContext, point0, point1);\n }\n chainContext.clusterAndMergeVerticesXYZ();\n return chainContext.collectMaximalChains();\n }\n\n /**\n * * Split facets of mesh \"A\" into parts that are\n * * under mesh \"B\"\n * * over mesh \"B\"\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are fed to caller-supplied builders.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * This step is commonly one-half of \"cut fill\".\n * * A \"cut fill\" wrapper will call this twice with the visitor and builder roles reversed.\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA: PolyfaceVisitor, visitorB: PolyfaceVisitor, builderAUnderB: PolyfaceBuilder | undefined, builderAOverB: PolyfaceBuilder | undefined): void {\n const rangeDataA = PolyfaceQuery.collectRangeLengthData(visitorA);\n const searchA = RangeSearch.create2dSearcherForRangeLengthData<number>(rangeDataA);\n if (!searchA)\n return;\n const range = Range3d.create();\n for (visitorA.reset(); visitorA.moveToNextFacet();) {\n visitorA.point.setRange(range);\n searchA.addRange(range, visitorA.currentReadIndex());\n }\n const xyClip = new GrowableXYZArray(10);\n const workArray = new GrowableXYZArray(10);\n const xyFrustum = ConvexClipPlaneSet.createEmpty();\n const below = new GrowableXYZArray(10);\n const above = new GrowableXYZArray(10);\n const planeOfFacet = ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, 0)!;\n const altitudeRange = Range1d.createNull();\n\n for (visitorB.reset(); visitorB.moveToNextFacet();) {\n visitorB.point.setRange(range);\n ConvexClipPlaneSet.setPlaneAndXYLoopCCW(visitorB.point, planeOfFacet, xyFrustum);\n searchA.searchRange2d(range, (_rangeA: Range2d, readIndexA: number) => {\n visitorA.moveToReadIndex(readIndexA);\n xyFrustum.polygonClip(visitorA.point, xyClip, workArray);\n // builderAOverB.addPolygonGrowableXYZArray(xyClip);\n if (xyClip.length > 0) {\n // planeOfFacet.convexPolygonSplitInsideOutsideGrowableArrays(xyClip, below, above, altitudeRange);\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(planeOfFacet, xyClip, below, above, altitudeRange);\n if (below.length > 0 && builderAUnderB)\n builderAUnderB.addPolygonGrowableXYZArray(below);\n if (above.length > 0 && builderAOverB)\n builderAOverB.addPolygonGrowableXYZArray(above);\n }\n return true;\n });\n }\n }\n\n /**\n * * Split facets into vertically overlapping sections\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are returned as separate meshes.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * * Each output contains some facets from meshA and some from meshB:\n * * meshAUnderB -- areas where meshA is underneath mesh B.\n * * If A is \"design surface\" and B is existing DTM, this is \"cut\" volume\n * * meshAOverB -- areas where meshB is over meshB.\n * * If A is \"design surface\" and B is existing DTM, this is \"fill\" volume\n *\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static computeCutFill(meshA: IndexedPolyface, meshB: IndexedPolyface): { meshAUnderB: IndexedPolyface, meshAOverB: IndexedPolyface } {\n const visitorA = meshA.createVisitor();\n const visitorB = meshB.createVisitor();\n const builderAUnderB = PolyfaceBuilder.create();\n const builderAOverB = PolyfaceBuilder.create();\n builderAUnderB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA, visitorB, builderAUnderB, builderAOverB);\n builderAUnderB.toggleReversedFacetFlag();\n builderAOverB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorB, visitorA, builderAOverB, builderAUnderB);\n return {\n meshAUnderB: builderAUnderB.claimPolyface(),\n meshAOverB: builderAOverB.claimPolyface(),\n };\n }\n}\n"]}
@@ -187,7 +187,7 @@ export declare class PolyfaceData {
187
187
  resizeAllArrays(length: number): void;
188
188
  /**
189
189
  * Resize all data arrays to the specified `length`.
190
- * @deprecated in 4.x because name is misleading. Call [[PolyfaceData.resizeAllArrays]] instead.
190
+ * @deprecated in 4.5.0 - will not be removed until after 2026-06-13. Because name is misleading. Call [[PolyfaceData.resizeAllArrays]] instead.
191
191
  */
192
192
  resizeAllDataArrays(length: number): void;
193
193
  /** Return the range of the point array (optionally transformed). */
@@ -503,7 +503,7 @@ export class PolyfaceData {
503
503
  }
504
504
  /**
505
505
  * Resize all data arrays to the specified `length`.
506
- * @deprecated in 4.x because name is misleading. Call [[PolyfaceData.resizeAllArrays]] instead.
506
+ * @deprecated in 4.5.0 - will not be removed until after 2026-06-13. Because name is misleading. Call [[PolyfaceData.resizeAllArrays]] instead.
507
507
  */
508
508
  resizeAllDataArrays(length) {
509
509
  if (length > this.point.length) {