@itwin/core-geometry 3.0.0-extension.0 → 3.1.0-dev.5

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 (213) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Geometry.d.ts +6 -0
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.d.ts +4 -0
  7. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js +39 -0
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurveOps.d.ts +7 -0
  11. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurveOps.js +21 -6
  13. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  14. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  15. package/lib/cjs/bspline/BezierCurve3dH.js +7 -3
  16. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  17. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  18. package/lib/cjs/bspline/InterpolationCurve3d.js +12 -5
  19. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  20. package/lib/cjs/bspline/KnotVector.d.ts +2 -2
  21. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  22. package/lib/cjs/bspline/KnotVector.js +2 -2
  23. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  24. package/lib/cjs/clipping/BooleanClipNode.d.ts +10 -5
  25. package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
  26. package/lib/cjs/clipping/BooleanClipNode.js +13 -3
  27. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  28. package/lib/cjs/clipping/ClipPlane.d.ts +12 -0
  29. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  30. package/lib/cjs/clipping/ClipPlane.js +12 -0
  31. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  32. package/lib/cjs/clipping/ClipUtils.d.ts +57 -9
  33. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  34. package/lib/cjs/clipping/ClipUtils.js +191 -2
  35. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  36. package/lib/cjs/clipping/ClipVector.d.ts +7 -3
  37. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  38. package/lib/cjs/clipping/ClipVector.js +9 -4
  39. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  40. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -1
  41. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  42. package/lib/cjs/clipping/ConvexClipPlaneSet.js +4 -3
  43. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  44. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +1 -1
  45. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  46. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +2 -3
  47. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  48. package/lib/cjs/curve/CurveFactory.d.ts +12 -0
  49. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  50. package/lib/cjs/curve/CurveFactory.js +25 -0
  51. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  52. package/lib/cjs/curve/CurvePrimitive.js +3 -0
  53. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  54. package/lib/cjs/curve/spiral/DirectSpiral3d.js +2 -2
  55. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  56. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +0 -1
  57. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  58. package/lib/cjs/curve/spiral/NormalizedTransition.js +0 -1
  59. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  60. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/FrameBuilder.js +20 -1
  62. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  63. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +12 -0
  64. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  65. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +12 -0
  66. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  67. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -11
  68. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  69. package/lib/cjs/geometry3d/Point3dVector3d.js +5 -25
  70. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  71. package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -0
  72. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  73. package/lib/cjs/geometry3d/PolygonOps.js +7 -0
  74. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  75. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -0
  76. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  77. package/lib/cjs/geometry3d/PolylineOps.js +21 -0
  78. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  79. package/lib/cjs/geometry3d/Ray3d.d.ts +10 -0
  80. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  81. package/lib/cjs/geometry3d/Ray3d.js +23 -0
  82. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  83. package/lib/cjs/geometry3d/Transform.d.ts +5 -0
  84. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  85. package/lib/cjs/geometry3d/Transform.js +7 -0
  86. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  87. package/lib/cjs/geometry4d/Point4d.d.ts +12 -0
  88. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  89. package/lib/cjs/geometry4d/Point4d.js +12 -0
  90. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  91. package/lib/cjs/serialization/GeometrySamples.d.ts +7 -0
  92. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  93. package/lib/cjs/serialization/GeometrySamples.js +27 -0
  94. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  95. package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts +2 -0
  96. package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
  97. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js +4 -0
  98. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  99. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +1 -0
  100. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  101. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts +17 -4
  102. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  103. package/lib/cjs/topology/HalfEdgePositionDetail.js +26 -5
  104. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  105. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  106. package/lib/cjs/topology/InsertAndRetriangulateContext.js +28 -2
  107. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  108. package/lib/esm/Geometry.d.ts +6 -0
  109. package/lib/esm/Geometry.d.ts.map +1 -1
  110. package/lib/esm/Geometry.js.map +1 -1
  111. package/lib/esm/bspline/BSplineCurve.d.ts +4 -0
  112. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  113. package/lib/esm/bspline/BSplineCurve.js +39 -0
  114. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  115. package/lib/esm/bspline/BSplineCurveOps.d.ts +7 -0
  116. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  117. package/lib/esm/bspline/BSplineCurveOps.js +21 -6
  118. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  119. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  120. package/lib/esm/bspline/BezierCurve3dH.js +7 -3
  121. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  122. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  123. package/lib/esm/bspline/InterpolationCurve3d.js +12 -5
  124. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  125. package/lib/esm/bspline/KnotVector.d.ts +2 -2
  126. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  127. package/lib/esm/bspline/KnotVector.js +2 -2
  128. package/lib/esm/bspline/KnotVector.js.map +1 -1
  129. package/lib/esm/clipping/BooleanClipNode.d.ts +10 -5
  130. package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
  131. package/lib/esm/clipping/BooleanClipNode.js +13 -3
  132. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  133. package/lib/esm/clipping/ClipPlane.d.ts +12 -0
  134. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  135. package/lib/esm/clipping/ClipPlane.js +12 -0
  136. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  137. package/lib/esm/clipping/ClipUtils.d.ts +57 -9
  138. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  139. package/lib/esm/clipping/ClipUtils.js +191 -2
  140. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  141. package/lib/esm/clipping/ClipVector.d.ts +7 -3
  142. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  143. package/lib/esm/clipping/ClipVector.js +9 -4
  144. package/lib/esm/clipping/ClipVector.js.map +1 -1
  145. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -1
  146. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  147. package/lib/esm/clipping/ConvexClipPlaneSet.js +4 -3
  148. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  149. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +1 -1
  150. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  151. package/lib/esm/curve/CurveChainWithDistanceIndex.js +2 -3
  152. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  153. package/lib/esm/curve/CurveFactory.d.ts +12 -0
  154. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  155. package/lib/esm/curve/CurveFactory.js +25 -0
  156. package/lib/esm/curve/CurveFactory.js.map +1 -1
  157. package/lib/esm/curve/CurvePrimitive.js +3 -0
  158. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  159. package/lib/esm/curve/spiral/DirectSpiral3d.js +2 -2
  160. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  161. package/lib/esm/curve/spiral/NormalizedTransition.d.ts +0 -1
  162. package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  163. package/lib/esm/curve/spiral/NormalizedTransition.js +0 -1
  164. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  165. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  166. package/lib/esm/geometry3d/FrameBuilder.js +20 -1
  167. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  168. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +12 -0
  169. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  170. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +12 -0
  171. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  172. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -11
  173. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  174. package/lib/esm/geometry3d/Point3dVector3d.js +5 -25
  175. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  176. package/lib/esm/geometry3d/PolygonOps.d.ts +2 -0
  177. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  178. package/lib/esm/geometry3d/PolygonOps.js +7 -0
  179. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  180. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -0
  181. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  182. package/lib/esm/geometry3d/PolylineOps.js +21 -0
  183. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  184. package/lib/esm/geometry3d/Ray3d.d.ts +10 -0
  185. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  186. package/lib/esm/geometry3d/Ray3d.js +23 -0
  187. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  188. package/lib/esm/geometry3d/Transform.d.ts +5 -0
  189. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  190. package/lib/esm/geometry3d/Transform.js +7 -0
  191. package/lib/esm/geometry3d/Transform.js.map +1 -1
  192. package/lib/esm/geometry4d/Point4d.d.ts +12 -0
  193. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  194. package/lib/esm/geometry4d/Point4d.js +12 -0
  195. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  196. package/lib/esm/serialization/GeometrySamples.d.ts +7 -0
  197. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  198. package/lib/esm/serialization/GeometrySamples.js +27 -0
  199. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  200. package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts +2 -0
  201. package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
  202. package/lib/esm/topology/HalfEdgeNodeXYZUV.js +4 -0
  203. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  204. package/lib/esm/topology/HalfEdgePointInGraphSearch.js +1 -0
  205. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  206. package/lib/esm/topology/HalfEdgePositionDetail.d.ts +17 -4
  207. package/lib/esm/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  208. package/lib/esm/topology/HalfEdgePositionDetail.js +26 -5
  209. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  210. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  211. package/lib/esm/topology/InsertAndRetriangulateContext.js +28 -2
  212. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  213. package/package.json +8 -9
@@ -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,CAAC;AAC7E,OAAO,EAAuB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAW,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAiB,cAAc,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAm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AAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAWhG,sGAAsG;IAC/F,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAkBtD,yFAAyF;IAClF,YAAY,CAAC,SAAS,EAAE,OAAO;IAItC,2EAA2E;IACpE,aAAa;IAIpB;;;OAGG;IACI,cAAc,CAAC,MAAM,EAAE,MAAM;IAIpC;;;;;;;OAOG;IACI,wBAAwB,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,GAAE,OAAc,EAAE,SAAS,GAAE,MAAqC;IAIvJ;;;;;;;;;;OAUG;IACI,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAE,OAAc,EAAE,SAAS,GAAE,OAAc,GAAG,OAAO;IAgB5G,uFAAuF;IAChF,+BAA+B,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO;IAuBpK;;;;;OAKG;IACI,QAAQ,IAAI,SAAS;IAM5B;;;;OAIG;IACI,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,GAAE,OAAe,GAAG,gBAAgB,GAAG,SAAS;IAuBrG;;;;;;OAMG;IACI,iBAAiB,CACtB,GAAG,EAAE,gBAAgB,EACrB,eAAe,EAAE,gBAAgB,EAAE,EACnC,gBAAgB,EAAE,gBAAgB,EAAE,EACpC,UAAU,EAAE,qBAAqB,GAAG,IAAI;CAQ3C"}
@@ -261,6 +261,18 @@ class ClipPlane {
261
261
  altitudeXYZ(x, y, z) {
262
262
  return x * this._inwardNormal.x + y * this._inwardNormal.y + z * this._inwardNormal.z - this._distanceFromOrigin;
263
263
  }
264
+ /**
265
+ * Return the x component of the normal used to evaluate altitude.
266
+ */
267
+ normalX() { return this._inwardNormal.x; }
268
+ /**
269
+ * Return the x component of the normal used to evaluate altitude.
270
+ */
271
+ normalY() { return this._inwardNormal.y; }
272
+ /**
273
+ * Return the z component of the normal used to evaluate altitude.
274
+ */
275
+ normalZ() { return this._inwardNormal.z; }
264
276
  /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin).
265
277
  */
266
278
  velocity(vector) {
@@ -1 +1 @@
1
- {"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,0CAA0E;AAG1E,6EAA0E;AAC1E,qEAAkE;AAClE,qDAAkD;AAClD,6FAA0F;AAC1F,mEAAkE;AAClE,yDAA0E;AAC1E,+CAAuD;AACvD,uDAAoD;AAEpD,mDAAgD;AAChD,yDAAwD;AACxD,2CAAqE;AAkBrE;;;;;;;;;;;;GAYG;AACH,MAAa,SAAS;IAUpB,YAAoB,MAAgB,EAAE,QAAgB,EAAE,SAAkB,EAAE,QAAiB;QAC3F,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,mBAAmB,GAAG,QAAQ,CAAC;IACtC,CAAC;IACD;;;;;MAKE;IACF;;;OAGG;IACI,aAAa,CAAC,KAAgB;QACnC,OAAO,mBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,CAAC;eAChF,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC;eACrD,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;eAClC,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC;IAC5C,CAAC;IACD,4BAA4B;IACrB,KAAK;QACV,MAAM,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QACxD,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;QAC9C,2CAA8B,CAAC,kCAAkC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACjF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YACrB,OAAO,SAAS,CAAC;QACnB,IAAI,eAAe;YACjB,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;;;;OAMG;IACI,iBAAiB,CACtB,GAAqB,EACrB,eAAmC,EACnC,gBAAoC,EACpC,UAAiC;QACjC,MAAM,kBAAkB,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC9C,2CAA8B,CAAC,oCAAoC,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC;QAC1H,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;;AAxfH,8BAyfC;AA3LgB,+BAAqB,GAAG,IAAI,2CAAoB,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\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 { Transform } from \"../geometry3d/Transform\";\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\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\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 distance from the origin. */\r\n dist?: number;\r\n /** Defaults to `false`. */\r\n invisible?: boolean;\r\n /** Defaults to `false`. */\r\n interior?: boolean;\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 *\r\n * Hence\r\n * * The halfspace function evaluation for \"point\" [x,y,z,] is: ([x,y,z] DOT (u,v,w)l - 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 and inward normal, the signedDistance is (point DOT normal)\r\n * @public\r\n */\r\nexport class ClipPlane implements Clipper, PlaneAltitudeEvaluator, PolygonClipper {\r\n private _inwardNormal: Vector3d;\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 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 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(plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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(normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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 /** 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 a vector from the origin.)\r\n */\r\n public static createNormalAndPoint(normal: Vector3d, point: Point3d, invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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 ClipPlane\r\n * * \"normal\" (normalX, normalY, nz) is the inward normal of the plane.\r\n * * The given (normalX,normalY,normalZ)\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 a vector from the origin.)\r\n */\r\n public static createNormalAndPointXYZXYZ(normalX: number, normalY: number, normalZ: number,\r\n originX: number, originY: number, originZ: number,\r\n invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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 /**\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\r\n if (this.interior)\r\n props.interior = true;\r\n\r\n if (this.invisible)\r\n props.invisible = true;\r\n\r\n return props;\r\n }\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(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\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\r\n /**\r\n * Return the stored distanceFromOrigin property.\r\n */\r\n public get distance() { return this._distanceFromOrigin; }\r\n /**\r\n * Return the stored inward normal property.\r\n */\r\n public get inwardNormalRef(): Vector3d { return this._inwardNormal; }\r\n /**\r\n * Return the \"interior\" property bit\r\n */\r\n public get interior() { return this._interior; }\r\n /**\r\n * Return the \"invisible\" property bit.\r\n */\r\n public get invisible() { 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(point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane): 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 /**\r\n * Create a plane perpendicular to the edge between the xy parts of point0 and point1\r\n */\r\n public static createEdgeXY(point0: Point3d, point1: Point3d, 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 * 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(Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d), 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(this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin);\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 plane coefficients are scaled otherwise)\r\n * @param 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 /**\r\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w 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 + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z - point.w * this._distanceFromOrigin;\r\n }\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 + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z - this._distanceFromOrigin;\r\n }\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 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 + y * this._inwardNormal.y + z * this._inwardNormal.z - this._distanceFromOrigin;\r\n }\r\n\r\n /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin).\r\n */\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 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 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 /**\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 /**\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(alpha, beta, gamma, undefined, undefined, intersectionRadians);\r\n }\r\n\r\n private static _clipArcFractionArray = new GrowableFloat64Array();\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\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 is up to the use code algorithms. */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\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 /**\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 * @param xyz input points.\r\n * @param work work buffer\r\n * @param tolerance tolerance for \"on plane\" decision.\r\n */\r\n public clipConvexPolygonInPlace(xyz: GrowableXYZArray, work: GrowableXYZArray, inside: boolean = true, tolerance: number = Geometry.smallMetricDistance) {\r\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\r\n }\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 * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n * @return false if unable to invert\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\r\n /** announce the interval (if any) where a line is within the clip plane half space. */\r\n public announceClippedSegmentIntervals(f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void): 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 /** Implement appendPolygonClip, as defined in interface PolygonClipper. /**\r\n *\r\n * @param xyz input polygon. This is not changed.\r\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n */\r\n public appendPolygonClip(\r\n xyz: GrowableXYZArray,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache): void {\r\n const perpendicularRange = Range1d.createNull();\r\n const newInside = arrayCache.grabFromCache();\r\n const newOutside = arrayCache.grabFromCache();\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(this, xyz, newInside, newOutside, perpendicularRange);\r\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\r\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,0CAA0E;AAG1E,6E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C,CAAC;QAC9C,2CAA8B,CAAC,kCAAkC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACjF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YACrB,OAAO,SAAS,CAAC;QACnB,IAAI,eAAe;YACjB,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;;;;OAMG;IACI,iBAAiB,CACtB,GAAqB,EACrB,eAAmC,EACnC,gBAAoC,EACpC,UAAiC;QACjC,MAAM,kBAAkB,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC9C,2CAA8B,CAAC,oCAAoC,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC;QAC1H,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;;AArgBH,8BAsgBC;AA3LgB,+BAAqB,GAAG,IAAI,2CAAoB,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\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 { Transform } from \"../geometry3d/Transform\";\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\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\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 distance from the origin. */\r\n dist?: number;\r\n /** Defaults to `false`. */\r\n invisible?: boolean;\r\n /** Defaults to `false`. */\r\n interior?: boolean;\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 *\r\n * Hence\r\n * * The halfspace function evaluation for \"point\" [x,y,z,] is: ([x,y,z] DOT (u,v,w)l - 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 and inward normal, the signedDistance is (point DOT normal)\r\n * @public\r\n */\r\nexport class ClipPlane implements Clipper, PlaneAltitudeEvaluator, PolygonClipper {\r\n private _inwardNormal: Vector3d;\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 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 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(plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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(normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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 /** 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 a vector from the origin.)\r\n */\r\n public static createNormalAndPoint(normal: Vector3d, point: Point3d, invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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 ClipPlane\r\n * * \"normal\" (normalX, normalY, nz) is the inward normal of the plane.\r\n * * The given (normalX,normalY,normalZ)\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 a vector from the origin.)\r\n */\r\n public static createNormalAndPointXYZXYZ(normalX: number, normalY: number, normalZ: number,\r\n originX: number, originY: number, originZ: number,\r\n invisible: boolean = false, interior: boolean = false, result?: ClipPlane): 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 /**\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\r\n if (this.interior)\r\n props.interior = true;\r\n\r\n if (this.invisible)\r\n props.invisible = true;\r\n\r\n return props;\r\n }\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(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\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\r\n /**\r\n * Return the stored distanceFromOrigin property.\r\n */\r\n public get distance() { return this._distanceFromOrigin; }\r\n /**\r\n * Return the stored inward normal property.\r\n */\r\n public get inwardNormalRef(): Vector3d { return this._inwardNormal; }\r\n /**\r\n * Return the \"interior\" property bit\r\n */\r\n public get interior() { return this._interior; }\r\n /**\r\n * Return the \"invisible\" property bit.\r\n */\r\n public get invisible() { 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(point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane): 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 /**\r\n * Create a plane perpendicular to the edge between the xy parts of point0 and point1\r\n */\r\n public static createEdgeXY(point0: Point3d, point1: Point3d, 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 * 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(Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d), 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(this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin);\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 plane coefficients are scaled otherwise)\r\n * @param 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 /**\r\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w 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 + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z - point.w * this._distanceFromOrigin;\r\n }\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 + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z - this._distanceFromOrigin;\r\n }\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 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 + y * this._inwardNormal.y + z * this._inwardNormal.z - this._distanceFromOrigin;\r\n }\r\n\r\n /**\r\n * Return the x component of the normal used to evaluate altitude.\r\n */\r\n public normalX(): number {return this._inwardNormal.x; }\r\n /**\r\n * Return the x component of the normal used to evaluate altitude.\r\n */\r\n public normalY(): number {return this._inwardNormal.y; }\r\n /**\r\n * Return the z component of the normal used to evaluate altitude.\r\n */\r\n public normalZ(): number {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 */\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 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 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 /**\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 /**\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(alpha, beta, gamma, undefined, undefined, intersectionRadians);\r\n }\r\n\r\n private static _clipArcFractionArray = new GrowableFloat64Array();\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\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 is up to the use code algorithms. */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\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 /**\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 * @param xyz input points.\r\n * @param work work buffer\r\n * @param tolerance tolerance for \"on plane\" decision.\r\n */\r\n public clipConvexPolygonInPlace(xyz: GrowableXYZArray, work: GrowableXYZArray, inside: boolean = true, tolerance: number = Geometry.smallMetricDistance) {\r\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\r\n }\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 * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n * @return false if unable to invert\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\r\n /** announce the interval (if any) where a line is within the clip plane half space. */\r\n public announceClippedSegmentIntervals(f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void): 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 /** Implement appendPolygonClip, as defined in interface PolygonClipper. /**\r\n *\r\n * @param xyz input polygon. This is not changed.\r\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n */\r\n public appendPolygonClip(\r\n xyz: GrowableXYZArray,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache): void {\r\n const perpendicularRange = Range1d.createNull();\r\n const newInside = arrayCache.grabFromCache();\r\n const newOutside = arrayCache.grabFromCache();\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(this, xyz, newInside, newOutside, perpendicularRange);\r\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\r\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\r\n }\r\n}\r\n"]}
@@ -28,6 +28,18 @@ export declare enum ClipPlaneContainment {
28
28
  /** All points outside */
29
29
  StronglyOutside = 3
30
30
  }
31
+ /**
32
+ * Enumeration of ways to handle an intermediate fragment from a clipping step
33
+ * @public
34
+ */
35
+ export declare enum ClipStepAction {
36
+ /** Pass fragments directly to final accepted "in" state */
37
+ acceptIn = 1,
38
+ /** Pass fragments directly to final accepted "out" state */
39
+ acceptOut = -1,
40
+ /** forward fragments to subsequent steps. */
41
+ passToNextStep = 0
42
+ }
31
43
  /** Enumerated type for describing what must yet be done to clip a piece of geometry.
32
44
  * @public
33
45
  */
@@ -64,7 +76,21 @@ export interface Clipper {
64
76
  * @returns true if one or more arcs portions were announced, false if entirely outside.
65
77
  */
66
78
  announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean;
79
+ /** Optional polygon clip method.
80
+ * * This is expected to be implemented by planar clip structures.
81
+ * * This is unimplemented for curve clippers (e.g. sphere) for which polygon clip result has
82
+ * curved edges.
83
+ */
84
+ appendPolygonClip?: AppendPolygonClipFunction;
67
85
  }
86
+ /**
87
+ * Signature of method to execute polygon clip, distributing fragments of xyz among insideFragments and outsideFragments
88
+ * @param xyz input polygon. This is not changed.
89
+ * @param insideFragments Array to receive "inside" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.
90
+ * @param outsideFragments Array to receive "outside" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.
91
+ * @param arrayCache cache for reusable GrowableXYZArray.
92
+ */
93
+ declare type AppendPolygonClipFunction = (xyz: GrowableXYZArray, insideFragments: GrowableXYZArray[], outsideFragments: GrowableXYZArray[], arrayCache: GrowableXYZArrayCache) => void;
68
94
  /**
69
95
  * Interface for clipping polygons.
70
96
  * Supported by:
@@ -73,14 +99,7 @@ export interface Clipper {
73
99
  * @public
74
100
  */
75
101
  export interface PolygonClipper {
76
- /**
77
- *
78
- * @param xyz input polygon. This is not changed.
79
- * @param insideFragments Array to receive "inside" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.
80
- * @param outsideFragments Array to receive "outside" fragments. Each fragment is a GrowableXYZArray grabbed from the cache. This is NOT cleared.
81
- * @param arrayCache cache for reusable GrowableXYZArray.
82
- */
83
- appendPolygonClip(xyz: GrowableXYZArray, insideFragments: GrowableXYZArray[], outsideFragments: GrowableXYZArray[], arrayCache: GrowableXYZArrayCache): void;
102
+ appendPolygonClip: AppendPolygonClipFunction;
84
103
  }
85
104
  /** Static class whose various methods are functions for clipping geometry
86
105
  * @public
@@ -206,7 +225,7 @@ export declare class ClipUtilities {
206
225
  * @param singleton single array which may be a replacement for multiple fragments
207
226
  * @param cache cache for array management
208
227
  */
209
- static restoreSingletonInPlaceOfMultipleShards(fragments: GrowableXYZArray[], baseCount: number, singleton: GrowableXYZArray, arrayCache: GrowableXYZArrayCache): void;
228
+ static restoreSingletonInPlaceOfMultipleShards(fragments: GrowableXYZArray[] | undefined, baseCount: number, singleton: GrowableXYZArray, arrayCache: GrowableXYZArrayCache): void;
210
229
  /**
211
230
  * Create a UnionOfConvexClipPlaneSets for a volume defined by a path and offsets.
212
231
  * @param points points along the path.
@@ -287,5 +306,34 @@ export declare class ClipUtilities {
287
306
  * @param points polyline whose segments are passed to the clipper
288
307
  */
289
308
  static sumPolylineClipLength(clipper: Clipper, points: Point3d[]): number;
309
+ /**
310
+ * Pass polygon `xyz` through a sequence of PolygonClip steps.
311
+ * * At the outset, `xyz` is the (only) entry in a set of candidates.
312
+ * * For each clipper, each candidate is presented for appendPolygon to inside and outside parts.
313
+ * * Each (in,out) result is distributed among (acceptedIn, acceptedOut, candidates) according to
314
+ * (inAction, outAction)
315
+ * * At the end, all remaining candidates are distributed among (acceptedIn, acceptedOut, finalUnknown)
316
+ * according to finalAction
317
+ * * Any clipper that does not have an appendPolygonClip method is skipped.
318
+ * @param xyz
319
+ * @param clippers
320
+ * @param acceptedIn
321
+ * @param acceptedOut
322
+ * @param finalCandidates
323
+ * @param inAction
324
+ * @param outAction
325
+ * @param finalCandidateAction
326
+ */
327
+ static doPolygonClipSequence(xyz: GrowableXYZArray, clippers: Clipper[], acceptedIn: GrowableXYZArray[] | undefined, acceptedOut: GrowableXYZArray[] | undefined, finalCandidates: GrowableXYZArray[] | undefined, inAction: ClipStepAction, outAction: ClipStepAction, finalFragmentAction: ClipStepAction, arrayCache: GrowableXYZArrayCache | undefined): void;
328
+ /**
329
+ * Pass polygon `xyz` through a sequence of PolygonClip steps with "parity" rules
330
+ */
331
+ static doPolygonClipParitySequence(xyz: GrowableXYZArray, clippers: Clipper[], acceptedIn: GrowableXYZArray[] | undefined, acceptedOut: GrowableXYZArray[] | undefined, arrayCache: GrowableXYZArrayCache | undefined): void;
332
+ /** For each plane of clipper, construct a UnionOfConvexClipPlaneSets for an outer (infinite) convex volume that
333
+ * abuts the outer volume of the neighbor faces.
334
+ *
335
+ */
336
+ static createComplementaryClips(clipper: ConvexClipPlaneSet): UnionOfConvexClipPlaneSets;
290
337
  }
338
+ export {};
291
339
  //# sourceMappingURL=ClipUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClipUtils.d.ts","sourceRoot":"","sources":["../../../src/clipping/ClipUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,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AAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAChI,cAAc,GAAE,MAAgB;IAMlC;;;;;OAKG;WACW,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI;IAQ5H;;;;OAIG;WACW,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;IASvE;;;;;;;;;;;;;;;;;OAiBG;WACW,qBAAqB,CACjC,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE,OAAO,EAAE,EACnB,UAAU,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAC1C,WAAW,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAC3C,eAAe,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAC/C,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,cAAc,EACzB,mBAAmB,EAAE,cAAc,EACnC,UAAU,EAAE,qBAAqB,GAAG,SAAS;IAmC/C;;OAEG;WACW,2BAA2B,CACvC,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE,OAAO,EAAE,EACnB,UAAU,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAC1C,WAAW,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAC3C,UAAU,EAAE,qBAAqB,GAAG,SAAS;IA6C/C;;;OAGG;WACW,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,0BAA0B;CA6BhG"}
@@ -7,7 +7,7 @@
7
7
  * @module CartesianGeometry
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ClipUtilities = exports.ClipStatus = exports.ClipPlaneContainment = void 0;
10
+ exports.ClipUtilities = exports.ClipStatus = exports.ClipStepAction = exports.ClipPlaneContainment = void 0;
11
11
  const LineString3d_1 = require("../curve/LineString3d");
12
12
  const Loop_1 = require("../curve/Loop");
13
13
  const Geometry_1 = require("../Geometry");
@@ -19,8 +19,10 @@ const ClipPrimitive_1 = require("./ClipPrimitive");
19
19
  const ClipVector_1 = require("./ClipVector");
20
20
  const ConvexClipPlaneSet_1 = require("./ConvexClipPlaneSet");
21
21
  const UnionOfConvexClipPlaneSets_1 = require("./UnionOfConvexClipPlaneSets");
22
+ const ReusableObjectCache_1 = require("../geometry3d/ReusableObjectCache");
22
23
  const LineStringOffsetClipperContext_1 = require("./internalContexts/LineStringOffsetClipperContext");
23
24
  const Point3dArrayCarrier_1 = require("../geometry3d/Point3dArrayCarrier");
25
+ const CurveFactory_1 = require("../curve/CurveFactory");
24
26
  /** Enumerated type for describing where geometry lies with respect to clipping planes.
25
27
  * @public
26
28
  */
@@ -33,6 +35,19 @@ var ClipPlaneContainment;
33
35
  /** All points outside */
34
36
  ClipPlaneContainment[ClipPlaneContainment["StronglyOutside"] = 3] = "StronglyOutside";
35
37
  })(ClipPlaneContainment = exports.ClipPlaneContainment || (exports.ClipPlaneContainment = {}));
38
+ /**
39
+ * Enumeration of ways to handle an intermediate fragment from a clipping step
40
+ * @public
41
+ */
42
+ var ClipStepAction;
43
+ (function (ClipStepAction) {
44
+ /** Pass fragments directly to final accepted "in" state */
45
+ ClipStepAction[ClipStepAction["acceptIn"] = 1] = "acceptIn";
46
+ /** Pass fragments directly to final accepted "out" state */
47
+ ClipStepAction[ClipStepAction["acceptOut"] = -1] = "acceptOut";
48
+ /** forward fragments to subsequent steps. */
49
+ ClipStepAction[ClipStepAction["passToNextStep"] = 0] = "passToNextStep";
50
+ })(ClipStepAction = exports.ClipStepAction || (exports.ClipStepAction = {}));
36
51
  /** Enumerated type for describing what must yet be done to clip a piece of geometry.
37
52
  * @public
38
53
  */
@@ -425,7 +440,7 @@ class ClipUtilities {
425
440
  * @param cache cache for array management
426
441
  */
427
442
  static restoreSingletonInPlaceOfMultipleShards(fragments, baseCount, singleton, arrayCache) {
428
- if (fragments.length > baseCount + 1) {
443
+ if (fragments && fragments.length > baseCount + 1) {
429
444
  while (fragments.length > baseCount) {
430
445
  const f = fragments.pop();
431
446
  arrayCache.dropToCache(f);
@@ -617,7 +632,181 @@ class ClipUtilities {
617
632
  }
618
633
  return s;
619
634
  }
635
+ /**
636
+ * Pass polygon `xyz` through a sequence of PolygonClip steps.
637
+ * * At the outset, `xyz` is the (only) entry in a set of candidates.
638
+ * * For each clipper, each candidate is presented for appendPolygon to inside and outside parts.
639
+ * * Each (in,out) result is distributed among (acceptedIn, acceptedOut, candidates) according to
640
+ * (inAction, outAction)
641
+ * * At the end, all remaining candidates are distributed among (acceptedIn, acceptedOut, finalUnknown)
642
+ * according to finalAction
643
+ * * Any clipper that does not have an appendPolygonClip method is skipped.
644
+ * @param xyz
645
+ * @param clippers
646
+ * @param acceptedIn
647
+ * @param acceptedOut
648
+ * @param finalCandidates
649
+ * @param inAction
650
+ * @param outAction
651
+ * @param finalCandidateAction
652
+ */
653
+ static doPolygonClipSequence(xyz, clippers, acceptedIn, acceptedOut, finalCandidates, inAction, outAction, finalFragmentAction, arrayCache) {
654
+ if (arrayCache === undefined)
655
+ arrayCache = new ReusableObjectCache_1.GrowableXYZArrayCache();
656
+ let candidates = [arrayCache.grabAndFill(xyz)];
657
+ let nextCandidates = [];
658
+ const intermediateIn = [];
659
+ const intermediateOut = [];
660
+ const oldInsideCount = acceptedIn ? acceptedIn.length : 0;
661
+ const oldOutsideCount = acceptedOut ? acceptedOut.length : 0;
662
+ let shard;
663
+ // At each convex set, carryForwardA is all the fragments that have been outside all previous convex sets.
664
+ // Clip each such fragment to the current set, sending the outside parts to carryForwardB, which will got to the next clipper
665
+ // The final surviving carryForward really is out.
666
+ for (const c of clippers) {
667
+ if (c.appendPolygonClip) {
668
+ while (undefined !== (shard = candidates.pop())) {
669
+ c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);
670
+ distributeFragments(inAction, intermediateIn, acceptedIn, acceptedOut, nextCandidates, arrayCache);
671
+ distributeFragments(outAction, intermediateOut, acceptedIn, acceptedOut, nextCandidates, arrayCache);
672
+ arrayCache.dropToCache(shard);
673
+ }
674
+ // candidates is empty !!
675
+ const temp = candidates;
676
+ candidates = nextCandidates;
677
+ nextCandidates = temp;
678
+ }
679
+ }
680
+ distributeFragments(finalFragmentAction, candidates, acceptedIn, acceptedOut, finalCandidates, arrayCache);
681
+ // Note: The following assumes that there were no residual candidates ... need to track if that happened?
682
+ // If nothing was out, the inside fragments can be replaced by the original.
683
+ if ((acceptedOut === null || acceptedOut === void 0 ? void 0 : acceptedOut.length) === oldOutsideCount)
684
+ ClipUtilities.restoreSingletonInPlaceOfMultipleShards(acceptedIn, oldInsideCount, xyz, arrayCache);
685
+ // If nothing was in, the outside fragments can be replaced by the original.
686
+ if ((acceptedIn === null || acceptedIn === void 0 ? void 0 : acceptedIn.length) === oldInsideCount)
687
+ ClipUtilities.restoreSingletonInPlaceOfMultipleShards(acceptedOut, oldOutsideCount, xyz, arrayCache);
688
+ }
689
+ /**
690
+ * Pass polygon `xyz` through a sequence of PolygonClip steps with "parity" rules
691
+ */
692
+ static doPolygonClipParitySequence(xyz, clippers, acceptedIn, acceptedOut, arrayCache) {
693
+ if (arrayCache === undefined)
694
+ arrayCache = new ReusableObjectCache_1.GrowableXYZArrayCache();
695
+ let candidatesOut = [arrayCache.grabAndFill(xyz)];
696
+ let candidatesIn = [];
697
+ let nextCandidatesIn = [];
698
+ let nextCandidatesOut = [];
699
+ const intermediateIn = [];
700
+ const intermediateOut = [];
701
+ let shard;
702
+ // at each step ..
703
+ // candidatesIn and candidatesOut are evolved in and out
704
+ // nextCandidatesIn and nextCandidatesOut are EMPTY
705
+ for (const c of clippers) {
706
+ if (c.appendPolygonClip) {
707
+ // (IN,OUT) parts of IN parts distribute to (OUT,IN)
708
+ while (undefined !== (shard = candidatesIn.pop())) {
709
+ c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);
710
+ distributeFragments(ClipStepAction.acceptOut, intermediateIn, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);
711
+ distributeFragments(ClipStepAction.acceptIn, intermediateOut, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);
712
+ arrayCache.dropToCache(shard);
713
+ }
714
+ // (IN,OUT) parts of IN parts distribute to (OUT,IN)
715
+ while (undefined !== (shard = candidatesOut.pop())) {
716
+ c.appendPolygonClip(shard, intermediateIn, intermediateOut, arrayCache);
717
+ distributeFragments(ClipStepAction.acceptIn, intermediateIn, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);
718
+ distributeFragments(ClipStepAction.acceptOut, intermediateOut, nextCandidatesIn, nextCandidatesOut, undefined, arrayCache);
719
+ arrayCache.dropToCache(shard);
720
+ }
721
+ // reload each candidate step
722
+ const tempA = candidatesIn;
723
+ candidatesIn = nextCandidatesIn;
724
+ nextCandidatesIn = tempA;
725
+ const tempB = candidatesOut;
726
+ candidatesOut = nextCandidatesOut;
727
+ nextCandidatesOut = tempB;
728
+ }
729
+ }
730
+ // candidatesIn and candidatesOut are final ....
731
+ if (candidatesOut.length === 0)
732
+ acceptedIn === null || acceptedIn === void 0 ? void 0 : acceptedIn.push(arrayCache.grabAndFill(xyz));
733
+ else if (candidatesOut.length === 0)
734
+ acceptedOut === null || acceptedOut === void 0 ? void 0 : acceptedOut.push(arrayCache.grabAndFill(xyz));
735
+ else {
736
+ moveFragments(candidatesIn, acceptedIn, arrayCache);
737
+ moveFragments(candidatesOut, acceptedOut, arrayCache);
738
+ }
739
+ }
740
+ /** For each plane of clipper, construct a UnionOfConvexClipPlaneSets for an outer (infinite) convex volume that
741
+ * abuts the outer volume of the neighbor faces.
742
+ *
743
+ */
744
+ static createComplementaryClips(clipper) {
745
+ const planes = clipper.planes;
746
+ const interval = Range_1.Range1d.createNull();
747
+ const n = planes.length;
748
+ const newClippers = [];
749
+ for (const p of planes) {
750
+ const outerSet = ConvexClipPlaneSet_1.ConvexClipPlaneSet.createEmpty();
751
+ outerSet.addPlaneToConvexSet(p.cloneNegated());
752
+ newClippers.push(outerSet);
753
+ }
754
+ for (let i = 0; i < n; i++) {
755
+ for (let j = i + 1; j < n; j++) {
756
+ const ray = CurveFactory_1.CurveFactory.planePlaneIntersectionRay(planes[i], planes[j]);
757
+ if (ray) {
758
+ if (clipper.hasIntersectionWithRay(ray, interval)) {
759
+ // the normal-to-normal vector is bisector (or close to bisector?)
760
+ const newNormal = planes[j].inwardNormalRef.minus(planes[i].inwardNormalRef);
761
+ const plane1 = ClipPlane_1.ClipPlane.createNormalAndPoint(newNormal, ray.origin);
762
+ if (plane1) {
763
+ const plane2 = plane1.cloneNegated();
764
+ newClippers[i].addPlaneToConvexSet(plane1);
765
+ newClippers[j].addPlaneToConvexSet(plane2);
766
+ }
767
+ }
768
+ }
769
+ }
770
+ }
771
+ return UnionOfConvexClipPlaneSets_1.UnionOfConvexClipPlaneSets.createConvexSets(newClippers);
772
+ }
620
773
  }
621
774
  exports.ClipUtilities = ClipUtilities;
622
775
  ClipUtilities._selectIntervals01TestPoint = Point3dVector3d_1.Point3d.create();
776
+ function moveFragments(fragments, destination, arrayCache) {
777
+ if (destination === undefined)
778
+ arrayCache.dropAllToCache(fragments);
779
+ else {
780
+ for (const f of fragments)
781
+ destination.push(f);
782
+ }
783
+ fragments.length = 0;
784
+ }
785
+ /**
786
+ * Distribute fragments among acceptedIn, acceptedOut, and passToNextStep as directed by action.
787
+ * * If the indicated destination is unknown, drop the fragments to the arrayCache.
788
+ * @param action destination selector
789
+ * @param fragments fragments to be distributed
790
+ * @param acceptedIn destination for "in"
791
+ * @param acceptedOut destination for "out"
792
+ * @param passToNextStep destination for fragments to be passed to a later step
793
+ * @param arrayCache destination for un-distributed fragments.
794
+ */
795
+ function distributeFragments(action, fragments, acceptedIn, acceptedOut, passToNextStep, arrayCache) {
796
+ let destination;
797
+ if (action === ClipStepAction.acceptIn)
798
+ destination = acceptedIn;
799
+ else if (action === ClipStepAction.acceptOut)
800
+ destination = acceptedOut;
801
+ else if (action === ClipStepAction.passToNextStep)
802
+ destination = passToNextStep;
803
+ // remark: if action is other than the enum values, destination is undefined
804
+ if (destination === undefined)
805
+ arrayCache.dropAllToCache(fragments);
806
+ else {
807
+ for (const f of fragments)
808
+ destination.push(f);
809
+ }
810
+ fragments.length = 0;
811
+ }
623
812
  //# sourceMappingURL=ClipUtils.js.map