@itwin/core-geometry 5.2.0-dev.7 → 5.2.0

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 (772) hide show
  1. package/CHANGELOG.md +46 -1
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.d.ts +30 -10
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js +74 -10
  6. package/lib/cjs/Geometry.js.map +1 -1
  7. package/lib/cjs/bspline/AkimaCurve3d.d.ts +19 -6
  8. package/lib/cjs/bspline/AkimaCurve3d.d.ts.map +1 -1
  9. package/lib/cjs/bspline/AkimaCurve3d.js +21 -5
  10. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  11. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurve.d.ts +3 -3
  13. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  14. package/lib/cjs/bspline/BSplineCurve.js +6 -6
  15. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  16. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  17. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  18. package/lib/cjs/bspline/BSplineCurveOps.js +1 -1
  19. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  20. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  21. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  22. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  23. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  24. package/lib/cjs/bspline/BezierCurveBase.d.ts +2 -2
  25. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  26. package/lib/cjs/bspline/BezierCurveBase.js +4 -6
  27. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  28. package/lib/cjs/bspline/InterpolationCurve3d.d.ts +27 -17
  29. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  30. package/lib/cjs/bspline/InterpolationCurve3d.js +17 -7
  31. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  32. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  33. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  34. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  35. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  36. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  37. package/lib/cjs/clipping/ClipPlane.d.ts +19 -6
  38. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  39. package/lib/cjs/clipping/ClipPlane.js +17 -2
  40. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  41. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  42. package/lib/cjs/clipping/ClipUtils.d.ts +14 -1
  43. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  44. package/lib/cjs/clipping/ClipUtils.js +21 -3
  45. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  46. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  47. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +14 -11
  48. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  49. package/lib/cjs/clipping/ConvexClipPlaneSet.js +23 -16
  50. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  51. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  52. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  53. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  54. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  55. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  56. package/lib/cjs/core-geometry.js.map +1 -1
  57. package/lib/cjs/curve/Arc3d.d.ts +27 -17
  58. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  59. package/lib/cjs/curve/Arc3d.js +61 -35
  60. package/lib/cjs/curve/Arc3d.js.map +1 -1
  61. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  62. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  63. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  64. package/lib/cjs/curve/CurveCollection.d.ts +1 -0
  65. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  66. package/lib/cjs/curve/CurveCollection.js +1 -0
  67. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  68. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  69. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  70. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  71. package/lib/cjs/curve/CurveLocationDetail.d.ts +8 -7
  72. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  73. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  74. package/lib/cjs/curve/CurveOps.d.ts +51 -1
  75. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  76. package/lib/cjs/curve/CurveOps.js +97 -3
  77. package/lib/cjs/curve/CurveOps.js.map +1 -1
  78. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  79. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  80. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  81. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  82. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  83. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  84. package/lib/cjs/curve/LineString3d.d.ts +4 -4
  85. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  86. package/lib/cjs/curve/LineString3d.js +8 -8
  87. package/lib/cjs/curve/LineString3d.js.map +1 -1
  88. package/lib/cjs/curve/Loop.js.map +1 -1
  89. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  90. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  91. package/lib/cjs/curve/Path.js.map +1 -1
  92. package/lib/cjs/curve/PointString3d.js.map +1 -1
  93. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  94. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
  95. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  96. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  97. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  98. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  99. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +6 -2
  100. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  101. package/lib/cjs/curve/Query/PlanarSubdivision.js +12 -7
  102. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  103. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  104. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  105. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  106. package/lib/cjs/curve/RegionOps.d.ts +9 -4
  107. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  108. package/lib/cjs/curve/RegionOps.js +10 -5
  109. package/lib/cjs/curve/RegionOps.js.map +1 -1
  110. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  111. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  112. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  113. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  114. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  115. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  116. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  117. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  118. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  119. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  120. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  121. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  122. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
  123. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  124. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  125. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  126. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  127. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  128. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  129. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -4
  130. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  131. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +21 -18
  132. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  133. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  134. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  135. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  136. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +30 -50
  137. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  138. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  139. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  140. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  141. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  142. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  143. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  144. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  145. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  146. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  147. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  148. package/lib/cjs/curve/spiral/DirectSpiral3d.js +6 -2
  149. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  150. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  151. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  152. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +6 -2
  153. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  154. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  155. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  156. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  157. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  158. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +5 -1
  159. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  160. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +0 -3
  161. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  162. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  163. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  164. package/lib/cjs/geometry3d/AngleSweep.d.ts +6 -2
  165. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  166. package/lib/cjs/geometry3d/AngleSweep.js +12 -3
  167. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  168. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  169. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  170. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  171. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  172. package/lib/cjs/geometry3d/FrameBuilder.d.ts +2 -1
  173. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  174. package/lib/cjs/geometry3d/FrameBuilder.js +14 -18
  175. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  176. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  177. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  178. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  179. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  180. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  181. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  182. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  183. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  184. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  185. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  186. package/lib/cjs/geometry3d/Matrix3d.d.ts +1 -1
  187. package/lib/cjs/geometry3d/Matrix3d.js +1 -1
  188. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  189. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  190. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  191. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  192. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  193. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  194. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +18 -2
  195. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  196. package/lib/cjs/geometry3d/Point2dVector2d.js +37 -4
  197. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  198. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  199. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  200. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  201. package/lib/cjs/geometry3d/Point3dVector3d.js +1 -0
  202. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  203. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  204. package/lib/cjs/geometry3d/PointStreaming.d.ts +8 -0
  205. package/lib/cjs/geometry3d/PointStreaming.d.ts.map +1 -1
  206. package/lib/cjs/geometry3d/PointStreaming.js +18 -2
  207. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  208. package/lib/cjs/geometry3d/PolygonOps.d.ts +18 -9
  209. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  210. package/lib/cjs/geometry3d/PolygonOps.js +53 -26
  211. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  212. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
  213. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  214. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
  215. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  216. package/lib/cjs/geometry3d/PolylineOps.d.ts +14 -3
  217. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  218. package/lib/cjs/geometry3d/PolylineOps.js +20 -4
  219. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  220. package/lib/cjs/geometry3d/Range.d.ts +34 -32
  221. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  222. package/lib/cjs/geometry3d/Range.js +28 -21
  223. package/lib/cjs/geometry3d/Range.js.map +1 -1
  224. package/lib/cjs/geometry3d/Ray2d.d.ts +16 -6
  225. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  226. package/lib/cjs/geometry3d/Ray2d.js +28 -4
  227. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  228. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  229. package/lib/cjs/geometry3d/Ray3d.js +3 -4
  230. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  231. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  232. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  233. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  234. package/lib/cjs/geometry3d/Transform.d.ts +1 -1
  235. package/lib/cjs/geometry3d/Transform.js +1 -1
  236. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  237. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  238. package/lib/cjs/geometry3d/XYZProps.d.ts +12 -1
  239. package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
  240. package/lib/cjs/geometry3d/XYZProps.js +17 -2
  241. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  242. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  243. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  244. package/lib/cjs/geometry4d/Matrix4d.d.ts +16 -0
  245. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  246. package/lib/cjs/geometry4d/Matrix4d.js +26 -0
  247. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  248. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  249. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  250. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  251. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  252. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  253. package/lib/cjs/numerics/BezierPolynomials.js +5 -9
  254. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  255. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  256. package/lib/cjs/numerics/Complex.js.map +1 -1
  257. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  258. package/lib/cjs/numerics/Newton.js.map +1 -1
  259. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  260. package/lib/cjs/numerics/PolarData.js.map +1 -1
  261. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  262. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  263. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  264. package/lib/cjs/numerics/SmallSystem.d.ts +13 -7
  265. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  266. package/lib/cjs/numerics/SmallSystem.js +13 -7
  267. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  268. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  269. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  270. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  271. package/lib/cjs/polyface/AuxData.js.map +1 -1
  272. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  273. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  274. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  275. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  276. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  277. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  278. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  279. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  280. package/lib/cjs/polyface/Polyface.d.ts +1 -3
  281. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  282. package/lib/cjs/polyface/Polyface.js +2 -6
  283. package/lib/cjs/polyface/Polyface.js.map +1 -1
  284. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +25 -6
  285. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  286. package/lib/cjs/polyface/PolyfaceBuilder.js +59 -8
  287. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  288. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  289. package/lib/cjs/polyface/PolyfaceData.d.ts +2 -0
  290. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  291. package/lib/cjs/polyface/PolyfaceData.js +7 -3
  292. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  293. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  294. package/lib/cjs/polyface/PolyfaceQuery.js +8 -10
  295. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  296. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  297. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  298. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  299. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
  300. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
  301. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
  302. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  303. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
  304. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
  305. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
  306. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  307. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
  308. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  309. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +9 -12
  310. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  311. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
  312. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  313. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
  314. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  315. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  316. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  317. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  318. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  319. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  320. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  321. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  322. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  323. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  324. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  325. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  326. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  327. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  328. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  329. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  330. package/lib/cjs/serialization/DeepCompare.js +1 -1
  331. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  332. package/lib/cjs/serialization/GeometrySamples.d.ts +2 -1
  333. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  334. package/lib/cjs/serialization/GeometrySamples.js +2 -1
  335. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  336. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  337. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  338. package/lib/cjs/solid/Box.js.map +1 -1
  339. package/lib/cjs/solid/Cone.js.map +1 -1
  340. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  341. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  342. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  343. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  344. package/lib/cjs/solid/Sphere.js.map +1 -1
  345. package/lib/cjs/solid/SweepContour.js.map +1 -1
  346. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  347. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  348. package/lib/cjs/topology/Graph.d.ts +38 -12
  349. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  350. package/lib/cjs/topology/Graph.js +91 -23
  351. package/lib/cjs/topology/Graph.js.map +1 -1
  352. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
  353. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
  354. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
  355. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  356. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +20 -11
  357. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  358. package/lib/cjs/topology/HalfEdgeGraphSearch.js +43 -39
  359. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  360. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  361. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  362. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  363. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  364. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  365. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  366. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  367. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  368. package/lib/cjs/topology/MaskManager.js.map +1 -1
  369. package/lib/cjs/topology/Merging.d.ts +7 -4
  370. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  371. package/lib/cjs/topology/Merging.js +16 -11
  372. package/lib/cjs/topology/Merging.js.map +1 -1
  373. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  374. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  375. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  376. package/lib/cjs/topology/Triangulation.d.ts +13 -11
  377. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  378. package/lib/cjs/topology/Triangulation.js +40 -36
  379. package/lib/cjs/topology/Triangulation.js.map +1 -1
  380. package/lib/cjs/topology/Voronoi.d.ts +195 -0
  381. package/lib/cjs/topology/Voronoi.d.ts.map +1 -0
  382. package/lib/cjs/topology/Voronoi.js +700 -0
  383. package/lib/cjs/topology/Voronoi.js.map +1 -0
  384. package/lib/cjs/topology/XYParitySearchContext.d.ts +1 -1
  385. package/lib/cjs/topology/XYParitySearchContext.d.ts.map +1 -1
  386. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  387. package/lib/esm/Constant.js.map +1 -1
  388. package/lib/esm/Geometry.d.ts +30 -10
  389. package/lib/esm/Geometry.d.ts.map +1 -1
  390. package/lib/esm/Geometry.js +74 -10
  391. package/lib/esm/Geometry.js.map +1 -1
  392. package/lib/esm/bspline/AkimaCurve3d.d.ts +19 -6
  393. package/lib/esm/bspline/AkimaCurve3d.d.ts.map +1 -1
  394. package/lib/esm/bspline/AkimaCurve3d.js +21 -5
  395. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  396. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  397. package/lib/esm/bspline/BSplineCurve.d.ts +3 -3
  398. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  399. package/lib/esm/bspline/BSplineCurve.js +6 -6
  400. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  401. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  402. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  403. package/lib/esm/bspline/BSplineCurveOps.js +1 -1
  404. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  405. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  406. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  407. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  408. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  409. package/lib/esm/bspline/BezierCurveBase.d.ts +2 -2
  410. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  411. package/lib/esm/bspline/BezierCurveBase.js +4 -6
  412. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  413. package/lib/esm/bspline/InterpolationCurve3d.d.ts +27 -17
  414. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  415. package/lib/esm/bspline/InterpolationCurve3d.js +17 -7
  416. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  417. package/lib/esm/bspline/KnotVector.js.map +1 -1
  418. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  419. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  420. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  421. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  422. package/lib/esm/clipping/ClipPlane.d.ts +19 -6
  423. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  424. package/lib/esm/clipping/ClipPlane.js +17 -2
  425. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  426. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  427. package/lib/esm/clipping/ClipUtils.d.ts +14 -1
  428. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  429. package/lib/esm/clipping/ClipUtils.js +21 -3
  430. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  431. package/lib/esm/clipping/ClipVector.js.map +1 -1
  432. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +14 -11
  433. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  434. package/lib/esm/clipping/ConvexClipPlaneSet.js +23 -16
  435. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  436. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  437. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  438. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  439. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  440. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  441. package/lib/esm/core-geometry.js.map +1 -1
  442. package/lib/esm/curve/Arc3d.d.ts +27 -17
  443. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  444. package/lib/esm/curve/Arc3d.js +61 -35
  445. package/lib/esm/curve/Arc3d.js.map +1 -1
  446. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  447. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  448. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  449. package/lib/esm/curve/CurveCollection.d.ts +1 -0
  450. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  451. package/lib/esm/curve/CurveCollection.js +1 -0
  452. package/lib/esm/curve/CurveCollection.js.map +1 -1
  453. package/lib/esm/curve/CurveCurve.js.map +1 -1
  454. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  455. package/lib/esm/curve/CurveFactory.js.map +1 -1
  456. package/lib/esm/curve/CurveLocationDetail.d.ts +8 -7
  457. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  458. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  459. package/lib/esm/curve/CurveOps.d.ts +51 -1
  460. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  461. package/lib/esm/curve/CurveOps.js +98 -4
  462. package/lib/esm/curve/CurveOps.js.map +1 -1
  463. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  464. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  465. package/lib/esm/curve/CurveTypes.js.map +1 -1
  466. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  467. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  468. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  469. package/lib/esm/curve/LineString3d.d.ts +4 -4
  470. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  471. package/lib/esm/curve/LineString3d.js +8 -8
  472. package/lib/esm/curve/LineString3d.js.map +1 -1
  473. package/lib/esm/curve/Loop.js.map +1 -1
  474. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  475. package/lib/esm/curve/ParityRegion.js.map +1 -1
  476. package/lib/esm/curve/Path.js.map +1 -1
  477. package/lib/esm/curve/PointString3d.js.map +1 -1
  478. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  479. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
  480. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  481. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  482. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  483. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  484. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +6 -2
  485. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  486. package/lib/esm/curve/Query/PlanarSubdivision.js +12 -7
  487. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  488. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  489. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  490. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  491. package/lib/esm/curve/RegionOps.d.ts +9 -4
  492. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  493. package/lib/esm/curve/RegionOps.js +10 -5
  494. package/lib/esm/curve/RegionOps.js.map +1 -1
  495. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  496. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  497. package/lib/esm/curve/UnionRegion.js.map +1 -1
  498. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  499. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  500. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  501. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  502. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  503. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  504. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  505. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  506. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  507. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
  508. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  509. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  510. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  511. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  512. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  513. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  514. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -4
  515. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  516. package/lib/esm/curve/internalContexts/MultiChainCollector.js +21 -18
  517. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  518. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  519. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  520. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  521. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +30 -50
  522. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  523. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  524. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  525. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  526. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  527. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  528. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  529. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  530. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  531. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  532. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  533. package/lib/esm/curve/spiral/DirectSpiral3d.js +6 -2
  534. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  535. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  536. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  537. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +6 -2
  538. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  539. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  540. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  541. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  542. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  543. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +5 -1
  544. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  545. package/lib/esm/curve/spiral/TransitionSpiral3d.js +0 -3
  546. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  547. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  548. package/lib/esm/geometry3d/Angle.js.map +1 -1
  549. package/lib/esm/geometry3d/AngleSweep.d.ts +6 -2
  550. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  551. package/lib/esm/geometry3d/AngleSweep.js +12 -3
  552. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  553. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  554. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  555. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  556. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  557. package/lib/esm/geometry3d/FrameBuilder.d.ts +2 -1
  558. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  559. package/lib/esm/geometry3d/FrameBuilder.js +14 -18
  560. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  561. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  562. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  563. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  564. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  565. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  566. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  567. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  568. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  569. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  570. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  571. package/lib/esm/geometry3d/Matrix3d.d.ts +1 -1
  572. package/lib/esm/geometry3d/Matrix3d.js +1 -1
  573. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  574. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  575. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  576. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  577. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  578. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  579. package/lib/esm/geometry3d/Point2dVector2d.d.ts +18 -2
  580. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  581. package/lib/esm/geometry3d/Point2dVector2d.js +37 -4
  582. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  583. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  584. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  585. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  586. package/lib/esm/geometry3d/Point3dVector3d.js +1 -0
  587. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  588. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  589. package/lib/esm/geometry3d/PointStreaming.d.ts +8 -0
  590. package/lib/esm/geometry3d/PointStreaming.d.ts.map +1 -1
  591. package/lib/esm/geometry3d/PointStreaming.js +18 -2
  592. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  593. package/lib/esm/geometry3d/PolygonOps.d.ts +18 -9
  594. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  595. package/lib/esm/geometry3d/PolygonOps.js +53 -26
  596. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  597. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
  598. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  599. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
  600. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  601. package/lib/esm/geometry3d/PolylineOps.d.ts +14 -3
  602. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  603. package/lib/esm/geometry3d/PolylineOps.js +20 -4
  604. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  605. package/lib/esm/geometry3d/Range.d.ts +34 -32
  606. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  607. package/lib/esm/geometry3d/Range.js +28 -21
  608. package/lib/esm/geometry3d/Range.js.map +1 -1
  609. package/lib/esm/geometry3d/Ray2d.d.ts +16 -6
  610. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  611. package/lib/esm/geometry3d/Ray2d.js +28 -4
  612. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  613. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  614. package/lib/esm/geometry3d/Ray3d.js +3 -4
  615. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  616. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  617. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  618. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  619. package/lib/esm/geometry3d/Transform.d.ts +1 -1
  620. package/lib/esm/geometry3d/Transform.js +1 -1
  621. package/lib/esm/geometry3d/Transform.js.map +1 -1
  622. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  623. package/lib/esm/geometry3d/XYZProps.d.ts +12 -1
  624. package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
  625. package/lib/esm/geometry3d/XYZProps.js +16 -1
  626. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  627. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  628. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  629. package/lib/esm/geometry4d/Matrix4d.d.ts +16 -0
  630. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  631. package/lib/esm/geometry4d/Matrix4d.js +26 -0
  632. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  633. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  634. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  635. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  636. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  637. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  638. package/lib/esm/numerics/BezierPolynomials.js +5 -9
  639. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  640. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  641. package/lib/esm/numerics/Complex.js.map +1 -1
  642. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  643. package/lib/esm/numerics/Newton.js.map +1 -1
  644. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  645. package/lib/esm/numerics/PolarData.js.map +1 -1
  646. package/lib/esm/numerics/Polynomials.js.map +1 -1
  647. package/lib/esm/numerics/Quadrature.js.map +1 -1
  648. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  649. package/lib/esm/numerics/SmallSystem.d.ts +13 -7
  650. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  651. package/lib/esm/numerics/SmallSystem.js +13 -7
  652. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  653. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  654. package/lib/esm/numerics/UnionFind.js.map +1 -1
  655. package/lib/esm/numerics/UsageSums.js.map +1 -1
  656. package/lib/esm/polyface/AuxData.js.map +1 -1
  657. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  658. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  659. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  660. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  661. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  662. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  663. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  664. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  665. package/lib/esm/polyface/Polyface.d.ts +1 -3
  666. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  667. package/lib/esm/polyface/Polyface.js +2 -6
  668. package/lib/esm/polyface/Polyface.js.map +1 -1
  669. package/lib/esm/polyface/PolyfaceBuilder.d.ts +25 -6
  670. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  671. package/lib/esm/polyface/PolyfaceBuilder.js +59 -8
  672. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  673. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  674. package/lib/esm/polyface/PolyfaceData.d.ts +2 -0
  675. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  676. package/lib/esm/polyface/PolyfaceData.js +7 -3
  677. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  678. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  679. package/lib/esm/polyface/PolyfaceQuery.js +8 -10
  680. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  681. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  682. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  683. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  684. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
  685. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
  686. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
  687. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  688. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
  689. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
  690. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
  691. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  692. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
  693. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  694. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +9 -12
  695. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  696. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
  697. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  698. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
  699. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  700. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  701. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  702. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  703. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  704. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  705. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  706. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  707. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  708. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  709. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  710. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  711. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  712. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  713. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  714. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  715. package/lib/esm/serialization/DeepCompare.js +1 -1
  716. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  717. package/lib/esm/serialization/GeometrySamples.d.ts +2 -1
  718. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  719. package/lib/esm/serialization/GeometrySamples.js +2 -1
  720. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  721. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  722. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  723. package/lib/esm/solid/Box.js.map +1 -1
  724. package/lib/esm/solid/Cone.js.map +1 -1
  725. package/lib/esm/solid/LinearSweep.js.map +1 -1
  726. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  727. package/lib/esm/solid/RuledSweep.js.map +1 -1
  728. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  729. package/lib/esm/solid/Sphere.js.map +1 -1
  730. package/lib/esm/solid/SweepContour.js.map +1 -1
  731. package/lib/esm/solid/TorusPipe.js.map +1 -1
  732. package/lib/esm/topology/ChainMerge.js.map +1 -1
  733. package/lib/esm/topology/Graph.d.ts +38 -12
  734. package/lib/esm/topology/Graph.d.ts.map +1 -1
  735. package/lib/esm/topology/Graph.js +92 -24
  736. package/lib/esm/topology/Graph.js.map +1 -1
  737. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
  738. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
  739. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
  740. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  741. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +20 -11
  742. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  743. package/lib/esm/topology/HalfEdgeGraphSearch.js +43 -39
  744. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  745. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  746. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  747. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  748. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  749. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  750. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  751. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  752. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  753. package/lib/esm/topology/MaskManager.js.map +1 -1
  754. package/lib/esm/topology/Merging.d.ts +7 -4
  755. package/lib/esm/topology/Merging.d.ts.map +1 -1
  756. package/lib/esm/topology/Merging.js +17 -12
  757. package/lib/esm/topology/Merging.js.map +1 -1
  758. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  759. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  760. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  761. package/lib/esm/topology/Triangulation.d.ts +13 -11
  762. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  763. package/lib/esm/topology/Triangulation.js +40 -36
  764. package/lib/esm/topology/Triangulation.js.map +1 -1
  765. package/lib/esm/topology/Voronoi.d.ts +195 -0
  766. package/lib/esm/topology/Voronoi.d.ts.map +1 -0
  767. package/lib/esm/topology/Voronoi.js +696 -0
  768. package/lib/esm/topology/Voronoi.js.map +1 -0
  769. package/lib/esm/topology/XYParitySearchContext.d.ts +1 -1
  770. package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
  771. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  772. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanClipFactory.js","sourceRoot":"","sources":["../../../src/clipping/BooleanClipFactory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,uDAA6G;AAC7G,2CAAwC;AACxC,2CAAqD;AACrD,6DAA0D;AAC1D,6EAA0E;AAE1E;;;;;;;;;;;;;GAaG;AACH,MAAa,kBAAkB;IAC7B;;;;;;OA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AM,CAAC,EAAE,CAAC;YACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;YAChE,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1D,CAAC;aAAM,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,MAAc,CAAC,GAAG,CAAC,CAAC;YAC/D,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;aAAM,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;YAChE,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,0DAA0D;IACnD,MAAM,CAAC,gBAAgB,CAAC,OAAY;QACzC,IAAI,yBAAa,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,MAAM;gBAChB,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAlKD,gDAkKC","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 */\nimport { BooleanClipNodeIntersection, BooleanClipNodeParity, BooleanClipNodeUnion } from \"./BooleanClipNode\";\nimport { ClipPlane } from \"./ClipPlane\";\nimport { Clipper, ClipUtilities } from \"./ClipUtils\";\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\nimport { UnionOfConvexClipPlaneSets } from \"./UnionOfConvexClipPlaneSets\";\n\n/**\n * A BooleanClipFactory is a factory to create objects that implement interior nodes of a tree of boolean clip operations.\n * * These methods create specific clip tree types:\n * * Union\n * * Intersection\n * * Parity\n * * Difference\n * * Each construction has a `keepInside` flag that optionally negates the initial result of the parity, intersection,\n * parity, or difference:\n * * if `keepInside === true`, accept the \"inside\" of the initial result.\n * * if `keepInside === false`, accept the \"outside\" of the initial result.\n * * These methods create various other specialized clippers.\n * @public\n */\nexport class BooleanClipFactory {\n /**\n * Create a boolean clipper which performs a union over its children.\n * * if `keepInside === true`, accept the \"inside\" of the union result.\n * * if `keepInside === false`, accept the \"outside\" of the union result.\n * @param clippers clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureUnion(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\n const result = new BooleanClipNodeUnion(keepInside);\n result.captureChild(clippers);\n return result;\n }\n /**\n * Create a boolean clipper which performs an intersection over its children.\n * * if `keepInside === true`, accept the \"inside\" of the intersection result.\n * * if `keepInside === false`, accept the \"outside\" of the intersection result.\n * @param clippers clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureIntersection(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\n const result = new BooleanClipNodeIntersection(keepInside);\n result.captureChild(clippers);\n return result;\n }\n /**\n * Create a boolean clipper which performs a parity over its children.\n * * if `keepInside === true`, accept the \"inside\" of the parity result.\n * * if `keepInside === false`, accept the \"outside\" of the parity result.\n * @param clippers clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureParity(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\n const result = new BooleanClipNodeParity(keepInside);\n result.captureChild(clippers);\n return result;\n }\n /**\n * Create a boolean clipper which performs a difference operation for points \"inside `primaryClipper`\" and\n * \"outside `excludedClipper`\".\n * * if `keepInside === true`, accept the \"inside\" of the difference.\n * * if `keepInside === false`, accept the \"outside\" of the difference.\n * @param primaryClipper any clip object whose output is treated as positive.\n * @param excludeClip any clipper whose output is treated as negative.\n * @param keepInside flag to select results inside or outside the initial `primary minus excludeClipper` clippers.\n */\n public static createCaptureDifference(primaryClipper: Clipper, excludedClipper: Clipper, keepInside: boolean): Clipper {\n const mask = this.createCaptureUnion(excludedClipper, false);\n return this.createCaptureIntersection([primaryClipper, mask], keepInside);\n }\n /**\n * Create a boolean clipper which performs the reverse of that of `primaryClipper`.\n * @param primaryClipper clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureClipOutside(primaryClipper: Clipper): Clipper {\n return this.createCaptureUnion([primaryClipper], false);\n }\n /**\n * Convert `source` to an array of clipper objects.\n * * ANY TYPE OF Clipper is accepted.\n * * REMARK: This is normally called only from the primary public method `parseToClipper`.\n */\n public static parseToClipperArray(source: any): Clipper[] | undefined {\n if (Array.isArray(source)) {\n const clippers = [];\n for (const c of source) {\n const c1 = this.parseToClipper(c);\n if (!c1)\n return undefined;\n clippers.push(c1);\n }\n if (clippers.length === 0)\n return undefined;\n return clippers;\n } else {\n // accept singleton to singleton array\n const c = this.parseToClipper(source);\n if (c)\n return [c];\n }\n return undefined;\n }\n /**\n * Look for content that represents a clipper.\n * * Possible outputs are\n * * `ClipPlane`\n * * `ConvexClipPlaneSet`\n * * `UnionOfConvexClipPlaneSets`\n * * One of the `ClipBoolean` derived classes\n * * `ClipBooleanXOR`\n * * `ClipBooleanOR`\n * * `ClipBooleanAND`\n * @param source json object\n * @public\n */\n public static parseToClipper(source?: object): Clipper | undefined {\n if (!source)\n return undefined;\n\n if (source.hasOwnProperty(\"normal\") && source.hasOwnProperty(\"dist\")) {\n return ClipPlane.fromJSON(source);\n } else if (Array.isArray(source)) {\n const clippers: Clipper[] = [];\n let numPlanes = 0;\n let numConvexSets = 0;\n for (const c of source) {\n const c1 = this.parseToClipper(c);\n if (!c1)\n return undefined;\n clippers.push(c1);\n if (c1 instanceof ClipPlane)\n numPlanes++;\n else if (c1 instanceof ConvexClipPlaneSet)\n numConvexSets++;\n else\n return undefined;\n }\n if (clippers.length === 0)\n return undefined;\n if (numPlanes === source.length) {\n // array of planes is a convex clip plane set.\n return ConvexClipPlaneSet.createPlanes(clippers as ClipPlane[]);\n } else if (numConvexSets === source.length) {\n return UnionOfConvexClipPlaneSets.createConvexSets(clippers as ConvexClipPlaneSet[]);\n }\n // array of mixed types should not occur. fall out to undefined.\n } else if (source.hasOwnProperty(\"OR\")) {\n const clippers = this.parseToClipperArray((source as any).OR);\n if (clippers)\n return this.createCaptureUnion(clippers, true);\n } else if (source.hasOwnProperty(\"NOR\")) {\n const clippers = this.parseToClipperArray((source as any).NOR);\n if (clippers)\n return this.createCaptureUnion(clippers, false);\n } else if (source.hasOwnProperty(\"AND\")) {\n const clippers = this.parseToClipperArray((source as any).AND);\n if (clippers)\n return this.createCaptureIntersection(clippers, true);\n } else if (source.hasOwnProperty(\"NAND\")) {\n const clippers = this.parseToClipperArray((source as any).NAND);\n if (clippers)\n return this.createCaptureIntersection(clippers, true);\n } else if (source.hasOwnProperty(\"XOR\")) {\n const clippers = this.parseToClipperArray((source as any).XOR);\n if (clippers)\n return this.createCaptureParity(clippers, true);\n } else if (source.hasOwnProperty(\"NXOR\")) {\n const clippers = this.parseToClipperArray((source as any).NXOR);\n if (clippers)\n return this.createCaptureParity(clippers, true);\n }\n return undefined;\n }\n /** Choose a `toJSON` method appropriate to the clipper */\n public static anyClipperToJSON(clipper: any): any {\n if (ClipUtilities.isClipper(clipper)) {\n if (clipper.toJSON)\n return clipper.toJSON();\n }\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"BooleanClipFactory.js","sourceRoot":"","sources":["../../../src/clipping/BooleanClipFactory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,uDAA6G;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;gBACV,OAAO,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1D,CAAC;aAAM,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;YAChE,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1D,CAAC;aAAM,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,MAAc,CAAC,GAAG,CAAC,CAAC;YAC/D,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;aAAM,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;YAChE,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,0DAA0D;IACnD,MAAM,CAAC,gBAAgB,CAAC,OAAY;QACzC,IAAI,yBAAa,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,MAAM;gBAChB,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAlKD,gDAkKC","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\nimport { BooleanClipNodeIntersection, BooleanClipNodeParity, BooleanClipNodeUnion } from \"./BooleanClipNode\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { Clipper, ClipUtilities } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets } from \"./UnionOfConvexClipPlaneSets\";\r\n\r\n/**\r\n * A BooleanClipFactory is a factory to create objects that implement interior nodes of a tree of boolean clip operations.\r\n * * These methods create specific clip tree types:\r\n * * Union\r\n * * Intersection\r\n * * Parity\r\n * * Difference\r\n * * Each construction has a `keepInside` flag that optionally negates the initial result of the parity, intersection,\r\n * parity, or difference:\r\n * * if `keepInside === true`, accept the \"inside\" of the initial result.\r\n * * if `keepInside === false`, accept the \"outside\" of the initial result.\r\n * * These methods create various other specialized clippers.\r\n * @public\r\n */\r\nexport class BooleanClipFactory {\r\n /**\r\n * Create a boolean clipper which performs a union over its children.\r\n * * if `keepInside === true`, accept the \"inside\" of the union result.\r\n * * if `keepInside === false`, accept the \"outside\" of the union result.\r\n * @param clippers clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureUnion(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\r\n const result = new BooleanClipNodeUnion(keepInside);\r\n result.captureChild(clippers);\r\n return result;\r\n }\r\n /**\r\n * Create a boolean clipper which performs an intersection over its children.\r\n * * if `keepInside === true`, accept the \"inside\" of the intersection result.\r\n * * if `keepInside === false`, accept the \"outside\" of the intersection result.\r\n * @param clippers clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureIntersection(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\r\n const result = new BooleanClipNodeIntersection(keepInside);\r\n result.captureChild(clippers);\r\n return result;\r\n }\r\n /**\r\n * Create a boolean clipper which performs a parity over its children.\r\n * * if `keepInside === true`, accept the \"inside\" of the parity result.\r\n * * if `keepInside === false`, accept the \"outside\" of the parity result.\r\n * @param clippers clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureParity(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\r\n const result = new BooleanClipNodeParity(keepInside);\r\n result.captureChild(clippers);\r\n return result;\r\n }\r\n /**\r\n * Create a boolean clipper which performs a difference operation for points \"inside `primaryClipper`\" and\r\n * \"outside `excludedClipper`\".\r\n * * if `keepInside === true`, accept the \"inside\" of the difference.\r\n * * if `keepInside === false`, accept the \"outside\" of the difference.\r\n * @param primaryClipper any clip object whose output is treated as positive.\r\n * @param excludeClip any clipper whose output is treated as negative.\r\n * @param keepInside flag to select results inside or outside the initial `primary minus excludeClipper` clippers.\r\n */\r\n public static createCaptureDifference(primaryClipper: Clipper, excludedClipper: Clipper, keepInside: boolean): Clipper {\r\n const mask = this.createCaptureUnion(excludedClipper, false);\r\n return this.createCaptureIntersection([primaryClipper, mask], keepInside);\r\n }\r\n /**\r\n * Create a boolean clipper which performs the reverse of that of `primaryClipper`.\r\n * @param primaryClipper clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureClipOutside(primaryClipper: Clipper): Clipper {\r\n return this.createCaptureUnion([primaryClipper], false);\r\n }\r\n /**\r\n * Convert `source` to an array of clipper objects.\r\n * * ANY TYPE OF Clipper is accepted.\r\n * * REMARK: This is normally called only from the primary public method `parseToClipper`.\r\n */\r\n public static parseToClipperArray(source: any): Clipper[] | undefined {\r\n if (Array.isArray(source)) {\r\n const clippers = [];\r\n for (const c of source) {\r\n const c1 = this.parseToClipper(c);\r\n if (!c1)\r\n return undefined;\r\n clippers.push(c1);\r\n }\r\n if (clippers.length === 0)\r\n return undefined;\r\n return clippers;\r\n } else {\r\n // accept singleton to singleton array\r\n const c = this.parseToClipper(source);\r\n if (c)\r\n return [c];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Look for content that represents a clipper.\r\n * * Possible outputs are\r\n * * `ClipPlane`\r\n * * `ConvexClipPlaneSet`\r\n * * `UnionOfConvexClipPlaneSets`\r\n * * One of the `ClipBoolean` derived classes\r\n * * `ClipBooleanXOR`\r\n * * `ClipBooleanOR`\r\n * * `ClipBooleanAND`\r\n * @param source json object\r\n * @public\r\n */\r\n public static parseToClipper(source?: object): Clipper | undefined {\r\n if (!source)\r\n return undefined;\r\n\r\n if (source.hasOwnProperty(\"normal\") && source.hasOwnProperty(\"dist\")) {\r\n return ClipPlane.fromJSON(source);\r\n } else if (Array.isArray(source)) {\r\n const clippers: Clipper[] = [];\r\n let numPlanes = 0;\r\n let numConvexSets = 0;\r\n for (const c of source) {\r\n const c1 = this.parseToClipper(c);\r\n if (!c1)\r\n return undefined;\r\n clippers.push(c1);\r\n if (c1 instanceof ClipPlane)\r\n numPlanes++;\r\n else if (c1 instanceof ConvexClipPlaneSet)\r\n numConvexSets++;\r\n else\r\n return undefined;\r\n }\r\n if (clippers.length === 0)\r\n return undefined;\r\n if (numPlanes === source.length) {\r\n // array of planes is a convex clip plane set.\r\n return ConvexClipPlaneSet.createPlanes(clippers as ClipPlane[]);\r\n } else if (numConvexSets === source.length) {\r\n return UnionOfConvexClipPlaneSets.createConvexSets(clippers as ConvexClipPlaneSet[]);\r\n }\r\n // array of mixed types should not occur. fall out to undefined.\r\n } else if (source.hasOwnProperty(\"OR\")) {\r\n const clippers = this.parseToClipperArray((source as any).OR);\r\n if (clippers)\r\n return this.createCaptureUnion(clippers, true);\r\n } else if (source.hasOwnProperty(\"NOR\")) {\r\n const clippers = this.parseToClipperArray((source as any).NOR);\r\n if (clippers)\r\n return this.createCaptureUnion(clippers, false);\r\n } else if (source.hasOwnProperty(\"AND\")) {\r\n const clippers = this.parseToClipperArray((source as any).AND);\r\n if (clippers)\r\n return this.createCaptureIntersection(clippers, true);\r\n } else if (source.hasOwnProperty(\"NAND\")) {\r\n const clippers = this.parseToClipperArray((source as any).NAND);\r\n if (clippers)\r\n return this.createCaptureIntersection(clippers, true);\r\n } else if (source.hasOwnProperty(\"XOR\")) {\r\n const clippers = this.parseToClipperArray((source as any).XOR);\r\n if (clippers)\r\n return this.createCaptureParity(clippers, true);\r\n } else if (source.hasOwnProperty(\"NXOR\")) {\r\n const clippers = this.parseToClipperArray((source as any).NXOR);\r\n if (clippers)\r\n return this.createCaptureParity(clippers, true);\r\n }\r\n return undefined;\r\n }\r\n /** Choose a `toJSON` method appropriate to the clipper */\r\n public static anyClipperToJSON(clipper: any): any {\r\n if (ClipUtilities.isClipper(clipper)) {\r\n if (clipper.toJSON)\r\n return clipper.toJSON();\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanClipNode.js","sourceRoot":"","sources":["../../../src/clipping/BooleanClipNode.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAW/F,+CAA8C;AAE9C,2DAAwD;AACxD,2CAAqF;AAErF;;;;;;;;;;;;;;;GAeG;AACH,MAAsB,eAAe;IACzB,SAAS,CAAY;IACrB,WAAW,CAAY;IACvB,WAAW,CAAY;IACvB,WAAW,CAAU;IAE/B,YAAmB,UAAmB;QACpC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAIM,MAAM;QACX,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,MAAM,EAAE,GAAG,CAAQ,CAAC;YACpB,IAAI,EAAE,CAAC,MAAM;gBACX,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3B,CAAC;QACD,gCAAgC;QAChC,MAAM,CAAC,GAAG,IAAI,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AC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAChF,YAAmB,UAAmB;QACpC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpB,CAAC;IACD,mDAAmD;IAC5C,yBAAyB,CAAC,KAAc;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC;gBACnC,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACM,gBAAgB,CAAC,QAAmB,EAAE,QAAmB;QAC9D,OAAO,2BAAY,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IACM,iBAAiB,CACtB,GAAyB,EACzB,eAAmC,EACnC,gBAAoC,EACpC,UAAiC;QAGjC,yBAAa,CAAC,qBAAqB,CACjC,GAAG,EACH,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,EACrD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,EACrD,SAAS,EACT,0BAAc,CAAC,cAAc,EAC7B,0BAAc,CAAC,SAAS,EACxB,0BAAc,CAAC,QAAQ,EACvB,UAAU,CACX,CAAC;IACJ,CAAC;CACF;AAnCD,kEAmCC","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 { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range1d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Range1dArray } from \"../numerics/Range1dArray\";\nimport { Clipper, ClipStepAction, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/** BooleanClipNode is an abstract base class for boolean actions by an array of clippers.\n * * Derived class must implement\n * * The single point test `isPointOnOrInsideChildren`\n * * Boolean operation on 1d intervals `combineIntervals`\n * * The `keepInside` flag controls an additional optional flip of the boolean result.\n * * if `keepInside === true`, accept the \"inside\" of the clip clippers\n * * if `keepInside === false`, accept the \"outside\" of the child clippers.\n * * Hence the combinations of derived classes for (OR, AND, XOR) and keepInside are\n * * (OR, true) = simple union (OR), i.e. \"in\" one or more clips\n * * (OR, false) = complement of union (NOR), i.e. \"outside\" all clips\n * * (AND, true) = simple intersection (AND), i.e. \"in\" all clips\n * * (AND, false) = complement of intersection (NAND), i.e. \"outside\" one or more clips\n * * (XOR,true) = simple parity, i.e. \"in\" an odd number of clips\n * * (XOR,false) = complement of parity ), i.e. \"in\" an even number of clips\n * @internal\n */\nexport abstract class BooleanClipNode implements Clipper {\n protected _clippers: Clipper[];\n protected _intervalsA: Range1d[];\n protected _intervalsB: Range1d[];\n protected _keepInside: boolean;\n\n public constructor(keepInside: boolean) {\n this._keepInside = keepInside;\n this._clippers = [];\n this._intervalsA = [];\n this._intervalsB = [];\n }\n protected abstract isPointOnOrInsideChildren(point: Point3d): boolean;\n protected abstract combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[];\n public abstract get operationName(): string;\n public toJSON(): any {\n const data = [];\n for (const c of this._clippers) {\n const c1 = c as any;\n if (c1.toJSON)\n data.push(c1.toJSON());\n }\n // return this.formatJSON(data);\n const s = this.operationName;\n const json: { [opType: string]: any[] } = {};\n json[s] = data;\n return json;\n }\n /** Capture a (reference to a) child node or nodes */\n public captureChild(child: Clipper | Clipper[]) {\n if (Array.isArray(child)) {\n for (const c of child) this.captureChild(c);\n } else {\n this._clippers.push(child);\n }\n }\n /** Toggle the \"keepInside\" behavior. Return the prior value. */\n public toggleResult(): boolean {\n return this.selectResult(!this._keepInside);\n }\n /** Set the \"keepInside\" behavior */\n public selectResult(keepInside: boolean): boolean {\n const s = this._keepInside;\n this._keepInside = keepInside;\n return s;\n }\n /**\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1).\n * * Return 0 if not called, 1 if called.\n */\n protected testedAnnounceNN(a0: number, a1: number, announce?: AnnounceNumberNumber): number {\n if (a0 < a1) {\n if (announce)\n announce(a0, a1);\n return 1;\n }\n return 0;\n }\n /**\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1, cp).\n * * Return 0 if not called, 1 if called.\n */\n protected testedAnnounceNNC(\n a0: number, a1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\n ): number {\n if (a0 < a1) {\n if (announce)\n announce(a0, a1, cp);\n return 1;\n }\n return 0;\n }\n /** Swap the _intervalsA and _intervalsB */\n protected swapAB(): void {\n const q = this._intervalsA;\n this._intervalsA = this._intervalsB;\n this._intervalsB = q;\n }\n /**\n * Announce all \"outside intervals\" --not masked by intervals\n * * Return true if any intervals announced.\n */\n protected announcePartsNN(\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, announce?: AnnounceNumberNumber,\n ): boolean {\n let numAnnounce = 0;\n if (!keepInside) {\n let lowFraction = f0;\n for (const interval of intervals) {\n numAnnounce += this.testedAnnounceNN(lowFraction, interval.low, announce);\n lowFraction = interval.high;\n }\n numAnnounce += this.testedAnnounceNN(lowFraction, f1, announce);\n } else {\n for (const interval of intervals) {\n // use f0..f1 ?\n numAnnounce += this.testedAnnounceNN(interval.low, interval.high, announce);\n }\n }\n return numAnnounce > 0;\n }\n /**\n * Announce all \"outside intervals\" --not masked by intervals\n * * Return true if any intervals announced.\n */\n protected announcePartsNNC(\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\n ): boolean {\n let numAnnounce = 0;\n if (!keepInside) {\n let lowFraction = f0;\n for (const interval of intervals) {\n numAnnounce += this.testedAnnounceNNC(lowFraction, interval.low, cp, announce);\n lowFraction = interval.high;\n }\n numAnnounce += this.testedAnnounceNNC(lowFraction, f1, cp, announce);\n } else {\n for (const interval of intervals) {\n // use f0..f1 ?\n numAnnounce += this.testedAnnounceNNC(interval.low, interval.high, cp, announce);\n }\n }\n return numAnnounce > 0;\n }\n /** Invoke callback to test if a point is \"in\" this clipper */\n public isPointOnOrInside(point: Point3d): boolean {\n const q = this.isPointOnOrInsideChildren(point);\n return this._keepInside ? q : !q;\n }\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\n ): boolean {\n this._intervalsA.length = 0;\n const announceIntervalB = (a0: number, a1: number) => {\n this._intervalsB.push(Range1d.createXX(a0, a1));\n };\n // Strategy:\n // _intervalsA is the accumulated UNION of from clippers\n // _intervalsB is the current clipper.\n // announceIntervalB appends single new interval to _intervalB\n // at end, output gaps in _intervalsA\n //\n let i = 0;\n for (const c of this._clippers) {\n this._intervalsB.length = 0;\n c.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announceIntervalB);\n Range1dArray.simplifySortUnion(this._intervalsB);\n if (i === 0) {\n this.swapAB();\n } else {\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\n }\n i++;\n }\n return this.announcePartsNN(this._keepInside, this._intervalsA, f0, f1, announce);\n }\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n this._intervalsA.length = 0;\n const announceIntervalB = (a0: number, a1: number) => {\n this._intervalsB.push(Range1d.createXX(a0, a1));\n };\n let i = 0;\n for (const c of this._clippers) {\n this._intervalsB.length = 0;\n c.announceClippedArcIntervals(arc, announceIntervalB);\n Range1dArray.simplifySortUnion(this._intervalsB);\n if (i === 0) {\n this.swapAB();\n } else {\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\n }\n i++;\n }\n return this.announcePartsNNC(this._keepInside, this._intervalsA, 0, 1, arc, announce);\n }\n}\n\n/**\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\n * @internal\n */\nexport class BooleanClipNodeUnion extends BooleanClipNode {\n public get operationName(): string { return this._keepInside ? \"OR\" : \"NOR\"; }\n public constructor(keepInside: boolean) {\n super(keepInside);\n }\n /** Return true if inside any child clipper */\n public isPointOnOrInsideChildren(point: Point3d): boolean {\n for (const clipper of this._clippers) {\n if (clipper.isPointOnOrInside(point))\n return true;\n }\n return false;\n }\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\n return Range1dArray.unionSorted(operandA, operandB);\n }\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ) {\n ClipUtilities.doPolygonClipSequence(\n xyz,\n this._clippers,\n this._keepInside ? insideFragments : outsideFragments,\n this._keepInside ? outsideFragments : insideFragments,\n undefined,\n ClipStepAction.acceptIn,\n ClipStepAction.passToNextStep,\n ClipStepAction.acceptOut,\n arrayCache,\n );\n }\n}\n\n/**\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\n * @internal\n */\nexport class BooleanClipNodeParity extends BooleanClipNode {\n public get operationName(): string { return this._keepInside ? \"XOR\" : \"NXOR\"; }\n public constructor(keepInside: boolean) {\n super(keepInside);\n }\n /** Return true if inside an odd number of clippers child clipper */\n public isPointOnOrInsideChildren(point: Point3d): boolean {\n let q = false;\n for (const clipper of this._clippers) {\n if (clipper.isPointOnOrInside(point))\n q = !q;\n }\n return q;\n }\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\n return Range1dArray.paritySorted(operandA, operandB);\n }\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ) {\n ClipUtilities.doPolygonClipParitySequence(\n xyz,\n this._clippers,\n this._keepInside ? insideFragments : outsideFragments,\n this._keepInside ? outsideFragments : insideFragments,\n arrayCache,\n );\n }\n}\n\n/**\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\n * @internal\n */\nexport class BooleanClipNodeIntersection extends BooleanClipNode implements PolygonClipper {\n public get operationName(): string { return this._keepInside ? \"AND\" : \"NAND\"; }\n public constructor(keepInside: boolean) {\n super(keepInside);\n }\n /** Return false if outside of any child clipper */\n public isPointOnOrInsideChildren(point: Point3d): boolean {\n for (const clipper of this._clippers) {\n if (!clipper.isPointOnOrInside(point))\n return false;\n }\n return true;\n }\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\n return Range1dArray.intersectSorted(operandA, operandB);\n }\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ) {\n\n ClipUtilities.doPolygonClipSequence(\n xyz,\n this._clippers,\n this._keepInside ? insideFragments : outsideFragments,\n this._keepInside ? outsideFragments : insideFragments,\n undefined,\n ClipStepAction.passToNextStep,\n ClipStepAction.acceptOut,\n ClipStepAction.acceptIn,\n arrayCache,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"BooleanClipNode.js","sourceRoot":"","sources":["../../../src/clipping/BooleanClipNode.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAW/F,+CAA8C;AAE9C,2DAAwD;AACxD,2CAAqF;AAErF;;;;;;;;;;;;;;;GAeG;AACH,MAAsB,eAAe;IACzB,SAAS,CAAY;IACrB,WAAW,CAAY;IACvB,W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,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,EACrD,SAAS,EACT,0BAAc,CAAC,cAAc,EAC7B,0BAAc,CAAC,SAAS,EACxB,0BAAc,CAAC,QAAQ,EACvB,UAAU,CACX,CAAC;IACJ,CAAC;CACF;AAnCD,kEAmCC","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 { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Range1dArray } from \"../numerics/Range1dArray\";\r\nimport { Clipper, ClipStepAction, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\r\n\r\n/** BooleanClipNode is an abstract base class for boolean actions by an array of clippers.\r\n * * Derived class must implement\r\n * * The single point test `isPointOnOrInsideChildren`\r\n * * Boolean operation on 1d intervals `combineIntervals`\r\n * * The `keepInside` flag controls an additional optional flip of the boolean result.\r\n * * if `keepInside === true`, accept the \"inside\" of the clip clippers\r\n * * if `keepInside === false`, accept the \"outside\" of the child clippers.\r\n * * Hence the combinations of derived classes for (OR, AND, XOR) and keepInside are\r\n * * (OR, true) = simple union (OR), i.e. \"in\" one or more clips\r\n * * (OR, false) = complement of union (NOR), i.e. \"outside\" all clips\r\n * * (AND, true) = simple intersection (AND), i.e. \"in\" all clips\r\n * * (AND, false) = complement of intersection (NAND), i.e. \"outside\" one or more clips\r\n * * (XOR,true) = simple parity, i.e. \"in\" an odd number of clips\r\n * * (XOR,false) = complement of parity ), i.e. \"in\" an even number of clips\r\n * @internal\r\n */\r\nexport abstract class BooleanClipNode implements Clipper {\r\n protected _clippers: Clipper[];\r\n protected _intervalsA: Range1d[];\r\n protected _intervalsB: Range1d[];\r\n protected _keepInside: boolean;\r\n\r\n public constructor(keepInside: boolean) {\r\n this._keepInside = keepInside;\r\n this._clippers = [];\r\n this._intervalsA = [];\r\n this._intervalsB = [];\r\n }\r\n protected abstract isPointOnOrInsideChildren(point: Point3d): boolean;\r\n protected abstract combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[];\r\n public abstract get operationName(): string;\r\n public toJSON(): any {\r\n const data = [];\r\n for (const c of this._clippers) {\r\n const c1 = c as any;\r\n if (c1.toJSON)\r\n data.push(c1.toJSON());\r\n }\r\n // return this.formatJSON(data);\r\n const s = this.operationName;\r\n const json: { [opType: string]: any[] } = {};\r\n json[s] = data;\r\n return json;\r\n }\r\n /** Capture a (reference to a) child node or nodes */\r\n public captureChild(child: Clipper | Clipper[]) {\r\n if (Array.isArray(child)) {\r\n for (const c of child) this.captureChild(c);\r\n } else {\r\n this._clippers.push(child);\r\n }\r\n }\r\n /** Toggle the \"keepInside\" behavior. Return the prior value. */\r\n public toggleResult(): boolean {\r\n return this.selectResult(!this._keepInside);\r\n }\r\n /** Set the \"keepInside\" behavior */\r\n public selectResult(keepInside: boolean): boolean {\r\n const s = this._keepInside;\r\n this._keepInside = keepInside;\r\n return s;\r\n }\r\n /**\r\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1).\r\n * * Return 0 if not called, 1 if called.\r\n */\r\n protected testedAnnounceNN(a0: number, a1: number, announce?: AnnounceNumberNumber): number {\r\n if (a0 < a1) {\r\n if (announce)\r\n announce(a0, a1);\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n /**\r\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1, cp).\r\n * * Return 0 if not called, 1 if called.\r\n */\r\n protected testedAnnounceNNC(\r\n a0: number, a1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\r\n ): number {\r\n if (a0 < a1) {\r\n if (announce)\r\n announce(a0, a1, cp);\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n /** Swap the _intervalsA and _intervalsB */\r\n protected swapAB(): void {\r\n const q = this._intervalsA;\r\n this._intervalsA = this._intervalsB;\r\n this._intervalsB = q;\r\n }\r\n /**\r\n * Announce all \"outside intervals\" --not masked by intervals\r\n * * Return true if any intervals announced.\r\n */\r\n protected announcePartsNN(\r\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n let numAnnounce = 0;\r\n if (!keepInside) {\r\n let lowFraction = f0;\r\n for (const interval of intervals) {\r\n numAnnounce += this.testedAnnounceNN(lowFraction, interval.low, announce);\r\n lowFraction = interval.high;\r\n }\r\n numAnnounce += this.testedAnnounceNN(lowFraction, f1, announce);\r\n } else {\r\n for (const interval of intervals) {\r\n // use f0..f1 ?\r\n numAnnounce += this.testedAnnounceNN(interval.low, interval.high, announce);\r\n }\r\n }\r\n return numAnnounce > 0;\r\n }\r\n /**\r\n * Announce all \"outside intervals\" --not masked by intervals\r\n * * Return true if any intervals announced.\r\n */\r\n protected announcePartsNNC(\r\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\r\n ): boolean {\r\n let numAnnounce = 0;\r\n if (!keepInside) {\r\n let lowFraction = f0;\r\n for (const interval of intervals) {\r\n numAnnounce += this.testedAnnounceNNC(lowFraction, interval.low, cp, announce);\r\n lowFraction = interval.high;\r\n }\r\n numAnnounce += this.testedAnnounceNNC(lowFraction, f1, cp, announce);\r\n } else {\r\n for (const interval of intervals) {\r\n // use f0..f1 ?\r\n numAnnounce += this.testedAnnounceNNC(interval.low, interval.high, cp, announce);\r\n }\r\n }\r\n return numAnnounce > 0;\r\n }\r\n /** Invoke callback to test if a point is \"in\" this clipper */\r\n public isPointOnOrInside(point: Point3d): boolean {\r\n const q = this.isPointOnOrInsideChildren(point);\r\n return this._keepInside ? q : !q;\r\n }\r\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n this._intervalsA.length = 0;\r\n const announceIntervalB = (a0: number, a1: number) => {\r\n this._intervalsB.push(Range1d.createXX(a0, a1));\r\n };\r\n // Strategy:\r\n // _intervalsA is the accumulated UNION of from clippers\r\n // _intervalsB is the current clipper.\r\n // announceIntervalB appends single new interval to _intervalB\r\n // at end, output gaps in _intervalsA\r\n //\r\n let i = 0;\r\n for (const c of this._clippers) {\r\n this._intervalsB.length = 0;\r\n c.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announceIntervalB);\r\n Range1dArray.simplifySortUnion(this._intervalsB);\r\n if (i === 0) {\r\n this.swapAB();\r\n } else {\r\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\r\n }\r\n i++;\r\n }\r\n return this.announcePartsNN(this._keepInside, this._intervalsA, f0, f1, announce);\r\n }\r\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this._intervalsA.length = 0;\r\n const announceIntervalB = (a0: number, a1: number) => {\r\n this._intervalsB.push(Range1d.createXX(a0, a1));\r\n };\r\n let i = 0;\r\n for (const c of this._clippers) {\r\n this._intervalsB.length = 0;\r\n c.announceClippedArcIntervals(arc, announceIntervalB);\r\n Range1dArray.simplifySortUnion(this._intervalsB);\r\n if (i === 0) {\r\n this.swapAB();\r\n } else {\r\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\r\n }\r\n i++;\r\n }\r\n return this.announcePartsNNC(this._keepInside, this._intervalsA, 0, 1, arc, announce);\r\n }\r\n}\r\n\r\n/**\r\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\r\n * @internal\r\n */\r\nexport class BooleanClipNodeUnion extends BooleanClipNode {\r\n public get operationName(): string { return this._keepInside ? \"OR\" : \"NOR\"; }\r\n public constructor(keepInside: boolean) {\r\n super(keepInside);\r\n }\r\n /** Return true if inside any child clipper */\r\n public isPointOnOrInsideChildren(point: Point3d): boolean {\r\n for (const clipper of this._clippers) {\r\n if (clipper.isPointOnOrInside(point))\r\n return true;\r\n }\r\n return false;\r\n }\r\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\r\n return Range1dArray.unionSorted(operandA, operandB);\r\n }\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ) {\r\n ClipUtilities.doPolygonClipSequence(\r\n xyz,\r\n this._clippers,\r\n this._keepInside ? insideFragments : outsideFragments,\r\n this._keepInside ? outsideFragments : insideFragments,\r\n undefined,\r\n ClipStepAction.acceptIn,\r\n ClipStepAction.passToNextStep,\r\n ClipStepAction.acceptOut,\r\n arrayCache,\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\r\n * @internal\r\n */\r\nexport class BooleanClipNodeParity extends BooleanClipNode {\r\n public get operationName(): string { return this._keepInside ? \"XOR\" : \"NXOR\"; }\r\n public constructor(keepInside: boolean) {\r\n super(keepInside);\r\n }\r\n /** Return true if inside an odd number of clippers child clipper */\r\n public isPointOnOrInsideChildren(point: Point3d): boolean {\r\n let q = false;\r\n for (const clipper of this._clippers) {\r\n if (clipper.isPointOnOrInside(point))\r\n q = !q;\r\n }\r\n return q;\r\n }\r\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\r\n return Range1dArray.paritySorted(operandA, operandB);\r\n }\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ) {\r\n ClipUtilities.doPolygonClipParitySequence(\r\n xyz,\r\n this._clippers,\r\n this._keepInside ? insideFragments : outsideFragments,\r\n this._keepInside ? outsideFragments : insideFragments,\r\n arrayCache,\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\r\n * @internal\r\n */\r\nexport class BooleanClipNodeIntersection extends BooleanClipNode implements PolygonClipper {\r\n public get operationName(): string { return this._keepInside ? \"AND\" : \"NAND\"; }\r\n public constructor(keepInside: boolean) {\r\n super(keepInside);\r\n }\r\n /** Return false if outside of any child clipper */\r\n public isPointOnOrInsideChildren(point: Point3d): boolean {\r\n for (const clipper of this._clippers) {\r\n if (!clipper.isPointOnOrInside(point))\r\n return false;\r\n }\r\n return true;\r\n }\r\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\r\n return Range1dArray.intersectSorted(operandA, operandB);\r\n }\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ) {\r\n\r\n ClipUtilities.doPolygonClipSequence(\r\n xyz,\r\n this._clippers,\r\n this._keepInside ? insideFragments : outsideFragments,\r\n this._keepInside ? outsideFragments : insideFragments,\r\n undefined,\r\n ClipStepAction.passToNextStep,\r\n ClipStepAction.acceptOut,\r\n ClipStepAction.acceptIn,\r\n arrayCache,\r\n );\r\n }\r\n}\r\n"]}
@@ -13,7 +13,7 @@ import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
13
13
  import { Range3d } from "../geometry3d/Range";
14
14
  import { GrowableXYZArrayCache } from "../geometry3d/ReusableObjectCache";
15
15
  import { Transform } from "../geometry3d/Transform";
16
- import { XYZProps } from "../geometry3d/XYZProps";
16
+ import { XYAndZ, XYZProps } from "../geometry3d/XYZProps";
17
17
  import { Matrix4d } from "../geometry4d/Matrix4d";
18
18
  import { Point4d } from "../geometry4d/Point4d";
19
19
  import { Clipper, PolygonClipper } from "./ClipUtils";
@@ -81,7 +81,7 @@ export declare class ClipPlane extends Plane3d implements Clipper, PolygonClippe
81
81
  * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz as
82
82
  * a vector from the origin.)
83
83
  */
84
- static createNormalAndPoint(normal: Vector3d, point: Point3d, invisible?: boolean, interior?: boolean, result?: ClipPlane): ClipPlane | undefined;
84
+ static createNormalAndPoint(normal: Vector3d, point: XYAndZ, invisible?: boolean, interior?: boolean, result?: ClipPlane): ClipPlane | undefined;
85
85
  /**
86
86
  * Create a clip plane
87
87
  * @param origin any point on the plane.
@@ -127,7 +127,13 @@ export declare class ClipPlane extends Plane3d implements Clipper, PolygonClippe
127
127
  */
128
128
  static createEdgeAndUpVector(point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane): ClipPlane | undefined;
129
129
  /** Create a plane perpendicular to the edge between the xy parts of point0 and point1. */
130
- static createEdgeXY(point0: Point3d, point1: Point3d, result?: ClipPlane): ClipPlane | undefined;
130
+ static createEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined;
131
+ /**
132
+ * Variant of [[createEdgeXY]] that computes the plane using the edge midpoint instead of its start point.
133
+ * * This is more stable for creating a pair of clip planes from a long edge and its reversal, as is commonly found
134
+ * in a [[UnionOfConvexClipPlaneSets]].
135
+ */
136
+ static createMidPointEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined;
131
137
  /**
132
138
  * Return the Plane3d form of the plane.
133
139
  * * The plane origin is the point `distance * inwardNormal`
@@ -235,11 +241,17 @@ export declare class ClipPlane extends Plane3d implements Clipper, PolygonClippe
235
241
  * Clip a polygon to the inside or outside of the plane.
236
242
  * * Results with 2 or fewer points are ignored.
237
243
  * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.
244
+ * * For a convex input polygon, the output polygon is also convex.
245
+ * * For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a
246
+ * valid clip in a parity sense (overlapping regions cancel).
238
247
  * @param xyz input points.
239
- * @param work work buffer
240
- * @param tolerance tolerance for "on plane" decision.
248
+ * @param work optional work buffer
249
+ * @param inside whether the positive side of the plane survives (true, default), or negative side (false).
250
+ * @param tolerance distance tolerance for "on plane" decision. Default value is [[Geometry.smallMetricDistance]].
251
+ * @return the number of crossings. If this is larger than 2, the input polygon was non-convex.
252
+ * @see appendPolygonClip
241
253
  */
242
- clipConvexPolygonInPlace(xyz: GrowableXYZArray, work: GrowableXYZArray, inside?: boolean, tolerance?: number): number;
254
+ clipConvexPolygonInPlace(xyz: GrowableXYZArray, work?: GrowableXYZArray, inside?: boolean, tolerance?: number): number;
243
255
  /**
244
256
  * Multiply the ClipPlane's DPoint4d by matrix.
245
257
  * @param matrix matrix to apply.
@@ -276,6 +288,7 @@ export declare class ClipPlane extends Plane3d implements Clipper, PolygonClippe
276
288
  * @param outsideFragments Array to receive "outside" fragments. Each fragment is a GrowableXYZArray grabbed
277
289
  * from the cache. This is NOT cleared.
278
290
  * @param arrayCache cache for reusable GrowableXYZArray.
291
+ * @see clipConvexPolygonInPlace
279
292
  */
280
293
  appendPolygonClip(xyz: IndexedXYZCollection, insideFragments: GrowableXYZArray[], outsideFragments: GrowableXYZArray[], arrayCache: GrowableXYZArrayCache): void;
281
294
  /** Project a point in space to the plane. */
@@ -1 +1 @@
1
- {"version":3,"file":"ClipPlane.d.ts","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAA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O,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GAClH,OAAO;IAuBV;;;;;OAKG;IACI,QAAQ,IAAI,SAAS;IAM5B;;;;OAIG;IACI,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,GAAE,OAAe,GAAG,gBAAgB,GAAG,SAAS;IAuBrG;;;;;;;;;OASG;IACI,iBAAiB,CACtB,GAAG,EAAE,oBAAoB,EACzB,eAAe,EAAE,gBAAgB,EAAE,EACnC,gBAAgB,EAAE,gBAAgB,EAAE,EACpC,UAAU,EAAE,qBAAqB,GAChC,IAAI;IAUP,6CAA6C;IACtC,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAG1E,uDAAuD;IACvC,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;CAI9F"}
@@ -235,6 +235,14 @@ class ClipPlane extends Plane3d_1.Plane3d {
235
235
  return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);
236
236
  return undefined;
237
237
  }
238
+ /**
239
+ * Variant of [[createEdgeXY]] that computes the plane using the edge midpoint instead of its start point.
240
+ * * This is more stable for creating a pair of clip planes from a long edge and its reversal, as is commonly found
241
+ * in a [[UnionOfConvexClipPlaneSets]].
242
+ */
243
+ static createMidPointEdgeXY(point0, point1, result) {
244
+ return ClipPlane.createNormalAndPointXYZXYZ(point0.y - point1.y, point1.x - point0.x, 0, 0.5 * (point0.x + point1.x), 0.5 * (point0.y + point1.y), 0, false, false, result);
245
+ }
238
246
  /**
239
247
  * Return the Plane3d form of the plane.
240
248
  * * The plane origin is the point `distance * inwardNormal`
@@ -440,9 +448,15 @@ class ClipPlane extends Plane3d_1.Plane3d {
440
448
  * Clip a polygon to the inside or outside of the plane.
441
449
  * * Results with 2 or fewer points are ignored.
442
450
  * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.
451
+ * * For a convex input polygon, the output polygon is also convex.
452
+ * * For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a
453
+ * valid clip in a parity sense (overlapping regions cancel).
443
454
  * @param xyz input points.
444
- * @param work work buffer
445
- * @param tolerance tolerance for "on plane" decision.
455
+ * @param work optional work buffer
456
+ * @param inside whether the positive side of the plane survives (true, default), or negative side (false).
457
+ * @param tolerance distance tolerance for "on plane" decision. Default value is [[Geometry.smallMetricDistance]].
458
+ * @return the number of crossings. If this is larger than 2, the input polygon was non-convex.
459
+ * @see appendPolygonClip
446
460
  */
447
461
  clipConvexPolygonInPlace(xyz, work, inside = true, tolerance = Geometry_1.Geometry.smallMetricDistance) {
448
462
  return PolygonOps_1.IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);
@@ -553,6 +567,7 @@ class ClipPlane extends Plane3d_1.Plane3d {
553
567
  * @param outsideFragments Array to receive "outside" fragments. Each fragment is a GrowableXYZArray grabbed
554
568
  * from the cache. This is NOT cleared.
555
569
  * @param arrayCache cache for reusable GrowableXYZArray.
570
+ * @see clipConvexPolygonInPlace
556
571
  */
557
572
  appendPolygonClip(xyz, insideFragments, outsideFragments, arrayCache) {
558
573
  const perpendicularRange = Range_1.Range1d.createNull();
@@ -1 +1 @@
1
- {"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,0CAAkD;AAElD,6EAA0E;AAC1E,qEAAkE;AAElE,qDAAkD;AAClD,mDAAgD;AAChD,6FAA0F;AAC1F,mEAAkE;AAClE,yDAA0E;AAC1E,+CAAuD;AAEvD,uDAAoD;AAGpD,mDAAgD;AAChD,yDAAwD;AACxD,2CAAqE;AAkBrE;;;;;;;;;;;;;;GAcG;AACH,MAAa,SAAU,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AAe,EAAE,UAAU,CAAC,CAAC;QACvE,yBAAa,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IACD,6CAA6C;IACtC,mBAAmB,CAAC,UAAmB,EAAE,MAAgB;QAC9D,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClF,CAAC;IACD,uDAAuD;IACvC,iBAAiB,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,MAAgB;QACjF,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,OAAO,yBAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACtI,CAAC;;AA5jBH,8BA6jBC","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 { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3d } from \"../geometry3d/Plane3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XYZProps } from \"../geometry3d/XYZProps\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { AnalyticRoots } from \"../numerics/Polynomials\";\nimport { Clipper, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/**\n * Wire format describing a [[ClipPlane]].\n * If either [[normal]] or [[dist]] are omitted, defaults to a normal of [[Vector3d.unitZ]] and a distance of zero.\n * @public\n */\nexport interface ClipPlaneProps {\n /** The plane's inward normal. */\n normal?: XYZProps;\n /** The plane's signed distance from the origin. */\n dist?: number;\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\n invisible?: boolean;\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\n interior?: boolean;\n}\n\n/**\n * A ClipPlane is a single plane represented as\n * * An inward unit normal (u,v,w)\n * * A signedDistance\n * More details can be found at docs/learning/geometry/Clipping.md\n *\n * Hence\n * * The halfspace function evaluation for \"point\" (x,y,z) is `(x,y,z) DOT (u,v,w) - signedDistance`.\n * * POSITIVE values of the halfspace function are \"inside\".\n * * ZERO value of the halfspace function is \"on\".\n * * NEGATIVE value of the halfspace function is \"outside\".\n * * A representative point on the plane is (signedDistance * u, signedDistance * v, signedDistance * w).\n * * Given a point on the plane and the inward normal of the plane, `signedDistance = point DOT normal`.\n * @public\n */\nexport class ClipPlane extends Plane3d implements Clipper, PolygonClipper {\n private _inwardNormal: Vector3d;\n /**\n * Construct a parallel plane through the origin.\n * * Move it to the actual position.\n * * _distanceFromOrigin is the distance it moved, with the (inward) normal direction as positive\n */\n private _distanceFromOrigin: number;\n private _invisible: boolean;\n private _interior: boolean;\n\n private constructor(normal: Vector3d, distance: number, invisible: boolean, interior: boolean) {\n super();\n this._invisible = invisible;\n this._interior = interior;\n this._inwardNormal = normal;\n this._distanceFromOrigin = distance;\n }\n /*\n private safeSetXYZDistance(nx: number, ny: number, nz: number, d: number) {\n this._inwardNormal.set(nx, ny, nz);\n this._distanceFromOrigin = d;\n }\n */\n /**\n * Return true if all members are almostEqual to corresponding members of other.\n * @param other clip plane to compare\n */\n public isAlmostEqual(other: ClipPlane): boolean {\n return Geometry.isSameCoordinate(this._distanceFromOrigin, other._distanceFromOrigin)\n && this._inwardNormal.isAlmostEqual(other._inwardNormal)\n && this._interior === other._interior\n && this._invisible === other._invisible;\n }\n /** Return a cloned plane */\n public clone(): ClipPlane {\n const result = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n return result;\n }\n /** Return a cloned plane with coordinate data negated. */\n public cloneNegated(): ClipPlane {\n const plane = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n plane.negateInPlace();\n return plane;\n }\n /** Create a ClipPlane from Plane3dByOriginAndUnitNormal. */\n public static createPlane(\n plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane {\n const distance = plane.getNormalRef().dotProduct(plane.getOriginRef());\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = plane.getNormalRef().clone();\n result._distanceFromOrigin = distance;\n return result;\n }\n return new ClipPlane(plane.getNormalRef().clone(), distance, invisible, interior);\n }\n /**\n * Create a ClipPlane with direct normal and signedDistance.\n * * The vector is normalized for storage.\n */\n public static createNormalAndDistance(\n normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a ClipPlane\n * * \"normal\" is the inward normal of the plane (it is internally normalized).\n * * \"point\" is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz as\n * a vector from the origin.)\n */\n public static createNormalAndPoint(\n normal: Vector3d, point: Point3d, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n const distance = normalized.dotProduct(point);\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a clip plane\n * @param origin any point on the plane.\n * @param vectorA any vector in the plane\n * @param vectorB any vector in the plane\n * @return undefined if the vectors are not independent.\n * * The stored inward normal is vectorB.crossProduct(vectorA).\n * * That is, the vectors are considered as a right-handed pair when viewed from the outside.\n */\n public static createOriginAndVectors(\n origin: Point3d,\n vectorA: Vector3d,\n vectorB: Vector3d,\n invisible: boolean = false,\n interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = vectorB.crossProduct(vectorA);\n return this.createNormalAndPoint(normalized, origin, invisible, interior, result);\n }\n /**\n * Create a ClipPlane\n * * \"normal\" (normalX, normalY, normalZ) is the inward normal of the plane.\n * * \"point\" (originX,originY,originZ) is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz\n * as a vector from the origin.)\n */\n public static createNormalAndPointXYZXYZ(\n normalX: number, normalY: number, normalZ: number,\n originX: number, originY: number, originZ: number,\n invisible: boolean = false, interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const q = Geometry.hypotenuseXYZ(normalX, normalY, normalZ);\n const r = Geometry.conditionalDivideFraction(1, q);\n if (r !== undefined) {\n if (result) {\n result._inwardNormal.set(normalX * r, normalY * r, normalZ * r);\n result._distanceFromOrigin = result._inwardNormal.dotProductXYZ(originX, originY, originZ);\n result._invisible = invisible;\n result._interior = interior;\n return result;\n }\n const normal = Vector3d.create(normalX * r, normalY * r, normalZ * r);\n return new ClipPlane(normal, normal.dotProductXYZ(originX, originY, originZ), invisible, interior);\n }\n return undefined;\n }\n /**\n * Return a json object of the form\n * `{\"normal\":[u,v,w],\"dist\":signedDistanceValue,\"interior\":true,\"invisible\":true}`\n */\n public toJSON(): ClipPlaneProps {\n const props: ClipPlaneProps = {\n normal: this.inwardNormalRef.toJSON(),\n dist: this.distance,\n };\n if (this.interior)\n props.interior = true;\n if (this.invisible)\n props.invisible = true;\n return props;\n }\n /** Parse json object to ClipPlane instance */\n public static fromJSON(json: ClipPlaneProps, result?: ClipPlane): ClipPlane | undefined {\n if (json && json.normal && undefined !== json.dist && Number.isFinite(json.dist))\n return ClipPlane.createNormalAndDistance(\n Vector3d.fromJSON(json.normal), json.dist, !!json.invisible, !!json.interior,\n );\n return ClipPlane.createNormalAndDistance(Vector3d.unitZ(), 0, false, false, result);\n }\n /** Set both the invisible and interior flags. */\n public setFlags(invisible: boolean, interior: boolean) {\n this._invisible = invisible;\n this._interior = interior;\n }\n /** Return the stored distanceFromOrigin property. */\n public get distance() {\n return this._distanceFromOrigin;\n }\n /** * Return the stored inward normal property. */\n public get inwardNormalRef(): Vector3d {\n return this._inwardNormal;\n }\n /** Return the \"interior\" property flag. Interpretation of this flag is algorithm-specific. */\n public get interior() {\n return this._interior;\n }\n /** Return the \"invisible\" property flag. Interpretation of this flag is algorithm-specific. */\n public get invisible() {\n return this._invisible;\n }\n /**\n * Create a plane defined by two points, an up vector, and a tilt angle relative to the up vector.\n * @param point0 start point of the edge\n * @param point1 end point of the edge\n * @param upVector vector perpendicular to the plane\n * @param tiltAngle angle to tilt the plane around the edge in the direction of the up vector.\n * @param result optional preallocated plane\n */\n public static createEdgeAndUpVector(\n point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane,\n ): ClipPlane | undefined {\n const edgeVector = Vector3d.createFrom(point1.minus(point0));\n let normal = (upVector.crossProduct(edgeVector)).normalize();\n\n if (normal) {\n if (tiltAngle !== undefined && !tiltAngle.isAlmostZero) {\n const tiltNormal = Vector3d.createRotateVectorAroundVector(normal, edgeVector, tiltAngle);\n if (tiltNormal) {\n normal = tiltNormal.clone();\n }\n }\n normal.negate(normal);\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n }\n return undefined;\n }\n /** Create a plane perpendicular to the edge between the xy parts of point0 and point1. */\n public static createEdgeXY(point0: Point3d, point1: Point3d, result?: ClipPlane): ClipPlane | undefined {\n const normal = Vector3d.create(point0.y - point1.y, point1.x - point0.x);\n if (normal.normalizeInPlace())\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n return undefined;\n }\n /**\n * Return the Plane3d form of the plane.\n * * The plane origin is the point `distance * inwardNormal`\n * * The plane normal is the inward normal of the ClipPlane.\n */\n public getPlane3d(): Plane3dByOriginAndUnitNormal {\n const d = this._distanceFromOrigin;\n // normal should be normalized, will not return undefined\n return Plane3dByOriginAndUnitNormal.create(\n Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d),\n this._inwardNormal,\n )!;\n }\n /**\n * Return the Point4d d form of the plane.\n * * The homogeneous xyz are the inward normal xyz.\n * * The homogeneous weight is the negated ClipPlane distance.\n */\n public getPlane4d(): Point4d {\n return Point4d.create(\n this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin,\n );\n }\n /**\n * Set the plane from DPoint4d style plane.\n * * The saved plane has its direction normalized.\n * * This preserves the plane itself as a zero set but make plane evaluations act as true distances (even if the\n * plane coefficients are scaled otherwise).\n * @param plane the DPoint4d style plane.\n */\n public setPlane4d(plane: Point4d) {\n const a = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);\n const r = a === 0.0 ? 1.0 : 1.0 / a;\n this._inwardNormal.x = r * plane.x;\n this._inwardNormal.y = r * plane.y;\n this._inwardNormal.z = r * plane.z;\n this._distanceFromOrigin = -r * plane.w;\n }\n /**\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w\n * scale applied to distance.\n * @param point space point to test.\n */\n public weightedAltitude(point: Point4d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - point.w * this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space, i.e. (dot product with inward normal) minus distance.\n * @param point space point to test.\n */\n public altitude(point: Point3d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space with point given as x,y,z, i.e. (dot product with\n * inward normal) minus distance.\n * @param point space point to test.\n */\n public altitudeXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x\n + y * this._inwardNormal.y\n + z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalX(): number {\n return this._inwardNormal.x;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalY(): number {\n return this._inwardNormal.y;\n }\n /** Return the z component of the normal used to evaluate altitude. */\n public normalZ(): number {\n return this._inwardNormal.z;\n }\n /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin). */\n public velocity(vector: Vector3d): number {\n return vector.x * this._inwardNormal.x + vector.y * this._inwardNormal.y + vector.z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the x,yz, vector components (NOT using the plane's\n * distanceFromOrigin).\n */\n public velocityXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x + y * this._inwardNormal.y + z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the point (treating the point xyz as a vector, and NOT\n * using the plane's distanceFromOrigin).\n */\n public dotProductPlaneNormalPoint(point: Point3d): number {\n return point.x * this._inwardNormal.x + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z;\n }\n /**\n * Return true if spacePoint is inside or on the plane, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOnOrInside(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(spacePoint);\n if (tolerance) { value += tolerance; }\n return value >= 0.0;\n }\n /**\n * Return true if spacePoint is strictly inside the halfspace, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(point);\n if (tolerance) { value -= tolerance; }\n return value > 0.0;\n }\n /**\n * Return true if spacePoint is strictly on the plane, within tolerance\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOn(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n return Math.abs(this.altitude(point)) <= tolerance;\n }\n /**\n * Compute intersections of an (UNBOUNDED) arc with the plane. Append them (as radians) to a growing array.\n * @param arc arc to test. The angle limits of the arc are NOT considered.\n * @param intersectionRadians array to receive results\n */\n public appendIntersectionRadians(arc: Arc3d, intersectionRadians: GrowableFloat64Array) {\n const arcVectors = arc.toVectors();\n const alpha = this.altitude(arc.center);\n const beta = this.velocity(arcVectors.vector0);\n const gamma = this.velocity(arcVectors.vector90);\n AnalyticRoots.appendImplicitLineUnitCircleIntersections(\n alpha, beta, gamma, undefined, undefined, intersectionRadians,\n );\n }\n private static _clipArcFractionArray = new GrowableFloat64Array();\n /**\n * Announce fractional intervals of arc clip.\n * * Each call to `announce(fraction0, fraction1, arc)` announces one interval that is inside the clip plane.\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n const breaks = ClipPlane._clipArcFractionArray;\n breaks.clear();\n this.appendIntersectionRadians(arc, breaks);\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\n }\n /**\n * Compute intersection of (unbounded) segment with the plane.\n * * If the ends are on the same side of the plane, return undefined.\n * * If the intersection is an endpoint or interior to the segment return the fraction.\n * * If both ends are on, return undefined.\n */\n public getBoundedSegmentSimpleIntersection(pointA: Point3d, pointB: Point3d): number | undefined {\n const h0 = this.altitude(pointA);\n const h1 = this.altitude(pointB);\n if (h0 * h1 > 0.0)\n return undefined;\n if (h0 === 0.0 && h1 === 0.0) {\n return undefined;\n }\n return - h0 / (h1 - h0);\n }\n /** Apply transform to the origin. Apply inverse transpose of the matrix part to th normal vector. */\n public transformInPlace(transform: Transform): boolean {\n const plane: Plane3dByOriginAndUnitNormal = this.getPlane3d();\n const matrix: Matrix3d = transform.matrix;\n const newPoint = transform.multiplyPoint3d(plane.getOriginRef());\n // Normal transforms as the inverse transpose of the matrix part\n // BTW: If the matrix is orthogonal, this is a long way to multiply by the matrix part (mumble grumble)\n const newNormal = matrix.multiplyInverseTranspose(plane.getNormalRef());\n if (!newNormal)\n return false;\n\n plane.set(newPoint, newNormal);\n const normalized = (plane.getNormalRef()).normalize();\n if (!normalized)\n return false;\n this._inwardNormal = normalized;\n this._distanceFromOrigin = this._inwardNormal.dotProduct(plane.getOriginRef());\n return true;\n }\n /** Set the invisible flag. Interpretation of this flag is algorithm-specific. */\n public setInvisible(invisible: boolean) {\n this._invisible = invisible;\n }\n /** Reverse the sign of all coefficients, so outside and inside reverse */\n public negateInPlace() {\n this._inwardNormal = this._inwardNormal.negate();\n this._distanceFromOrigin = - this._distanceFromOrigin;\n }\n /**\n * Move the plane INWARD by given distance\n * @param offset distance of shift inwards\n */\n public offsetDistance(offset: number) {\n this._distanceFromOrigin += offset;\n }\n /**\n * Clip a polygon to the inside or outside of the plane.\n * * Results with 2 or fewer points are ignored.\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\n * @param xyz input points.\n * @param work work buffer\n * @param tolerance tolerance for \"on plane\" decision.\n */\n public clipConvexPolygonInPlace(\n xyz: GrowableXYZArray,\n work: GrowableXYZArray,\n inside: boolean = true,\n tolerance: number = Geometry.smallMetricDistance,\n ) {\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\n }\n /**\n * Multiply the ClipPlane's 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 * @param matrix matrix to apply\n * @return false if unable to invert\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\n * 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 */\n public multiplyPlaneByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n const plane: Point4d = this.getPlane4d();\n if (invert) {\n const inverse = matrix.createInverse();\n if (inverse)\n return this.multiplyPlaneByMatrix4d(inverse, false, transpose);\n return false;\n }\n if (transpose)\n matrix.multiplyTransposePoint4d(plane, plane);\n else\n matrix.multiplyPoint4d(plane, plane);\n this.setPlane4d(plane);\n return true;\n }\n /** Announce the interval (if any) where a line is within the clip plane half space. */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void,\n ): boolean {\n if (f1 < f0)\n return false;\n const h0 = - this.altitude(pointA);\n const h1 = - this.altitude(pointB);\n const delta = h1 - h0;\n const f = Geometry.conditionalDivideFraction(-h0, delta);\n if (f === undefined) { // The segment is parallel to the plane.\n if (h0 <= 0.0) { if (announce) announce(f0, f1); return true; }\n return false;\n }\n if (delta > 0) { // segment aims OUT\n if (f < f1) f1 = f;\n } else {\n // segment aims IN\n if (f > f0)\n f0 = f;\n }\n if (f1 < f0)\n return false;\n if (announce) announce(f0, f1);\n return true;\n }\n /**\n * Return a coordinate frame with\n * * origin at closest point to global origin\n * * z axis points in\n * * x and y are \"in plane\"\n */\n public getFrame(): Transform {\n const d = this._distanceFromOrigin;\n const origin = Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d);\n const matrix = Matrix3d.createRigidHeadsUp(this._inwardNormal, AxisOrder.ZXY);\n return Transform.createOriginAndMatrix(origin, matrix);\n }\n /**\n * Return the intersection of the plane with a range cube.\n * @param range\n * @param xyzOut intersection polygon. This is convex.\n */\n public intersectRange(range: Range3d, addClosurePoint: boolean = false): GrowableXYZArray | undefined {\n if (range.isNull)\n return undefined;\n const corners = range.corners();\n const frameOnPlane = this.getFrame();\n frameOnPlane.multiplyInversePoint3dArrayInPlace(corners);\n const localRange = Range3d.createArray(corners);\n if (localRange.low.z * localRange.high.z > 0.0)\n return undefined;\n // oversized polygon on local z= 0\n const xyzOut = new GrowableXYZArray();\n xyzOut.pushXYZ(localRange.low.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.high.y, 0);\n xyzOut.pushXYZ(localRange.low.x, localRange.high.y, 0);\n xyzOut.multiplyTransformInPlace(frameOnPlane);\n IndexedXYZCollectionPolygonOps.intersectRangeConvexPolygonInPlace(range, xyzOut);\n if (xyzOut.length === 0)\n return undefined;\n if (addClosurePoint)\n xyzOut.pushWrap(1);\n return xyzOut;\n }\n /**\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\n * @param xyz convex polygon. This is not changed.\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ): void {\n const perpendicularRange = Range1d.createNull();\n const newInside = arrayCache.grabFromCache();\n const newOutside = arrayCache.grabFromCache();\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\n this, xyz, newInside, newOutside, perpendicularRange,\n );\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\n }\n /** Project a point in space to the plane. */\n public projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d {\n return this.projectXYZToPlane(spacePoint.x, spacePoint.y, spacePoint.z, result);\n }\n /** Return the projection of (x,y,z) onto the plane. */\n public override projectXYZToPlane(x: number, y: number, z: number, result?: Point3d): Point3d {\n const scale = -this.altitudeXYZ(x, y, z);\n return Point3d.create(x + scale * this._inwardNormal.x, y + scale * this._inwardNormal.y, z + scale * this._inwardNormal.z, result);\n }\n}\n"]}
1
+ {"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,0CAAkD;AAElD,6EAA0E;AAC1E,qEAAkE;AAElE,qDAAkD;AAClD,mDAAgD;AAChD,6FAA0F;AAC1F,mEAAkE;AAClE,yDAA0E;AAC1E,+CAAuD;AAEvD,uDAAoD;AAGpD,mDAAgD;AAChD,yDAAwD;AACxD,2CAAqE;AAkBrE;;;;;;;;;;;;;;GAcG;AACH,MAAa,SAAU,SAAQ,iBAAO;IAC5B,aAAa,CAAW;IAChC;;;;OAIG;IACK,mBAAmB,CAAS;IAC5B,UAAU,CAAU;IACpB,SAAS,CAAU;IAE3B,YAAoB,MAAgB,EAAE,QAAgB,EAAE,SAAkB,EAAE,QAAiB;QAC3F,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QA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MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC9C,2CAA8B,CAAC,oCAAoC,CACjE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,CACrD,CAAC;QACF,yBAAa,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QACvE,yBAAa,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IACD,6CAA6C;IACtC,mBAAmB,CAAC,UAAmB,EAAE,MAAgB;QAC9D,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClF,CAAC;IACD,uDAAuD;IACvC,iBAAiB,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,MAAgB;QACjF,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,OAAO,yBAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACtI,CAAC;;AA/kBH,8BAglBC","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 { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3d } from \"../geometry3d/Plane3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { IndexedXYZCollectionPolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XYAndZ, XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { AnalyticRoots } from \"../numerics/Polynomials\";\r\nimport { Clipper, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\r\n\r\n/**\r\n * Wire format describing a [[ClipPlane]].\r\n * If either [[normal]] or [[dist]] are omitted, defaults to a normal of [[Vector3d.unitZ]] and a distance of zero.\r\n * @public\r\n */\r\nexport interface ClipPlaneProps {\r\n /** The plane's inward normal. */\r\n normal?: XYZProps;\r\n /** The plane's signed distance from the origin. */\r\n dist?: number;\r\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\r\n invisible?: boolean;\r\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\r\n interior?: boolean;\r\n}\r\n\r\n/**\r\n * A ClipPlane is a single plane represented as\r\n * * An inward unit normal (u,v,w)\r\n * * A signedDistance\r\n * More details can be found at docs/learning/geometry/Clipping.md\r\n *\r\n * Hence\r\n * * The halfspace function evaluation for \"point\" (x,y,z) is `(x,y,z) DOT (u,v,w) - signedDistance`.\r\n * * POSITIVE values of the halfspace function are \"inside\".\r\n * * ZERO value of the halfspace function is \"on\".\r\n * * NEGATIVE value of the halfspace function is \"outside\".\r\n * * A representative point on the plane is (signedDistance * u, signedDistance * v, signedDistance * w).\r\n * * Given a point on the plane and the inward normal of the plane, `signedDistance = point DOT normal`.\r\n * @public\r\n */\r\nexport class ClipPlane extends Plane3d implements Clipper, PolygonClipper {\r\n private _inwardNormal: Vector3d;\r\n /**\r\n * Construct a parallel plane through the origin.\r\n * * Move it to the actual position.\r\n * * _distanceFromOrigin is the distance it moved, with the (inward) normal direction as positive\r\n */\r\n private _distanceFromOrigin: number;\r\n private _invisible: boolean;\r\n private _interior: boolean;\r\n\r\n private constructor(normal: Vector3d, distance: number, invisible: boolean, interior: boolean) {\r\n super();\r\n this._invisible = invisible;\r\n this._interior = interior;\r\n this._inwardNormal = normal;\r\n this._distanceFromOrigin = distance;\r\n }\r\n /*\r\n private safeSetXYZDistance(nx: number, ny: number, nz: number, d: number) {\r\n this._inwardNormal.set(nx, ny, nz);\r\n this._distanceFromOrigin = d;\r\n }\r\n */\r\n /**\r\n * Return true if all members are almostEqual to corresponding members of other.\r\n * @param other clip plane to compare\r\n */\r\n public isAlmostEqual(other: ClipPlane): boolean {\r\n return Geometry.isSameCoordinate(this._distanceFromOrigin, other._distanceFromOrigin)\r\n && this._inwardNormal.isAlmostEqual(other._inwardNormal)\r\n && this._interior === other._interior\r\n && this._invisible === other._invisible;\r\n }\r\n /** Return a cloned plane */\r\n public clone(): ClipPlane {\r\n const result = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\r\n return result;\r\n }\r\n /** Return a cloned plane with coordinate data negated. */\r\n public cloneNegated(): ClipPlane {\r\n const plane = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\r\n plane.negateInPlace();\r\n return plane;\r\n }\r\n /** Create a ClipPlane from Plane3dByOriginAndUnitNormal. */\r\n public static createPlane(\r\n plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\r\n ): ClipPlane {\r\n const distance = plane.getNormalRef().dotProduct(plane.getOriginRef());\r\n if (result) {\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n result._inwardNormal = plane.getNormalRef().clone();\r\n result._distanceFromOrigin = distance;\r\n return result;\r\n }\r\n return new ClipPlane(plane.getNormalRef().clone(), distance, invisible, interior);\r\n }\r\n /**\r\n * Create a ClipPlane with direct normal and signedDistance.\r\n * * The vector is normalized for storage.\r\n */\r\n public static createNormalAndDistance(\r\n normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const normalized = normal.normalize();\r\n if (normalized) {\r\n if (result) {\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n result._inwardNormal = normalized;\r\n result._distanceFromOrigin = distance;\r\n }\r\n return new ClipPlane(normalized, distance, invisible, interior);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a ClipPlane\r\n * * \"normal\" is the inward normal of the plane (it is internally normalized).\r\n * * \"point\" is any point of the plane.\r\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz as\r\n * a vector from the origin.)\r\n */\r\n public static createNormalAndPoint(\r\n normal: Vector3d, point: XYAndZ, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const normalized = normal.normalize();\r\n if (normalized) {\r\n const distance = normalized.dotProduct(point);\r\n if (result) {\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n result._inwardNormal = normalized;\r\n result._distanceFromOrigin = distance;\r\n }\r\n return new ClipPlane(normalized, distance, invisible, interior);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a clip plane\r\n * @param origin any point on the plane.\r\n * @param vectorA any vector in the plane\r\n * @param vectorB any vector in the plane\r\n * @return undefined if the vectors are not independent.\r\n * * The stored inward normal is vectorB.crossProduct(vectorA).\r\n * * That is, the vectors are considered as a right-handed pair when viewed from the outside.\r\n */\r\n public static createOriginAndVectors(\r\n origin: Point3d,\r\n vectorA: Vector3d,\r\n vectorB: Vector3d,\r\n invisible: boolean = false,\r\n interior: boolean = false,\r\n result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const normalized = vectorB.crossProduct(vectorA);\r\n return this.createNormalAndPoint(normalized, origin, invisible, interior, result);\r\n }\r\n /**\r\n * Create a ClipPlane\r\n * * \"normal\" (normalX, normalY, normalZ) is the inward normal of the plane.\r\n * * \"point\" (originX,originY,originZ) is any point of the plane.\r\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz\r\n * as a vector from the origin.)\r\n */\r\n public static createNormalAndPointXYZXYZ(\r\n normalX: number, normalY: number, normalZ: number,\r\n originX: number, originY: number, originZ: number,\r\n invisible: boolean = false, interior: boolean = false,\r\n result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const q = Geometry.hypotenuseXYZ(normalX, normalY, normalZ);\r\n const r = Geometry.conditionalDivideFraction(1, q);\r\n if (r !== undefined) {\r\n if (result) {\r\n result._inwardNormal.set(normalX * r, normalY * r, normalZ * r);\r\n result._distanceFromOrigin = result._inwardNormal.dotProductXYZ(originX, originY, originZ);\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n return result;\r\n }\r\n const normal = Vector3d.create(normalX * r, normalY * r, normalZ * r);\r\n return new ClipPlane(normal, normal.dotProductXYZ(originX, originY, originZ), invisible, interior);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a json object of the form\r\n * `{\"normal\":[u,v,w],\"dist\":signedDistanceValue,\"interior\":true,\"invisible\":true}`\r\n */\r\n public toJSON(): ClipPlaneProps {\r\n const props: ClipPlaneProps = {\r\n normal: this.inwardNormalRef.toJSON(),\r\n dist: this.distance,\r\n };\r\n if (this.interior)\r\n props.interior = true;\r\n if (this.invisible)\r\n props.invisible = true;\r\n return props;\r\n }\r\n /** Parse json object to ClipPlane instance */\r\n public static fromJSON(json: ClipPlaneProps, result?: ClipPlane): ClipPlane | undefined {\r\n if (json && json.normal && undefined !== json.dist && Number.isFinite(json.dist))\r\n return ClipPlane.createNormalAndDistance(\r\n Vector3d.fromJSON(json.normal), json.dist, !!json.invisible, !!json.interior,\r\n );\r\n return ClipPlane.createNormalAndDistance(Vector3d.unitZ(), 0, false, false, result);\r\n }\r\n /** Set both the invisible and interior flags. */\r\n public setFlags(invisible: boolean, interior: boolean) {\r\n this._invisible = invisible;\r\n this._interior = interior;\r\n }\r\n /** Return the stored distanceFromOrigin property. */\r\n public get distance() {\r\n return this._distanceFromOrigin;\r\n }\r\n /** * Return the stored inward normal property. */\r\n public get inwardNormalRef(): Vector3d {\r\n return this._inwardNormal;\r\n }\r\n /** Return the \"interior\" property flag. Interpretation of this flag is algorithm-specific. */\r\n public get interior() {\r\n return this._interior;\r\n }\r\n /** Return the \"invisible\" property flag. Interpretation of this flag is algorithm-specific. */\r\n public get invisible() {\r\n return this._invisible;\r\n }\r\n /**\r\n * Create a plane defined by two points, an up vector, and a tilt angle relative to the up vector.\r\n * @param point0 start point of the edge\r\n * @param point1 end point of the edge\r\n * @param upVector vector perpendicular to the plane\r\n * @param tiltAngle angle to tilt the plane around the edge in the direction of the up vector.\r\n * @param result optional preallocated plane\r\n */\r\n public static createEdgeAndUpVector(\r\n point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const edgeVector = Vector3d.createFrom(point1.minus(point0));\r\n let normal = (upVector.crossProduct(edgeVector)).normalize();\r\n\r\n if (normal) {\r\n if (tiltAngle !== undefined && !tiltAngle.isAlmostZero) {\r\n const tiltNormal = Vector3d.createRotateVectorAroundVector(normal, edgeVector, tiltAngle);\r\n if (tiltNormal) {\r\n normal = tiltNormal.clone();\r\n }\r\n }\r\n normal.negate(normal);\r\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\r\n }\r\n return undefined;\r\n }\r\n /** Create a plane perpendicular to the edge between the xy parts of point0 and point1. */\r\n public static createEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined {\r\n const normal = Vector3d.create(point0.y - point1.y, point1.x - point0.x);\r\n if (normal.normalizeInPlace())\r\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\r\n return undefined;\r\n }\r\n /**\r\n * Variant of [[createEdgeXY]] that computes the plane using the edge midpoint instead of its start point.\r\n * * This is more stable for creating a pair of clip planes from a long edge and its reversal, as is commonly found\r\n * in a [[UnionOfConvexClipPlaneSets]].\r\n */\r\n public static createMidPointEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined {\r\n return ClipPlane.createNormalAndPointXYZXYZ(\r\n point0.y - point1.y, point1.x - point0.x, 0,\r\n 0.5 * (point0.x + point1.x), 0.5 * (point0.y + point1.y), 0,\r\n false, false, result,\r\n );\r\n }\r\n /**\r\n * Return the Plane3d form of the plane.\r\n * * The plane origin is the point `distance * inwardNormal`\r\n * * The plane normal is the inward normal of the ClipPlane.\r\n */\r\n public getPlane3d(): Plane3dByOriginAndUnitNormal {\r\n const d = this._distanceFromOrigin;\r\n // normal should be normalized, will not return undefined\r\n return Plane3dByOriginAndUnitNormal.create(\r\n Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d),\r\n this._inwardNormal,\r\n )!;\r\n }\r\n /**\r\n * Return the Point4d d form of the plane.\r\n * * The homogeneous xyz are the inward normal xyz.\r\n * * The homogeneous weight is the negated ClipPlane distance.\r\n */\r\n public getPlane4d(): Point4d {\r\n return Point4d.create(\r\n this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin,\r\n );\r\n }\r\n /**\r\n * Set the plane from DPoint4d style plane.\r\n * * The saved plane has its direction normalized.\r\n * * This preserves the plane itself as a zero set but make plane evaluations act as true distances (even if the\r\n * plane coefficients are scaled otherwise).\r\n * @param plane the DPoint4d style plane.\r\n */\r\n public setPlane4d(plane: Point4d) {\r\n const a = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);\r\n const r = a === 0.0 ? 1.0 : 1.0 / a;\r\n this._inwardNormal.x = r * plane.x;\r\n this._inwardNormal.y = r * plane.y;\r\n this._inwardNormal.z = r * plane.z;\r\n this._distanceFromOrigin = -r * plane.w;\r\n }\r\n /**\r\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w\r\n * scale applied to distance.\r\n * @param point space point to test.\r\n */\r\n public weightedAltitude(point: Point4d): number {\r\n return point.x * this._inwardNormal.x\r\n + point.y * this._inwardNormal.y\r\n + point.z * this._inwardNormal.z\r\n - point.w * this._distanceFromOrigin;\r\n }\r\n /**\r\n * Evaluate the distance from the plane to a point in space, i.e. (dot product with inward normal) minus distance.\r\n * @param point space point to test.\r\n */\r\n public altitude(point: Point3d): number {\r\n return point.x * this._inwardNormal.x\r\n + point.y * this._inwardNormal.y\r\n + point.z * this._inwardNormal.z\r\n - this._distanceFromOrigin;\r\n }\r\n /**\r\n * Evaluate the distance from the plane to a point in space with point given as x,y,z, i.e. (dot product with\r\n * inward normal) minus distance.\r\n * @param point space point to test.\r\n */\r\n public altitudeXYZ(x: number, y: number, z: number): number {\r\n return x * this._inwardNormal.x\r\n + y * this._inwardNormal.y\r\n + z * this._inwardNormal.z\r\n - this._distanceFromOrigin;\r\n }\r\n /** Return the x component of the normal used to evaluate altitude. */\r\n public normalX(): number {\r\n return this._inwardNormal.x;\r\n }\r\n /** Return the x component of the normal used to evaluate altitude. */\r\n public normalY(): number {\r\n return this._inwardNormal.y;\r\n }\r\n /** Return the z component of the normal used to evaluate altitude. */\r\n public normalZ(): number {\r\n return this._inwardNormal.z;\r\n }\r\n /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin). */\r\n public velocity(vector: Vector3d): number {\r\n return vector.x * this._inwardNormal.x + vector.y * this._inwardNormal.y + vector.z * this._inwardNormal.z;\r\n }\r\n /**\r\n * Return the dot product of the plane normal with the x,yz, vector components (NOT using the plane's\r\n * distanceFromOrigin).\r\n */\r\n public velocityXYZ(x: number, y: number, z: number): number {\r\n return x * this._inwardNormal.x + y * this._inwardNormal.y + z * this._inwardNormal.z;\r\n }\r\n /**\r\n * Return the dot product of the plane normal with the point (treating the point xyz as a vector, and NOT\r\n * using the plane's distanceFromOrigin).\r\n */\r\n public dotProductPlaneNormalPoint(point: Point3d): number {\r\n return point.x * this._inwardNormal.x + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z;\r\n }\r\n /**\r\n * Return true if spacePoint is inside or on the plane, with tolerance applied to \"on\".\r\n * @param spacePoint point to test.\r\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\r\n */\r\n public isPointOnOrInside(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n let value = this.altitude(spacePoint);\r\n if (tolerance) { value += tolerance; }\r\n return value >= 0.0;\r\n }\r\n /**\r\n * Return true if spacePoint is strictly inside the halfspace, with tolerance applied to \"on\".\r\n * @param spacePoint point to test.\r\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\r\n */\r\n public isPointInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n let value = this.altitude(point);\r\n if (tolerance) { value -= tolerance; }\r\n return value > 0.0;\r\n }\r\n /**\r\n * Return true if spacePoint is strictly on the plane, within tolerance\r\n * @param spacePoint point to test.\r\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\r\n */\r\n public isPointOn(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n return Math.abs(this.altitude(point)) <= tolerance;\r\n }\r\n /**\r\n * Compute intersections of an (UNBOUNDED) arc with the plane. Append them (as radians) to a growing array.\r\n * @param arc arc to test. The angle limits of the arc are NOT considered.\r\n * @param intersectionRadians array to receive results\r\n */\r\n public appendIntersectionRadians(arc: Arc3d, intersectionRadians: GrowableFloat64Array) {\r\n const arcVectors = arc.toVectors();\r\n const alpha = this.altitude(arc.center);\r\n const beta = this.velocity(arcVectors.vector0);\r\n const gamma = this.velocity(arcVectors.vector90);\r\n AnalyticRoots.appendImplicitLineUnitCircleIntersections(\r\n alpha, beta, gamma, undefined, undefined, intersectionRadians,\r\n );\r\n }\r\n private static _clipArcFractionArray = new GrowableFloat64Array();\r\n /**\r\n * Announce fractional intervals of arc clip.\r\n * * Each call to `announce(fraction0, fraction1, arc)` announces one interval that is inside the clip plane.\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n const breaks = ClipPlane._clipArcFractionArray;\r\n breaks.clear();\r\n this.appendIntersectionRadians(arc, breaks);\r\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\r\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\r\n }\r\n /**\r\n * Compute intersection of (unbounded) segment with the plane.\r\n * * If the ends are on the same side of the plane, return undefined.\r\n * * If the intersection is an endpoint or interior to the segment return the fraction.\r\n * * If both ends are on, return undefined.\r\n */\r\n public getBoundedSegmentSimpleIntersection(pointA: Point3d, pointB: Point3d): number | undefined {\r\n const h0 = this.altitude(pointA);\r\n const h1 = this.altitude(pointB);\r\n if (h0 * h1 > 0.0)\r\n return undefined;\r\n if (h0 === 0.0 && h1 === 0.0) {\r\n return undefined;\r\n }\r\n return - h0 / (h1 - h0);\r\n }\r\n /** Apply transform to the origin. Apply inverse transpose of the matrix part to th normal vector. */\r\n public transformInPlace(transform: Transform): boolean {\r\n const plane: Plane3dByOriginAndUnitNormal = this.getPlane3d();\r\n const matrix: Matrix3d = transform.matrix;\r\n const newPoint = transform.multiplyPoint3d(plane.getOriginRef());\r\n // Normal transforms as the inverse transpose of the matrix part\r\n // BTW: If the matrix is orthogonal, this is a long way to multiply by the matrix part (mumble grumble)\r\n const newNormal = matrix.multiplyInverseTranspose(plane.getNormalRef());\r\n if (!newNormal)\r\n return false;\r\n\r\n plane.set(newPoint, newNormal);\r\n const normalized = (plane.getNormalRef()).normalize();\r\n if (!normalized)\r\n return false;\r\n this._inwardNormal = normalized;\r\n this._distanceFromOrigin = this._inwardNormal.dotProduct(plane.getOriginRef());\r\n return true;\r\n }\r\n /** Set the invisible flag. Interpretation of this flag is algorithm-specific. */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\r\n /** Reverse the sign of all coefficients, so outside and inside reverse */\r\n public negateInPlace() {\r\n this._inwardNormal = this._inwardNormal.negate();\r\n this._distanceFromOrigin = - this._distanceFromOrigin;\r\n }\r\n /**\r\n * Move the plane INWARD by given distance\r\n * @param offset distance of shift inwards\r\n */\r\n public offsetDistance(offset: number) {\r\n this._distanceFromOrigin += offset;\r\n }\r\n /**\r\n * Clip a polygon to the inside or outside of the plane.\r\n * * Results with 2 or fewer points are ignored.\r\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\r\n * * For a convex input polygon, the output polygon is also convex.\r\n * * For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a\r\n * valid clip in a parity sense (overlapping regions cancel).\r\n * @param xyz input points.\r\n * @param work optional work buffer\r\n * @param inside whether the positive side of the plane survives (true, default), or negative side (false).\r\n * @param tolerance distance tolerance for \"on plane\" decision. Default value is [[Geometry.smallMetricDistance]].\r\n * @return the number of crossings. If this is larger than 2, the input polygon was non-convex.\r\n * @see appendPolygonClip\r\n */\r\n public clipConvexPolygonInPlace(\r\n xyz: GrowableXYZArray,\r\n work?: GrowableXYZArray,\r\n inside: boolean = true,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): number {\r\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\r\n }\r\n /**\r\n * Multiply the ClipPlane's 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 * @param matrix matrix to apply\r\n * @return false if unable to invert\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\r\n * 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 */\r\n public multiplyPlaneByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n const plane: Point4d = this.getPlane4d();\r\n if (invert) {\r\n const inverse = matrix.createInverse();\r\n if (inverse)\r\n return this.multiplyPlaneByMatrix4d(inverse, false, transpose);\r\n return false;\r\n }\r\n if (transpose)\r\n matrix.multiplyTransposePoint4d(plane, plane);\r\n else\r\n matrix.multiplyPoint4d(plane, plane);\r\n this.setPlane4d(plane);\r\n return true;\r\n }\r\n /** Announce the interval (if any) where a line is within the clip plane half space. */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void,\r\n ): boolean {\r\n if (f1 < f0)\r\n return false;\r\n const h0 = - this.altitude(pointA);\r\n const h1 = - this.altitude(pointB);\r\n const delta = h1 - h0;\r\n const f = Geometry.conditionalDivideFraction(-h0, delta);\r\n if (f === undefined) { // The segment is parallel to the plane.\r\n if (h0 <= 0.0) { if (announce) announce(f0, f1); return true; }\r\n return false;\r\n }\r\n if (delta > 0) { // segment aims OUT\r\n if (f < f1) f1 = f;\r\n } else {\r\n // segment aims IN\r\n if (f > f0)\r\n f0 = f;\r\n }\r\n if (f1 < f0)\r\n return false;\r\n if (announce) announce(f0, f1);\r\n return true;\r\n }\r\n /**\r\n * Return a coordinate frame with\r\n * * origin at closest point to global origin\r\n * * z axis points in\r\n * * x and y are \"in plane\"\r\n */\r\n public getFrame(): Transform {\r\n const d = this._distanceFromOrigin;\r\n const origin = Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d);\r\n const matrix = Matrix3d.createRigidHeadsUp(this._inwardNormal, AxisOrder.ZXY);\r\n return Transform.createOriginAndMatrix(origin, matrix);\r\n }\r\n /**\r\n * Return the intersection of the plane with a range cube.\r\n * @param range\r\n * @param xyzOut intersection polygon. This is convex.\r\n */\r\n public intersectRange(range: Range3d, addClosurePoint: boolean = false): GrowableXYZArray | undefined {\r\n if (range.isNull)\r\n return undefined;\r\n const corners = range.corners();\r\n const frameOnPlane = this.getFrame();\r\n frameOnPlane.multiplyInversePoint3dArrayInPlace(corners);\r\n const localRange = Range3d.createArray(corners);\r\n if (localRange.low.z * localRange.high.z > 0.0)\r\n return undefined;\r\n // oversized polygon on local z= 0\r\n const xyzOut = new GrowableXYZArray();\r\n xyzOut.pushXYZ(localRange.low.x, localRange.low.y, 0);\r\n xyzOut.pushXYZ(localRange.high.x, localRange.low.y, 0);\r\n xyzOut.pushXYZ(localRange.high.x, localRange.high.y, 0);\r\n xyzOut.pushXYZ(localRange.low.x, localRange.high.y, 0);\r\n xyzOut.multiplyTransformInPlace(frameOnPlane);\r\n IndexedXYZCollectionPolygonOps.intersectRangeConvexPolygonInPlace(range, xyzOut);\r\n if (xyzOut.length === 0)\r\n return undefined;\r\n if (addClosurePoint)\r\n xyzOut.pushWrap(1);\r\n return xyzOut;\r\n }\r\n /**\r\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\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\r\n * from the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\r\n * from the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n * @see clipConvexPolygonInPlace\r\n */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ): void {\r\n const perpendicularRange = Range1d.createNull();\r\n const newInside = arrayCache.grabFromCache();\r\n const newOutside = arrayCache.grabFromCache();\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\r\n this, xyz, newInside, newOutside, perpendicularRange,\r\n );\r\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\r\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\r\n }\r\n /** Project a point in space to the plane. */\r\n public projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d {\r\n return this.projectXYZToPlane(spacePoint.x, spacePoint.y, spacePoint.z, result);\r\n }\r\n /** Return the projection of (x,y,z) onto the plane. */\r\n public override projectXYZToPlane(x: number, y: number, z: number, result?: Point3d): Point3d {\r\n const scale = -this.altitudeXYZ(x, y, z);\r\n return Point3d.create(x + scale * this._inwardNormal.x, y + scale * this._inwardNormal.y, z + scale * this._inwardNormal.z, result);\r\n }\r\n}\r\n"]}