@itwin/core-geometry 5.2.0-dev.30 → 5.2.0-dev.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/lib/cjs/Constant.js.map +1 -1
  2. package/lib/cjs/Geometry.js.map +1 -1
  3. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  4. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  9. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  10. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  12. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  13. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  14. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  15. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  16. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  17. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  18. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  19. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  20. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  21. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  22. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  23. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  24. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  25. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  26. package/lib/cjs/core-geometry.js.map +1 -1
  27. package/lib/cjs/curve/Arc3d.js.map +1 -1
  28. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  29. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  30. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  31. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  32. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  33. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  34. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  35. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  36. package/lib/cjs/curve/CurveOps.js.map +1 -1
  37. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  38. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  39. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  40. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  41. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  42. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  43. package/lib/cjs/curve/LineString3d.js.map +1 -1
  44. package/lib/cjs/curve/Loop.js.map +1 -1
  45. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  46. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  47. package/lib/cjs/curve/Path.js.map +1 -1
  48. package/lib/cjs/curve/PointString3d.js.map +1 -1
  49. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  50. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  51. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  52. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  53. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  54. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  55. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  56. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  57. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  58. package/lib/cjs/curve/RegionOps.js.map +1 -1
  59. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  60. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  61. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  62. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  63. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  64. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  65. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  66. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  67. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  68. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  69. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  71. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  72. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  73. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  75. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  83. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  84. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  85. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  86. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  87. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  88. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  89. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  90. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  91. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  92. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  93. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  94. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  95. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  96. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  97. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  98. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  99. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  100. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  101. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  102. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  103. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  104. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  105. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  106. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  107. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  108. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  109. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  110. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  111. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  112. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  113. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  114. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  115. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  116. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  117. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  118. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  119. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  120. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  121. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  122. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  123. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  124. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  125. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  126. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  127. package/lib/cjs/geometry3d/Range.js.map +1 -1
  128. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  129. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  130. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  131. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  132. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  133. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  134. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  135. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  136. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  137. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  138. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  139. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  140. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  141. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  142. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  143. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  144. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  145. package/lib/cjs/numerics/Complex.js.map +1 -1
  146. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  147. package/lib/cjs/numerics/Newton.js.map +1 -1
  148. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  149. package/lib/cjs/numerics/PolarData.js.map +1 -1
  150. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  151. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  152. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  153. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  154. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  155. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  156. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  157. package/lib/cjs/polyface/AuxData.js.map +1 -1
  158. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  159. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  160. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  161. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  162. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  163. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  164. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  165. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  166. package/lib/cjs/polyface/Polyface.js.map +1 -1
  167. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  168. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  169. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  170. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  171. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  172. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  173. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  174. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  175. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  176. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  177. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  178. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  179. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  180. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  181. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  182. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  183. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  184. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  185. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  186. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  187. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  188. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  189. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  190. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  191. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  192. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  193. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  194. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  195. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  196. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  197. package/lib/cjs/solid/Box.js.map +1 -1
  198. package/lib/cjs/solid/Cone.js.map +1 -1
  199. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  200. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  201. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  202. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  203. package/lib/cjs/solid/Sphere.js.map +1 -1
  204. package/lib/cjs/solid/SweepContour.js.map +1 -1
  205. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  206. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  207. package/lib/cjs/topology/Graph.js.map +1 -1
  208. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  209. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  210. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  211. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  212. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  213. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  214. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  215. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  216. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  217. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  218. package/lib/cjs/topology/MaskManager.js.map +1 -1
  219. package/lib/cjs/topology/Merging.js.map +1 -1
  220. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  221. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  222. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  223. package/lib/cjs/topology/Triangulation.js.map +1 -1
  224. package/lib/cjs/topology/Voronoi.js.map +1 -1
  225. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  226. package/lib/esm/Constant.js.map +1 -1
  227. package/lib/esm/Geometry.js.map +1 -1
  228. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  229. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  230. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  231. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  232. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  233. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  234. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  235. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  236. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  237. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  238. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  239. package/lib/esm/bspline/KnotVector.js.map +1 -1
  240. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  241. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  242. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  243. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  244. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  245. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  246. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  247. package/lib/esm/clipping/ClipVector.js.map +1 -1
  248. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  249. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  250. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  251. package/lib/esm/core-geometry.js.map +1 -1
  252. package/lib/esm/curve/Arc3d.js.map +1 -1
  253. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  254. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  255. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  256. package/lib/esm/curve/CurveCollection.js.map +1 -1
  257. package/lib/esm/curve/CurveCurve.js.map +1 -1
  258. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  259. package/lib/esm/curve/CurveFactory.js.map +1 -1
  260. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  261. package/lib/esm/curve/CurveOps.js.map +1 -1
  262. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  263. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  264. package/lib/esm/curve/CurveTypes.js.map +1 -1
  265. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  266. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  267. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  268. package/lib/esm/curve/LineString3d.js.map +1 -1
  269. package/lib/esm/curve/Loop.js.map +1 -1
  270. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  271. package/lib/esm/curve/ParityRegion.js.map +1 -1
  272. package/lib/esm/curve/Path.js.map +1 -1
  273. package/lib/esm/curve/PointString3d.js.map +1 -1
  274. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  275. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  276. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  277. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  278. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  279. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  280. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  281. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  282. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  283. package/lib/esm/curve/RegionOps.js.map +1 -1
  284. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  285. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  286. package/lib/esm/curve/UnionRegion.js.map +1 -1
  287. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  288. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  289. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  290. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  291. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  292. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  293. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  294. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  295. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  296. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  297. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  298. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  299. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  300. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  301. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  302. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  303. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  304. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  305. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  306. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  307. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  308. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  309. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  310. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  311. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  312. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  313. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  314. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  315. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  316. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  317. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  318. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  319. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  320. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  321. package/lib/esm/geometry3d/Angle.js.map +1 -1
  322. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  323. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  324. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  325. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  326. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  327. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  328. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  329. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  330. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  331. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  332. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  333. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  334. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  335. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  336. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  337. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  338. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  339. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  340. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  341. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  342. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  343. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  344. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  345. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  346. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  347. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  348. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  349. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  350. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  351. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  352. package/lib/esm/geometry3d/Range.js.map +1 -1
  353. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  354. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  355. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  356. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  357. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  358. package/lib/esm/geometry3d/Transform.js.map +1 -1
  359. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  360. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  361. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  362. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  363. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  364. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  365. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  366. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  367. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  368. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  369. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  370. package/lib/esm/numerics/Complex.js.map +1 -1
  371. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  372. package/lib/esm/numerics/Newton.js.map +1 -1
  373. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  374. package/lib/esm/numerics/PolarData.js.map +1 -1
  375. package/lib/esm/numerics/Polynomials.js.map +1 -1
  376. package/lib/esm/numerics/Quadrature.js.map +1 -1
  377. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  378. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  379. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  380. package/lib/esm/numerics/UnionFind.js.map +1 -1
  381. package/lib/esm/numerics/UsageSums.js.map +1 -1
  382. package/lib/esm/polyface/AuxData.js.map +1 -1
  383. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  384. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  385. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  386. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  387. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  388. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  389. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  390. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  391. package/lib/esm/polyface/Polyface.js.map +1 -1
  392. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  393. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  394. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  395. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  396. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  397. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  398. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  399. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  400. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  401. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  402. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  403. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  404. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  405. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  406. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  407. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  408. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  409. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  410. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  411. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  412. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  413. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  414. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  415. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  416. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  417. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  418. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  419. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  420. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  421. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  422. package/lib/esm/solid/Box.js.map +1 -1
  423. package/lib/esm/solid/Cone.js.map +1 -1
  424. package/lib/esm/solid/LinearSweep.js.map +1 -1
  425. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  426. package/lib/esm/solid/RuledSweep.js.map +1 -1
  427. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  428. package/lib/esm/solid/Sphere.js.map +1 -1
  429. package/lib/esm/solid/SweepContour.js.map +1 -1
  430. package/lib/esm/solid/TorusPipe.js.map +1 -1
  431. package/lib/esm/topology/ChainMerge.js.map +1 -1
  432. package/lib/esm/topology/Graph.js.map +1 -1
  433. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  434. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  435. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  436. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  437. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  438. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  439. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  440. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  441. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  442. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  443. package/lib/esm/topology/MaskManager.js.map +1 -1
  444. package/lib/esm/topology/Merging.js.map +1 -1
  445. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  446. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  447. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  448. package/lib/esm/topology/Triangulation.js.map +1 -1
  449. package/lib/esm/topology/Voronoi.js.map +1 -1
  450. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  451. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ClipUtils.js","sourceRoot":"","sources":["../../../src/clipping/ClipUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,8DAAmE;AACnE,wDAAqD;AACrD,4DAAmH;AAGnH,0DAAuD;AACvD,wDAAqD;AACrD,wCAAqC;AACrC,wCAAqC;AACrC,kDAAmE;AAEnE,sDAAmD;AACnD,0CAAuC;AACvC,6DAA0D;AAE1D,qEA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,CAAC;IACxB,CAAC;IACD,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AACvB,CAAC;AACD;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CAC1B,MAAsB,EACtB,SAA6B,EAC7B,UAA0C,EAC1C,WAA2C,EAC3C,cAA8C,EAC9C,UAAiC;IAEjC,IAAI,WAAW,CAAC;IAChB,IAAI,MAAM,KAAK,cAAc,CAAC,QAAQ;QACpC,WAAW,GAAG,UAAU,CAAC;SACtB,IAAI,MAAM,KAAK,cAAc,CAAC,SAAS;QAC1C,WAAW,GAAG,WAAW,CAAC;SACvB,IAAI,MAAM,KAAK,cAAc,CAAC,cAAc;QAC/C,WAAW,GAAG,cAAc,CAAC;IAC/B,4EAA4E;IAC5E,IAAI,WAAW,KAAK,SAAS;QAC3B,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;SAClC,CAAC;QACJ,KAAK,MAAM,CAAC,IAAI,SAAS;YACvB,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AACvB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { BagOfCurves, CurveChain } from \"../curve/CurveCollection\";\r\nimport { CurveFactory } from \"../curve/CurveFactory\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { AnyCurve, AnyRegion } from \"../curve/CurveTypes\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { LowAndHighXY, XAndY } from \"../geometry3d/XYZProps\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { Voronoi } from \"../topology/Voronoi\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { ClipPrimitive } from \"./ClipPrimitive\";\r\nimport { ClipVector } from \"./ClipVector\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\nimport { LineStringOffsetClipperContext } from \"./internalContexts/LineStringOffsetClipperContext\";\r\nimport { UnionOfConvexClipPlaneSets } from \"./UnionOfConvexClipPlaneSets\";\r\n\r\n/**\r\n * Enumerated type for describing where geometry lies with respect to clipping planes.\r\n * @public\r\n */\r\nexport enum ClipPlaneContainment {\r\n /** All points inside. */\r\n StronglyInside = 1,\r\n /** Inside/outside state unknown. */\r\n Ambiguous = 2,\r\n /** All points outside. */\r\n StronglyOutside = 3,\r\n}\r\n/**\r\n * Enumeration of ways to handle an intermediate fragment from a clipping step.\r\n * @public\r\n */\r\nexport enum ClipStepAction {\r\n /** Pass fragments directly to final accepted \"in\" state. */\r\n acceptIn = 1,\r\n /** Pass fragments directly to final accepted \"out\" state. */\r\n acceptOut = -1,\r\n /** Forward fragments to subsequent steps. */\r\n passToNextStep = 0,\r\n}\r\n\r\n/**\r\n * Enumerated type for describing what must yet be done to clip a piece of geometry.\r\n * @public\r\n */\r\nexport enum ClipStatus {\r\n /** Some geometry may cross the clip boundaries */\r\n ClipRequired,\r\n /** Geometry is clearly outside */\r\n TrivialReject,\r\n /** Geometry is clearly inside */\r\n TrivialAccept,\r\n}\r\n\r\n/**\r\n * An object containing clipping planes that can be used to clip geometry.\r\n * @public\r\n */\r\nexport interface Clipper {\r\n /** Test if `point` is on or inside the Clipper's volume. */\r\n isPointOnOrInside(point: Point3d, tolerance?: number): boolean;\r\n /**\r\n * Find the parts of the line segment (if any) that is within the convex clip volume.\r\n * * The line segment is defined by `pointA` and `pointB`.\r\n * * The input fractional interval from `fraction0` to `fraction1` (increasing) is the active part to consider.\r\n * * To clip to the usual bounded line segment, start with fractions (0,1).\r\n * If the clip volume is unbounded, the line interval may also be unbounded.\r\n * * An unbounded line portion will have fraction coordinates positive or negative `Number.MAX_VALUE`.\r\n * @param f0 fraction that is the initial lower fraction of the active interval (e.g., 0.0 for bounded segment).\r\n * @param f1 fraction that is the initial upper fraction of the active interval (e.g., 1.0 for bounded segment).\r\n * @param pointA segment start (fraction 0)\r\n * @param pointB segment end (fraction 1)\r\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\r\n * @returns true if a segment was announced, false if entirely outside.\r\n */\r\n announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber\r\n ): boolean;\r\n /**\r\n * Find the portion (or portions) of the arc (if any) that are within the convex clip volume.\r\n * @param arc the arc to be clipped.\r\n * @param announce function to be called to announce a fraction intervals that are within the convex clip volume.\r\n * @returns true if one or more arcs portions were announced, false if entirely outside.\r\n */\r\n announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean;\r\n /**\r\n * Optional polygon clip method.\r\n * * This is expected to be implemented by planar clip structures.\r\n * * This is unimplemented for curve clippers (e.g. sphere) for which polygon clip result has curved edges.\r\n * * The input polygon must be convex.\r\n */\r\n appendPolygonClip?: AppendPolygonClipFunction;\r\n}\r\n/**\r\n * Signature of method to execute polygon clip, distributing fragments of xyz among insideFragments and outsideFragments\r\n * @param xyz convex polygon. This is not changed.\r\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from\r\n * the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from\r\n * the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n */\r\ntype AppendPolygonClipFunction = (\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache\r\n) => void;\r\n\r\n/**\r\n * Interface for clipping convex polygons.\r\n * Supported by:\r\n * * AlternatingCCTreeNode\r\n * * ConvexClipPlaneSet\r\n * @public\r\n */\r\nexport interface PolygonClipper {\r\n appendPolygonClip: AppendPolygonClipFunction;\r\n}\r\n/**\r\n * Class whose various static methods are functions for clipping geometry\r\n * @public\r\n */\r\nexport class ClipUtilities {\r\n // on-demand scratch objects for method implementations. If you use one, make sure it isn't already being used in scope.\r\n private static _workTransform?: Transform;\r\n private static _workRange?: Range3d;\r\n private static _workClipper?: ConvexClipPlaneSet;\r\n\r\n private static _selectIntervals01TestPoint = Point3d.create();\r\n /**\r\n * Augment the unsortedFractionsArray with 0 and 1\r\n * * sort\r\n * * test the midpoint of each interval with `clipper.isPointOnOrInside`\r\n * * pass accepted intervals to `announce(f0,f1,curve)`\r\n */\r\n public static selectIntervals01(\r\n curve: CurvePrimitive,\r\n unsortedFractions: GrowableFloat64Array,\r\n clipper: Clipper,\r\n announce?: AnnounceNumberNumberCurvePrimitive,\r\n ): boolean {\r\n unsortedFractions.push(0);\r\n unsortedFractions.push(1);\r\n unsortedFractions.sort();\r\n let f0 = unsortedFractions.atUncheckedIndex(0);\r\n let f1;\r\n let fMid;\r\n const testPoint = ClipUtilities._selectIntervals01TestPoint;\r\n const n = unsortedFractions.length;\r\n for (let i = 1; i < n; i++) {\r\n f1 = unsortedFractions.atUncheckedIndex(i);\r\n if (f1 > f0 + Geometry.smallFraction) {\r\n fMid = 0.5 * (f0 + f1);\r\n if (fMid >= 0.0 && fMid <= 1.0) {\r\n curve.fractionToPoint(fMid, testPoint);\r\n if (clipper.isPointOnOrInside(testPoint)) {\r\n if (announce)\r\n announce(f0, f1, curve);\r\n else\r\n return true;\r\n }\r\n }\r\n f0 = f1;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Announce triples of (low, high, cp) for each entry in intervals.\r\n * @param intervals source array\r\n * @param cp CurvePrimitive for announcement\r\n * @param announce function to receive data\r\n */\r\n public static announceNNC(\r\n intervals: Range1d[], cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\r\n ): boolean {\r\n if (announce) {\r\n for (const ab of intervals) {\r\n announce(ab.low, ab.high, cp);\r\n }\r\n }\r\n return intervals.length > 0;\r\n }\r\n /**\r\n * Compute and return portions of the input curve that are within the clipper.\r\n * @param curve input curve, unmodified\r\n * @param clipper used to compute the clipped components\r\n * @return array of clipped curves\r\n */\r\n public static collectClippedCurves(curve: CurvePrimitive, clipper: Clipper): CurvePrimitive[] {\r\n const result: CurvePrimitive[] = [];\r\n curve.announceClipIntervals(\r\n clipper,\r\n (fraction0: number, fraction1: number, curveA: CurvePrimitive) => {\r\n if (fraction1 !== fraction0) {\r\n const partialCurve = curveA.clonePartialCurve(fraction0, fraction1);\r\n if (partialCurve)\r\n result.push(partialCurve);\r\n }\r\n },\r\n );\r\n return result;\r\n }\r\n /**\r\n * Compute and return the portions of the input region that are within the clipper.\r\n * @param region input region, unmodified\r\n * @param clipper used to compute the clipped components\r\n * @return clipped subregion, as a single `AnyRegion`\r\n */\r\n public static clipAnyRegion(region: AnyRegion, clipper: Clipper): AnyRegion | undefined {\r\n let result: UnionRegion | undefined;\r\n const localToWorld = ClipUtilities._workTransform = FrameBuilder.createRightHandedFrame(undefined, region, ClipUtilities._workTransform);\r\n if (!localToWorld)\r\n return result;\r\n const worldToLocal = localToWorld?.inverse();\r\n if (!worldToLocal)\r\n return result;\r\n const localRegion = region.cloneTransformed(worldToLocal) as AnyRegion; // parallel to xy-plane so we can ignore z\r\n if (!localRegion)\r\n return result;\r\n // We can only clip convex polygons with our clipper machinery, but the input region doesn't have to be\r\n // convex or even a polygon. We get around this limitation by using a Boolean operation, which admits\r\n // *any* planar regions, albeit in local coordinates. First, we clip a rectangle that covers the input region\r\n // (in world coordinates), then we intersect the resulting fragments with the input region in local coordinates.\r\n // Finally, we assemble the results into a UnionRegion back in world coordinates.\r\n const localRegionRange = ClipUtilities._workRange = localRegion.range();\r\n const xLength = localRegionRange.xLength();\r\n const yLength = localRegionRange.yLength();\r\n const rectangle = LineString3d.createRectangleXY(localRegionRange.low, xLength, yLength, true);\r\n rectangle.tryTransformInPlace(localToWorld);\r\n // Clip the rectangle to produce fragment(s) which we can Boolean intersect with the input region.\r\n const insideFragments: GrowableXYZArray[] = [];\r\n const outsideFragments: GrowableXYZArray[] = [];\r\n const cache = new GrowableXYZArrayCache();\r\n clipper.appendPolygonClip?.(rectangle.packedPoints, insideFragments, outsideFragments, cache);\r\n if (insideFragments.length === 0)\r\n return result;\r\n // Create the \"clipped region\".\r\n for (const fragment of insideFragments) {\r\n const loop = Loop.createPolygon(fragment);\r\n loop.tryTransformInPlace(worldToLocal);\r\n const clippedLocalRegion = RegionOps.regionBooleanXY(localRegion, loop, RegionBinaryOpType.Intersection);\r\n if (clippedLocalRegion) {\r\n clippedLocalRegion.tryTransformInPlace(localToWorld);\r\n if (!result)\r\n result = (clippedLocalRegion instanceof UnionRegion) ? clippedLocalRegion : UnionRegion.create(clippedLocalRegion);\r\n if (clippedLocalRegion instanceof UnionRegion)\r\n result.children.push(...clippedLocalRegion.children); // avoid nested UnionRegions\r\n else\r\n result.tryAddChild(clippedLocalRegion);\r\n }\r\n }\r\n return result ? RegionOps.simplifyRegion(result) : undefined;\r\n }\r\n /**\r\n * Compute and return portions of the input curve or region that are within the clipper.\r\n * @param curve input curve or region, unmodified\r\n * @param clipper used to compute the clipped components\r\n * @return array of clipped components of the input curve or region that lie inside the clipper\r\n */\r\n public static clipAnyCurve(curve: AnyCurve, clipper: Clipper): AnyCurve[] {\r\n if (curve instanceof CurvePrimitive)\r\n return ClipUtilities.collectClippedCurves(curve, clipper);\r\n if (curve.isAnyRegion()) {\r\n const ret = ClipUtilities.clipAnyRegion(curve, clipper);\r\n return ret ? [ret] : [];\r\n }\r\n const result: AnyCurve[] = [];\r\n if (curve instanceof Path || curve instanceof BagOfCurves) {\r\n for (const child of curve.children) {\r\n const partialClip = ClipUtilities.clipAnyCurve(child, clipper);\r\n result.push(...partialClip);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Clip a polygon down to regions defined by each shape of a ClipShape.\r\n * @return An multidimensional array of points, where each array is the boundary of part of the remaining polygon.\r\n */\r\n public static clipPolygonToClipShape(polygon: Point3d[], clipShape: ClipPrimitive): Point3d[][] {\r\n const outputA = this.clipPolygonToClipShapeReturnGrowableXYZArrays(polygon, clipShape);\r\n const output = [];\r\n for (const g of outputA)\r\n output.push(g.getPoint3dArray());\r\n return output;\r\n }\r\n /**\r\n * Clip a polygon down to regions defined by each shape of a ClipShape.\r\n * @return An multidimensional array of points, where each array is the boundary of part of the remaining polygon.\r\n */\r\n public static clipPolygonToClipShapeReturnGrowableXYZArrays(\r\n polygon: Point3d[], clipShape: ClipPrimitive,\r\n ): GrowableXYZArray[] {\r\n const output: GrowableXYZArray[] = [];\r\n const clipper = clipShape.fetchClipPlanesRef();\r\n // NEEDS WORK -- what if it is a mask !!!!\r\n if (clipper) {\r\n clipper.polygonClip(polygon, output);\r\n }\r\n return output;\r\n }\r\n /**\r\n * Given an array of points, test for trivial containment conditions.\r\n * * ClipStatus.TrivialAccept if all points are in any one of the convexSet's.\r\n * * ClipStatus.ClipRequired if (in any single convexSet) there were points on both sides of any single plane.\r\n * * ClipStatus.TrivialReject if neither of those occurred.\r\n */\r\n public static pointSetSingleClipStatus(\r\n points: GrowableXYZArray, planeSet: UnionOfConvexClipPlaneSets, tolerance: number,\r\n ): ClipStatus {\r\n if (planeSet.convexSets.length === 0)\r\n return ClipStatus.TrivialAccept;\r\n\r\n for (const convexSet of planeSet.convexSets) {\r\n let allOutsideSinglePlane = false, anyOutside = false;\r\n\r\n for (const plane of convexSet.planes) {\r\n let numInside = 0, numOutside = 0;\r\n const planeDistance = plane.distance - tolerance;\r\n\r\n const currPt = Point3d.create();\r\n const currVec = Vector3d.create();\r\n for (let i = 0; i < points.length; i++) {\r\n points.getPoint3dAtUncheckedPointIndex(i, currPt);\r\n currVec.setFrom(currPt);\r\n currVec.dotProduct(plane.inwardNormalRef) > planeDistance ? numInside++ : numOutside++;\r\n }\r\n\r\n anyOutside = (numOutside !== 0) ? true : anyOutside;\r\n if (numInside === 0) {\r\n allOutsideSinglePlane = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!anyOutside) // totally inside this set - no clip required\r\n return ClipStatus.TrivialAccept;\r\n if (!allOutsideSinglePlane)\r\n return ClipStatus.ClipRequired;\r\n }\r\n return ClipStatus.TrivialReject;\r\n }\r\n /**\r\n * Emit point loops for intersection of a convex set with a range.\r\n * * return zero length array for (a) null range or (b) no intersections\r\n * @param range range to intersect\r\n * @param includeConvexSetFaces if false, do not compute facets originating as convex set planes.\r\n * @param includeRangeFaces if false, do not compute facets originating as range faces\r\n * @param ignoreInvisiblePlanes if true, do NOT compute a facet for convex set faces marked invisible.\r\n */\r\n public static announceLoopsOfConvexClipPlaneSetIntersectRange(\r\n convexSet: ConvexClipPlaneSet | ClipPlane,\r\n range: Range3d,\r\n loopFunction: (loopPoints: GrowableXYZArray) => void,\r\n includeConvexSetFaces: boolean = true,\r\n includeRangeFaces: boolean = true,\r\n ignoreInvisiblePlanes = false,\r\n ): void {\r\n const work = new GrowableXYZArray();\r\n if (includeConvexSetFaces) {\r\n // Clip convexSet planes to the range and to the rest of the convexSet . .\r\n if (convexSet instanceof ConvexClipPlaneSet) {\r\n for (const plane of convexSet.planes) {\r\n if (ignoreInvisiblePlanes && plane.invisible)\r\n continue;\r\n const pointsClippedToRange = plane.intersectRange(range, true);\r\n const finalPoints = new GrowableXYZArray();\r\n if (pointsClippedToRange) {\r\n convexSet.polygonClip(pointsClippedToRange, finalPoints, work, plane);\r\n if (finalPoints.length > 0)\r\n loopFunction(finalPoints);\r\n }\r\n }\r\n } else { // `convexSet` is just one plane ...\r\n if (ignoreInvisiblePlanes && convexSet.invisible) {\r\n // skip it !\r\n } else {\r\n const pointsClippedToRange = convexSet.intersectRange(range, true);\r\n if (pointsClippedToRange)\r\n loopFunction(pointsClippedToRange);\r\n }\r\n }\r\n }\r\n\r\n if (includeRangeFaces) {\r\n // clip range faces to the convex set . . .\r\n const corners = range.corners();\r\n for (let i = 0; i < 6; i++) {\r\n const indices = Range3d.faceCornerIndices(i);\r\n const finalPoints = new GrowableXYZArray();\r\n const lineString = LineString3d.createIndexedPoints(corners, indices);\r\n if (convexSet instanceof ConvexClipPlaneSet) {\r\n convexSet.polygonClip(lineString.packedPoints, finalPoints, work);\r\n if (finalPoints.length > 0)\r\n loopFunction(finalPoints);\r\n } else {\r\n convexSet.clipConvexPolygonInPlace(lineString.packedPoints, work);\r\n if (lineString.packedPoints.length > 0)\r\n loopFunction(lineString.packedPoints);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Return a (possibly empty) array of geometry (Loops !!) which are facets of the intersection of the convex set\r\n * intersecting a range.\r\n * * Return zero length array for (a) null range or (b) no intersections\r\n * @param allClippers convex or union clipper\r\n * @param range range to intersect\r\n * @param includeConvexSetFaces if false, do not compute facets originating as convex set planes.\r\n * @param includeRangeFaces if false, do not compute facets originating as range faces\r\n * @param ignoreInvisiblePlanes if true, do NOT compute a facet for convex set faces marked invisible.\r\n */\r\n public static loopsOfConvexClipPlaneIntersectionWithRange(\r\n allClippers: ConvexClipPlaneSet | UnionOfConvexClipPlaneSets | ClipPlane,\r\n range: Range3d,\r\n includeConvexSetFaces: boolean = true,\r\n includeRangeFaces: boolean = true,\r\n ignoreInvisiblePlanes = false,\r\n ): GeometryQuery[] {\r\n const result: GeometryQuery[] = [];\r\n if (allClippers instanceof UnionOfConvexClipPlaneSets) {\r\n for (const clipper of allClippers.convexSets) {\r\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(clipper, range,\r\n (points: GrowableXYZArray) => {\r\n if (points.length > 0) result.push(Loop.createPolygon(points));\r\n },\r\n includeConvexSetFaces, includeRangeFaces, ignoreInvisiblePlanes);\r\n }\r\n } else if (allClippers instanceof ConvexClipPlaneSet || allClippers instanceof ClipPlane) {\r\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(allClippers, range,\r\n (points: GrowableXYZArray) => {\r\n if (points.length > 0) result.push(Loop.createPolygon(points));\r\n },\r\n includeConvexSetFaces, includeRangeFaces, ignoreInvisiblePlanes);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return the (possibly null) range of the intersection of the convex set with a range.\r\n * * The convex set is permitted to be unbounded (e.g. a single plane). The range parameter provides bounds.\r\n * @param convexSet convex set for intersection.\r\n * @param range range to intersect\r\n */\r\n public static rangeOfConvexClipPlaneSetIntersectionWithRange(convexSet: ConvexClipPlaneSet, range: Range3d): Range3d {\r\n const result = Range3d.createNull();\r\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(convexSet, range,\r\n (points: GrowableXYZArray) => {\r\n if (points.length > 0) result.extendArray(points);\r\n },\r\n true, true, false);\r\n return result;\r\n }\r\n /**\r\n * Return the range of various types of clippers\r\n * * `ConvexClipPlaneSet` -- dispatch to `rangeOfConvexClipPlaneSetIntersectionWithRange`\r\n * * `UnionOfConvexClipPlaneSet` -- union of ranges of member `ConvexClipPlaneSet`\r\n * * `ClipPrimitive` -- access its `UnionOfConvexClipPlaneSet`.\r\n * * `ClipVector` -- intersection of the ranges of its `ClipPrimitive`.\r\n * * `undefined` -- entire input range.\r\n * * If `observeInvisibleFlag` is false, the \"invisible\" properties are ignored, and this effectively returns the range of the edge work of the members\r\n * * If `observeInvisibleFlag` is true, the \"invisible\" properties are observed, and \"invisible\" parts do not restrict the range.\r\n * @param clipper\r\n * @param range non-null range.\r\n * @param observeInvisibleFlag indicates how \"invisible\" bit is applied for ClipPrimitive.\r\n */\r\n public static rangeOfClipperIntersectionWithRange(\r\n clipper: ConvexClipPlaneSet | UnionOfConvexClipPlaneSets | ClipPrimitive | ClipVector | undefined,\r\n range: Range3d,\r\n observeInvisibleFlag: boolean = true,\r\n ): Range3d {\r\n if (clipper === undefined)\r\n return range.clone();\r\n if (clipper instanceof ConvexClipPlaneSet)\r\n return this.rangeOfConvexClipPlaneSetIntersectionWithRange(clipper, range);\r\n if (clipper instanceof UnionOfConvexClipPlaneSets) {\r\n const rangeUnion = Range3d.createNull();\r\n for (const c of clipper.convexSets) {\r\n const rangeC = this.rangeOfConvexClipPlaneSetIntersectionWithRange(c, range);\r\n rangeUnion.extendRange(rangeC);\r\n }\r\n return rangeUnion;\r\n }\r\n if (clipper instanceof ClipPrimitive) {\r\n if (observeInvisibleFlag && clipper.invisible)\r\n return range.clone();\r\n return this.rangeOfClipperIntersectionWithRange(clipper.fetchClipPlanesRef(), range);\r\n }\r\n if (clipper instanceof ClipVector) {\r\n const rangeIntersection = range.clone();\r\n for (const c of clipper.clips) {\r\n if (observeInvisibleFlag && c.invisible) {\r\n // trivial range tests do not expose the effects. Assume the hole allows everything.\r\n } else {\r\n const rangeC = this.rangeOfClipperIntersectionWithRange(c, range, observeInvisibleFlag);\r\n rangeIntersection.intersect(rangeC, rangeIntersection);\r\n }\r\n }\r\n return rangeIntersection;\r\n\r\n }\r\n return range.clone();\r\n }\r\n /**\r\n * Test if various types of clippers have any intersection with a range.\r\n * * This follows the same logic as `rangeOfClipperIntersectionWithRange` but attempts to exit at earliest point of confirmed intersection\r\n * * `ConvexClipPlaneSet` -- dispatch to `doesConvexClipPlaneSetIntersectRange`\r\n * * `UnionOfConvexClipPlaneSet` -- union of ranges of member `ConvexClipPlaneSet`\r\n * * `ClipPrimitive` -- access its `UnionOfConvexClipPlaneSet`.\r\n * * `ClipVector` -- intersection of the ranges of its `ClipPrimitive`.\r\n * * `undefined` -- entire input range.\r\n * * If `observeInvisibleFlag` is false, the \"invisible\" properties are ignored, and holes do not affect the result.\r\n * * If `observeInvisibleFlag` is true, the \"invisible\" properties are observed, and may affect the result.\r\n * @param clipper\r\n * @param range non-null range.\r\n * @param observeInvisibleFlag indicates how \"invisible\" bit is applied for ClipPrimitive.\r\n */\r\n public static doesClipperIntersectRange(\r\n clipper: ConvexClipPlaneSet | UnionOfConvexClipPlaneSets | ClipPrimitive | ClipVector | undefined,\r\n range: Range3d,\r\n observeInvisibleFlag: boolean = true,\r\n ): boolean {\r\n if (clipper === undefined)\r\n return true;\r\n\r\n if (clipper instanceof ConvexClipPlaneSet)\r\n return this.doesConvexClipPlaneSetIntersectRange(clipper, range);\r\n\r\n if (clipper instanceof UnionOfConvexClipPlaneSets) {\r\n for (const c of clipper.convexSets) {\r\n if (this.doesConvexClipPlaneSetIntersectRange(c, range))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n if (clipper instanceof ClipPrimitive) {\r\n if (observeInvisibleFlag && clipper.invisible) // um is there an easy way to detect range-completely-inside?\r\n return true;\r\n return this.doesClipperIntersectRange(clipper.fetchClipPlanesRef(), range);\r\n }\r\n\r\n if (clipper instanceof ClipVector) {\r\n const rangeIntersection = range.clone();\r\n for (const c of clipper.clips) {\r\n if (observeInvisibleFlag && c.invisible) {\r\n // trivial range tests do not expose the effects. Assume the hole allows everything.\r\n } else {\r\n const rangeC = this.rangeOfClipperIntersectionWithRange(c, range, observeInvisibleFlag);\r\n rangeIntersection.intersect(rangeC, rangeIntersection);\r\n }\r\n }\r\n return !rangeIntersection.isNull;\r\n }\r\n /** If the case statement above is complete for the variant inputs, this is unreachable .. */\r\n return false;\r\n }\r\n /**\r\n * Emit point loops for intersection of a convex set with a range.\r\n * * return zero length array for (a) null range or (b) no intersections\r\n * @param range range to intersect\r\n * @param includeConvexSetFaces if false, do not compute facets originating as convex set planes.\r\n * @param includeRangeFaces if false, do not compute facets originating as range faces\r\n * @param ignoreInvisiblePlanes if true, do NOT compute a facet for convex set faces marked invisible.\r\n */\r\n public static doesConvexClipPlaneSetIntersectRange(\r\n convexSet: ConvexClipPlaneSet,\r\n range: Range3d,\r\n includeConvexSetFaces: boolean = true,\r\n includeRangeFaces: boolean = true,\r\n ignoreInvisiblePlanes = false,\r\n ): boolean {\r\n const work = new GrowableXYZArray();\r\n if (includeConvexSetFaces) {\r\n // Clip convexSet planes to the range and to the rest of the convexSet . .\r\n for (const plane of convexSet.planes) {\r\n if (ignoreInvisiblePlanes && plane.invisible)\r\n continue;\r\n const pointsClippedToRange = plane.intersectRange(range, true);\r\n if (pointsClippedToRange) {\r\n const finalPoints = new GrowableXYZArray();\r\n convexSet.polygonClip(pointsClippedToRange, finalPoints, work, plane);\r\n if (finalPoints.length > 0)\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n if (includeRangeFaces) {\r\n // clip range faces to the convex set . . .\r\n const corners = range.corners();\r\n for (let i = 0; i < 6; i++) {\r\n const indices = Range3d.faceCornerIndices(i);\r\n const finalPoints = new GrowableXYZArray();\r\n const lineString = LineString3d.createIndexedPoints(corners, indices);\r\n convexSet.polygonClip(lineString.packedPoints, finalPoints, work);\r\n if (finalPoints.length > 0)\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Create a clipper from the transformed range.\r\n * @param range input range to create clipper from\r\n * @param transform how to transform the range (NOTE: applied to the range faces without swelling the range volume)\r\n * @param degeneratePoints optionally populated with the 1 or 2 points defining the transformed range if it is degenerate (all points colinear/coincident); otherwise untouched\r\n * @returns newly constructed clipper. If no clip planes could be computed, fill `degeneratePoints` and return undefined.\r\n */\r\n private static createClipperFromTransformedRange3d(range: Range3d, transform: Transform, degeneratePoints?: Point3d[]): ConvexClipPlaneSet | undefined {\r\n if (!transform)\r\n transform = Transform.createIdentity();\r\n const builder = PolyfaceBuilder.create();\r\n builder.addTransformedRangeMesh(transform, range);\r\n const mesh = builder.claimPolyface();\r\n const clipper = this._workClipper = ConvexClipPlaneSet.createConvexPolyface(mesh, this._workClipper).clipper;\r\n if (clipper.planes.length > 0)\r\n return clipper;\r\n // no faces found in the compressed mesh\r\n if (degeneratePoints) {\r\n assert(mesh.data.point.length <= 2);\r\n for (let i = 0; i < 2; ++i) {\r\n const point = mesh.data.point.getPoint3dAtCheckedPointIndex(i);\r\n if (point)\r\n degeneratePoints.push(point);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Handle pathological cases of range-range intersection, where one of the ranges defines no area or volume (is a line segment or single point).\r\n * @param range local range to intersect with the point/segment\r\n * @param points isolated local point, or local segment's start and end\r\n * @param localToWorld optional transform for output range\r\n * @param intersection optional range of the intersection, in world coordinates, or null range if no intersection.\r\n * @returns whether the point/segment intersects the range\r\n */\r\n private static rangeIntersectPointOrSegment(range: Range3d, points: Point3d[], localToWorld?: Transform, intersection?: Range3d): boolean {\r\n const announceInterval: AnnounceNumberNumberCurvePrimitive | undefined = intersection ?\r\n (f0: number, f1: number, cp: CurvePrimitive) => {\r\n intersection.extendPoint(cp.fractionToPoint(f0), localToWorld);\r\n intersection.extendPoint(cp.fractionToPoint(f1), localToWorld);\r\n } : undefined;\r\n let hasIntersection = false;\r\n if (points.length > 1) {\r\n const segment = LineSegment3d.createCapture(points[0], points[1]);\r\n const clipper = ConvexClipPlaneSet.createRange3dPlanes(range);\r\n hasIntersection = segment.announceClipIntervals(clipper, announceInterval);\r\n } else if (points.length > 0) {\r\n hasIntersection = range.containsPoint(points[0]);\r\n if (hasIntersection && intersection)\r\n intersection.extendPoint(points[0], localToWorld);\r\n }\r\n return hasIntersection;\r\n }\r\n /**\r\n * Test for intersection of two ranges in different local coordinates.\r\n * * Useful for clash detection of elements in iModels, using their stored (tight) local ranges and placement transforms.\r\n * @param range0 first range in local coordinates\r\n * @param local0ToWorld placement transform for first range\r\n * @param range1 second range in local coordinates\r\n * @param local1ToWorld placement transform for second range. Assumed to be invertible.\r\n * @param range1Margin optional signed local distance to expand/contract the second range before intersection. Positive expands.\r\n * @return whether the local ranges are adjacent or intersect. Also returns false if local1ToWorld is singular.\r\n */\r\n public static doLocalRangesIntersect(\r\n range0: Range3d, local0ToWorld: Transform, range1: Range3d, local1ToWorld: Transform, range1Margin?: number,\r\n ): boolean {\r\n const worldToLocal1 = this._workTransform = local1ToWorld.inverse(this._workTransform);\r\n if (!worldToLocal1)\r\n return false;\r\n let myRange1 = range1;\r\n if (range1Margin) {\r\n myRange1 = this._workRange = range1.clone(this._workRange);\r\n myRange1.expandInPlace(range1Margin);\r\n }\r\n const degeneratePoints: Point3d[] = [];\r\n const local0ToLocal1 = worldToLocal1.multiplyTransformTransform(local0ToWorld, worldToLocal1);\r\n // convert range0 into a clipper in local1 coordinates, then intersect with range1\r\n const clipper = this.createClipperFromTransformedRange3d(range0, local0ToLocal1, degeneratePoints);\r\n if (clipper)\r\n return this.doesClipperIntersectRange(clipper, myRange1);\r\n return this.rangeIntersectPointOrSegment(myRange1, degeneratePoints, local1ToWorld);\r\n }\r\n /**\r\n * Compute the range of the intersection between two local (e.g., element-aligned) ranges.\r\n * @param range0 first range in local coordinates\r\n * @param local0ToWorld placement transform for first range\r\n * @param range1 second range in local coordinates\r\n * @param local1ToWorld placement transform for second range. Assumed to be invertible.\r\n * @param result optional pre-allocated range to fill and return\r\n * @return range of the intersection (aligned to world axes). Returns null range if local1ToWorld is singular.\r\n */\r\n public static rangeOfIntersectionOfLocalRanges(range0: Range3d, local0ToWorld: Transform, range1: Range3d, local1ToWorld: Transform, result?: Range3d): Range3d {\r\n const myResult = Range3d.createNull(result);\r\n const worldToLocal1 = this._workTransform = local1ToWorld.inverse(this._workTransform);\r\n if (!worldToLocal1)\r\n return myResult;\r\n const degeneratePoints: Point3d[] = [];\r\n const local0ToLocal1 = worldToLocal1.multiplyTransformTransform(local0ToWorld, worldToLocal1);\r\n // convert range0 into a clipper in local1 coordinates, then intersect with range1\r\n const clipper = this.createClipperFromTransformedRange3d(range0, local0ToLocal1, degeneratePoints);\r\n if (clipper)\r\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(clipper, range1, (loopPoints: GrowableXYZArray) => { loopPoints.extendRange(myResult, local1ToWorld); });\r\n else\r\n this.rangeIntersectPointOrSegment(range1, degeneratePoints, local1ToWorld, myResult);\r\n return myResult;\r\n }\r\n /**\r\n * Test if `obj` is a `Clipper` object.\r\n * * This is implemented by testing for each of the methods in the `Clipper` interface.\r\n */\r\n public static isClipper(obj: any): boolean {\r\n if (obj) {\r\n if (obj.isPointOnOrInside\r\n && obj.announceClippedSegmentIntervals\r\n && obj.announceClippedArcIntervals)\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Specialized logic for replacing clip fragments by an equivalent singleton.\r\n * * If there are baseCount + 1 or fewer fragments, do nothing.\r\n * * If there are more than baseCount+1 fragments:\r\n * * drop them all to the cache\r\n * * push a copy of the singleton.\r\n * * The use case for this is that a multi-step clipper (e.g. UnionOfConvexClipPlaneSets) may produce many fragments,\r\n * and then be able to determine that they really are the original pre-clip polygon unchanged.\r\n * * The baseCount+1 case is the case where the entire original singleton is still a singleton and can be left alone.\r\n * * Calling this replacer shuffles the original back into the fragment array, and drops the fragments.\r\n * * This determination is solely within the logic of the caller.\r\n * @param shards array of fragments\r\n * @param baseCount original count\r\n * @param singleton single array which may be a replacement for multiple fragments\r\n * @param cache cache for array management\r\n */\r\n public static restoreSingletonInPlaceOfMultipleShards(\r\n fragments: GrowableXYZArray[] | undefined, baseCount: number, singleton: IndexedXYZCollection, arrayCache: GrowableXYZArrayCache,\r\n ): void {\r\n if (fragments && fragments.length > baseCount + 1) {\r\n while (fragments.length > baseCount) {\r\n const f = fragments.pop();\r\n arrayCache.dropToCache(f);\r\n }\r\n fragments.push(arrayCache.grabAndFill(singleton));\r\n }\r\n }\r\n /**\r\n * Create a UnionOfConvexClipPlaneSets for a volume defined by a path and offsets.\r\n * @param points points along the path.\r\n * @param positiveOffsetLeft offset to left. 0 is clip on the path.\r\n * @param positiveOffsetRight offset to the right. 0 is clip on the path.\r\n * @param z0 z for lower clipping plane. If undefined, unbounded in positive z\r\n * @param z1 z for upper clipping plane. If undefined, unbounded in negative z.\r\n * @alpha\r\n */\r\n public static createXYOffsetClipFromLineString(\r\n points: Point3d[] | IndexedXYZCollection, leftOffset: number, rightOffset: number, z0: number, z1: number,\r\n ): UnionOfConvexClipPlaneSets {\r\n if (Array.isArray(points)) {\r\n return LineStringOffsetClipperContext.createClipBetweenOffsets(\r\n new Point3dArrayCarrier(points), leftOffset, rightOffset, z0, z1);\r\n }\r\n return LineStringOffsetClipperContext.createClipBetweenOffsets(points, leftOffset, rightOffset, z0, z1);\r\n }\r\n /** If data.length >= minLength threshold, push it to destination; if smaller drop it back to the cache. */\r\n public static captureOrDrop(\r\n data: GrowableXYZArray, minLength: number, destination: GrowableXYZArray[], cache: GrowableXYZArrayCache,\r\n ): void {\r\n if (data.length >= minLength)\r\n destination.push(data);\r\n else\r\n cache.dropToCache(data);\r\n }\r\n /**\r\n * Find the portion of a line within a half-plane clip.\r\n * * The half-plane clip is to the left of the line from clipA to clipB.\r\n * * The original clipped segment has fractions 0 and 1 at respective segment points.\r\n * * Caller initializes the interval\r\n * * This method reduces the interval size.\r\n * * See clipSegmentToCCWTriangleXY for typical use.\r\n * @param linePointA First point of clip line\r\n * @param linePointB Second point of clip line\r\n * @param segmentPoint0 First point of clipped segment\r\n * @param segmentPoint1 Second point of clipped segment\r\n * @param interval Live interval.\r\n * @param absoluteTolerance absolute tolerance for both cross product values to indicate \"on\" the line\r\n */\r\n public static clipSegmentToLLeftOfLineXY(\r\n linePointA: XAndY, linePointB: XAndY, segmentPoint0: XAndY, segmentPoint1: XAndY, interval: Range1d, absoluteTolerance: number = 1.0e-14,\r\n ): void {\r\n const ux = linePointB.x - linePointA.x;\r\n const uy = linePointB.y - linePointA.y;\r\n // negative is in positive is out ...\r\n const h0 = -(ux * (segmentPoint0.y - linePointA.y) - uy * (segmentPoint0.x - linePointA.x));\r\n const h1 = -(ux * (segmentPoint1.y - linePointA.y) - uy * (segmentPoint1.x - linePointA.x));\r\n if (h0 < absoluteTolerance && h1 < absoluteTolerance) {\r\n // The entire segment is in .....\r\n return;\r\n }\r\n if (h0 * h1 > 0.0) {\r\n if (h0 > 0.0)\r\n interval.setNull();\r\n } else if (h0 * h1 < 0.0) {\r\n // strict crossing with safe fraction . . .\r\n const fraction = -h0 / (h1 - h0);\r\n if (h0 < 0.0) {\r\n return interval.intersectRangeXXInPlace(0.0, fraction);\r\n } else {\r\n return interval.intersectRangeXXInPlace(fraction, 1.0);\r\n }\r\n } else {\r\n // There is an exact hit at one end, possibly non-zero at the other ... the sign of either determines which side is in play\r\n // A zero and a zero or negative is entirely in, which does not alter the prior clip.\r\n if (h0 > 0.0) {\r\n interval.intersectRangeXXInPlace(1.0, 1.0);\r\n } else if (h1 > 0.0) {\r\n interval.intersectRangeXXInPlace(0.0, 0.0);\r\n }\r\n }\r\n }\r\n /**\r\n * Clip an interval of a line segment to a triangle.\r\n * * Triangle is assumed CCW\r\n * @param pointA point of triangle.\r\n * @param pointB point of triangle.\r\n * @param pointC point of triangle.\r\n * @param segment0 start of segment\r\n * @param segment1 end of segment\r\n * @param interval Pre-initialized interval of live part of segment\r\n * @param absoluteTolerance absolute tolerance for begin \"on a line\"\r\n */\r\n public static clipSegmentToCCWTriangleXY(\r\n pointA: XAndY, pointB: XAndY, pointC: XAndY, segment0: XAndY, segment1: XAndY, interval: Range1d, absoluteTolerance: number = 1.0e-14,\r\n ): void {\r\n if (!interval.isNull) {\r\n this.clipSegmentToLLeftOfLineXY(pointA, pointB, segment0, segment1, interval, absoluteTolerance);\r\n if (!interval.isNull) {\r\n this.clipSegmentToLLeftOfLineXY(pointB, pointC, segment0, segment1, interval, absoluteTolerance);\r\n if (!interval.isNull) {\r\n this.clipSegmentToLLeftOfLineXY(pointC, pointA, segment0, segment1, interval, absoluteTolerance);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Find the portion of a line within a half-plane clip.\r\n * * The half-plane clip is to the left of the line from clipA to clipB.\r\n * * The original clipped segment has fractions 0 and 1 at respective segment points.\r\n * * Caller initializes the interval\r\n * * This method reduces the interval size.\r\n * * See clipSegmentToCCWTriangleXY for typical use.\r\n * @param linePointA First point of clip line\r\n * @param linePointB Second point of clip line\r\n * @param segmentPoint0 First point of clipped segment\r\n * @param segmentPoint1 Second point of clipped segment\r\n * @param interval Live interval.\r\n * @param absoluteTolerance absolute tolerance for both cross product values to indicate \"on\" the line\r\n */\r\n public static clipSegmentBelowPlaneXY(\r\n plane: Plane3dByOriginAndUnitNormal, segmentPoint0: XAndY, segmentPoint1: XAndY, interval: Range1d, absoluteTolerance: number = 1.0e-14,\r\n ): void {\r\n // negative is in positive is out ...\r\n const h0 = plane.altitudeXY(segmentPoint0.x, segmentPoint0.y);\r\n const h1 = plane.altitudeXY(segmentPoint1.x, segmentPoint1.y);\r\n if (h0 < absoluteTolerance && h1 < absoluteTolerance) {\r\n // The entire segment is in ..... the interval is unaffected.\r\n return;\r\n }\r\n if (h0 * h1 > 0.0) {\r\n if (h0 > 0.0)\r\n interval.setNull();\r\n } else if (h0 * h1 < 0.0) {\r\n // strict crossing with safe fraction . . .\r\n const fraction = -h0 / (h1 - h0);\r\n if (h0 < 0.0) {\r\n return interval.intersectRangeXXInPlace(0.0, fraction);\r\n } else {\r\n return interval.intersectRangeXXInPlace(fraction, 1.0);\r\n }\r\n } else {\r\n // There is an exact hit at one end, possibly non-zero at the other ... the sign of either determines which side is in play\r\n // A zero and a zero or negative is entirely in, which does not alter the prior clip.\r\n if (h0 > 0.0) {\r\n interval.intersectRangeXXInPlace(1.0, 1.0);\r\n } else if (h1 > 0.0) {\r\n interval.intersectRangeXXInPlace(0.0, 0.0);\r\n }\r\n }\r\n }\r\n /**\r\n * Clip an interval of a line segment to an array of planes\r\n * * plane normals assumed OUTWARD\r\n * * planeAltitude is typically a tolerance a tolerance distance.\r\n * * positive altitude makes tha plane move in the direction of the unit normal.\r\n * @param planes array of planes\r\n * @param segment0 start of segment\r\n * @param segment1 end of segment\r\n * @param interval Pre-initialized interval of live part of segment\r\n * @param absoluteTolerance absolute tolerance for begin \"on a line\"\r\n */\r\n public static clipSegmentBelowPlanesXY(\r\n planes: Plane3dByOriginAndUnitNormal[], segment0: XAndY, segment1: XAndY, interval: Range1d, signedAltitude: number = 1.0e-14,\r\n ): void {\r\n const numPlanes = planes.length;\r\n for (let i = 0; (!interval.isNull) && i < numPlanes; i++) {\r\n this.clipSegmentBelowPlaneXY(planes[i], segment0, segment1, interval, signedAltitude);\r\n }\r\n }\r\n /**\r\n * Pass line segments from a polyline to the clipper. Resolve the fractional clips to simple points for announcement.\r\n * @param clipper clipper to call\r\n * @param points polyline whose segments are passed to the clipper\r\n * @param announce caller's handler for simple point pairs.\r\n */\r\n public static announcePolylineClip(\r\n clipper: Clipper, points: Point3d[], announce: (point0: Point3d, point1: Point3d) => void,\r\n ): void {\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n clipper.announceClippedSegmentIntervals(0, 1, points[i], points[i + 1],\r\n (f0: number, f1: number) => {\r\n announce(points[i].interpolate(f0, points[i + 1]), points[i].interpolate(f1, points[i + 1]));\r\n });\r\n }\r\n }\r\n /**\r\n * Pass line segments from a polyline to the clipper. Sum the lengths of the clipped pieces. Return the sum.\r\n * @param clipper clipper to call\r\n * @param points polyline whose segments are passed to the clipper\r\n */\r\n public static sumPolylineClipLength(clipper: Clipper, points: Point3d[]): number {\r\n let s = 0;\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const a = points[i].distance(points[i + 1]);\r\n clipper.announceClippedSegmentIntervals(0, 1, points[i], points[i + 1],\r\n (f0: number, f1: number) => { s += Math.abs(f1 - f0) * a; });\r\n }\r\n return s;\r\n }\r\n /**\r\n * Pass polygon `xyz` through a sequence of PolygonClip steps.\r\n * * At the outset, `xyz` is the (only) entry in a set of candidates.\r\n * * For each clipper, each candidate is presented for appendPolygon to inside and outside parts.\r\n * * Each (in,out) result is distributed among (acceptedIn, acceptedOut, candidates) according to\r\n * (inAction, outAction)\r\n * * At the end, all remaining candidates are distributed among (acceptedIn, acceptedOut, finalUnknown)\r\n * according to finalAction\r\n * * Any clipper that does not have an appendPolygonClip method is skipped.\r\n * @param xyz\r\n * @param clippers\r\n * @param acceptedIn\r\n * @param acceptedOut\r\n * @param finalCandidates\r\n * @param inAction\r\n * @param outAction\r\n * @param finalCandidateAction\r\n */\r\n public static doPolygonClipSequence(\r\n xyz: IndexedXYZCollection,\r\n clippers: Clipper[],\r\n acceptedIn: GrowableXYZArray[] | undefined,\r\n acceptedOut: GrowableXYZArray[] | undefined,\r\n finalCandidates: GrowableXYZArray[] | undefined,\r\n inAction: ClipStepAction,\r\n outAction: ClipStepAction,\r\n finalFragmentAction: ClipStepAction,\r\n arrayCache: GrowableXYZArrayCache | undefined,\r\n ) {\r\n if (arrayCache === undefined)\r\n arrayCache = new GrowableXYZArrayCache();\r\n let candidates = [arrayCache.grabAndFill(xyz)];\r\n let nextCandidates: GrowableXYZArray[] = [];\r\n const intermediateIn: GrowableXYZArray[] = [];\r\n const intermediateOut: GrowableXYZArray[] = [];\r\n const oldInsideCount = acceptedIn ? acceptedIn.length : 0;\r\n const oldOutsideCount = acceptedOut ? acceptedOut.length : 0;\r\n let shard;\r\n // At each convex set, carryForwardA is all the fragments that have been outside all previous convex sets.\r\n // Clip each such fragment to the current set, sending the outside parts to carryForwardB, which will got to\r\n // the next clipper. The final surviving carryForward really is out.\r\n for (const c of clippers) {\r\n if (c.appendPolygonClip) {\r\n while (undefined !== (shard = candidates.pop())) {\r\n c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);\r\n distributeFragments(inAction, intermediateIn, acceptedIn, acceptedOut, nextCandidates, arrayCache);\r\n distributeFragments(outAction, intermediateOut, acceptedIn, acceptedOut, nextCandidates, arrayCache);\r\n arrayCache.dropToCache(shard);\r\n }\r\n // candidates is empty !!\r\n const temp = candidates; candidates = nextCandidates; nextCandidates = temp;\r\n }\r\n }\r\n distributeFragments(finalFragmentAction, candidates, acceptedIn, acceptedOut, finalCandidates, arrayCache);\r\n // Note: The following assumes that there were no residual candidates ... need to track if that happened?\r\n // If nothing was out, the inside fragments can be replaced by the original.\r\n if (acceptedOut?.length === oldOutsideCount)\r\n ClipUtilities.restoreSingletonInPlaceOfMultipleShards(acceptedIn, oldInsideCount, xyz, arrayCache);\r\n // If nothing was in, the outside fragments can be replaced by the original.\r\n if (acceptedIn?.length === oldInsideCount)\r\n ClipUtilities.restoreSingletonInPlaceOfMultipleShards(acceptedOut, oldOutsideCount, xyz, arrayCache);\r\n }\r\n /** Pass polygon `xyz` through a sequence of PolygonClip steps with \"parity\" rules */\r\n public static doPolygonClipParitySequence(\r\n xyz: IndexedXYZCollection,\r\n clippers: Clipper[],\r\n acceptedIn: GrowableXYZArray[] | undefined,\r\n acceptedOut: GrowableXYZArray[] | undefined,\r\n arrayCache: GrowableXYZArrayCache | undefined,\r\n ) {\r\n if (arrayCache === undefined)\r\n arrayCache = new GrowableXYZArrayCache();\r\n let candidatesOut = [arrayCache.grabAndFill(xyz)];\r\n let candidatesIn: GrowableXYZArray[] = [];\r\n let nextCandidatesIn: GrowableXYZArray[] = [];\r\n let nextCandidatesOut: GrowableXYZArray[] = [];\r\n const intermediateIn: GrowableXYZArray[] = [];\r\n const intermediateOut: GrowableXYZArray[] = [];\r\n let shard;\r\n // at each step ..\r\n // candidatesIn and candidatesOut are evolved in and out\r\n // nextCandidatesIn and nextCandidatesOut are EMPTY\r\n for (const c of clippers) {\r\n if (c.appendPolygonClip) {\r\n // (IN,OUT) parts of IN parts distribute to (OUT,IN)\r\n while (undefined !== (shard = candidatesIn.pop())) {\r\n c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);\r\n distributeFragments(ClipStepAction.acceptOut, intermediateIn, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\r\n distributeFragments(ClipStepAction.acceptIn, intermediateOut, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\r\n arrayCache.dropToCache(shard);\r\n }\r\n // (IN,OUT) parts of IN parts distribute to (OUT,IN)\r\n while (undefined !== (shard = candidatesOut.pop())) {\r\n c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);\r\n distributeFragments(ClipStepAction.acceptIn, intermediateIn, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\r\n distributeFragments(ClipStepAction.acceptOut, intermediateOut, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\r\n arrayCache.dropToCache(shard);\r\n }\r\n // reload each candidate step\r\n const tempA = candidatesIn; candidatesIn = nextCandidatesIn; nextCandidatesIn = tempA;\r\n const tempB = candidatesOut; candidatesOut = nextCandidatesOut; nextCandidatesOut = tempB;\r\n }\r\n }\r\n // candidatesIn and candidatesOut are final ....\r\n if (candidatesOut.length === 0)\r\n acceptedIn?.push(arrayCache.grabAndFill(xyz));\r\n else if (candidatesOut.length === 0)\r\n acceptedOut?.push(arrayCache.grabAndFill(xyz));\r\n else {\r\n moveFragments(candidatesIn, acceptedIn, arrayCache);\r\n moveFragments(candidatesOut, acceptedOut, arrayCache);\r\n }\r\n }\r\n /**\r\n * For each plane of clipper, construct a UnionOfConvexClipPlaneSets for an outer (infinite) convex volume that\r\n * abuts the outer volume of the neighbor faces.\r\n */\r\n public static createComplementaryClips(clipper: ConvexClipPlaneSet): UnionOfConvexClipPlaneSets {\r\n const planes = clipper.planes;\r\n const interval = Range1d.createNull();\r\n const n = planes.length;\r\n const newClippers: ConvexClipPlaneSet[] = [];\r\n for (const p of planes) {\r\n const outerSet = ConvexClipPlaneSet.createEmpty();\r\n outerSet.addPlaneToConvexSet(p.cloneNegated());\r\n newClippers.push(outerSet);\r\n }\r\n for (let i = 0; i < n; i++) {\r\n for (let j = i + 1; j < n; j++) {\r\n const ray = CurveFactory.planePlaneIntersectionRay(planes[i], planes[j]);\r\n if (ray) {\r\n if (clipper.hasIntersectionWithRay(ray, interval)) {\r\n // the normal-to-normal vector is bisector (or close to bisector?)\r\n const newNormal = planes[j].inwardNormalRef.minus(planes[i].inwardNormalRef);\r\n const plane1 = ClipPlane.createNormalAndPoint(newNormal, ray.origin);\r\n if (plane1) {\r\n const plane2 = plane1.cloneNegated();\r\n newClippers[i].addPlaneToConvexSet(plane1);\r\n newClippers[j].addPlaneToConvexSet(plane2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return UnionOfConvexClipPlaneSets.createConvexSets(newClippers);\r\n }\r\n /**\r\n * Creates clippers for regions closest to the children of a curve chain.\r\n * * For best results, each child should have length larger than `distanceTol`.\r\n * @param curveChain A curve chain; xy-only (z-coordinate is ignored). Must have at least 2 children.\r\n * @param strokeOptions Optional stroke options to control the sampling of the curve chain.\r\n * @param distanceTol Optional distance tolerance to use when comparing points; default is [[Geometry.smallMetricDistance]].\r\n * @param boundingBox Optional nominal xy-bounding box for the clipper regions; default is maximal clipper regions.\r\n * @returns An ordered array of clippers, each of which represents the region closest to the corresponding primitive in the\r\n * input chain, or undefined if the input is invalid.\r\n */\r\n public static createClippersForRegionsClosestToCurvePrimitivesXY(\r\n curveChain: CurveChain, strokeOptions?: StrokeOptions, distanceTol: number = Geometry.smallMetricDistance, boundingBox?: LowAndHighXY\r\n ): UnionOfConvexClipPlaneSets[] | undefined {\r\n const voronoi = Voronoi.createFromCurveChain(curveChain, strokeOptions, distanceTol, boundingBox);\r\n if (!voronoi)\r\n return undefined;\r\n const superFaces = voronoi.computeVoronoiSuperFaces(curveChain.children.length);\r\n if (superFaces === undefined || superFaces.length !== curveChain.children.length)\r\n return undefined;\r\n return voronoi.generateClippersFromVoronoiSuperFaces(superFaces);\r\n }\r\n}\r\nfunction moveFragments(\r\n fragments: GrowableXYZArray[],\r\n destination: GrowableXYZArray[] | undefined,\r\n arrayCache: GrowableXYZArrayCache,\r\n) {\r\n if (destination === undefined)\r\n arrayCache.dropAllToCache(fragments);\r\n else {\r\n for (const f of fragments)\r\n destination.push(f);\r\n }\r\n fragments.length = 0;\r\n}\r\n/**\r\n * Distribute fragments among acceptedIn, acceptedOut, and passToNextStep as directed by action.\r\n * * If the indicated destination is unknown, drop the fragments to the arrayCache.\r\n * @param action destination selector\r\n * @param fragments fragments to be distributed\r\n * @param acceptedIn destination for \"in\"\r\n * @param acceptedOut destination for \"out\"\r\n * @param passToNextStep destination for fragments to be passed to a later step\r\n * @param arrayCache destination for un-distributed fragments.\r\n */\r\nfunction distributeFragments(\r\n action: ClipStepAction,\r\n fragments: GrowableXYZArray[],\r\n acceptedIn: GrowableXYZArray[] | undefined,\r\n acceptedOut: GrowableXYZArray[] | undefined,\r\n passToNextStep: GrowableXYZArray[] | undefined,\r\n arrayCache: GrowableXYZArrayCache,\r\n) {\r\n let destination;\r\n if (action === ClipStepAction.acceptIn)\r\n destination = acceptedIn;\r\n else if (action === ClipStepAction.acceptOut)\r\n destination = acceptedOut;\r\n else if (action === ClipStepAction.passToNextStep)\r\n destination = passToNextStep;\r\n // remark: if action is other than the enum values, destination is undefined\r\n if (destination === undefined)\r\n arrayCache.dropAllToCache(fragments);\r\n else {\r\n for (const f of fragments)\r\n destination.push(f);\r\n }\r\n fragments.length = 0;\r\n}\r\n"]}
1
+ {"version":3,"file":"ClipUtils.js","sourceRoot":"","sources":["../../../src/clipping/ClipUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,8DAAmE;AACnE,wDA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AK,SAAS;QAC3B,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;SAClC,CAAC;QACJ,KAAK,MAAM,CAAC,IAAI,SAAS;YACvB,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AACvB,CAAC;AACD;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CAC1B,MAAsB,EACtB,SAA6B,EAC7B,UAA0C,EAC1C,WAA2C,EAC3C,cAA8C,EAC9C,UAAiC;IAEjC,IAAI,WAAW,CAAC;IAChB,IAAI,MAAM,KAAK,cAAc,CAAC,QAAQ;QACpC,WAAW,GAAG,UAAU,CAAC;SACtB,IAAI,MAAM,KAAK,cAAc,CAAC,SAAS;QAC1C,WAAW,GAAG,WAAW,CAAC;SACvB,IAAI,MAAM,KAAK,cAAc,CAAC,cAAc;QAC/C,WAAW,GAAG,cAAc,CAAC;IAC/B,4EAA4E;IAC5E,IAAI,WAAW,KAAK,SAAS;QAC3B,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;SAClC,CAAC;QACJ,KAAK,MAAM,CAAC,IAAI,SAAS;YACvB,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AACvB,CAAC","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/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { BagOfCurves, CurveChain } from \"../curve/CurveCollection\";\nimport { CurveFactory } from \"../curve/CurveFactory\";\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { AnyCurve, AnyRegion } from \"../curve/CurveTypes\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { Path } from \"../curve/Path\";\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { Geometry } from \"../Geometry\";\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { LowAndHighXY, XAndY } from \"../geometry3d/XYZProps\";\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\nimport { Voronoi } from \"../topology/Voronoi\";\nimport { ClipPlane } from \"./ClipPlane\";\nimport { ClipPrimitive } from \"./ClipPrimitive\";\nimport { ClipVector } from \"./ClipVector\";\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\nimport { LineStringOffsetClipperContext } from \"./internalContexts/LineStringOffsetClipperContext\";\nimport { UnionOfConvexClipPlaneSets } from \"./UnionOfConvexClipPlaneSets\";\n\n/**\n * Enumerated type for describing where geometry lies with respect to clipping planes.\n * @public\n */\nexport enum ClipPlaneContainment {\n /** All points inside. */\n StronglyInside = 1,\n /** Inside/outside state unknown. */\n Ambiguous = 2,\n /** All points outside. */\n StronglyOutside = 3,\n}\n/**\n * Enumeration of ways to handle an intermediate fragment from a clipping step.\n * @public\n */\nexport enum ClipStepAction {\n /** Pass fragments directly to final accepted \"in\" state. */\n acceptIn = 1,\n /** Pass fragments directly to final accepted \"out\" state. */\n acceptOut = -1,\n /** Forward fragments to subsequent steps. */\n passToNextStep = 0,\n}\n\n/**\n * Enumerated type for describing what must yet be done to clip a piece of geometry.\n * @public\n */\nexport enum ClipStatus {\n /** Some geometry may cross the clip boundaries */\n ClipRequired,\n /** Geometry is clearly outside */\n TrivialReject,\n /** Geometry is clearly inside */\n TrivialAccept,\n}\n\n/**\n * An object containing clipping planes that can be used to clip geometry.\n * @public\n */\nexport interface Clipper {\n /** Test if `point` is on or inside the Clipper's volume. */\n isPointOnOrInside(point: Point3d, tolerance?: number): boolean;\n /**\n * Find the parts of the line segment (if any) that is within the convex clip volume.\n * * The line segment is defined by `pointA` and `pointB`.\n * * The input fractional interval from `fraction0` to `fraction1` (increasing) is the active part to consider.\n * * To clip to the usual bounded line segment, start with fractions (0,1).\n * If the clip volume is unbounded, the line interval may also be unbounded.\n * * An unbounded line portion will have fraction coordinates positive or negative `Number.MAX_VALUE`.\n * @param f0 fraction that is the initial lower fraction of the active interval (e.g., 0.0 for bounded segment).\n * @param f1 fraction that is the initial upper fraction of the active interval (e.g., 1.0 for bounded segment).\n * @param pointA segment start (fraction 0)\n * @param pointB segment end (fraction 1)\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\n * @returns true if a segment was announced, false if entirely outside.\n */\n announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber\n ): boolean;\n /**\n * Find the portion (or portions) of the arc (if any) that are within the convex clip volume.\n * @param arc the arc to be clipped.\n * @param announce function to be called to announce a fraction intervals that are within the convex clip volume.\n * @returns true if one or more arcs portions were announced, false if entirely outside.\n */\n announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean;\n /**\n * Optional polygon clip method.\n * * This is expected to be implemented by planar clip structures.\n * * This is unimplemented for curve clippers (e.g. sphere) for which polygon clip result has curved edges.\n * * The input polygon must be convex.\n */\n appendPolygonClip?: AppendPolygonClipFunction;\n}\n/**\n * Signature of method to execute polygon clip, distributing fragments of xyz among insideFragments and outsideFragments\n * @param xyz convex polygon. This is not changed.\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from\n * the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from\n * the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n */\ntype AppendPolygonClipFunction = (\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache\n) => void;\n\n/**\n * Interface for clipping convex polygons.\n * Supported by:\n * * AlternatingCCTreeNode\n * * ConvexClipPlaneSet\n * @public\n */\nexport interface PolygonClipper {\n appendPolygonClip: AppendPolygonClipFunction;\n}\n/**\n * Class whose various static methods are functions for clipping geometry\n * @public\n */\nexport class ClipUtilities {\n // on-demand scratch objects for method implementations. If you use one, make sure it isn't already being used in scope.\n private static _workTransform?: Transform;\n private static _workRange?: Range3d;\n private static _workClipper?: ConvexClipPlaneSet;\n\n private static _selectIntervals01TestPoint = Point3d.create();\n /**\n * Augment the unsortedFractionsArray with 0 and 1\n * * sort\n * * test the midpoint of each interval with `clipper.isPointOnOrInside`\n * * pass accepted intervals to `announce(f0,f1,curve)`\n */\n public static selectIntervals01(\n curve: CurvePrimitive,\n unsortedFractions: GrowableFloat64Array,\n clipper: Clipper,\n announce?: AnnounceNumberNumberCurvePrimitive,\n ): boolean {\n unsortedFractions.push(0);\n unsortedFractions.push(1);\n unsortedFractions.sort();\n let f0 = unsortedFractions.atUncheckedIndex(0);\n let f1;\n let fMid;\n const testPoint = ClipUtilities._selectIntervals01TestPoint;\n const n = unsortedFractions.length;\n for (let i = 1; i < n; i++) {\n f1 = unsortedFractions.atUncheckedIndex(i);\n if (f1 > f0 + Geometry.smallFraction) {\n fMid = 0.5 * (f0 + f1);\n if (fMid >= 0.0 && fMid <= 1.0) {\n curve.fractionToPoint(fMid, testPoint);\n if (clipper.isPointOnOrInside(testPoint)) {\n if (announce)\n announce(f0, f1, curve);\n else\n return true;\n }\n }\n f0 = f1;\n }\n }\n return false;\n }\n /**\n * Announce triples of (low, high, cp) for each entry in intervals.\n * @param intervals source array\n * @param cp CurvePrimitive for announcement\n * @param announce function to receive data\n */\n public static announceNNC(\n intervals: Range1d[], cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\n ): boolean {\n if (announce) {\n for (const ab of intervals) {\n announce(ab.low, ab.high, cp);\n }\n }\n return intervals.length > 0;\n }\n /**\n * Compute and return portions of the input curve that are within the clipper.\n * @param curve input curve, unmodified\n * @param clipper used to compute the clipped components\n * @return array of clipped curves\n */\n public static collectClippedCurves(curve: CurvePrimitive, clipper: Clipper): CurvePrimitive[] {\n const result: CurvePrimitive[] = [];\n curve.announceClipIntervals(\n clipper,\n (fraction0: number, fraction1: number, curveA: CurvePrimitive) => {\n if (fraction1 !== fraction0) {\n const partialCurve = curveA.clonePartialCurve(fraction0, fraction1);\n if (partialCurve)\n result.push(partialCurve);\n }\n },\n );\n return result;\n }\n /**\n * Compute and return the portions of the input region that are within the clipper.\n * @param region input region, unmodified\n * @param clipper used to compute the clipped components\n * @return clipped subregion, as a single `AnyRegion`\n */\n public static clipAnyRegion(region: AnyRegion, clipper: Clipper): AnyRegion | undefined {\n let result: UnionRegion | undefined;\n const localToWorld = ClipUtilities._workTransform = FrameBuilder.createRightHandedFrame(undefined, region, ClipUtilities._workTransform);\n if (!localToWorld)\n return result;\n const worldToLocal = localToWorld?.inverse();\n if (!worldToLocal)\n return result;\n const localRegion = region.cloneTransformed(worldToLocal) as AnyRegion; // parallel to xy-plane so we can ignore z\n if (!localRegion)\n return result;\n // We can only clip convex polygons with our clipper machinery, but the input region doesn't have to be\n // convex or even a polygon. We get around this limitation by using a Boolean operation, which admits\n // *any* planar regions, albeit in local coordinates. First, we clip a rectangle that covers the input region\n // (in world coordinates), then we intersect the resulting fragments with the input region in local coordinates.\n // Finally, we assemble the results into a UnionRegion back in world coordinates.\n const localRegionRange = ClipUtilities._workRange = localRegion.range();\n const xLength = localRegionRange.xLength();\n const yLength = localRegionRange.yLength();\n const rectangle = LineString3d.createRectangleXY(localRegionRange.low, xLength, yLength, true);\n rectangle.tryTransformInPlace(localToWorld);\n // Clip the rectangle to produce fragment(s) which we can Boolean intersect with the input region.\n const insideFragments: GrowableXYZArray[] = [];\n const outsideFragments: GrowableXYZArray[] = [];\n const cache = new GrowableXYZArrayCache();\n clipper.appendPolygonClip?.(rectangle.packedPoints, insideFragments, outsideFragments, cache);\n if (insideFragments.length === 0)\n return result;\n // Create the \"clipped region\".\n for (const fragment of insideFragments) {\n const loop = Loop.createPolygon(fragment);\n loop.tryTransformInPlace(worldToLocal);\n const clippedLocalRegion = RegionOps.regionBooleanXY(localRegion, loop, RegionBinaryOpType.Intersection);\n if (clippedLocalRegion) {\n clippedLocalRegion.tryTransformInPlace(localToWorld);\n if (!result)\n result = (clippedLocalRegion instanceof UnionRegion) ? clippedLocalRegion : UnionRegion.create(clippedLocalRegion);\n if (clippedLocalRegion instanceof UnionRegion)\n result.children.push(...clippedLocalRegion.children); // avoid nested UnionRegions\n else\n result.tryAddChild(clippedLocalRegion);\n }\n }\n return result ? RegionOps.simplifyRegion(result) : undefined;\n }\n /**\n * Compute and return portions of the input curve or region that are within the clipper.\n * @param curve input curve or region, unmodified\n * @param clipper used to compute the clipped components\n * @return array of clipped components of the input curve or region that lie inside the clipper\n */\n public static clipAnyCurve(curve: AnyCurve, clipper: Clipper): AnyCurve[] {\n if (curve instanceof CurvePrimitive)\n return ClipUtilities.collectClippedCurves(curve, clipper);\n if (curve.isAnyRegion()) {\n const ret = ClipUtilities.clipAnyRegion(curve, clipper);\n return ret ? [ret] : [];\n }\n const result: AnyCurve[] = [];\n if (curve instanceof Path || curve instanceof BagOfCurves) {\n for (const child of curve.children) {\n const partialClip = ClipUtilities.clipAnyCurve(child, clipper);\n result.push(...partialClip);\n }\n }\n return result;\n }\n /**\n * Clip a polygon down to regions defined by each shape of a ClipShape.\n * @return An multidimensional array of points, where each array is the boundary of part of the remaining polygon.\n */\n public static clipPolygonToClipShape(polygon: Point3d[], clipShape: ClipPrimitive): Point3d[][] {\n const outputA = this.clipPolygonToClipShapeReturnGrowableXYZArrays(polygon, clipShape);\n const output = [];\n for (const g of outputA)\n output.push(g.getPoint3dArray());\n return output;\n }\n /**\n * Clip a polygon down to regions defined by each shape of a ClipShape.\n * @return An multidimensional array of points, where each array is the boundary of part of the remaining polygon.\n */\n public static clipPolygonToClipShapeReturnGrowableXYZArrays(\n polygon: Point3d[], clipShape: ClipPrimitive,\n ): GrowableXYZArray[] {\n const output: GrowableXYZArray[] = [];\n const clipper = clipShape.fetchClipPlanesRef();\n // NEEDS WORK -- what if it is a mask !!!!\n if (clipper) {\n clipper.polygonClip(polygon, output);\n }\n return output;\n }\n /**\n * Given an array of points, test for trivial containment conditions.\n * * ClipStatus.TrivialAccept if all points are in any one of the convexSet's.\n * * ClipStatus.ClipRequired if (in any single convexSet) there were points on both sides of any single plane.\n * * ClipStatus.TrivialReject if neither of those occurred.\n */\n public static pointSetSingleClipStatus(\n points: GrowableXYZArray, planeSet: UnionOfConvexClipPlaneSets, tolerance: number,\n ): ClipStatus {\n if (planeSet.convexSets.length === 0)\n return ClipStatus.TrivialAccept;\n\n for (const convexSet of planeSet.convexSets) {\n let allOutsideSinglePlane = false, anyOutside = false;\n\n for (const plane of convexSet.planes) {\n let numInside = 0, numOutside = 0;\n const planeDistance = plane.distance - tolerance;\n\n const currPt = Point3d.create();\n const currVec = Vector3d.create();\n for (let i = 0; i < points.length; i++) {\n points.getPoint3dAtUncheckedPointIndex(i, currPt);\n currVec.setFrom(currPt);\n currVec.dotProduct(plane.inwardNormalRef) > planeDistance ? numInside++ : numOutside++;\n }\n\n anyOutside = (numOutside !== 0) ? true : anyOutside;\n if (numInside === 0) {\n allOutsideSinglePlane = true;\n break;\n }\n }\n\n if (!anyOutside) // totally inside this set - no clip required\n return ClipStatus.TrivialAccept;\n if (!allOutsideSinglePlane)\n return ClipStatus.ClipRequired;\n }\n return ClipStatus.TrivialReject;\n }\n /**\n * Emit point loops for intersection of a convex set with a range.\n * * return zero length array for (a) null range or (b) no intersections\n * @param range range to intersect\n * @param includeConvexSetFaces if false, do not compute facets originating as convex set planes.\n * @param includeRangeFaces if false, do not compute facets originating as range faces\n * @param ignoreInvisiblePlanes if true, do NOT compute a facet for convex set faces marked invisible.\n */\n public static announceLoopsOfConvexClipPlaneSetIntersectRange(\n convexSet: ConvexClipPlaneSet | ClipPlane,\n range: Range3d,\n loopFunction: (loopPoints: GrowableXYZArray) => void,\n includeConvexSetFaces: boolean = true,\n includeRangeFaces: boolean = true,\n ignoreInvisiblePlanes = false,\n ): void {\n const work = new GrowableXYZArray();\n if (includeConvexSetFaces) {\n // Clip convexSet planes to the range and to the rest of the convexSet . .\n if (convexSet instanceof ConvexClipPlaneSet) {\n for (const plane of convexSet.planes) {\n if (ignoreInvisiblePlanes && plane.invisible)\n continue;\n const pointsClippedToRange = plane.intersectRange(range, true);\n const finalPoints = new GrowableXYZArray();\n if (pointsClippedToRange) {\n convexSet.polygonClip(pointsClippedToRange, finalPoints, work, plane);\n if (finalPoints.length > 0)\n loopFunction(finalPoints);\n }\n }\n } else { // `convexSet` is just one plane ...\n if (ignoreInvisiblePlanes && convexSet.invisible) {\n // skip it !\n } else {\n const pointsClippedToRange = convexSet.intersectRange(range, true);\n if (pointsClippedToRange)\n loopFunction(pointsClippedToRange);\n }\n }\n }\n\n if (includeRangeFaces) {\n // clip range faces to the convex set . . .\n const corners = range.corners();\n for (let i = 0; i < 6; i++) {\n const indices = Range3d.faceCornerIndices(i);\n const finalPoints = new GrowableXYZArray();\n const lineString = LineString3d.createIndexedPoints(corners, indices);\n if (convexSet instanceof ConvexClipPlaneSet) {\n convexSet.polygonClip(lineString.packedPoints, finalPoints, work);\n if (finalPoints.length > 0)\n loopFunction(finalPoints);\n } else {\n convexSet.clipConvexPolygonInPlace(lineString.packedPoints, work);\n if (lineString.packedPoints.length > 0)\n loopFunction(lineString.packedPoints);\n }\n }\n }\n }\n /**\n * Return a (possibly empty) array of geometry (Loops !!) which are facets of the intersection of the convex set\n * intersecting a range.\n * * Return zero length array for (a) null range or (b) no intersections\n * @param allClippers convex or union clipper\n * @param range range to intersect\n * @param includeConvexSetFaces if false, do not compute facets originating as convex set planes.\n * @param includeRangeFaces if false, do not compute facets originating as range faces\n * @param ignoreInvisiblePlanes if true, do NOT compute a facet for convex set faces marked invisible.\n */\n public static loopsOfConvexClipPlaneIntersectionWithRange(\n allClippers: ConvexClipPlaneSet | UnionOfConvexClipPlaneSets | ClipPlane,\n range: Range3d,\n includeConvexSetFaces: boolean = true,\n includeRangeFaces: boolean = true,\n ignoreInvisiblePlanes = false,\n ): GeometryQuery[] {\n const result: GeometryQuery[] = [];\n if (allClippers instanceof UnionOfConvexClipPlaneSets) {\n for (const clipper of allClippers.convexSets) {\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(clipper, range,\n (points: GrowableXYZArray) => {\n if (points.length > 0) result.push(Loop.createPolygon(points));\n },\n includeConvexSetFaces, includeRangeFaces, ignoreInvisiblePlanes);\n }\n } else if (allClippers instanceof ConvexClipPlaneSet || allClippers instanceof ClipPlane) {\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(allClippers, range,\n (points: GrowableXYZArray) => {\n if (points.length > 0) result.push(Loop.createPolygon(points));\n },\n includeConvexSetFaces, includeRangeFaces, ignoreInvisiblePlanes);\n }\n return result;\n }\n /**\n * Return the (possibly null) range of the intersection of the convex set with a range.\n * * The convex set is permitted to be unbounded (e.g. a single plane). The range parameter provides bounds.\n * @param convexSet convex set for intersection.\n * @param range range to intersect\n */\n public static rangeOfConvexClipPlaneSetIntersectionWithRange(convexSet: ConvexClipPlaneSet, range: Range3d): Range3d {\n const result = Range3d.createNull();\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(convexSet, range,\n (points: GrowableXYZArray) => {\n if (points.length > 0) result.extendArray(points);\n },\n true, true, false);\n return result;\n }\n /**\n * Return the range of various types of clippers\n * * `ConvexClipPlaneSet` -- dispatch to `rangeOfConvexClipPlaneSetIntersectionWithRange`\n * * `UnionOfConvexClipPlaneSet` -- union of ranges of member `ConvexClipPlaneSet`\n * * `ClipPrimitive` -- access its `UnionOfConvexClipPlaneSet`.\n * * `ClipVector` -- intersection of the ranges of its `ClipPrimitive`.\n * * `undefined` -- entire input range.\n * * If `observeInvisibleFlag` is false, the \"invisible\" properties are ignored, and this effectively returns the range of the edge work of the members\n * * If `observeInvisibleFlag` is true, the \"invisible\" properties are observed, and \"invisible\" parts do not restrict the range.\n * @param clipper\n * @param range non-null range.\n * @param observeInvisibleFlag indicates how \"invisible\" bit is applied for ClipPrimitive.\n */\n public static rangeOfClipperIntersectionWithRange(\n clipper: ConvexClipPlaneSet | UnionOfConvexClipPlaneSets | ClipPrimitive | ClipVector | undefined,\n range: Range3d,\n observeInvisibleFlag: boolean = true,\n ): Range3d {\n if (clipper === undefined)\n return range.clone();\n if (clipper instanceof ConvexClipPlaneSet)\n return this.rangeOfConvexClipPlaneSetIntersectionWithRange(clipper, range);\n if (clipper instanceof UnionOfConvexClipPlaneSets) {\n const rangeUnion = Range3d.createNull();\n for (const c of clipper.convexSets) {\n const rangeC = this.rangeOfConvexClipPlaneSetIntersectionWithRange(c, range);\n rangeUnion.extendRange(rangeC);\n }\n return rangeUnion;\n }\n if (clipper instanceof ClipPrimitive) {\n if (observeInvisibleFlag && clipper.invisible)\n return range.clone();\n return this.rangeOfClipperIntersectionWithRange(clipper.fetchClipPlanesRef(), range);\n }\n if (clipper instanceof ClipVector) {\n const rangeIntersection = range.clone();\n for (const c of clipper.clips) {\n if (observeInvisibleFlag && c.invisible) {\n // trivial range tests do not expose the effects. Assume the hole allows everything.\n } else {\n const rangeC = this.rangeOfClipperIntersectionWithRange(c, range, observeInvisibleFlag);\n rangeIntersection.intersect(rangeC, rangeIntersection);\n }\n }\n return rangeIntersection;\n\n }\n return range.clone();\n }\n /**\n * Test if various types of clippers have any intersection with a range.\n * * This follows the same logic as `rangeOfClipperIntersectionWithRange` but attempts to exit at earliest point of confirmed intersection\n * * `ConvexClipPlaneSet` -- dispatch to `doesConvexClipPlaneSetIntersectRange`\n * * `UnionOfConvexClipPlaneSet` -- union of ranges of member `ConvexClipPlaneSet`\n * * `ClipPrimitive` -- access its `UnionOfConvexClipPlaneSet`.\n * * `ClipVector` -- intersection of the ranges of its `ClipPrimitive`.\n * * `undefined` -- entire input range.\n * * If `observeInvisibleFlag` is false, the \"invisible\" properties are ignored, and holes do not affect the result.\n * * If `observeInvisibleFlag` is true, the \"invisible\" properties are observed, and may affect the result.\n * @param clipper\n * @param range non-null range.\n * @param observeInvisibleFlag indicates how \"invisible\" bit is applied for ClipPrimitive.\n */\n public static doesClipperIntersectRange(\n clipper: ConvexClipPlaneSet | UnionOfConvexClipPlaneSets | ClipPrimitive | ClipVector | undefined,\n range: Range3d,\n observeInvisibleFlag: boolean = true,\n ): boolean {\n if (clipper === undefined)\n return true;\n\n if (clipper instanceof ConvexClipPlaneSet)\n return this.doesConvexClipPlaneSetIntersectRange(clipper, range);\n\n if (clipper instanceof UnionOfConvexClipPlaneSets) {\n for (const c of clipper.convexSets) {\n if (this.doesConvexClipPlaneSetIntersectRange(c, range))\n return true;\n }\n return false;\n }\n\n if (clipper instanceof ClipPrimitive) {\n if (observeInvisibleFlag && clipper.invisible) // um is there an easy way to detect range-completely-inside?\n return true;\n return this.doesClipperIntersectRange(clipper.fetchClipPlanesRef(), range);\n }\n\n if (clipper instanceof ClipVector) {\n const rangeIntersection = range.clone();\n for (const c of clipper.clips) {\n if (observeInvisibleFlag && c.invisible) {\n // trivial range tests do not expose the effects. Assume the hole allows everything.\n } else {\n const rangeC = this.rangeOfClipperIntersectionWithRange(c, range, observeInvisibleFlag);\n rangeIntersection.intersect(rangeC, rangeIntersection);\n }\n }\n return !rangeIntersection.isNull;\n }\n /** If the case statement above is complete for the variant inputs, this is unreachable .. */\n return false;\n }\n /**\n * Emit point loops for intersection of a convex set with a range.\n * * return zero length array for (a) null range or (b) no intersections\n * @param range range to intersect\n * @param includeConvexSetFaces if false, do not compute facets originating as convex set planes.\n * @param includeRangeFaces if false, do not compute facets originating as range faces\n * @param ignoreInvisiblePlanes if true, do NOT compute a facet for convex set faces marked invisible.\n */\n public static doesConvexClipPlaneSetIntersectRange(\n convexSet: ConvexClipPlaneSet,\n range: Range3d,\n includeConvexSetFaces: boolean = true,\n includeRangeFaces: boolean = true,\n ignoreInvisiblePlanes = false,\n ): boolean {\n const work = new GrowableXYZArray();\n if (includeConvexSetFaces) {\n // Clip convexSet planes to the range and to the rest of the convexSet . .\n for (const plane of convexSet.planes) {\n if (ignoreInvisiblePlanes && plane.invisible)\n continue;\n const pointsClippedToRange = plane.intersectRange(range, true);\n if (pointsClippedToRange) {\n const finalPoints = new GrowableXYZArray();\n convexSet.polygonClip(pointsClippedToRange, finalPoints, work, plane);\n if (finalPoints.length > 0)\n return true;\n }\n }\n }\n\n if (includeRangeFaces) {\n // clip range faces to the convex set . . .\n const corners = range.corners();\n for (let i = 0; i < 6; i++) {\n const indices = Range3d.faceCornerIndices(i);\n const finalPoints = new GrowableXYZArray();\n const lineString = LineString3d.createIndexedPoints(corners, indices);\n convexSet.polygonClip(lineString.packedPoints, finalPoints, work);\n if (finalPoints.length > 0)\n return true;\n }\n }\n return false;\n }\n /**\n * Create a clipper from the transformed range.\n * @param range input range to create clipper from\n * @param transform how to transform the range (NOTE: applied to the range faces without swelling the range volume)\n * @param degeneratePoints optionally populated with the 1 or 2 points defining the transformed range if it is degenerate (all points colinear/coincident); otherwise untouched\n * @returns newly constructed clipper. If no clip planes could be computed, fill `degeneratePoints` and return undefined.\n */\n private static createClipperFromTransformedRange3d(range: Range3d, transform: Transform, degeneratePoints?: Point3d[]): ConvexClipPlaneSet | undefined {\n if (!transform)\n transform = Transform.createIdentity();\n const builder = PolyfaceBuilder.create();\n builder.addTransformedRangeMesh(transform, range);\n const mesh = builder.claimPolyface();\n const clipper = this._workClipper = ConvexClipPlaneSet.createConvexPolyface(mesh, this._workClipper).clipper;\n if (clipper.planes.length > 0)\n return clipper;\n // no faces found in the compressed mesh\n if (degeneratePoints) {\n assert(mesh.data.point.length <= 2);\n for (let i = 0; i < 2; ++i) {\n const point = mesh.data.point.getPoint3dAtCheckedPointIndex(i);\n if (point)\n degeneratePoints.push(point);\n }\n }\n return undefined;\n }\n /**\n * Handle pathological cases of range-range intersection, where one of the ranges defines no area or volume (is a line segment or single point).\n * @param range local range to intersect with the point/segment\n * @param points isolated local point, or local segment's start and end\n * @param localToWorld optional transform for output range\n * @param intersection optional range of the intersection, in world coordinates, or null range if no intersection.\n * @returns whether the point/segment intersects the range\n */\n private static rangeIntersectPointOrSegment(range: Range3d, points: Point3d[], localToWorld?: Transform, intersection?: Range3d): boolean {\n const announceInterval: AnnounceNumberNumberCurvePrimitive | undefined = intersection ?\n (f0: number, f1: number, cp: CurvePrimitive) => {\n intersection.extendPoint(cp.fractionToPoint(f0), localToWorld);\n intersection.extendPoint(cp.fractionToPoint(f1), localToWorld);\n } : undefined;\n let hasIntersection = false;\n if (points.length > 1) {\n const segment = LineSegment3d.createCapture(points[0], points[1]);\n const clipper = ConvexClipPlaneSet.createRange3dPlanes(range);\n hasIntersection = segment.announceClipIntervals(clipper, announceInterval);\n } else if (points.length > 0) {\n hasIntersection = range.containsPoint(points[0]);\n if (hasIntersection && intersection)\n intersection.extendPoint(points[0], localToWorld);\n }\n return hasIntersection;\n }\n /**\n * Test for intersection of two ranges in different local coordinates.\n * * Useful for clash detection of elements in iModels, using their stored (tight) local ranges and placement transforms.\n * @param range0 first range in local coordinates\n * @param local0ToWorld placement transform for first range\n * @param range1 second range in local coordinates\n * @param local1ToWorld placement transform for second range. Assumed to be invertible.\n * @param range1Margin optional signed local distance to expand/contract the second range before intersection. Positive expands.\n * @return whether the local ranges are adjacent or intersect. Also returns false if local1ToWorld is singular.\n */\n public static doLocalRangesIntersect(\n range0: Range3d, local0ToWorld: Transform, range1: Range3d, local1ToWorld: Transform, range1Margin?: number,\n ): boolean {\n const worldToLocal1 = this._workTransform = local1ToWorld.inverse(this._workTransform);\n if (!worldToLocal1)\n return false;\n let myRange1 = range1;\n if (range1Margin) {\n myRange1 = this._workRange = range1.clone(this._workRange);\n myRange1.expandInPlace(range1Margin);\n }\n const degeneratePoints: Point3d[] = [];\n const local0ToLocal1 = worldToLocal1.multiplyTransformTransform(local0ToWorld, worldToLocal1);\n // convert range0 into a clipper in local1 coordinates, then intersect with range1\n const clipper = this.createClipperFromTransformedRange3d(range0, local0ToLocal1, degeneratePoints);\n if (clipper)\n return this.doesClipperIntersectRange(clipper, myRange1);\n return this.rangeIntersectPointOrSegment(myRange1, degeneratePoints, local1ToWorld);\n }\n /**\n * Compute the range of the intersection between two local (e.g., element-aligned) ranges.\n * @param range0 first range in local coordinates\n * @param local0ToWorld placement transform for first range\n * @param range1 second range in local coordinates\n * @param local1ToWorld placement transform for second range. Assumed to be invertible.\n * @param result optional pre-allocated range to fill and return\n * @return range of the intersection (aligned to world axes). Returns null range if local1ToWorld is singular.\n */\n public static rangeOfIntersectionOfLocalRanges(range0: Range3d, local0ToWorld: Transform, range1: Range3d, local1ToWorld: Transform, result?: Range3d): Range3d {\n const myResult = Range3d.createNull(result);\n const worldToLocal1 = this._workTransform = local1ToWorld.inverse(this._workTransform);\n if (!worldToLocal1)\n return myResult;\n const degeneratePoints: Point3d[] = [];\n const local0ToLocal1 = worldToLocal1.multiplyTransformTransform(local0ToWorld, worldToLocal1);\n // convert range0 into a clipper in local1 coordinates, then intersect with range1\n const clipper = this.createClipperFromTransformedRange3d(range0, local0ToLocal1, degeneratePoints);\n if (clipper)\n this.announceLoopsOfConvexClipPlaneSetIntersectRange(clipper, range1, (loopPoints: GrowableXYZArray) => { loopPoints.extendRange(myResult, local1ToWorld); });\n else\n this.rangeIntersectPointOrSegment(range1, degeneratePoints, local1ToWorld, myResult);\n return myResult;\n }\n /**\n * Test if `obj` is a `Clipper` object.\n * * This is implemented by testing for each of the methods in the `Clipper` interface.\n */\n public static isClipper(obj: any): boolean {\n if (obj) {\n if (obj.isPointOnOrInside\n && obj.announceClippedSegmentIntervals\n && obj.announceClippedArcIntervals)\n return true;\n }\n return false;\n }\n /**\n * Specialized logic for replacing clip fragments by an equivalent singleton.\n * * If there are baseCount + 1 or fewer fragments, do nothing.\n * * If there are more than baseCount+1 fragments:\n * * drop them all to the cache\n * * push a copy of the singleton.\n * * The use case for this is that a multi-step clipper (e.g. UnionOfConvexClipPlaneSets) may produce many fragments,\n * and then be able to determine that they really are the original pre-clip polygon unchanged.\n * * The baseCount+1 case is the case where the entire original singleton is still a singleton and can be left alone.\n * * Calling this replacer shuffles the original back into the fragment array, and drops the fragments.\n * * This determination is solely within the logic of the caller.\n * @param shards array of fragments\n * @param baseCount original count\n * @param singleton single array which may be a replacement for multiple fragments\n * @param cache cache for array management\n */\n public static restoreSingletonInPlaceOfMultipleShards(\n fragments: GrowableXYZArray[] | undefined, baseCount: number, singleton: IndexedXYZCollection, arrayCache: GrowableXYZArrayCache,\n ): void {\n if (fragments && fragments.length > baseCount + 1) {\n while (fragments.length > baseCount) {\n const f = fragments.pop();\n arrayCache.dropToCache(f);\n }\n fragments.push(arrayCache.grabAndFill(singleton));\n }\n }\n /**\n * Create a UnionOfConvexClipPlaneSets for a volume defined by a path and offsets.\n * @param points points along the path.\n * @param positiveOffsetLeft offset to left. 0 is clip on the path.\n * @param positiveOffsetRight offset to the right. 0 is clip on the path.\n * @param z0 z for lower clipping plane. If undefined, unbounded in positive z\n * @param z1 z for upper clipping plane. If undefined, unbounded in negative z.\n * @alpha\n */\n public static createXYOffsetClipFromLineString(\n points: Point3d[] | IndexedXYZCollection, leftOffset: number, rightOffset: number, z0: number, z1: number,\n ): UnionOfConvexClipPlaneSets {\n if (Array.isArray(points)) {\n return LineStringOffsetClipperContext.createClipBetweenOffsets(\n new Point3dArrayCarrier(points), leftOffset, rightOffset, z0, z1);\n }\n return LineStringOffsetClipperContext.createClipBetweenOffsets(points, leftOffset, rightOffset, z0, z1);\n }\n /** If data.length >= minLength threshold, push it to destination; if smaller drop it back to the cache. */\n public static captureOrDrop(\n data: GrowableXYZArray, minLength: number, destination: GrowableXYZArray[], cache: GrowableXYZArrayCache,\n ): void {\n if (data.length >= minLength)\n destination.push(data);\n else\n cache.dropToCache(data);\n }\n /**\n * Find the portion of a line within a half-plane clip.\n * * The half-plane clip is to the left of the line from clipA to clipB.\n * * The original clipped segment has fractions 0 and 1 at respective segment points.\n * * Caller initializes the interval\n * * This method reduces the interval size.\n * * See clipSegmentToCCWTriangleXY for typical use.\n * @param linePointA First point of clip line\n * @param linePointB Second point of clip line\n * @param segmentPoint0 First point of clipped segment\n * @param segmentPoint1 Second point of clipped segment\n * @param interval Live interval.\n * @param absoluteTolerance absolute tolerance for both cross product values to indicate \"on\" the line\n */\n public static clipSegmentToLLeftOfLineXY(\n linePointA: XAndY, linePointB: XAndY, segmentPoint0: XAndY, segmentPoint1: XAndY, interval: Range1d, absoluteTolerance: number = 1.0e-14,\n ): void {\n const ux = linePointB.x - linePointA.x;\n const uy = linePointB.y - linePointA.y;\n // negative is in positive is out ...\n const h0 = -(ux * (segmentPoint0.y - linePointA.y) - uy * (segmentPoint0.x - linePointA.x));\n const h1 = -(ux * (segmentPoint1.y - linePointA.y) - uy * (segmentPoint1.x - linePointA.x));\n if (h0 < absoluteTolerance && h1 < absoluteTolerance) {\n // The entire segment is in .....\n return;\n }\n if (h0 * h1 > 0.0) {\n if (h0 > 0.0)\n interval.setNull();\n } else if (h0 * h1 < 0.0) {\n // strict crossing with safe fraction . . .\n const fraction = -h0 / (h1 - h0);\n if (h0 < 0.0) {\n return interval.intersectRangeXXInPlace(0.0, fraction);\n } else {\n return interval.intersectRangeXXInPlace(fraction, 1.0);\n }\n } else {\n // There is an exact hit at one end, possibly non-zero at the other ... the sign of either determines which side is in play\n // A zero and a zero or negative is entirely in, which does not alter the prior clip.\n if (h0 > 0.0) {\n interval.intersectRangeXXInPlace(1.0, 1.0);\n } else if (h1 > 0.0) {\n interval.intersectRangeXXInPlace(0.0, 0.0);\n }\n }\n }\n /**\n * Clip an interval of a line segment to a triangle.\n * * Triangle is assumed CCW\n * @param pointA point of triangle.\n * @param pointB point of triangle.\n * @param pointC point of triangle.\n * @param segment0 start of segment\n * @param segment1 end of segment\n * @param interval Pre-initialized interval of live part of segment\n * @param absoluteTolerance absolute tolerance for begin \"on a line\"\n */\n public static clipSegmentToCCWTriangleXY(\n pointA: XAndY, pointB: XAndY, pointC: XAndY, segment0: XAndY, segment1: XAndY, interval: Range1d, absoluteTolerance: number = 1.0e-14,\n ): void {\n if (!interval.isNull) {\n this.clipSegmentToLLeftOfLineXY(pointA, pointB, segment0, segment1, interval, absoluteTolerance);\n if (!interval.isNull) {\n this.clipSegmentToLLeftOfLineXY(pointB, pointC, segment0, segment1, interval, absoluteTolerance);\n if (!interval.isNull) {\n this.clipSegmentToLLeftOfLineXY(pointC, pointA, segment0, segment1, interval, absoluteTolerance);\n }\n }\n }\n }\n /**\n * Find the portion of a line within a half-plane clip.\n * * The half-plane clip is to the left of the line from clipA to clipB.\n * * The original clipped segment has fractions 0 and 1 at respective segment points.\n * * Caller initializes the interval\n * * This method reduces the interval size.\n * * See clipSegmentToCCWTriangleXY for typical use.\n * @param linePointA First point of clip line\n * @param linePointB Second point of clip line\n * @param segmentPoint0 First point of clipped segment\n * @param segmentPoint1 Second point of clipped segment\n * @param interval Live interval.\n * @param absoluteTolerance absolute tolerance for both cross product values to indicate \"on\" the line\n */\n public static clipSegmentBelowPlaneXY(\n plane: Plane3dByOriginAndUnitNormal, segmentPoint0: XAndY, segmentPoint1: XAndY, interval: Range1d, absoluteTolerance: number = 1.0e-14,\n ): void {\n // negative is in positive is out ...\n const h0 = plane.altitudeXY(segmentPoint0.x, segmentPoint0.y);\n const h1 = plane.altitudeXY(segmentPoint1.x, segmentPoint1.y);\n if (h0 < absoluteTolerance && h1 < absoluteTolerance) {\n // The entire segment is in ..... the interval is unaffected.\n return;\n }\n if (h0 * h1 > 0.0) {\n if (h0 > 0.0)\n interval.setNull();\n } else if (h0 * h1 < 0.0) {\n // strict crossing with safe fraction . . .\n const fraction = -h0 / (h1 - h0);\n if (h0 < 0.0) {\n return interval.intersectRangeXXInPlace(0.0, fraction);\n } else {\n return interval.intersectRangeXXInPlace(fraction, 1.0);\n }\n } else {\n // There is an exact hit at one end, possibly non-zero at the other ... the sign of either determines which side is in play\n // A zero and a zero or negative is entirely in, which does not alter the prior clip.\n if (h0 > 0.0) {\n interval.intersectRangeXXInPlace(1.0, 1.0);\n } else if (h1 > 0.0) {\n interval.intersectRangeXXInPlace(0.0, 0.0);\n }\n }\n }\n /**\n * Clip an interval of a line segment to an array of planes\n * * plane normals assumed OUTWARD\n * * planeAltitude is typically a tolerance a tolerance distance.\n * * positive altitude makes tha plane move in the direction of the unit normal.\n * @param planes array of planes\n * @param segment0 start of segment\n * @param segment1 end of segment\n * @param interval Pre-initialized interval of live part of segment\n * @param absoluteTolerance absolute tolerance for begin \"on a line\"\n */\n public static clipSegmentBelowPlanesXY(\n planes: Plane3dByOriginAndUnitNormal[], segment0: XAndY, segment1: XAndY, interval: Range1d, signedAltitude: number = 1.0e-14,\n ): void {\n const numPlanes = planes.length;\n for (let i = 0; (!interval.isNull) && i < numPlanes; i++) {\n this.clipSegmentBelowPlaneXY(planes[i], segment0, segment1, interval, signedAltitude);\n }\n }\n /**\n * Pass line segments from a polyline to the clipper. Resolve the fractional clips to simple points for announcement.\n * @param clipper clipper to call\n * @param points polyline whose segments are passed to the clipper\n * @param announce caller's handler for simple point pairs.\n */\n public static announcePolylineClip(\n clipper: Clipper, points: Point3d[], announce: (point0: Point3d, point1: Point3d) => void,\n ): void {\n for (let i = 0; i + 1 < points.length; i++) {\n clipper.announceClippedSegmentIntervals(0, 1, points[i], points[i + 1],\n (f0: number, f1: number) => {\n announce(points[i].interpolate(f0, points[i + 1]), points[i].interpolate(f1, points[i + 1]));\n });\n }\n }\n /**\n * Pass line segments from a polyline to the clipper. Sum the lengths of the clipped pieces. Return the sum.\n * @param clipper clipper to call\n * @param points polyline whose segments are passed to the clipper\n */\n public static sumPolylineClipLength(clipper: Clipper, points: Point3d[]): number {\n let s = 0;\n for (let i = 0; i + 1 < points.length; i++) {\n const a = points[i].distance(points[i + 1]);\n clipper.announceClippedSegmentIntervals(0, 1, points[i], points[i + 1],\n (f0: number, f1: number) => { s += Math.abs(f1 - f0) * a; });\n }\n return s;\n }\n /**\n * Pass polygon `xyz` through a sequence of PolygonClip steps.\n * * At the outset, `xyz` is the (only) entry in a set of candidates.\n * * For each clipper, each candidate is presented for appendPolygon to inside and outside parts.\n * * Each (in,out) result is distributed among (acceptedIn, acceptedOut, candidates) according to\n * (inAction, outAction)\n * * At the end, all remaining candidates are distributed among (acceptedIn, acceptedOut, finalUnknown)\n * according to finalAction\n * * Any clipper that does not have an appendPolygonClip method is skipped.\n * @param xyz\n * @param clippers\n * @param acceptedIn\n * @param acceptedOut\n * @param finalCandidates\n * @param inAction\n * @param outAction\n * @param finalCandidateAction\n */\n public static doPolygonClipSequence(\n xyz: IndexedXYZCollection,\n clippers: Clipper[],\n acceptedIn: GrowableXYZArray[] | undefined,\n acceptedOut: GrowableXYZArray[] | undefined,\n finalCandidates: GrowableXYZArray[] | undefined,\n inAction: ClipStepAction,\n outAction: ClipStepAction,\n finalFragmentAction: ClipStepAction,\n arrayCache: GrowableXYZArrayCache | undefined,\n ) {\n if (arrayCache === undefined)\n arrayCache = new GrowableXYZArrayCache();\n let candidates = [arrayCache.grabAndFill(xyz)];\n let nextCandidates: GrowableXYZArray[] = [];\n const intermediateIn: GrowableXYZArray[] = [];\n const intermediateOut: GrowableXYZArray[] = [];\n const oldInsideCount = acceptedIn ? acceptedIn.length : 0;\n const oldOutsideCount = acceptedOut ? acceptedOut.length : 0;\n let shard;\n // At each convex set, carryForwardA is all the fragments that have been outside all previous convex sets.\n // Clip each such fragment to the current set, sending the outside parts to carryForwardB, which will got to\n // the next clipper. The final surviving carryForward really is out.\n for (const c of clippers) {\n if (c.appendPolygonClip) {\n while (undefined !== (shard = candidates.pop())) {\n c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);\n distributeFragments(inAction, intermediateIn, acceptedIn, acceptedOut, nextCandidates, arrayCache);\n distributeFragments(outAction, intermediateOut, acceptedIn, acceptedOut, nextCandidates, arrayCache);\n arrayCache.dropToCache(shard);\n }\n // candidates is empty !!\n const temp = candidates; candidates = nextCandidates; nextCandidates = temp;\n }\n }\n distributeFragments(finalFragmentAction, candidates, acceptedIn, acceptedOut, finalCandidates, arrayCache);\n // Note: The following assumes that there were no residual candidates ... need to track if that happened?\n // If nothing was out, the inside fragments can be replaced by the original.\n if (acceptedOut?.length === oldOutsideCount)\n ClipUtilities.restoreSingletonInPlaceOfMultipleShards(acceptedIn, oldInsideCount, xyz, arrayCache);\n // If nothing was in, the outside fragments can be replaced by the original.\n if (acceptedIn?.length === oldInsideCount)\n ClipUtilities.restoreSingletonInPlaceOfMultipleShards(acceptedOut, oldOutsideCount, xyz, arrayCache);\n }\n /** Pass polygon `xyz` through a sequence of PolygonClip steps with \"parity\" rules */\n public static doPolygonClipParitySequence(\n xyz: IndexedXYZCollection,\n clippers: Clipper[],\n acceptedIn: GrowableXYZArray[] | undefined,\n acceptedOut: GrowableXYZArray[] | undefined,\n arrayCache: GrowableXYZArrayCache | undefined,\n ) {\n if (arrayCache === undefined)\n arrayCache = new GrowableXYZArrayCache();\n let candidatesOut = [arrayCache.grabAndFill(xyz)];\n let candidatesIn: GrowableXYZArray[] = [];\n let nextCandidatesIn: GrowableXYZArray[] = [];\n let nextCandidatesOut: GrowableXYZArray[] = [];\n const intermediateIn: GrowableXYZArray[] = [];\n const intermediateOut: GrowableXYZArray[] = [];\n let shard;\n // at each step ..\n // candidatesIn and candidatesOut are evolved in and out\n // nextCandidatesIn and nextCandidatesOut are EMPTY\n for (const c of clippers) {\n if (c.appendPolygonClip) {\n // (IN,OUT) parts of IN parts distribute to (OUT,IN)\n while (undefined !== (shard = candidatesIn.pop())) {\n c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);\n distributeFragments(ClipStepAction.acceptOut, intermediateIn, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\n distributeFragments(ClipStepAction.acceptIn, intermediateOut, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\n arrayCache.dropToCache(shard);\n }\n // (IN,OUT) parts of IN parts distribute to (OUT,IN)\n while (undefined !== (shard = candidatesOut.pop())) {\n c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);\n distributeFragments(ClipStepAction.acceptIn, intermediateIn, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\n distributeFragments(ClipStepAction.acceptOut, intermediateOut, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);\n arrayCache.dropToCache(shard);\n }\n // reload each candidate step\n const tempA = candidatesIn; candidatesIn = nextCandidatesIn; nextCandidatesIn = tempA;\n const tempB = candidatesOut; candidatesOut = nextCandidatesOut; nextCandidatesOut = tempB;\n }\n }\n // candidatesIn and candidatesOut are final ....\n if (candidatesOut.length === 0)\n acceptedIn?.push(arrayCache.grabAndFill(xyz));\n else if (candidatesOut.length === 0)\n acceptedOut?.push(arrayCache.grabAndFill(xyz));\n else {\n moveFragments(candidatesIn, acceptedIn, arrayCache);\n moveFragments(candidatesOut, acceptedOut, arrayCache);\n }\n }\n /**\n * For each plane of clipper, construct a UnionOfConvexClipPlaneSets for an outer (infinite) convex volume that\n * abuts the outer volume of the neighbor faces.\n */\n public static createComplementaryClips(clipper: ConvexClipPlaneSet): UnionOfConvexClipPlaneSets {\n const planes = clipper.planes;\n const interval = Range1d.createNull();\n const n = planes.length;\n const newClippers: ConvexClipPlaneSet[] = [];\n for (const p of planes) {\n const outerSet = ConvexClipPlaneSet.createEmpty();\n outerSet.addPlaneToConvexSet(p.cloneNegated());\n newClippers.push(outerSet);\n }\n for (let i = 0; i < n; i++) {\n for (let j = i + 1; j < n; j++) {\n const ray = CurveFactory.planePlaneIntersectionRay(planes[i], planes[j]);\n if (ray) {\n if (clipper.hasIntersectionWithRay(ray, interval)) {\n // the normal-to-normal vector is bisector (or close to bisector?)\n const newNormal = planes[j].inwardNormalRef.minus(planes[i].inwardNormalRef);\n const plane1 = ClipPlane.createNormalAndPoint(newNormal, ray.origin);\n if (plane1) {\n const plane2 = plane1.cloneNegated();\n newClippers[i].addPlaneToConvexSet(plane1);\n newClippers[j].addPlaneToConvexSet(plane2);\n }\n }\n }\n }\n }\n return UnionOfConvexClipPlaneSets.createConvexSets(newClippers);\n }\n /**\n * Creates clippers for regions closest to the children of a curve chain.\n * * For best results, each child should have length larger than `distanceTol`.\n * @param curveChain A curve chain; xy-only (z-coordinate is ignored). Must have at least 2 children.\n * @param strokeOptions Optional stroke options to control the sampling of the curve chain.\n * @param distanceTol Optional distance tolerance to use when comparing points; default is [[Geometry.smallMetricDistance]].\n * @param boundingBox Optional nominal xy-bounding box for the clipper regions; default is maximal clipper regions.\n * @returns An ordered array of clippers, each of which represents the region closest to the corresponding primitive in the\n * input chain, or undefined if the input is invalid.\n */\n public static createClippersForRegionsClosestToCurvePrimitivesXY(\n curveChain: CurveChain, strokeOptions?: StrokeOptions, distanceTol: number = Geometry.smallMetricDistance, boundingBox?: LowAndHighXY\n ): UnionOfConvexClipPlaneSets[] | undefined {\n const voronoi = Voronoi.createFromCurveChain(curveChain, strokeOptions, distanceTol, boundingBox);\n if (!voronoi)\n return undefined;\n const superFaces = voronoi.computeVoronoiSuperFaces(curveChain.children.length);\n if (superFaces === undefined || superFaces.length !== curveChain.children.length)\n return undefined;\n return voronoi.generateClippersFromVoronoiSuperFaces(superFaces);\n }\n}\nfunction moveFragments(\n fragments: GrowableXYZArray[],\n destination: GrowableXYZArray[] | undefined,\n arrayCache: GrowableXYZArrayCache,\n) {\n if (destination === undefined)\n arrayCache.dropAllToCache(fragments);\n else {\n for (const f of fragments)\n destination.push(f);\n }\n fragments.length = 0;\n}\n/**\n * Distribute fragments among acceptedIn, acceptedOut, and passToNextStep as directed by action.\n * * If the indicated destination is unknown, drop the fragments to the arrayCache.\n * @param action destination selector\n * @param fragments fragments to be distributed\n * @param acceptedIn destination for \"in\"\n * @param acceptedOut destination for \"out\"\n * @param passToNextStep destination for fragments to be passed to a later step\n * @param arrayCache destination for un-distributed fragments.\n */\nfunction distributeFragments(\n action: ClipStepAction,\n fragments: GrowableXYZArray[],\n acceptedIn: GrowableXYZArray[] | undefined,\n acceptedOut: GrowableXYZArray[] | undefined,\n passToNextStep: GrowableXYZArray[] | undefined,\n arrayCache: GrowableXYZArrayCache,\n) {\n let destination;\n if (action === ClipStepAction.acceptIn)\n destination = acceptedIn;\n else if (action === ClipStepAction.acceptOut)\n destination = acceptedOut;\n else if (action === ClipStepAction.passToNextStep)\n destination = passToNextStep;\n // remark: if action is other than the enum values, destination is undefined\n if (destination === undefined)\n arrayCache.dropAllToCache(fragments);\n else {\n for (const f of fragments)\n destination.push(f);\n }\n fragments.length = 0;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ClipVector.js","sourceRoot":"","sources":["../../../src/clipping/ClipVector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAG7C,0DAAuD;AACvD,0CAAuC;AAIvC,+CAA8C;AAG9C,uDAAoD;AAEpD,uDAAgE;AAEhE,mDAAuG;AACvG,2CAA4D;AAS5D;;;;;;GAMG;AACH,MAAa,UAAU;IACb,MAAM,CAAkB;IAChC;;;;;OAKG;IACI,aAAa,GAAY,eAAO,CAAC,UAAU,EAAE,CAAC;IACrD,sDAAsD;IACtD,IAAW,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kBAAkB,EAAE,CAAC;YACxC,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU;oBAC9B,GAAG,GAAG,GAAG,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,CAAC;YACD,OAAO,GAAG,GAAG,GAAG,CAAC;QACnB,CAAC;QACD,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK;YAChC,MAAM,GAAG,GAAG,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,OAAO,GAAG,MAAM,GAAG,CAAC;IACtB,CAAC;;AAraH,gCAsaC;AAWD;;;;GAIG;AACH,IAAiB,qBAAqB,CAkBrC;AAlBD,WAAiB,qBAAqB;IACpC;;;;OAIG;IACH,SAAgB,cAAc,CAAC,IAAiB;QAC9C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO;YACxB,OAAO,SAAS,CAAC;QAEnB,MAAM,GAAG,GAAG,IAAW,CAAC;QACxB,IAAI,SAAS,KAAK,GAAG,CAAC,UAAU;YAC9B,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE1C,MAAM,WAAW,GAAG,GAA4B,CAAC;QACjD,IAAA,qBAAM,EAAC,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,WAAW,CAAC;IACrB,CAAC;IAXe,oCAAc,iBAW7B,CAAA;AACH,CAAC,EAlBgB,qBAAqB,qCAArB,qBAAqB,QAkBrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Segment1d } from \"../geometry3d/Segment1d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { BooleanClipNodeIntersection } from \"./BooleanClipNode\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { ClipMaskXYZRangePlanes, ClipPrimitive, ClipPrimitiveProps, ClipShape } from \"./ClipPrimitive\";\r\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\n\r\n/**\r\n * Wire format describing a [[ClipVector]].\r\n * @public\r\n */\r\nexport type ClipVectorProps = ClipPrimitiveProps[];\r\n\r\n/**\r\n * Class holding an array structure of shapes defined by `ClipPrimitive`\r\n * * The `ClipVector` defines an intersection of the member `ClipPrimitive` regions.\r\n * * In the most common usage, one of the `ClipPrimitive` will be an outer region, and all others are holes with marker\r\n * flag indicating that the outside of each hole is live.\r\n * @public\r\n */\r\nexport class ClipVector implements Clipper {\r\n private _clips: ClipPrimitive[];\r\n /**\r\n * Range acting as first filter.\r\n * * This is understood as overall range limit, not as precise planes.\r\n * * Applying any rotation to the whole ClipVector generally expands this range, rather than exactly transforming\r\n * its planes.\r\n */\r\n public boundingRange: Range3d = Range3d.createNull();\r\n /** Returns a reference to the array of ClipShapes. */\r\n public get clips() { return this._clips; }\r\n private constructor(clips?: ClipPrimitive[]) {\r\n this._clips = clips ? clips : [];\r\n }\r\n /** Returns true if this ClipVector contains a ClipPrimitive. */\r\n public get isValid(): boolean { return this._clips.length > 0; }\r\n /** Create a ClipVector with an empty set of ClipShapes. */\r\n public static createEmpty(result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips.length = 0;\r\n return result;\r\n }\r\n return new ClipVector();\r\n }\r\n /** Create a ClipVector from an array of ClipPrimitives (or derived classes) (capture the pointers) */\r\n public static createCapture(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips = clips;\r\n return result;\r\n }\r\n return new ClipVector(clips);\r\n }\r\n /** Create a ClipVector from (clones of) an array of ClipPrimitives */\r\n public static create(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n const clipClones: ClipPrimitive[] = [];\r\n for (const clip of clips)\r\n clipClones.push(clip.clone());\r\n return ClipVector.createCapture(clipClones, result);\r\n }\r\n /** Create a deep copy of another ClipVector */\r\n public clone(result?: ClipVector): ClipVector {\r\n const retVal = result ? result : new ClipVector();\r\n retVal._clips.length = 0;\r\n for (const clip of this._clips) {\r\n retVal._clips.push(clip.clone());\r\n }\r\n retVal.boundingRange.setFrom(this.boundingRange);\r\n return retVal;\r\n }\r\n /** Parse this ClipVector into a JSON object. */\r\n public toJSON(): ClipVectorProps {\r\n if (!this.isValid)\r\n return [];\r\n\r\n return this.clips.map((clip) => clip.toJSON());\r\n }\r\n /** Parse a JSON object into a new ClipVector. */\r\n public static fromJSON(json: ClipVectorProps | undefined, result?: ClipVector): ClipVector {\r\n result = result ? result : new ClipVector();\r\n result.clear();\r\n if (!Array.isArray(json))\r\n return result;\r\n try {\r\n for (const clip of json) {\r\n const clipPrim = ClipPrimitive.fromJSON(clip);\r\n if (clipPrim)\r\n result._clips.push(clipPrim);\r\n }\r\n } catch {\r\n result.clear();\r\n }\r\n return result;\r\n }\r\n /** Empties out the array of ClipShapes. */\r\n public clear() {\r\n this._clips.length = 0;\r\n }\r\n /** Append a deep copy of the given ClipPrimitive to this ClipVector. */\r\n public appendClone(clip: ClipPrimitive) {\r\n this._clips.push(clip.clone());\r\n }\r\n /** Append a reference of the given ClipPrimitive to this ClipVector. */\r\n public appendReference(clip: ClipPrimitive) {\r\n this._clips.push(clip);\r\n }\r\n /** Create and append a new ClipPrimitive to the array given a shape as an array of points. Returns true if successful. */\r\n public appendShape(shape: Point3d[], zLow?: number, zHigh?: number,\r\n transform?: Transform, isMask: boolean = false, invisible: boolean = false): boolean {\r\n const clip = ClipShape.createShape(shape, zLow, zHigh, transform, isMask, invisible);\r\n if (!clip)\r\n return false;\r\n this._clips.push(clip);\r\n return true;\r\n }\r\n /** Returns true if the given point lies inside all of this ClipVector's ClipShapes (by rule of intersection).*/\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n return this.isPointOnOrInside(point, onTolerance);\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n if (!this.boundingRange.isNull && !this.boundingRange.containsPoint(point))\r\n return false;\r\n\r\n for (const clip of this._clips) {\r\n if (!clip.pointInside(point, onTolerance))\r\n return false;\r\n }\r\n return true;\r\n }\r\n // Proxy object to implement line and arc clip.\r\n private _clipNodeProxy?: BooleanClipNodeIntersection;\r\n private ensureProxyClipNode(): boolean {\r\n if (this._clipNodeProxy)\r\n return true;\r\n this._clipNodeProxy = new BooleanClipNodeIntersection(true);\r\n let numChildren = 0;\r\n for (const child of this._clips) {\r\n const q = child.fetchClipPlanesRef();\r\n if (q) {\r\n numChildren++;\r\n this._clipNodeProxy.captureChild(q);\r\n }\r\n }\r\n return numChildren > 0;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n return this._clipNodeProxy.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\r\n return false;\r\n }\r\n /** Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n return this._clipNodeProxy.announceClippedArcIntervals(arc, announce);\r\n return false;\r\n }\r\n /** Execute polygon clip as intersection of the child primitives. */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache) {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n this._clipNodeProxy.appendPolygonClip(xyz, insideFragments, outsideFragments, arrayCache);\r\n }\r\n /**\r\n * Transforms this ClipVector to a new coordinate-system.\r\n * Note that if the transform has rotate and scale the boundingRange member expands.\r\n * Returns true if successful.\r\n */\r\n public transformInPlace(transform: Transform): boolean {\r\n for (const clip of this._clips)\r\n if (clip.transformInPlace(transform) === false)\r\n return false;\r\n\r\n if (!this.boundingRange.isNull)\r\n transform.multiplyRange(this.boundingRange, this.boundingRange);\r\n\r\n return true;\r\n }\r\n /**\r\n * A simple way of packaging this ClipVector's ClipShape points into a multidimensional array, while also\r\n * taking into account each ClipPrimitive's individual transforms.\r\n * ClipPrimitives OTHER THAN ClipShape are ignored.\r\n * Information out:\r\n * - All of the loop points are stored in the multidimensional Point3d array given (will return unchanged upon failure).\r\n * - If given a transform, will be set from the transformFromClip of the first ClipPrimitive.\r\n * - The ClipMask of the final ClipPrimitive is stored in the returned array at index 0.\r\n * - The last valid zLow found is stored in the returned array at index 1.\r\n * - The last valid zHigh found is stored in the returned array at index 2.\r\n */\r\n public extractBoundaryLoops(loopPoints: Point3d[][], transform?: Transform): number[] {\r\n let clipM = ClipMaskXYZRangePlanes.None;\r\n let zBack = -Number.MAX_VALUE;\r\n let zFront = Number.MAX_VALUE;\r\n const retVal: number[] = [];\r\n let nLoops = 0;\r\n\r\n if (this._clips.length === 0)\r\n return retVal;\r\n let firstClipShape: ClipShape | undefined;\r\n const deltaTrans = Transform.createIdentity();\r\n\r\n for (const clip of this._clips) {\r\n if (clip instanceof ClipShape) {\r\n if (firstClipShape !== undefined && clip !== firstClipShape) { // Is not the first iteration\r\n let fwdTrans = Transform.createIdentity();\r\n let invTrans = Transform.createIdentity();\r\n\r\n if (firstClipShape.transformValid && clip.transformValid) {\r\n fwdTrans = clip.transformFromClip!.clone();\r\n invTrans = firstClipShape.transformToClip!.clone();\r\n }\r\n deltaTrans.setFrom(invTrans.multiplyTransformTransform(fwdTrans));\r\n }\r\n if (!firstClipShape)\r\n firstClipShape = clip;\r\n loopPoints[nLoops] = [];\r\n\r\n if (clip.polygon !== undefined) {\r\n clipM = ClipMaskXYZRangePlanes.XAndY;\r\n\r\n if (clip.zHighValid) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZHigh;\r\n zFront = clip.zHigh!;\r\n }\r\n if (clip.zLowValid) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZLow;\r\n zBack = clip.zLow!;\r\n }\r\n\r\n for (const point of clip.polygon)\r\n loopPoints[nLoops].push(point.clone());\r\n deltaTrans.multiplyPoint3dArray(loopPoints[nLoops], loopPoints[nLoops]);\r\n nLoops++;\r\n }\r\n }\r\n }\r\n retVal.push(clipM);\r\n retVal.push(zBack);\r\n retVal.push(zFront);\r\n if (transform && firstClipShape)\r\n transform.setFrom(firstClipShape.transformFromClip!);\r\n return retVal;\r\n }\r\n /** Sets this ClipVector and all of its members to the visibility specified. */\r\n public setInvisible(invisible: boolean) {\r\n for (const clip of this._clips)\r\n clip.setInvisible(invisible);\r\n }\r\n /**\r\n * For every clip, parse the member point array into the member clip plane object (only for clipPlanes member,\r\n * not the mask)\r\n */\r\n public parseClipPlanes() {\r\n for (const clip of this._clips)\r\n clip.fetchClipPlanesRef();\r\n }\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n * @returns false if matrix inversion fails.\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n // no inverse necessary -- lower level cannot fail.\r\n for (const clip of this._clips)\r\n clip.multiplyPlanesByMatrix4d(matrix, false, transpose);\r\n return true;\r\n }\r\n /**\r\n * Determines whether the given points fall inside or outside this set of ClipShapes. If any set is defined\r\n * by masking planes, checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the\r\n * _clipPlanes member.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreMasks: boolean = false): ClipPlaneContainment {\r\n let currentContainment = ClipPlaneContainment.Ambiguous;\r\n\r\n for (const primitive of this._clips) {\r\n const thisContainment = primitive.classifyPointContainment(points, ignoreMasks);\r\n\r\n if (ClipPlaneContainment.Ambiguous === thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n\r\n if (ClipPlaneContainment.Ambiguous === currentContainment)\r\n currentContainment = thisContainment;\r\n else if (currentContainment !== thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return currentContainment;\r\n }\r\n /**\r\n * Determines whether a 3D range lies inside or outside this set of ClipShapes. If any set is defined by masking planes,\r\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the clip planes member.\r\n */\r\n public classifyRangeContainment(range: Range3d, ignoreMasks: boolean): ClipPlaneContainment {\r\n const corners: Point3d[] = range.corners();\r\n return this.classifyPointContainment(corners, ignoreMasks);\r\n }\r\n /**\r\n * For an array of points (making up a LineString), tests whether the segment between each point lies inside the\r\n * ClipVector.\r\n * If true, returns true immediately.\r\n */\r\n public isAnyLineStringPointInside(points: Point3d[]): boolean {\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n if (clipPlaneSet.isAnyPointInOrOnFromSegment(segment))\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n /** Note: Line segments are used to represent 1 dimensional intervals here, rather than segments. */\r\n public sumSizes(intervals: Segment1d[], begin: number, end: number): number {\r\n let s = 0.0;\r\n for (let i = begin; i < end; i++)\r\n s += (intervals[i].x1 - intervals[i].x0);\r\n return s;\r\n }\r\n private static readonly _TARGET_FRACTION_SUM = 0.99999999;\r\n /**\r\n * For an array of points that make up a LineString, develops a line segment between each point pair,\r\n * and returns true if all segments lie inside this ClipVector.\r\n */\r\n public isLineStringCompletelyContained(points: Point3d[]): boolean {\r\n const clipIntervals: Segment1d[] = [];\r\n\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n let fractionSum = 0.0;\r\n let index0 = 0;\r\n\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n clipPlaneSet.appendIntervalsFromSegment(segment, clipIntervals);\r\n const index1 = clipIntervals.length;\r\n fractionSum += this.sumSizes(clipIntervals, index0, index1);\r\n index0 = index1;\r\n // ASSUME primitives are non-overlapping...\r\n if (fractionSum >= ClipVector._TARGET_FRACTION_SUM)\r\n break;\r\n }\r\n }\r\n if (fractionSum < ClipVector._TARGET_FRACTION_SUM)\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Serializes this ClipVector to a compact string representation appropriate for transmission as part of a URL.\r\n * Chiefly used for requesting [Tile]($frontend)s with section cut facets.\r\n * UnionOfConvexClipPlaneSets is obtained for each ClipPrimitive. The encoding is as follows:\r\n * ClipVector:\r\n * ClipPrimitive[]\r\n * _\r\n * ClipPrimitive:\r\n * invisible: 0|1\r\n * ConvexClipPlaneSet[]\r\n * _\r\n * ConvexClipPlaneSet:\r\n * ClipPlane[]\r\n * _\r\n * ClipPlane:\r\n * flags: 0|1|2|3, where 1=invisible and 2=interior\r\n * inwardNormal: Number[3]\r\n * distance: Number\r\n * Number:\r\n * number\r\n * _\r\n */\r\n public toCompactString(): string {\r\n function formatNumber(num: number) {\r\n return `${num.toString()}_`;\r\n }\r\n function formatVector3d(vec: Vector3d) {\r\n return `${formatNumber(vec.x)}${formatNumber(vec.y)}${formatNumber(vec.z)}`;\r\n }\r\n function formatFlags(flags: number) {\r\n const f = flags.toString();\r\n assert(1 === f.length);\r\n return f;\r\n }\r\n function formatPlane(plane: ClipPlane) {\r\n let flags = plane.invisible ? 1 : 0;\r\n flags |= (plane.interior ? 2 : 0);\r\n return `${formatFlags(flags)}${formatVector3d(plane.inwardNormalRef)}${formatNumber(plane.distance)}`;\r\n }\r\n function formatPlaneSet(set: ConvexClipPlaneSet) {\r\n let planes = \"\";\r\n for (const plane of set.planes)\r\n planes = `${planes}${formatPlane(plane)}`;\r\n\r\n return `${planes}_`;\r\n }\r\n function formatPrimitive(prim: ClipPrimitive) {\r\n const flags = prim.invisible ? 1 : 0;\r\n let str = flags.toString();\r\n assert(1 === str.length);\r\n\r\n const union = prim.fetchClipPlanesRef();\r\n if (union) {\r\n for (const s of union.convexSets)\r\n str = `${str}${formatPlaneSet(s)}`;\r\n }\r\n return `${str}_`;\r\n }\r\n let result = \"\";\r\n for (const primitive of this.clips)\r\n result = `${result}${formatPrimitive(primitive)}`;\r\n return `${result}_`;\r\n }\r\n}\r\n\r\n/**\r\n * Bundles a [[ClipVector]] with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @see [[StringifiedClipVector.fromClipVector]] to create from a ClipVector.\r\n * @see [[ClipVector.toCompactString]] for a description of the string representation.\r\n * @alpha\r\n */\r\nexport type StringifiedClipVector = ClipVector & { readonly clipString: string };\r\n\r\n/**\r\n * Bundles a ClipVector with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @alpha\r\n */\r\nexport namespace StringifiedClipVector { // eslint-disable-line @typescript-eslint/no-redeclare\r\n /** Create from a ClipVector.\r\n * @param clip The ClipVector to stringify.\r\n * @returns The input ClipVector with its compact string representation, or undefined if the input is undefined or empty.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n */\r\n export function fromClipVector(clip?: ClipVector): StringifiedClipVector | undefined {\r\n if (!clip || !clip.isValid)\r\n return undefined;\r\n\r\n const ret = clip as any;\r\n if (undefined === ret.clipString)\r\n ret.clipString = clip.toCompactString();\r\n\r\n const stringified = ret as StringifiedClipVector;\r\n assert(undefined !== stringified.clipString);\r\n return stringified;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ClipVector.js","sourceRoot":"","sources":["../../../src/clipping/ClipVector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAG7C,0DAAuD;AACvD,0CAAuC;AAIvC,+CAA8C;AAG9C,uDAAoD;AAEpD,uDAAgE;AAEhE,mDAAuG;AACvG,2CAA4D;AAS5D;;;;;;GAMG;AACH,MAAa,UAAU;IACb,MAAM,CAAkB;IAChC;;;;;OAKG;IACI,aAAa,GAAY,eAAO,CAAC,UAAU,EAAE,CAAC;IACrD,sD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GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxC,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU;oBAC9B,GAAG,GAAG,GAAG,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,CAAC;YACD,OAAO,GAAG,GAAG,GAAG,CAAC;QACnB,CAAC;QACD,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK;YAChC,MAAM,GAAG,GAAG,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,OAAO,GAAG,MAAM,GAAG,CAAC;IACtB,CAAC;;AAraH,gCAsaC;AAWD;;;;GAIG;AACH,IAAiB,qBAAqB,CAkBrC;AAlBD,WAAiB,qBAAqB;IACpC;;;;OAIG;IACH,SAAgB,cAAc,CAAC,IAAiB;QAC9C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO;YACxB,OAAO,SAAS,CAAC;QAEnB,MAAM,GAAG,GAAG,IAAW,CAAC;QACxB,IAAI,SAAS,KAAK,GAAG,CAAC,UAAU;YAC9B,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE1C,MAAM,WAAW,GAAG,GAA4B,CAAC;QACjD,IAAA,qBAAM,EAAC,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,WAAW,CAAC;IACrB,CAAC;IAXe,oCAAc,iBAW7B,CAAA;AACH,CAAC,EAlBgB,qBAAqB,qCAArB,qBAAqB,QAkBrC","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 CartesianGeometry\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { Geometry } from \"../Geometry\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Segment1d } from \"../geometry3d/Segment1d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { BooleanClipNodeIntersection } from \"./BooleanClipNode\";\nimport { ClipPlane } from \"./ClipPlane\";\nimport { ClipMaskXYZRangePlanes, ClipPrimitive, ClipPrimitiveProps, ClipShape } from \"./ClipPrimitive\";\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\n\n/**\n * Wire format describing a [[ClipVector]].\n * @public\n */\nexport type ClipVectorProps = ClipPrimitiveProps[];\n\n/**\n * Class holding an array structure of shapes defined by `ClipPrimitive`\n * * The `ClipVector` defines an intersection of the member `ClipPrimitive` regions.\n * * In the most common usage, one of the `ClipPrimitive` will be an outer region, and all others are holes with marker\n * flag indicating that the outside of each hole is live.\n * @public\n */\nexport class ClipVector implements Clipper {\n private _clips: ClipPrimitive[];\n /**\n * Range acting as first filter.\n * * This is understood as overall range limit, not as precise planes.\n * * Applying any rotation to the whole ClipVector generally expands this range, rather than exactly transforming\n * its planes.\n */\n public boundingRange: Range3d = Range3d.createNull();\n /** Returns a reference to the array of ClipShapes. */\n public get clips() { return this._clips; }\n private constructor(clips?: ClipPrimitive[]) {\n this._clips = clips ? clips : [];\n }\n /** Returns true if this ClipVector contains a ClipPrimitive. */\n public get isValid(): boolean { return this._clips.length > 0; }\n /** Create a ClipVector with an empty set of ClipShapes. */\n public static createEmpty(result?: ClipVector): ClipVector {\n if (result) {\n result._clips.length = 0;\n return result;\n }\n return new ClipVector();\n }\n /** Create a ClipVector from an array of ClipPrimitives (or derived classes) (capture the pointers) */\n public static createCapture(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\n if (result) {\n result._clips = clips;\n return result;\n }\n return new ClipVector(clips);\n }\n /** Create a ClipVector from (clones of) an array of ClipPrimitives */\n public static create(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\n const clipClones: ClipPrimitive[] = [];\n for (const clip of clips)\n clipClones.push(clip.clone());\n return ClipVector.createCapture(clipClones, result);\n }\n /** Create a deep copy of another ClipVector */\n public clone(result?: ClipVector): ClipVector {\n const retVal = result ? result : new ClipVector();\n retVal._clips.length = 0;\n for (const clip of this._clips) {\n retVal._clips.push(clip.clone());\n }\n retVal.boundingRange.setFrom(this.boundingRange);\n return retVal;\n }\n /** Parse this ClipVector into a JSON object. */\n public toJSON(): ClipVectorProps {\n if (!this.isValid)\n return [];\n\n return this.clips.map((clip) => clip.toJSON());\n }\n /** Parse a JSON object into a new ClipVector. */\n public static fromJSON(json: ClipVectorProps | undefined, result?: ClipVector): ClipVector {\n result = result ? result : new ClipVector();\n result.clear();\n if (!Array.isArray(json))\n return result;\n try {\n for (const clip of json) {\n const clipPrim = ClipPrimitive.fromJSON(clip);\n if (clipPrim)\n result._clips.push(clipPrim);\n }\n } catch {\n result.clear();\n }\n return result;\n }\n /** Empties out the array of ClipShapes. */\n public clear() {\n this._clips.length = 0;\n }\n /** Append a deep copy of the given ClipPrimitive to this ClipVector. */\n public appendClone(clip: ClipPrimitive) {\n this._clips.push(clip.clone());\n }\n /** Append a reference of the given ClipPrimitive to this ClipVector. */\n public appendReference(clip: ClipPrimitive) {\n this._clips.push(clip);\n }\n /** Create and append a new ClipPrimitive to the array given a shape as an array of points. Returns true if successful. */\n public appendShape(shape: Point3d[], zLow?: number, zHigh?: number,\n transform?: Transform, isMask: boolean = false, invisible: boolean = false): boolean {\n const clip = ClipShape.createShape(shape, zLow, zHigh, transform, isMask, invisible);\n if (!clip)\n return false;\n this._clips.push(clip);\n return true;\n }\n /** Returns true if the given point lies inside all of this ClipVector's ClipShapes (by rule of intersection).*/\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\n return this.isPointOnOrInside(point, onTolerance);\n }\n /**\n * Method from [[Clipper]] interface.\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\n */\n public isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\n if (!this.boundingRange.isNull && !this.boundingRange.containsPoint(point))\n return false;\n\n for (const clip of this._clips) {\n if (!clip.pointInside(point, onTolerance))\n return false;\n }\n return true;\n }\n // Proxy object to implement line and arc clip.\n private _clipNodeProxy?: BooleanClipNodeIntersection;\n private ensureProxyClipNode(): boolean {\n if (this._clipNodeProxy)\n return true;\n this._clipNodeProxy = new BooleanClipNodeIntersection(true);\n let numChildren = 0;\n for (const child of this._clips) {\n const q = child.fetchClipPlanesRef();\n if (q) {\n numChildren++;\n this._clipNodeProxy.captureChild(q);\n }\n }\n return numChildren > 0;\n }\n /**\n * Method from [[Clipper]] interface.\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\n */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\n ): boolean {\n this.ensureProxyClipNode();\n if (this._clipNodeProxy)\n return this._clipNodeProxy.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\n return false;\n }\n /** Method from [[Clipper]] interface.\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n this.ensureProxyClipNode();\n if (this._clipNodeProxy)\n return this._clipNodeProxy.announceClippedArcIntervals(arc, announce);\n return false;\n }\n /** Execute polygon clip as intersection of the child primitives. */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache) {\n this.ensureProxyClipNode();\n if (this._clipNodeProxy)\n this._clipNodeProxy.appendPolygonClip(xyz, insideFragments, outsideFragments, arrayCache);\n }\n /**\n * Transforms this ClipVector to a new coordinate-system.\n * Note that if the transform has rotate and scale the boundingRange member expands.\n * Returns true if successful.\n */\n public transformInPlace(transform: Transform): boolean {\n for (const clip of this._clips)\n if (clip.transformInPlace(transform) === false)\n return false;\n\n if (!this.boundingRange.isNull)\n transform.multiplyRange(this.boundingRange, this.boundingRange);\n\n return true;\n }\n /**\n * A simple way of packaging this ClipVector's ClipShape points into a multidimensional array, while also\n * taking into account each ClipPrimitive's individual transforms.\n * ClipPrimitives OTHER THAN ClipShape are ignored.\n * Information out:\n * - All of the loop points are stored in the multidimensional Point3d array given (will return unchanged upon failure).\n * - If given a transform, will be set from the transformFromClip of the first ClipPrimitive.\n * - The ClipMask of the final ClipPrimitive is stored in the returned array at index 0.\n * - The last valid zLow found is stored in the returned array at index 1.\n * - The last valid zHigh found is stored in the returned array at index 2.\n */\n public extractBoundaryLoops(loopPoints: Point3d[][], transform?: Transform): number[] {\n let clipM = ClipMaskXYZRangePlanes.None;\n let zBack = -Number.MAX_VALUE;\n let zFront = Number.MAX_VALUE;\n const retVal: number[] = [];\n let nLoops = 0;\n\n if (this._clips.length === 0)\n return retVal;\n let firstClipShape: ClipShape | undefined;\n const deltaTrans = Transform.createIdentity();\n\n for (const clip of this._clips) {\n if (clip instanceof ClipShape) {\n if (firstClipShape !== undefined && clip !== firstClipShape) { // Is not the first iteration\n let fwdTrans = Transform.createIdentity();\n let invTrans = Transform.createIdentity();\n\n if (firstClipShape.transformValid && clip.transformValid) {\n fwdTrans = clip.transformFromClip!.clone();\n invTrans = firstClipShape.transformToClip!.clone();\n }\n deltaTrans.setFrom(invTrans.multiplyTransformTransform(fwdTrans));\n }\n if (!firstClipShape)\n firstClipShape = clip;\n loopPoints[nLoops] = [];\n\n if (clip.polygon !== undefined) {\n clipM = ClipMaskXYZRangePlanes.XAndY;\n\n if (clip.zHighValid) {\n clipM = clipM | ClipMaskXYZRangePlanes.ZHigh;\n zFront = clip.zHigh!;\n }\n if (clip.zLowValid) {\n clipM = clipM | ClipMaskXYZRangePlanes.ZLow;\n zBack = clip.zLow!;\n }\n\n for (const point of clip.polygon)\n loopPoints[nLoops].push(point.clone());\n deltaTrans.multiplyPoint3dArray(loopPoints[nLoops], loopPoints[nLoops]);\n nLoops++;\n }\n }\n }\n retVal.push(clipM);\n retVal.push(zBack);\n retVal.push(zFront);\n if (transform && firstClipShape)\n transform.setFrom(firstClipShape.transformFromClip!);\n return retVal;\n }\n /** Sets this ClipVector and all of its members to the visibility specified. */\n public setInvisible(invisible: boolean) {\n for (const clip of this._clips)\n clip.setInvisible(invisible);\n }\n /**\n * For every clip, parse the member point array into the member clip plane object (only for clipPlanes member,\n * not the mask)\n */\n public parseClipPlanes() {\n for (const clip of this._clips)\n clip.fetchClipPlanesRef();\n }\n /**\n * Multiply all ClipPlanes DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n * @param matrix matrix to apply\n * @returns false if matrix inversion fails.\n */\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n if (invert) { // form inverse once here, reuse for all planes\n const inverse = matrix.createInverse();\n if (!inverse)\n return false;\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\n }\n // no inverse necessary -- lower level cannot fail.\n for (const clip of this._clips)\n clip.multiplyPlanesByMatrix4d(matrix, false, transpose);\n return true;\n }\n /**\n * Determines whether the given points fall inside or outside this set of ClipShapes. If any set is defined\n * by masking planes, checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the\n * _clipPlanes member.\n */\n public classifyPointContainment(points: Point3d[], ignoreMasks: boolean = false): ClipPlaneContainment {\n let currentContainment = ClipPlaneContainment.Ambiguous;\n\n for (const primitive of this._clips) {\n const thisContainment = primitive.classifyPointContainment(points, ignoreMasks);\n\n if (ClipPlaneContainment.Ambiguous === thisContainment)\n return ClipPlaneContainment.Ambiguous;\n\n if (ClipPlaneContainment.Ambiguous === currentContainment)\n currentContainment = thisContainment;\n else if (currentContainment !== thisContainment)\n return ClipPlaneContainment.Ambiguous;\n }\n return currentContainment;\n }\n /**\n * Determines whether a 3D range lies inside or outside this set of ClipShapes. If any set is defined by masking planes,\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the clip planes member.\n */\n public classifyRangeContainment(range: Range3d, ignoreMasks: boolean): ClipPlaneContainment {\n const corners: Point3d[] = range.corners();\n return this.classifyPointContainment(corners, ignoreMasks);\n }\n /**\n * For an array of points (making up a LineString), tests whether the segment between each point lies inside the\n * ClipVector.\n * If true, returns true immediately.\n */\n public isAnyLineStringPointInside(points: Point3d[]): boolean {\n for (const clip of this._clips) {\n const clipPlaneSet = clip.fetchClipPlanesRef();\n if (clipPlaneSet !== undefined) {\n for (let i = 0; i + 1 < points.length; i++) {\n const segment = LineSegment3d.create(points[i], points[i + 1]);\n if (clipPlaneSet.isAnyPointInOrOnFromSegment(segment))\n return true;\n }\n }\n }\n return false;\n }\n /** Note: Line segments are used to represent 1 dimensional intervals here, rather than segments. */\n public sumSizes(intervals: Segment1d[], begin: number, end: number): number {\n let s = 0.0;\n for (let i = begin; i < end; i++)\n s += (intervals[i].x1 - intervals[i].x0);\n return s;\n }\n private static readonly _TARGET_FRACTION_SUM = 0.99999999;\n /**\n * For an array of points that make up a LineString, develops a line segment between each point pair,\n * and returns true if all segments lie inside this ClipVector.\n */\n public isLineStringCompletelyContained(points: Point3d[]): boolean {\n const clipIntervals: Segment1d[] = [];\n\n for (let i = 0; i + 1 < points.length; i++) {\n const segment = LineSegment3d.create(points[i], points[i + 1]);\n let fractionSum = 0.0;\n let index0 = 0;\n\n for (const clip of this._clips) {\n const clipPlaneSet = clip.fetchClipPlanesRef();\n if (clipPlaneSet !== undefined) {\n clipPlaneSet.appendIntervalsFromSegment(segment, clipIntervals);\n const index1 = clipIntervals.length;\n fractionSum += this.sumSizes(clipIntervals, index0, index1);\n index0 = index1;\n // ASSUME primitives are non-overlapping...\n if (fractionSum >= ClipVector._TARGET_FRACTION_SUM)\n break;\n }\n }\n if (fractionSum < ClipVector._TARGET_FRACTION_SUM)\n return false;\n }\n return true;\n }\n /**\n * Serializes this ClipVector to a compact string representation appropriate for transmission as part of a URL.\n * Chiefly used for requesting [Tile]($frontend)s with section cut facets.\n * UnionOfConvexClipPlaneSets is obtained for each ClipPrimitive. The encoding is as follows:\n * ClipVector:\n * ClipPrimitive[]\n * _\n * ClipPrimitive:\n * invisible: 0|1\n * ConvexClipPlaneSet[]\n * _\n * ConvexClipPlaneSet:\n * ClipPlane[]\n * _\n * ClipPlane:\n * flags: 0|1|2|3, where 1=invisible and 2=interior\n * inwardNormal: Number[3]\n * distance: Number\n * Number:\n * number\n * _\n */\n public toCompactString(): string {\n function formatNumber(num: number) {\n return `${num.toString()}_`;\n }\n function formatVector3d(vec: Vector3d) {\n return `${formatNumber(vec.x)}${formatNumber(vec.y)}${formatNumber(vec.z)}`;\n }\n function formatFlags(flags: number) {\n const f = flags.toString();\n assert(1 === f.length);\n return f;\n }\n function formatPlane(plane: ClipPlane) {\n let flags = plane.invisible ? 1 : 0;\n flags |= (plane.interior ? 2 : 0);\n return `${formatFlags(flags)}${formatVector3d(plane.inwardNormalRef)}${formatNumber(plane.distance)}`;\n }\n function formatPlaneSet(set: ConvexClipPlaneSet) {\n let planes = \"\";\n for (const plane of set.planes)\n planes = `${planes}${formatPlane(plane)}`;\n\n return `${planes}_`;\n }\n function formatPrimitive(prim: ClipPrimitive) {\n const flags = prim.invisible ? 1 : 0;\n let str = flags.toString();\n assert(1 === str.length);\n\n const union = prim.fetchClipPlanesRef();\n if (union) {\n for (const s of union.convexSets)\n str = `${str}${formatPlaneSet(s)}`;\n }\n return `${str}_`;\n }\n let result = \"\";\n for (const primitive of this.clips)\n result = `${result}${formatPrimitive(primitive)}`;\n return `${result}_`;\n }\n}\n\n/**\n * Bundles a [[ClipVector]] with its compact string representation.\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\n * @see [[StringifiedClipVector.fromClipVector]] to create from a ClipVector.\n * @see [[ClipVector.toCompactString]] for a description of the string representation.\n * @alpha\n */\nexport type StringifiedClipVector = ClipVector & { readonly clipString: string };\n\n/**\n * Bundles a ClipVector with its compact string representation.\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\n * @alpha\n */\nexport namespace StringifiedClipVector { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Create from a ClipVector.\n * @param clip The ClipVector to stringify.\n * @returns The input ClipVector with its compact string representation, or undefined if the input is undefined or empty.\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\n */\n export function fromClipVector(clip?: ClipVector): StringifiedClipVector | undefined {\n if (!clip || !clip.isValid)\n return undefined;\n\n const ret = clip as any;\n if (undefined === ret.clipString)\n ret.clipString = clip.toCompactString();\n\n const stringified = ret as StringifiedClipVector;\n assert(undefined !== stringified.clipString);\n return stringified;\n }\n}\n"]}