@itwin/core-geometry 5.1.0-dev.17 → 5.1.0-dev.18

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 (277) hide show
  1. package/lib/cjs/clipping/ClipPlane.d.ts +7 -5
  2. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  3. package/lib/cjs/clipping/ClipPlane.js +9 -5
  4. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  5. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  6. package/lib/cjs/clipping/ConvexClipPlaneSet.js +12 -23
  7. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  8. package/lib/cjs/core-geometry.d.ts +1 -0
  9. package/lib/cjs/core-geometry.d.ts.map +1 -1
  10. package/lib/cjs/core-geometry.js +1 -0
  11. package/lib/cjs/core-geometry.js.map +1 -1
  12. package/lib/cjs/curve/Arc3d.d.ts +53 -31
  13. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  14. package/lib/cjs/curve/Arc3d.js +55 -36
  15. package/lib/cjs/curve/Arc3d.js.map +1 -1
  16. package/lib/cjs/curve/CurveCollection.d.ts +2 -0
  17. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  18. package/lib/cjs/curve/CurveCollection.js +14 -0
  19. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  20. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  21. package/lib/cjs/curve/LineSegment3d.js +1 -0
  22. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  23. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  24. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
  25. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  26. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  27. package/lib/cjs/curve/Query/PlanarSubdivision.js +7 -2
  28. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  29. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  30. package/lib/cjs/curve/RegionMomentsXY.js +1 -1
  31. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  32. package/lib/cjs/curve/RegionOps.d.ts +32 -28
  33. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  34. package/lib/cjs/curve/RegionOps.js +32 -28
  35. package/lib/cjs/curve/RegionOps.js.map +1 -1
  36. package/lib/cjs/geometry3d/AngleSweep.d.ts +14 -11
  37. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  38. package/lib/cjs/geometry3d/AngleSweep.js +14 -11
  39. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  40. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +7 -2
  41. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  42. package/lib/cjs/geometry3d/GrowableXYZArray.js +20 -2
  43. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  44. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +2 -1
  45. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  46. package/lib/cjs/geometry3d/IndexedXYZCollection.js +7 -3
  47. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  48. package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
  49. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  50. package/lib/cjs/geometry3d/Plane3d.js +6 -1
  51. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  52. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  53. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  54. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  55. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  56. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  57. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  58. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  59. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  60. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -3
  61. package/lib/cjs/geometry3d/Point3dVector3d.js +3 -3
  62. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  63. package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
  64. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  65. package/lib/cjs/geometry3d/PointHelpers.js +66 -26
  66. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  67. package/lib/cjs/geometry3d/PolygonOps.d.ts +49 -2
  68. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  69. package/lib/cjs/geometry3d/PolygonOps.js +38 -2
  70. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  71. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  72. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  73. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  74. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  75. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
  76. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  77. package/lib/cjs/geometry3d/PolylineOps.js +5 -4
  78. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  79. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  80. package/lib/cjs/geometry3d/Ray3d.js +11 -23
  81. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  82. package/lib/cjs/geometry3d/Transform.d.ts +21 -2
  83. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  84. package/lib/cjs/geometry3d/Transform.js +32 -13
  85. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  86. package/lib/cjs/geometry4d/Point4d.d.ts +4 -2
  87. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  88. package/lib/cjs/geometry4d/Point4d.js +17 -13
  89. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  90. package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
  91. package/lib/cjs/polyface/FacetOrientation.js +1 -1
  92. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  93. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
  94. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  95. package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
  96. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  97. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  98. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  99. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
  100. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  101. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  102. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  103. package/lib/cjs/polyface/IndexedPolyfaceWalker.js +47 -32
  104. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  105. package/lib/cjs/polyface/Polyface.d.ts +17 -3
  106. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  107. package/lib/cjs/polyface/Polyface.js +16 -0
  108. package/lib/cjs/polyface/Polyface.js.map +1 -1
  109. package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
  110. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  111. package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
  112. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  113. package/lib/cjs/polyface/PolyfaceClip.js +39 -42
  114. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  115. package/lib/cjs/polyface/PolyfaceQuery.d.ts +116 -75
  116. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  117. package/lib/cjs/polyface/PolyfaceQuery.js +312 -228
  118. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  119. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  120. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  121. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
  122. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  123. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  124. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  125. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  126. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  127. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  128. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  129. package/lib/cjs/solid/LinearSweep.d.ts +2 -3
  130. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  131. package/lib/cjs/solid/LinearSweep.js +2 -3
  132. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  133. package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
  134. package/lib/cjs/solid/RotationalSweep.js +2 -2
  135. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  136. package/lib/cjs/topology/ChainMerge.d.ts +1 -1
  137. package/lib/cjs/topology/ChainMerge.js +1 -1
  138. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  139. package/lib/esm/clipping/ClipPlane.d.ts +7 -5
  140. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  141. package/lib/esm/clipping/ClipPlane.js +9 -5
  142. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  143. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  144. package/lib/esm/clipping/ConvexClipPlaneSet.js +12 -23
  145. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  146. package/lib/esm/core-geometry.d.ts +1 -0
  147. package/lib/esm/core-geometry.d.ts.map +1 -1
  148. package/lib/esm/core-geometry.js +1 -0
  149. package/lib/esm/core-geometry.js.map +1 -1
  150. package/lib/esm/curve/Arc3d.d.ts +53 -31
  151. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  152. package/lib/esm/curve/Arc3d.js +55 -36
  153. package/lib/esm/curve/Arc3d.js.map +1 -1
  154. package/lib/esm/curve/CurveCollection.d.ts +2 -0
  155. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  156. package/lib/esm/curve/CurveCollection.js +14 -0
  157. package/lib/esm/curve/CurveCollection.js.map +1 -1
  158. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  159. package/lib/esm/curve/LineSegment3d.js +1 -0
  160. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  161. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  162. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
  163. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  164. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  165. package/lib/esm/curve/Query/PlanarSubdivision.js +7 -2
  166. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  167. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  168. package/lib/esm/curve/RegionMomentsXY.js +1 -1
  169. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  170. package/lib/esm/curve/RegionOps.d.ts +32 -28
  171. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  172. package/lib/esm/curve/RegionOps.js +32 -28
  173. package/lib/esm/curve/RegionOps.js.map +1 -1
  174. package/lib/esm/geometry3d/AngleSweep.d.ts +14 -11
  175. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  176. package/lib/esm/geometry3d/AngleSweep.js +14 -11
  177. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  178. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +7 -2
  179. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  180. package/lib/esm/geometry3d/GrowableXYZArray.js +20 -2
  181. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  182. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +2 -1
  183. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  184. package/lib/esm/geometry3d/IndexedXYZCollection.js +7 -3
  185. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  186. package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
  187. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  188. package/lib/esm/geometry3d/Plane3d.js +6 -1
  189. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  190. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  191. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  192. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  193. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  194. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  195. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  196. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  197. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  198. package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -3
  199. package/lib/esm/geometry3d/Point3dVector3d.js +3 -3
  200. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  201. package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
  202. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  203. package/lib/esm/geometry3d/PointHelpers.js +66 -26
  204. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  205. package/lib/esm/geometry3d/PolygonOps.d.ts +49 -2
  206. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  207. package/lib/esm/geometry3d/PolygonOps.js +38 -2
  208. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  209. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  210. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  211. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  212. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  213. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
  214. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  215. package/lib/esm/geometry3d/PolylineOps.js +5 -4
  216. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  217. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  218. package/lib/esm/geometry3d/Ray3d.js +11 -23
  219. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  220. package/lib/esm/geometry3d/Transform.d.ts +21 -2
  221. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  222. package/lib/esm/geometry3d/Transform.js +32 -13
  223. package/lib/esm/geometry3d/Transform.js.map +1 -1
  224. package/lib/esm/geometry4d/Point4d.d.ts +4 -2
  225. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  226. package/lib/esm/geometry4d/Point4d.js +17 -13
  227. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  228. package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
  229. package/lib/esm/polyface/FacetOrientation.js +1 -1
  230. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  231. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
  232. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  233. package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
  234. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  235. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  236. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  237. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
  238. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  239. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  240. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  241. package/lib/esm/polyface/IndexedPolyfaceWalker.js +47 -32
  242. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  243. package/lib/esm/polyface/Polyface.d.ts +17 -3
  244. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  245. package/lib/esm/polyface/Polyface.js +16 -0
  246. package/lib/esm/polyface/Polyface.js.map +1 -1
  247. package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
  248. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  249. package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
  250. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  251. package/lib/esm/polyface/PolyfaceClip.js +39 -42
  252. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  253. package/lib/esm/polyface/PolyfaceQuery.d.ts +116 -75
  254. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  255. package/lib/esm/polyface/PolyfaceQuery.js +313 -229
  256. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  257. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  258. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  259. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
  260. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  261. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  262. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  263. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  264. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  265. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  266. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  267. package/lib/esm/solid/LinearSweep.d.ts +2 -3
  268. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  269. package/lib/esm/solid/LinearSweep.js +2 -3
  270. package/lib/esm/solid/LinearSweep.js.map +1 -1
  271. package/lib/esm/solid/RotationalSweep.d.ts +2 -2
  272. package/lib/esm/solid/RotationalSweep.js +2 -2
  273. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  274. package/lib/esm/topology/ChainMerge.d.ts +1 -1
  275. package/lib/esm/topology/ChainMerge.js +1 -1
  276. package/lib/esm/topology/ChainMerge.js.map +1 -1
  277. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ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AAyB,EACzB,eAAmC,EACnC,gBAAoC,EACpC,UAAiC;QAEjC,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC9C,8BAA8B,CAAC,oCAAoC,CACjE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,CACrD,CAAC;QACF,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QACvE,aAAa,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IACD,6CAA6C;IACtC,mBAAmB,CAAC,UAAmB,EAAE,MAAgB;QAC9D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACrC,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\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`. */\n invisible?: boolean;\n /** Defaults to `false`. */\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 bit */\n public get interior() {\n return this._interior;\n }\n /** Return the \"invisible\" property bit. */\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 is up to the use code algorithms. */\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 const d = -this.altitude(spacePoint);\n return spacePoint.plusXYZ(d * this._inwardNormal.x, d * this._inwardNormal.y, d * 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,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,aAAa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E,SAAS,EAAE,UAAU,EAAE,kBAAkB,CACrD,CAAC;QACF,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QACvE,aAAa,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,OAAO,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","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 +1 @@
1
- {"version":3,"file":"ConvexClipPlaneSet.d.ts","sourceRoot":"","sources":["../../../src/clipping/ConvexClipPlaneSet.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE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E;;;;;;;;OAQG;IACI,iBAAiB,CACtB,GAAG,EAAE,oBAAoB,EACzB,eAAe,EAAE,gBAAgB,EAAE,EACnC,gBAAgB,EAAE,gBAAgB,EAAE,EACpC,UAAU,EAAE,qBAAqB,GAChC,IAAI;IAKP;;;;;;;;;;MAUE;WACY,oBAAoB,CAChC,UAAU,EAAE,QAAQ,GAAG,eAAe,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAClE;QAAE,OAAO,EAAE,kBAAkB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CA4BnD"}
@@ -735,29 +735,18 @@ export class ConvexClipPlaneSet {
735
735
  static createConvexPolyface(convexMesh, result) {
736
736
  result = this.createEmpty(result);
737
737
  let vol = 0;
738
- let myMesh;
739
- let myVisitor;
740
- if (convexMesh instanceof Polyface) {
741
- myMesh = convexMesh;
742
- myVisitor = convexMesh.createVisitor(0);
743
- }
744
- else {
745
- myMesh = convexMesh.clientPolyface();
746
- myVisitor = convexMesh;
747
- }
748
- if (myMesh && myVisitor) {
749
- if (PolyfaceQuery.isPolyfaceClosedByEdgePairing(myMesh))
750
- vol = PolyfaceQuery.sumTetrahedralVolumes(myVisitor);
751
- const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward
752
- const normal = Vector3d.create();
753
- const plane = Plane3dByOriginAndUnitNormal.createXYPlane();
754
- myVisitor.reset();
755
- while (myVisitor.moveToNextFacet()) {
756
- if (undefined !== PolygonOps.areaNormalGo(myVisitor.point, normal)) {
757
- normal.scaleInPlace(scale);
758
- if (undefined !== Plane3dByOriginAndUnitNormal.create(myVisitor.point.front(), normal, plane))
759
- result.addPlaneToConvexSet(plane);
760
- }
738
+ if (PolyfaceQuery.isPolyfaceClosedByEdgePairing(convexMesh))
739
+ vol = PolyfaceQuery.sumTetrahedralVolumes(convexMesh);
740
+ const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward
741
+ const normal = Vector3d.create();
742
+ const plane = Plane3dByOriginAndUnitNormal.createXYPlane();
743
+ const visitor = convexMesh instanceof Polyface ? convexMesh.createVisitor(0) : convexMesh;
744
+ visitor.setNumWrap(0);
745
+ for (visitor.reset(); visitor.moveToNextFacet();) {
746
+ if (undefined !== PolygonOps.areaNormalGo(visitor.point, normal)) {
747
+ normal.scaleInPlace(scale);
748
+ if (undefined !== Plane3dByOriginAndUnitNormal.create(visitor.point.front(), normal, plane))
749
+ result.addPlaneToConvexSet(plane);
761
750
  }
762
751
  }
763
752
  return { clipper: result, volume: vol };
@@ -1 +1 @@
1
- {"version":3,"file":"ConvexClipPlaneSet.js","sourceRoot":"","sources":["../../../src/clipping/ConvexClipPlaneSet.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,OAAO,EAAW,MAAM,qBAAqB,CAAC;AAKvD,OAAO,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAW,oBAAoB,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAO3F;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B,iEAAiE;IAC1D,MAAM,CAAU,OAAO,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACj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qBAAqB,CAAC,SAAS,CAAC,CAAC;YACvD,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,6DAA6D;YACnG,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,4BAA4B,CAAC,aAAa,EAAE,CAAC;YAC3D,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC,eAAe,EAAE,EAAE,CAAC;gBACnC,IAAI,SAAS,KAAK,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;oBACnE,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;oBAC3B,IAAI,SAAS,KAAK,4BAA4B,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAG,EAAE,MAAM,EAAE,KAAK,CAAC;wBAC5F,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC1C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { 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 { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { Polyface, PolyfaceVisitor } from \"../polyface/Polyface\";\nimport { PolyfaceQuery } from \"../polyface/PolyfaceQuery\";\nimport { ClipPlane, ClipPlaneProps } from \"./ClipPlane\";\nimport { Clipper, ClipPlaneContainment, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/** Wire format describing a [[ConvexClipPlaneSet]].\n * @public\n */\nexport type ConvexClipPlaneSetProps = ClipPlaneProps[];\n\n/**\n * A ConvexClipPlaneSet is a collection of ClipPlanes, often used for bounding regions of space.\n * @public\n */\nexport class ConvexClipPlaneSet implements Clipper, PolygonClipper {\n /** Value acting as \"at infinity\" for coordinates along a ray. */\n public static readonly hugeVal = 1e37;\n /** Planes that define the convex set. */\n private _planes: ClipPlane[];\n // private _parity: number; <--- Not yet used\n // public get parity() { return this._parity; }\n // public set parity(value: number) { this._parity = value; }\n private constructor(planes?: ClipPlane[]) {\n // this._parity = 1;\n this._planes = planes ? planes : [];\n }\n /**\n * Return an array containing all the planes of the convex set.\n * * Note that this has no leading keyword identifying it as a ConvexClipPlaneSet.\n */\n public toJSON(): ConvexClipPlaneSetProps {\n const val: ClipPlaneProps[] = [];\n for (const plane of this._planes)\n val.push(plane.toJSON());\n return val;\n }\n /**\n * Extract clip planes from a json array `[ clipPlane, clipPlane ]`.\n * * Non-clipPlane members are ignored.\n */\n public static fromJSON(json: ConvexClipPlaneSetProps | undefined, result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n if (!Array.isArray(json))\n return result;\n for (const thisJson of json) {\n const plane = ClipPlane.fromJSON(thisJson);\n if (plane)\n result._planes.push(plane);\n }\n return result;\n }\n /**\n * Return true if all members are almostEqual to corresponding members of other. This includes identical order in array.\n * @param other clip plane to compare\n */\n public isAlmostEqual(other: ConvexClipPlaneSet): boolean {\n if (this._planes.length !== other._planes.length)\n return false;\n for (let i = 0; i < this._planes.length; i++)\n if (!this._planes[i].isAlmostEqual(other._planes[i]))\n return false;\n return true;\n }\n /**\n * Create ConvexClipPlaneSet from an array of planes.\n * * Each plane reference in the `planes` array is taken into the result.\n * * The input array itself is NOT taken into the result.\n */\n public static createPlanes(\n planes: (ClipPlane | Plane3dByOriginAndUnitNormal)[], result?: ConvexClipPlaneSet,\n ): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n for (const plane of planes) {\n if (plane instanceof ClipPlane) {\n result._planes.push(plane);\n } else if (plane instanceof Plane3dByOriginAndUnitNormal) {\n const clipPlane = ClipPlane.createPlane(plane);\n result._planes.push(clipPlane);\n }\n }\n return result;\n }\n /**\n * Create new convex set using selected planes of a Range3d.\n * @param range range with coordinates\n * @param lowX true to clip at the low x plane\n * @param highX true to clip at the high x plane\n * @param lowY true to clip at the low y plane\n * @param highY true to clip at the high z plane\n * @param lowZ true to clip at the low z plane\n * @param highZ true to clip at the high z plane\n */\n public static createRange3dPlanes(\n range: Range3d,\n lowX: boolean = true,\n highX: boolean = true,\n lowY: boolean = true,\n highY: boolean = true,\n lowZ: boolean = true,\n highZ: boolean = true,\n ): ConvexClipPlaneSet {\n const result = ConvexClipPlaneSet.createEmpty();\n\n if (lowX)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(1, 0, 0, range.low.x, 0, 0)!);\n if (highX)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(-1, 0, 0, range.high.x, 0, 0)!);\n\n if (lowY)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 1, 0, 0, range.low.y, 0)!);\n if (highY)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, -1, 0, 0, range.high.y, 0)!);\n\n if (lowZ)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, range.low.z)!);\n if (highZ)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 0, -1, 0, 0, range.high.z)!);\n\n return result;\n }\n /** Create an empty `ConvexClipPlaneSet` */\n public static createEmpty(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n if (result) {\n result._planes.length = 0;\n return result;\n }\n return new ConvexClipPlaneSet();\n }\n /** Negate all planes of the set. */\n public negateAllPlanes(): void {\n for (const plane of this._planes)\n plane.negateInPlace();\n }\n /**\n * Create a convex clip plane set that clips to `x0 <= x <= x1` and `y0 <= y <= y1`.\n * * Note that there is no test for the usual ordering `x0 <= x1` or `y0 <= y1`.\n * * if the usual ordering is violated, the convex set is an empty set.\n * * More details can be found at docs/learning/geometry/Clipping.md\n */\n public static createXYBox(\n x0: number, y0: number, x1: number, y1: number, result?: ConvexClipPlaneSet,\n ): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n const clip0 = ClipPlane.createNormalAndDistance(Vector3d.create(-1, 0, 0), -x1, false, true);\n const clip1 = ClipPlane.createNormalAndDistance(Vector3d.create(1, 0, 0), x0, false, true);\n const clip2 = ClipPlane.createNormalAndDistance(Vector3d.create(0, -1, 0), -y1, false, true);\n const clip3 = ClipPlane.createNormalAndDistance(Vector3d.create(0, 1, 0), y0, false, true);\n if (clip0 && clip1 && clip2 && clip3) {\n result._planes.push(clip0, clip1, clip2, clip3);\n }\n return result;\n }\n /**\n * Create a convex set containing a half space for each edge between points of a polyline.\n * * Caller is responsible for assuring the polyline is convex.\n * @param points array of points. Only xy parts are considered.\n * @param interior array whose boolean value is used as both the `interior` and `invisible` bits of the plane for the\n * succeeding segment. If this array is not provided, both are false.\n * @param leftIsInside if true, the interior is \"to the left\" of the segments. If false, interior is \"to the right\".\n */\n public static createXYPolyLine(\n points: Point3d[], interior: boolean[] | undefined, leftIsInside: boolean, result?: ConvexClipPlaneSet,\n ): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\n perp.z = 0.0;\n\n if (!leftIsInside)\n perp.scaleInPlace(-1.0);\n\n const perpNormalized = perp.normalize();\n if (perpNormalized) {\n const flag = interior !== undefined ? interior[i0] : false;\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], flag, flag);\n if (clip) {\n result._planes.push(clip);\n }\n }\n }\n return result;\n }\n /**\n * Create a convexClipPlaneSet with planes whose \"inside\" normal is to the left of each segment.\n * @param points array of points.\n */\n public static createXYPolyLineInsideLeft(points: Point3d[], result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\n perp.z = 0.0;\n\n const perpNormalized = perp.normalize();\n if (perpNormalized) {\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], false, false);\n if (clip) { result._planes.push(clip); }\n }\n }\n return result;\n }\n /**\n * Set (or reset) a plane and ConvexClipPlaneSet for a convex array, such as a convex facet used for xy clip.\n * * The planeOfPolygon is (re)initialized with the normal from 3 points, but not otherwise referenced.\n * * The ConvexClipPlaneSet is filled with outward normals of the facet edges as viewed to xy plane.\n * @param points\n * @param result\n */\n public static setPlaneAndXYLoopCCW(points: GrowableXYZArray, planeOfPolygon: ClipPlane, frustum: ConvexClipPlaneSet) {\n const i0 = points.length - 1;\n const n = points.length;\n let x0 = points.getXAtUncheckedPointIndex(i0);\n let y0 = points.getYAtUncheckedPointIndex(i0);\n let x1, y1, nx, ny;\n frustum._planes.length = 0;\n const z0 = points.getZAtUncheckedPointIndex(i0); // z for planes can stay fixed\n const planeNormal = points.crossProductIndexIndexIndex(0, 2, 1)!;\n ClipPlane.createNormalAndPointXYZXYZ(planeNormal.x, planeNormal.y, planeNormal.z, x0, y0, z0, false, false, planeOfPolygon);\n if (planeNormal.normalizeInPlace()) {\n for (let i1 = 0; i1 < n; i1++, x0 = x1, y0 = y1) {\n x1 = points.getXAtUncheckedPointIndex(i1);\n y1 = points.getYAtUncheckedPointIndex(i1);\n nx = -(y1 - y0);\n ny = x1 - x0;\n const clipper = ClipPlane.createNormalAndPointXYZXYZ(nx, ny, 0, x1, y1, z0);\n if (clipper)\n frustum._planes.push(clipper);\n }\n }\n }\n /** Deep clone of all planes. */\n public clone(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n for (const plane of this._planes)\n result._planes.push(plane.clone());\n return result;\n }\n /** Return the (reference to the) array of `ClipPlane` */\n public get planes(): ClipPlane[] {\n return this._planes;\n }\n /**\n * Test if there is any intersection with a ray defined by origin and direction.\n * * Optionally record the range (null or otherwise) in caller-allocated result.\n * * If the ray is unbounded inside the clip, result can contain positive or negative\n * \"Geometry.largeCoordinateResult\" values.\n * * If no result is provide, there are no object allocations.\n * @param result optional Range1d to receive parameters along the ray.\n */\n public hasIntersectionWithRay(ray: Ray3d, result?: Range1d, tolerance: number = Geometry.smallMetricDistance): boolean {\n // form low and high values in locals that do not require allocation.\n // transfer to caller-supplied result at end\n let t0 = -Geometry.largeCoordinateResult;\n let t1 = Geometry.largeCoordinateResult;\n if (result)\n result.setNull();\n const velocityTolerance = 1.0e-13;\n for (const plane of this._planes) {\n const vD = plane.velocity(ray.direction);\n const vN = plane.altitude(ray.origin);\n\n if (Math.abs(vD) <= velocityTolerance) {\n // Ray is parallel... No need to continue testing if outside halfspace.\n if (vN < -tolerance)\n return false; // and result is a null range.\n } else {\n const rayFraction = - vN / vD;\n if (vD < 0.0) {\n if (rayFraction < t1)\n t1 = rayFraction;\n } else {\n if (rayFraction > t0)\n t0 = rayFraction;\n }\n }\n }\n if (t1 < t0)\n return false; // and result is a null range.\n if (result) {\n result.extendX(t0);\n result.extendX(t1);\n }\n return true;\n }\n /**\n * Multiply all the ClipPlanes DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect\n * on the plane is the inverse transpose of matrixA.\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n * @param matrix matrix to apply\n */\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n if (invert) { // form inverse once here, reuse for all planes\n const inverse = matrix.createInverse();\n if (!inverse)\n return false;\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\n }\n for (const plane of this._planes) {\n plane.multiplyPlaneByMatrix4d(matrix, false, transpose);\n }\n return true;\n }\n /** Return true if `point` satisfies `point.isPointInside` for all planes */\n public isPointInside(point: Point3d): boolean {\n for (const plane of this._planes) {\n // Defaults to strict inside check. Other clipping classes may use \"on or inside\" check for the \"on\" case\n if (!plane.isPointInside(point))\n return false;\n }\n return true;\n }\n\n /** Return true if `point` satisfies `point.isPointOnOrInside` for all planes */\n public isPointOnOrInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n const interiorTolerance = Math.abs(tolerance); // Interior tolerance should always be positive. (TFS# 246598).\n for (const plane of this._planes) {\n if (!plane.isPointOnOrInside(point, (plane.interior ? interiorTolerance : tolerance)))\n return false;\n }\n return true;\n }\n /**\n * Test if a sphere is completely inside the convex set.\n * @param centerPoint center of sphere\n * @param radius radius of sphere.\n */\n public isSphereInside(centerPoint: Point3d, radius: number): boolean {\n const r1 = Math.abs(radius) + Geometry.smallMetricDistance;\n for (const plane of this._planes) {\n if (!plane.isPointOnOrInside(centerPoint, r1)) {\n return false;\n }\n }\n return true;\n }\n /**\n * Find the parts of the line segment (if any) that is within the convex clip volume.\n * * The line segment is defined by `pointA` and `pointB`.\n * * The input fractional interval from `fraction0` to `fraction1` (increasing) is the active part to consider.\n * * To clip to the usual bounded line segment, start with fractions (0,1).\n * If the clip volume is unbounded, the line interval may also be unbounded.\n * * An unbounded line portion will have fraction coordinates positive or negative `Number.MAX_VALUE`.\n * @param f0 fraction that is the initial lower fraction of the active interval (e.g., 0.0 for bounded segment).\n * @param f1 fraction that is the initial upper fraction of the active interval (e.g., 1.0 for bounded segment).\n * @param pointA segment start (fraction 0)\n * @param pointB segment end (fraction 1)\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\n * @returns true if a segment was announced, false if entirely outside.\n */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\n ): boolean {\n let fraction: number | undefined;\n if (f1 < f0)\n return false;\n for (const plane of this._planes) {\n const hA = -plane.altitude(pointA);\n const hB = -plane.altitude(pointB);\n fraction = Geometry.conditionalDivideFraction(-hA, (hB - hA));\n if (fraction === undefined) {\n // Line parallel to the plane. If positive, it is all OUT\n if (hA > 0.0)\n return false;\n } else if (hB > hA) { // STRICTLY moving outward\n if (fraction < f0)\n return false;\n if (fraction < f1)\n f1 = fraction;\n } else if (hA > hB) { // STRICTLY moving inward\n if (fraction > f1)\n return false;\n if (fraction > f0)\n f0 = fraction;\n } else {\n // Strictly equal evaluations\n if (hA > 0.0)\n return false;\n }\n }\n if (f1 >= f0) {\n if (announce)\n announce(f0, f1);\n return true;\n }\n return false;\n }\n private static _clipArcFractionArray = new GrowableFloat64Array();\n /**\n * Find fractional parts of the arc that are within this ClipPlaneSet, and announce each as\n * * `announce(fraction, fraction, curve)`\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n const breaks = ConvexClipPlaneSet._clipArcFractionArray;\n breaks.clear();\n for (const clipPlane of this.planes) {\n clipPlane.appendIntersectionRadians(arc, breaks);\n }\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\n }\n /**\n * Find the parts of the (unbounded) line segment (if any) that is within the convex clip volume.\n * @param pointA segment start (fraction 0)\n * @param pointB segment end (fraction 1)\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\n * @returns true if a segment was announced, false if entirely outside.\n */\n public clipUnboundedSegment(pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber): boolean {\n return this.announceClippedSegmentIntervals(-Number.MAX_VALUE, Number.MAX_VALUE, pointA, pointB, announce);\n }\n /** transform each plane in place. */\n public transformInPlace(transform: Transform) {\n for (const plane of this._planes) {\n plane.transformInPlace(transform);\n }\n }\n /**\n * Clip a polygon to the inside of the convex set.\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, work: GrowableXYZArray, tolerance: number = Geometry.smallMetricDistance,\n ): void {\n for (const plane of this._planes) {\n plane.clipConvexPolygonInPlace(xyz, work, true, tolerance);\n if (xyz.length < 3)\n return;\n }\n }\n /**\n * Clip a convex polygon to (a single) inside part and (possibly many) outside parts.\n * @param xyz input polygon.\n * @param outsideFragments an array to receive (via push, with no preliminary clear) outside fragments\n * @param arrayCache cache for work arrays.\n * @return the surviving inside part (if any)\n */\n public clipInsidePushOutside(\n xyz: IndexedXYZCollection, outsideFragments: GrowableXYZArray[] | undefined, arrayCache: GrowableXYZArrayCache,\n ): GrowableXYZArray | undefined {\n const perpendicularRange = Range1d.createNull();\n let newInside = arrayCache.grabFromCache();\n let newOutside = arrayCache.grabFromCache();\n let insidePart = arrayCache.grabFromCache(); // this is empty ...\n insidePart.pushFrom(xyz);\n // While looping through planes . .\n // the outside part for the current plane is definitely outside and can be stashed to the final outside\n // the inside part for the current plane passes forward to be further split by the remaining planes.\n for (const plane of this._planes) {\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\n plane, insidePart, newInside, newOutside, perpendicularRange,\n );\n if (newOutside.length > 0) {\n // the newOutside fragment is definitely outside the ConvexClipPlaneSet\n if (outsideFragments) // save the definitely outside part as return data.\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\n newOutside = arrayCache.grabFromCache();\n if (newInside.length === 0) {\n insidePart.length = 0;\n break;\n }\n // insideWork is changed ... swap it with insidePart\n arrayCache.dropToCache(insidePart);\n insidePart = newInside;\n newInside = arrayCache.grabFromCache();\n }\n // outside clip was empty .. insideWork is identical to insidePart .. let insidePart feed through to the next clipper.\n }\n // at break or fall out ...\n // ALWAYS drop `newInside` and `newOutside` to the cache\n arrayCache.dropToCache(newInside);\n arrayCache.dropToCache(newOutside);\n // if `insidePart` is alive, return it to caller. Otherwise drop it to cache and return undefined.\n if (insidePart.length > 0)\n return insidePart;\n arrayCache.dropToCache(insidePart);\n return undefined;\n }\n /**\n * Returns 1, 2, or 3 based on whether point array is strongly inside, ambiguous, or strongly outside respectively.\n * * This has a peculiar expected use case as a very fast pre-filter for more precise clipping.\n * * The expected point set is for a polygon.\n * * Hence any clipping will eventually have to consider the lines between the points.\n * * This method looks for the special case of a single clip plane that has all the points outside.\n * * In this case the whole polygon must be outside.\n * * Note that this does not detect a polygon that is outside but \"crosses a corner\" -- it is mixed with respect to\n * multiple planes.\n */\n public classifyPointContainment(points: Point3d[], onIsOutside: boolean): ClipPlaneContainment {\n let allInside = true;\n const onTolerance = onIsOutside ? 1.0e-8 : -1.0e-8;\n const interiorTolerance = 1.0e-8; // Interior tolerance should always be positive\n\n for (const plane of this._planes) {\n let nOutside = 0;\n for (const point of points) {\n if (plane.altitude(point) < (plane.interior ? interiorTolerance : onTolerance)) {\n nOutside++;\n allInside = false;\n }\n }\n if (nOutside === points.length)\n return ClipPlaneContainment.StronglyOutside;\n }\n return allInside ? ClipPlaneContainment.StronglyInside : ClipPlaneContainment.Ambiguous;\n }\n /**\n * * Create a convex clip set for a polygon swept with possible tilt angle.\n * * planes are constructed by ClipPlane.createEdgeAndUpVector, using successive points from the array.\n * * If the first and last points match, the polygon area is checked. If the area is negative, points are used in\n * reverse order.\n * * If first and last points do not match, points are used in order given\n * @param points polygon points. (Closure point optional)\n * @param upVector primary sweep direction, as applied by ClipPlane.createEdgeAndUpVector\n * @param tiltAngle angle to tilt sweep planes away from the sweep direction.\n */\n public static createSweptPolyline(\n points: Point3d[], upVector: Vector3d, tiltAngle?: Angle,\n ): ConvexClipPlaneSet | undefined {\n const result = ConvexClipPlaneSet.createEmpty();\n let reverse = false;\n if (points.length > 3 && points[0].isAlmostEqual(points[points.length - 1])) {\n const polygonNormal: Vector3d = PolygonOps.areaNormal(points);\n const normalDot = polygonNormal.dotProduct(upVector);\n if (normalDot > 0.0)\n reverse = true;\n }\n for (let i = 0; (i + 1) < points.length; i++) {\n if (reverse) {\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i + 1], points[i], upVector, tiltAngle);\n if (toAdd) { // clipPlane creation could result in undefined\n result.addPlaneToConvexSet(toAdd);\n } else {\n return undefined;\n }\n } else {\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i], points[i + 1], upVector, tiltAngle);\n if (toAdd) { // clipPlane creation could result in undefined\n result.addPlaneToConvexSet(toAdd);\n } else {\n return undefined;\n }\n }\n }\n return result;\n }\n /**\n * Add a plane to the convex set.\n * @param plane plane to add\n */\n public addPlaneToConvexSet(plane: ClipPlane | Plane3dByOriginAndUnitNormal | undefined) {\n if (plane instanceof ClipPlane)\n this._planes.push(plane);\n else if (plane instanceof Plane3dByOriginAndUnitNormal)\n this._planes.push(ClipPlane.createPlane(plane));\n }\n /**\n * Test many points. Distribute them to arrays depending on in/out result.\n * @param points points to test\n * @param inOrOn points that are in or on the set\n * @param out points that are out.\n */\n public clipPointsOnOrInside(points: Point3d[], inOrOn: Point3d[], out: Point3d[]) {\n inOrOn.length = 0;\n out.length = 0;\n for (const xyz of points) {\n if (this.isPointOnOrInside(xyz, 0.0)) {\n inOrOn.push(xyz);\n } else {\n out.push(xyz);\n }\n }\n }\n /**\n * Clip a polygon to the planes of the clip plane set.\n * * For a convex input polygon, the output is another convex polygon.\n * * For a non-convex input, the output may have double-back edges along plane intersections. This is still a\n * valid clip in a parity sense.\n * * The containingPlane parameter allows callers within ConvexClipPlane set to bypass planes known to contain\n * the polygon.\n * @param input polygon, usually convex.\n * @param output output polygon\n * @param work work array.\n * @param containingPlane if this plane is found in the convex set, it is NOT applied.\n */\n public polygonClip(\n input: GrowableXYZArray | Point3d[], output: GrowableXYZArray, work: GrowableXYZArray, planeToSkip?: ClipPlane,\n ): void {\n if (input instanceof GrowableXYZArray)\n input.clone(output);\n else\n GrowableXYZArray.create(input, output);\n\n for (const plane of this._planes) {\n if (planeToSkip === plane)\n continue;\n if (output.length === 0)\n break;\n plane.clipConvexPolygonInPlace(output, work);\n }\n }\n /**\n * * Define new planes in this ConvexClipPlaneSet so it clips to the inside of a polygon.\n * * always create planes for the swept edges of the polygon\n * * optionally (with nonzero sideSelect) create a cap plane using the polygon normal.\n * @param points Points of a bounding polygon\n * @param sweepDirection direction to sweep.\n * @param sideSelect 0 to have no cap polygon, 1 if the sweep vector side is in, -1 if sweep vector side is out.\n */\n public reloadSweptPolygon(points: Point3d[], sweepDirection: Vector3d, sideSelect: number): number {\n this._planes.length = 0;\n const n = points.length;\n if (n <= 2)\n return 0;\n\n const planeNormal: Vector3d = PolygonOps.areaNormal(points);\n const isCCW = sweepDirection.dotProduct(planeNormal) > 0.0;\n\n const delta = isCCW ? 1 : n - 1;\n for (let i = 0; i < n; i++) {\n const i1 = (i + delta) % n;\n const xyz0: Point3d = points[i];\n const xyz1: Point3d = points[i1];\n if (xyz0.isAlmostEqual(xyz1))\n continue;\n const edgeVector: Vector3d = Vector3d.createStartEnd(xyz0, xyz1);\n const inwardNormal: Vector3d = Vector3d.createCrossProduct(sweepDirection.x, sweepDirection.y, sweepDirection.z,\n edgeVector.x, edgeVector.y, edgeVector.z);\n const inwardNormalNormalized = inwardNormal.normalize();\n let distance;\n if (inwardNormalNormalized) { // should never fail... simply a check due to the format of the normalize function return\n distance = inwardNormalNormalized.dotProduct(xyz0);\n const clipToAdd = ClipPlane.createNormalAndDistance(inwardNormalNormalized, distance, false, false);\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\n }\n }\n if (sideSelect !== 0.0) {\n let planeNormalNormalized = planeNormal.normalize();\n if (planeNormalNormalized) { // Again.. should never fail\n const a = sweepDirection.dotProduct(planeNormalNormalized) * sideSelect;\n if (a < 0.0)\n planeNormalNormalized = planeNormalNormalized.negate();\n const xyz0: Point3d = points[0];\n const distance = planeNormalNormalized.dotProduct(xyz0);\n const clipToAdd = ClipPlane.createNormalAndDistance(planeNormalNormalized, distance, false, false);\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\n }\n }\n return isCCW ? 1 : -1;\n }\n /**\n * Compute intersections among all combinations of 3 planes in the convex set.\n * * optionally throw out points that are not in the set.\n * * optionally push the points in the caller-supplied point array.\n * * optionally extend a caller supplied range.\n * * In the common case where the convex set is (a) a slab or (b) a view frustum, there will be 8 points and the\n * range is the range of the convex set.\n * * If the convex set is unbounded, the range only contains the range of the accepted (corner) points, and the\n * range is not a representative of the \"range of all points in the set\".\n * @param transform (optional) transform to apply to the points.\n * @param points (optional) array to which computed points are to be added.\n * @param range (optional) range to be extended by the computed points\n * @param transform (optional) transform to apply to the accepted points.\n * @param testContainment if true, test each point to see if it is within the convex set. (send false if confident\n * that the convex set is rectilinear set such as a slab. Send true if chiseled corners are possible).\n * @returns number of points.\n */\n public computePlanePlanePlaneIntersections(\n points: Point3d[] | undefined,\n rangeToExtend: Range3d | undefined,\n transform?: Transform,\n testContainment: boolean = true,\n ): number {\n const normalRows = Matrix3d.createIdentity();\n const allPlanes = this._planes;\n const n = allPlanes.length;\n let numPoints = 0; // explicitly count points -- can't wait to end for points.length because it may be an optional output.\n for (let i = 0; i < n; i++) {\n for (let j = i + 1; j < n; j++)\n for (let k = j + 1; k < n; k++) {\n Matrix3d.createRowValues(\n allPlanes[i].inwardNormalRef.x, allPlanes[i].inwardNormalRef.y, allPlanes[i].inwardNormalRef.z,\n allPlanes[j].inwardNormalRef.x, allPlanes[j].inwardNormalRef.y, allPlanes[j].inwardNormalRef.z,\n allPlanes[k].inwardNormalRef.x, allPlanes[k].inwardNormalRef.y, allPlanes[k].inwardNormalRef.z,\n normalRows);\n if (normalRows.computeCachedInverse(false)) {\n const xyz = normalRows.multiplyInverseXYZAsPoint3d(allPlanes[i].distance, allPlanes[j].distance, allPlanes[k].distance)!;\n if (!testContainment || this.isPointOnOrInside(xyz, Geometry.smallMetricDistance)) {\n numPoints++;\n if (transform)\n transform.multiplyPoint3d(xyz, xyz);\n if (points)\n points.push(xyz);\n if (rangeToExtend)\n rangeToExtend.extendPoint(xyz);\n }\n }\n }\n }\n return numPoints;\n }\n /**\n * Set the `invisible` property on each plane of the convex set.\n * @param invisible value to store\n */\n public setInvisible(invisible: boolean) {\n for (const plane of this._planes) {\n plane.setInvisible(invisible);\n }\n }\n /**\n * Add planes for z-direction clip between low and high z levels.\n * @param invisible value to apply to the `invisible` bit for the new planes\n * @param zLow low z value. The plane clips out points with z below this.\n * @param zHigh high z value. The plane clips out points with z above this.\n */\n public addZClipPlanes(invisible: boolean, zLow?: number, zHigh?: number) {\n if (zLow !== undefined)\n this._planes.push(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, 1), zLow, invisible)!);\n if (zHigh !== undefined)\n this._planes.push(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, -1), -zHigh, invisible)!);\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 from\n * the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from\n * the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ): void {\n const newInside = this.clipInsidePushOutside(xyz, outsideFragments, arrayCache);\n if (newInside)\n insideFragments.push(newInside);\n }\n /**\n * Create a convex clip set from a convex mesh.\n * * Create a plane for each facet.\n * * Assemble the planes as a single clip plane set.\n * * If the facets are closed by edge pairing, use the sign of the computed volume to point the plane normals inward.\n * * If the facets are not closed, the facet orientation determines plane orientation.\n * * The implication of this is that if the facets are a convex volume, the returned clip plane set is convex.\n * @param convexMesh input mesh. For best results, the mesh should be closed and convex.\n * @param result optional preallocated result to reuse and return\n * @return clipper and volume (zero if mesh is not closed)\n */\n public static createConvexPolyface(\n convexMesh: Polyface | PolyfaceVisitor, result?: ConvexClipPlaneSet,\n ): { clipper: ConvexClipPlaneSet, volume: number } {\n result = this.createEmpty(result);\n let vol = 0;\n let myMesh: Polyface | undefined;\n let myVisitor: PolyfaceVisitor;\n if (convexMesh instanceof Polyface) {\n myMesh = convexMesh;\n myVisitor = convexMesh.createVisitor(0);\n } else {\n myMesh = convexMesh.clientPolyface();\n myVisitor = convexMesh;\n }\n if (myMesh && myVisitor) {\n if (PolyfaceQuery.isPolyfaceClosedByEdgePairing(myMesh))\n vol = PolyfaceQuery.sumTetrahedralVolumes(myVisitor);\n const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward\n const normal = Vector3d.create();\n const plane = Plane3dByOriginAndUnitNormal.createXYPlane();\n myVisitor.reset();\n while (myVisitor.moveToNextFacet()) {\n if (undefined !== PolygonOps.areaNormalGo(myVisitor.point, normal)) {\n normal.scaleInPlace(scale);\n if (undefined !== Plane3dByOriginAndUnitNormal.create(myVisitor.point.front()!, normal, plane))\n result.addPlaneToConvexSet(plane);\n }\n }\n }\n return { clipper: result, volume: vol };\n }\n\n // FUNCTIONS SKIPPED DUE TO BSPLINES, VU, OR NON-USAGE IN NATIVE CODE----------------------------------------------------------------\n\n // Uses bsplines... skipping for now:\n // public convexAppendIntervalsFromBspline();\n\n // Uses pushing and clearing from/to a cache and added functionality for arrays. . . skipping for now\n // public convexPolygonClipInsideOutside(input: Point3d[], inside: Point3d[], outside: Point3d[], work1: Point3d[], work2: Point3d[],\n // clearOutside: boolean, distanceTolerance: number)\n}\n"]}
1
+ {"version":3,"file":"ConvexClipPlaneSet.js","sourceRoot":"","sources":["../../../src/clipping/ConvexClipPlaneSet.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,OAAO,EAAW,MAAM,qBAAqB,CAAC;AAKvD,OAAO,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,C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MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,4BAA4B,CAAC,aAAa,EAAE,CAAC;QAC3D,MAAM,OAAO,GAAG,UAAU,YAAY,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC1F,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACtB,KAAK,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,eAAe,EAAE,GAAI,CAAC;YAClD,IAAI,SAAS,KAAK,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;gBACjE,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC3B,IAAI,SAAS,KAAK,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAG,EAAE,MAAM,EAAE,KAAK,CAAC;oBAC1F,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC1C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { 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 { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { Polyface, PolyfaceVisitor } from \"../polyface/Polyface\";\nimport { PolyfaceQuery } from \"../polyface/PolyfaceQuery\";\nimport { ClipPlane, ClipPlaneProps } from \"./ClipPlane\";\nimport { Clipper, ClipPlaneContainment, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/** Wire format describing a [[ConvexClipPlaneSet]].\n * @public\n */\nexport type ConvexClipPlaneSetProps = ClipPlaneProps[];\n\n/**\n * A ConvexClipPlaneSet is a collection of ClipPlanes, often used for bounding regions of space.\n * @public\n */\nexport class ConvexClipPlaneSet implements Clipper, PolygonClipper {\n /** Value acting as \"at infinity\" for coordinates along a ray. */\n public static readonly hugeVal = 1e37;\n /** Planes that define the convex set. */\n private _planes: ClipPlane[];\n // private _parity: number; <--- Not yet used\n // public get parity() { return this._parity; }\n // public set parity(value: number) { this._parity = value; }\n private constructor(planes?: ClipPlane[]) {\n // this._parity = 1;\n this._planes = planes ? planes : [];\n }\n /**\n * Return an array containing all the planes of the convex set.\n * * Note that this has no leading keyword identifying it as a ConvexClipPlaneSet.\n */\n public toJSON(): ConvexClipPlaneSetProps {\n const val: ClipPlaneProps[] = [];\n for (const plane of this._planes)\n val.push(plane.toJSON());\n return val;\n }\n /**\n * Extract clip planes from a json array `[ clipPlane, clipPlane ]`.\n * * Non-clipPlane members are ignored.\n */\n public static fromJSON(json: ConvexClipPlaneSetProps | undefined, result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n if (!Array.isArray(json))\n return result;\n for (const thisJson of json) {\n const plane = ClipPlane.fromJSON(thisJson);\n if (plane)\n result._planes.push(plane);\n }\n return result;\n }\n /**\n * Return true if all members are almostEqual to corresponding members of other. This includes identical order in array.\n * @param other clip plane to compare\n */\n public isAlmostEqual(other: ConvexClipPlaneSet): boolean {\n if (this._planes.length !== other._planes.length)\n return false;\n for (let i = 0; i < this._planes.length; i++)\n if (!this._planes[i].isAlmostEqual(other._planes[i]))\n return false;\n return true;\n }\n /**\n * Create ConvexClipPlaneSet from an array of planes.\n * * Each plane reference in the `planes` array is taken into the result.\n * * The input array itself is NOT taken into the result.\n */\n public static createPlanes(\n planes: (ClipPlane | Plane3dByOriginAndUnitNormal)[], result?: ConvexClipPlaneSet,\n ): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n for (const plane of planes) {\n if (plane instanceof ClipPlane) {\n result._planes.push(plane);\n } else if (plane instanceof Plane3dByOriginAndUnitNormal) {\n const clipPlane = ClipPlane.createPlane(plane);\n result._planes.push(clipPlane);\n }\n }\n return result;\n }\n /**\n * Create new convex set using selected planes of a Range3d.\n * @param range range with coordinates\n * @param lowX true to clip at the low x plane\n * @param highX true to clip at the high x plane\n * @param lowY true to clip at the low y plane\n * @param highY true to clip at the high z plane\n * @param lowZ true to clip at the low z plane\n * @param highZ true to clip at the high z plane\n */\n public static createRange3dPlanes(\n range: Range3d,\n lowX: boolean = true,\n highX: boolean = true,\n lowY: boolean = true,\n highY: boolean = true,\n lowZ: boolean = true,\n highZ: boolean = true,\n ): ConvexClipPlaneSet {\n const result = ConvexClipPlaneSet.createEmpty();\n\n if (lowX)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(1, 0, 0, range.low.x, 0, 0)!);\n if (highX)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(-1, 0, 0, range.high.x, 0, 0)!);\n\n if (lowY)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 1, 0, 0, range.low.y, 0)!);\n if (highY)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, -1, 0, 0, range.high.y, 0)!);\n\n if (lowZ)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, range.low.z)!);\n if (highZ)\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 0, -1, 0, 0, range.high.z)!);\n\n return result;\n }\n /** Create an empty `ConvexClipPlaneSet` */\n public static createEmpty(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n if (result) {\n result._planes.length = 0;\n return result;\n }\n return new ConvexClipPlaneSet();\n }\n /** Negate all planes of the set. */\n public negateAllPlanes(): void {\n for (const plane of this._planes)\n plane.negateInPlace();\n }\n /**\n * Create a convex clip plane set that clips to `x0 <= x <= x1` and `y0 <= y <= y1`.\n * * Note that there is no test for the usual ordering `x0 <= x1` or `y0 <= y1`.\n * * if the usual ordering is violated, the convex set is an empty set.\n * * More details can be found at docs/learning/geometry/Clipping.md\n */\n public static createXYBox(\n x0: number, y0: number, x1: number, y1: number, result?: ConvexClipPlaneSet,\n ): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n const clip0 = ClipPlane.createNormalAndDistance(Vector3d.create(-1, 0, 0), -x1, false, true);\n const clip1 = ClipPlane.createNormalAndDistance(Vector3d.create(1, 0, 0), x0, false, true);\n const clip2 = ClipPlane.createNormalAndDistance(Vector3d.create(0, -1, 0), -y1, false, true);\n const clip3 = ClipPlane.createNormalAndDistance(Vector3d.create(0, 1, 0), y0, false, true);\n if (clip0 && clip1 && clip2 && clip3) {\n result._planes.push(clip0, clip1, clip2, clip3);\n }\n return result;\n }\n /**\n * Create a convex set containing a half space for each edge between points of a polyline.\n * * Caller is responsible for assuring the polyline is convex.\n * @param points array of points. Only xy parts are considered.\n * @param interior array whose boolean value is used as both the `interior` and `invisible` bits of the plane for the\n * succeeding segment. If this array is not provided, both are false.\n * @param leftIsInside if true, the interior is \"to the left\" of the segments. If false, interior is \"to the right\".\n */\n public static createXYPolyLine(\n points: Point3d[], interior: boolean[] | undefined, leftIsInside: boolean, result?: ConvexClipPlaneSet,\n ): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\n perp.z = 0.0;\n\n if (!leftIsInside)\n perp.scaleInPlace(-1.0);\n\n const perpNormalized = perp.normalize();\n if (perpNormalized) {\n const flag = interior !== undefined ? interior[i0] : false;\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], flag, flag);\n if (clip) {\n result._planes.push(clip);\n }\n }\n }\n return result;\n }\n /**\n * Create a convexClipPlaneSet with planes whose \"inside\" normal is to the left of each segment.\n * @param points array of points.\n */\n public static createXYPolyLineInsideLeft(points: Point3d[], result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\n perp.z = 0.0;\n\n const perpNormalized = perp.normalize();\n if (perpNormalized) {\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], false, false);\n if (clip) { result._planes.push(clip); }\n }\n }\n return result;\n }\n /**\n * Set (or reset) a plane and ConvexClipPlaneSet for a convex array, such as a convex facet used for xy clip.\n * * The planeOfPolygon is (re)initialized with the normal from 3 points, but not otherwise referenced.\n * * The ConvexClipPlaneSet is filled with outward normals of the facet edges as viewed to xy plane.\n * @param points\n * @param result\n */\n public static setPlaneAndXYLoopCCW(points: GrowableXYZArray, planeOfPolygon: ClipPlane, frustum: ConvexClipPlaneSet) {\n const i0 = points.length - 1;\n const n = points.length;\n let x0 = points.getXAtUncheckedPointIndex(i0);\n let y0 = points.getYAtUncheckedPointIndex(i0);\n let x1, y1, nx, ny;\n frustum._planes.length = 0;\n const z0 = points.getZAtUncheckedPointIndex(i0); // z for planes can stay fixed\n const planeNormal = points.crossProductIndexIndexIndex(0, 2, 1)!;\n ClipPlane.createNormalAndPointXYZXYZ(planeNormal.x, planeNormal.y, planeNormal.z, x0, y0, z0, false, false, planeOfPolygon);\n if (planeNormal.normalizeInPlace()) {\n for (let i1 = 0; i1 < n; i1++, x0 = x1, y0 = y1) {\n x1 = points.getXAtUncheckedPointIndex(i1);\n y1 = points.getYAtUncheckedPointIndex(i1);\n nx = -(y1 - y0);\n ny = x1 - x0;\n const clipper = ClipPlane.createNormalAndPointXYZXYZ(nx, ny, 0, x1, y1, z0);\n if (clipper)\n frustum._planes.push(clipper);\n }\n }\n }\n /** Deep clone of all planes. */\n public clone(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\n result = result ? result : new ConvexClipPlaneSet();\n result._planes.length = 0;\n for (const plane of this._planes)\n result._planes.push(plane.clone());\n return result;\n }\n /** Return the (reference to the) array of `ClipPlane` */\n public get planes(): ClipPlane[] {\n return this._planes;\n }\n /**\n * Test if there is any intersection with a ray defined by origin and direction.\n * * Optionally record the range (null or otherwise) in caller-allocated result.\n * * If the ray is unbounded inside the clip, result can contain positive or negative\n * \"Geometry.largeCoordinateResult\" values.\n * * If no result is provide, there are no object allocations.\n * @param result optional Range1d to receive parameters along the ray.\n */\n public hasIntersectionWithRay(ray: Ray3d, result?: Range1d, tolerance: number = Geometry.smallMetricDistance): boolean {\n // form low and high values in locals that do not require allocation.\n // transfer to caller-supplied result at end\n let t0 = -Geometry.largeCoordinateResult;\n let t1 = Geometry.largeCoordinateResult;\n if (result)\n result.setNull();\n const velocityTolerance = 1.0e-13;\n for (const plane of this._planes) {\n const vD = plane.velocity(ray.direction);\n const vN = plane.altitude(ray.origin);\n\n if (Math.abs(vD) <= velocityTolerance) {\n // Ray is parallel... No need to continue testing if outside halfspace.\n if (vN < -tolerance)\n return false; // and result is a null range.\n } else {\n const rayFraction = - vN / vD;\n if (vD < 0.0) {\n if (rayFraction < t1)\n t1 = rayFraction;\n } else {\n if (rayFraction > t0)\n t0 = rayFraction;\n }\n }\n }\n if (t1 < t0)\n return false; // and result is a null range.\n if (result) {\n result.extendX(t0);\n result.extendX(t1);\n }\n return true;\n }\n /**\n * Multiply all the ClipPlanes DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect\n * on the plane is the inverse transpose of matrixA.\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n * @param matrix matrix to apply\n */\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n if (invert) { // form inverse once here, reuse for all planes\n const inverse = matrix.createInverse();\n if (!inverse)\n return false;\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\n }\n for (const plane of this._planes) {\n plane.multiplyPlaneByMatrix4d(matrix, false, transpose);\n }\n return true;\n }\n /** Return true if `point` satisfies `point.isPointInside` for all planes */\n public isPointInside(point: Point3d): boolean {\n for (const plane of this._planes) {\n // Defaults to strict inside check. Other clipping classes may use \"on or inside\" check for the \"on\" case\n if (!plane.isPointInside(point))\n return false;\n }\n return true;\n }\n\n /** Return true if `point` satisfies `point.isPointOnOrInside` for all planes */\n public isPointOnOrInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n const interiorTolerance = Math.abs(tolerance); // Interior tolerance should always be positive. (TFS# 246598).\n for (const plane of this._planes) {\n if (!plane.isPointOnOrInside(point, (plane.interior ? interiorTolerance : tolerance)))\n return false;\n }\n return true;\n }\n /**\n * Test if a sphere is completely inside the convex set.\n * @param centerPoint center of sphere\n * @param radius radius of sphere.\n */\n public isSphereInside(centerPoint: Point3d, radius: number): boolean {\n const r1 = Math.abs(radius) + Geometry.smallMetricDistance;\n for (const plane of this._planes) {\n if (!plane.isPointOnOrInside(centerPoint, r1)) {\n return false;\n }\n }\n return true;\n }\n /**\n * Find the parts of the line segment (if any) that is within the convex clip volume.\n * * The line segment is defined by `pointA` and `pointB`.\n * * The input fractional interval from `fraction0` to `fraction1` (increasing) is the active part to consider.\n * * To clip to the usual bounded line segment, start with fractions (0,1).\n * If the clip volume is unbounded, the line interval may also be unbounded.\n * * An unbounded line portion will have fraction coordinates positive or negative `Number.MAX_VALUE`.\n * @param f0 fraction that is the initial lower fraction of the active interval (e.g., 0.0 for bounded segment).\n * @param f1 fraction that is the initial upper fraction of the active interval (e.g., 1.0 for bounded segment).\n * @param pointA segment start (fraction 0)\n * @param pointB segment end (fraction 1)\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\n * @returns true if a segment was announced, false if entirely outside.\n */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\n ): boolean {\n let fraction: number | undefined;\n if (f1 < f0)\n return false;\n for (const plane of this._planes) {\n const hA = -plane.altitude(pointA);\n const hB = -plane.altitude(pointB);\n fraction = Geometry.conditionalDivideFraction(-hA, (hB - hA));\n if (fraction === undefined) {\n // Line parallel to the plane. If positive, it is all OUT\n if (hA > 0.0)\n return false;\n } else if (hB > hA) { // STRICTLY moving outward\n if (fraction < f0)\n return false;\n if (fraction < f1)\n f1 = fraction;\n } else if (hA > hB) { // STRICTLY moving inward\n if (fraction > f1)\n return false;\n if (fraction > f0)\n f0 = fraction;\n } else {\n // Strictly equal evaluations\n if (hA > 0.0)\n return false;\n }\n }\n if (f1 >= f0) {\n if (announce)\n announce(f0, f1);\n return true;\n }\n return false;\n }\n private static _clipArcFractionArray = new GrowableFloat64Array();\n /**\n * Find fractional parts of the arc that are within this ClipPlaneSet, and announce each as\n * * `announce(fraction, fraction, curve)`\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n const breaks = ConvexClipPlaneSet._clipArcFractionArray;\n breaks.clear();\n for (const clipPlane of this.planes) {\n clipPlane.appendIntersectionRadians(arc, breaks);\n }\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\n }\n /**\n * Find the parts of the (unbounded) line segment (if any) that is within the convex clip volume.\n * @param pointA segment start (fraction 0)\n * @param pointB segment end (fraction 1)\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\n * @returns true if a segment was announced, false if entirely outside.\n */\n public clipUnboundedSegment(pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber): boolean {\n return this.announceClippedSegmentIntervals(-Number.MAX_VALUE, Number.MAX_VALUE, pointA, pointB, announce);\n }\n /** transform each plane in place. */\n public transformInPlace(transform: Transform) {\n for (const plane of this._planes) {\n plane.transformInPlace(transform);\n }\n }\n /**\n * Clip a polygon to the inside of the convex set.\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, work: GrowableXYZArray, tolerance: number = Geometry.smallMetricDistance,\n ): void {\n for (const plane of this._planes) {\n plane.clipConvexPolygonInPlace(xyz, work, true, tolerance);\n if (xyz.length < 3)\n return;\n }\n }\n /**\n * Clip a convex polygon to (a single) inside part and (possibly many) outside parts.\n * @param xyz input polygon.\n * @param outsideFragments an array to receive (via push, with no preliminary clear) outside fragments\n * @param arrayCache cache for work arrays.\n * @return the surviving inside part (if any)\n */\n public clipInsidePushOutside(\n xyz: IndexedXYZCollection, outsideFragments: GrowableXYZArray[] | undefined, arrayCache: GrowableXYZArrayCache,\n ): GrowableXYZArray | undefined {\n const perpendicularRange = Range1d.createNull();\n let newInside = arrayCache.grabFromCache();\n let newOutside = arrayCache.grabFromCache();\n let insidePart = arrayCache.grabFromCache(); // this is empty ...\n insidePart.pushFrom(xyz);\n // While looping through planes . .\n // the outside part for the current plane is definitely outside and can be stashed to the final outside\n // the inside part for the current plane passes forward to be further split by the remaining planes.\n for (const plane of this._planes) {\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\n plane, insidePart, newInside, newOutside, perpendicularRange,\n );\n if (newOutside.length > 0) {\n // the newOutside fragment is definitely outside the ConvexClipPlaneSet\n if (outsideFragments) // save the definitely outside part as return data.\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\n newOutside = arrayCache.grabFromCache();\n if (newInside.length === 0) {\n insidePart.length = 0;\n break;\n }\n // insideWork is changed ... swap it with insidePart\n arrayCache.dropToCache(insidePart);\n insidePart = newInside;\n newInside = arrayCache.grabFromCache();\n }\n // outside clip was empty .. insideWork is identical to insidePart .. let insidePart feed through to the next clipper.\n }\n // at break or fall out ...\n // ALWAYS drop `newInside` and `newOutside` to the cache\n arrayCache.dropToCache(newInside);\n arrayCache.dropToCache(newOutside);\n // if `insidePart` is alive, return it to caller. Otherwise drop it to cache and return undefined.\n if (insidePart.length > 0)\n return insidePart;\n arrayCache.dropToCache(insidePart);\n return undefined;\n }\n /**\n * Returns 1, 2, or 3 based on whether point array is strongly inside, ambiguous, or strongly outside respectively.\n * * This has a peculiar expected use case as a very fast pre-filter for more precise clipping.\n * * The expected point set is for a polygon.\n * * Hence any clipping will eventually have to consider the lines between the points.\n * * This method looks for the special case of a single clip plane that has all the points outside.\n * * In this case the whole polygon must be outside.\n * * Note that this does not detect a polygon that is outside but \"crosses a corner\" -- it is mixed with respect to\n * multiple planes.\n */\n public classifyPointContainment(points: Point3d[], onIsOutside: boolean): ClipPlaneContainment {\n let allInside = true;\n const onTolerance = onIsOutside ? 1.0e-8 : -1.0e-8;\n const interiorTolerance = 1.0e-8; // Interior tolerance should always be positive\n\n for (const plane of this._planes) {\n let nOutside = 0;\n for (const point of points) {\n if (plane.altitude(point) < (plane.interior ? interiorTolerance : onTolerance)) {\n nOutside++;\n allInside = false;\n }\n }\n if (nOutside === points.length)\n return ClipPlaneContainment.StronglyOutside;\n }\n return allInside ? ClipPlaneContainment.StronglyInside : ClipPlaneContainment.Ambiguous;\n }\n /**\n * * Create a convex clip set for a polygon swept with possible tilt angle.\n * * planes are constructed by ClipPlane.createEdgeAndUpVector, using successive points from the array.\n * * If the first and last points match, the polygon area is checked. If the area is negative, points are used in\n * reverse order.\n * * If first and last points do not match, points are used in order given\n * @param points polygon points. (Closure point optional)\n * @param upVector primary sweep direction, as applied by ClipPlane.createEdgeAndUpVector\n * @param tiltAngle angle to tilt sweep planes away from the sweep direction.\n */\n public static createSweptPolyline(\n points: Point3d[], upVector: Vector3d, tiltAngle?: Angle,\n ): ConvexClipPlaneSet | undefined {\n const result = ConvexClipPlaneSet.createEmpty();\n let reverse = false;\n if (points.length > 3 && points[0].isAlmostEqual(points[points.length - 1])) {\n const polygonNormal: Vector3d = PolygonOps.areaNormal(points);\n const normalDot = polygonNormal.dotProduct(upVector);\n if (normalDot > 0.0)\n reverse = true;\n }\n for (let i = 0; (i + 1) < points.length; i++) {\n if (reverse) {\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i + 1], points[i], upVector, tiltAngle);\n if (toAdd) { // clipPlane creation could result in undefined\n result.addPlaneToConvexSet(toAdd);\n } else {\n return undefined;\n }\n } else {\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i], points[i + 1], upVector, tiltAngle);\n if (toAdd) { // clipPlane creation could result in undefined\n result.addPlaneToConvexSet(toAdd);\n } else {\n return undefined;\n }\n }\n }\n return result;\n }\n /**\n * Add a plane to the convex set.\n * @param plane plane to add\n */\n public addPlaneToConvexSet(plane: ClipPlane | Plane3dByOriginAndUnitNormal | undefined) {\n if (plane instanceof ClipPlane)\n this._planes.push(plane);\n else if (plane instanceof Plane3dByOriginAndUnitNormal)\n this._planes.push(ClipPlane.createPlane(plane));\n }\n /**\n * Test many points. Distribute them to arrays depending on in/out result.\n * @param points points to test\n * @param inOrOn points that are in or on the set\n * @param out points that are out.\n */\n public clipPointsOnOrInside(points: Point3d[], inOrOn: Point3d[], out: Point3d[]) {\n inOrOn.length = 0;\n out.length = 0;\n for (const xyz of points) {\n if (this.isPointOnOrInside(xyz, 0.0)) {\n inOrOn.push(xyz);\n } else {\n out.push(xyz);\n }\n }\n }\n /**\n * Clip a polygon to the planes of the clip plane set.\n * * For a convex input polygon, the output is another convex polygon.\n * * For a non-convex input, the output may have double-back edges along plane intersections. This is still a\n * valid clip in a parity sense.\n * * The containingPlane parameter allows callers within ConvexClipPlane set to bypass planes known to contain\n * the polygon.\n * @param input polygon, usually convex.\n * @param output output polygon\n * @param work work array.\n * @param containingPlane if this plane is found in the convex set, it is NOT applied.\n */\n public polygonClip(\n input: GrowableXYZArray | Point3d[], output: GrowableXYZArray, work: GrowableXYZArray, planeToSkip?: ClipPlane,\n ): void {\n if (input instanceof GrowableXYZArray)\n input.clone(output);\n else\n GrowableXYZArray.create(input, output);\n\n for (const plane of this._planes) {\n if (planeToSkip === plane)\n continue;\n if (output.length === 0)\n break;\n plane.clipConvexPolygonInPlace(output, work);\n }\n }\n /**\n * * Define new planes in this ConvexClipPlaneSet so it clips to the inside of a polygon.\n * * always create planes for the swept edges of the polygon\n * * optionally (with nonzero sideSelect) create a cap plane using the polygon normal.\n * @param points Points of a bounding polygon\n * @param sweepDirection direction to sweep.\n * @param sideSelect 0 to have no cap polygon, 1 if the sweep vector side is in, -1 if sweep vector side is out.\n */\n public reloadSweptPolygon(points: Point3d[], sweepDirection: Vector3d, sideSelect: number): number {\n this._planes.length = 0;\n const n = points.length;\n if (n <= 2)\n return 0;\n\n const planeNormal: Vector3d = PolygonOps.areaNormal(points);\n const isCCW = sweepDirection.dotProduct(planeNormal) > 0.0;\n\n const delta = isCCW ? 1 : n - 1;\n for (let i = 0; i < n; i++) {\n const i1 = (i + delta) % n;\n const xyz0: Point3d = points[i];\n const xyz1: Point3d = points[i1];\n if (xyz0.isAlmostEqual(xyz1))\n continue;\n const edgeVector: Vector3d = Vector3d.createStartEnd(xyz0, xyz1);\n const inwardNormal: Vector3d = Vector3d.createCrossProduct(sweepDirection.x, sweepDirection.y, sweepDirection.z,\n edgeVector.x, edgeVector.y, edgeVector.z);\n const inwardNormalNormalized = inwardNormal.normalize();\n let distance;\n if (inwardNormalNormalized) { // should never fail... simply a check due to the format of the normalize function return\n distance = inwardNormalNormalized.dotProduct(xyz0);\n const clipToAdd = ClipPlane.createNormalAndDistance(inwardNormalNormalized, distance, false, false);\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\n }\n }\n if (sideSelect !== 0.0) {\n let planeNormalNormalized = planeNormal.normalize();\n if (planeNormalNormalized) { // Again.. should never fail\n const a = sweepDirection.dotProduct(planeNormalNormalized) * sideSelect;\n if (a < 0.0)\n planeNormalNormalized = planeNormalNormalized.negate();\n const xyz0: Point3d = points[0];\n const distance = planeNormalNormalized.dotProduct(xyz0);\n const clipToAdd = ClipPlane.createNormalAndDistance(planeNormalNormalized, distance, false, false);\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\n }\n }\n return isCCW ? 1 : -1;\n }\n /**\n * Compute intersections among all combinations of 3 planes in the convex set.\n * * optionally throw out points that are not in the set.\n * * optionally push the points in the caller-supplied point array.\n * * optionally extend a caller supplied range.\n * * In the common case where the convex set is (a) a slab or (b) a view frustum, there will be 8 points and the\n * range is the range of the convex set.\n * * If the convex set is unbounded, the range only contains the range of the accepted (corner) points, and the\n * range is not a representative of the \"range of all points in the set\".\n * @param transform (optional) transform to apply to the points.\n * @param points (optional) array to which computed points are to be added.\n * @param range (optional) range to be extended by the computed points\n * @param transform (optional) transform to apply to the accepted points.\n * @param testContainment if true, test each point to see if it is within the convex set. (send false if confident\n * that the convex set is rectilinear set such as a slab. Send true if chiseled corners are possible).\n * @returns number of points.\n */\n public computePlanePlanePlaneIntersections(\n points: Point3d[] | undefined,\n rangeToExtend: Range3d | undefined,\n transform?: Transform,\n testContainment: boolean = true,\n ): number {\n const normalRows = Matrix3d.createIdentity();\n const allPlanes = this._planes;\n const n = allPlanes.length;\n let numPoints = 0; // explicitly count points -- can't wait to end for points.length because it may be an optional output.\n for (let i = 0; i < n; i++) {\n for (let j = i + 1; j < n; j++)\n for (let k = j + 1; k < n; k++) {\n Matrix3d.createRowValues(\n allPlanes[i].inwardNormalRef.x, allPlanes[i].inwardNormalRef.y, allPlanes[i].inwardNormalRef.z,\n allPlanes[j].inwardNormalRef.x, allPlanes[j].inwardNormalRef.y, allPlanes[j].inwardNormalRef.z,\n allPlanes[k].inwardNormalRef.x, allPlanes[k].inwardNormalRef.y, allPlanes[k].inwardNormalRef.z,\n normalRows);\n if (normalRows.computeCachedInverse(false)) {\n const xyz = normalRows.multiplyInverseXYZAsPoint3d(allPlanes[i].distance, allPlanes[j].distance, allPlanes[k].distance)!;\n if (!testContainment || this.isPointOnOrInside(xyz, Geometry.smallMetricDistance)) {\n numPoints++;\n if (transform)\n transform.multiplyPoint3d(xyz, xyz);\n if (points)\n points.push(xyz);\n if (rangeToExtend)\n rangeToExtend.extendPoint(xyz);\n }\n }\n }\n }\n return numPoints;\n }\n /**\n * Set the `invisible` property on each plane of the convex set.\n * @param invisible value to store\n */\n public setInvisible(invisible: boolean) {\n for (const plane of this._planes) {\n plane.setInvisible(invisible);\n }\n }\n /**\n * Add planes for z-direction clip between low and high z levels.\n * @param invisible value to apply to the `invisible` bit for the new planes\n * @param zLow low z value. The plane clips out points with z below this.\n * @param zHigh high z value. The plane clips out points with z above this.\n */\n public addZClipPlanes(invisible: boolean, zLow?: number, zHigh?: number) {\n if (zLow !== undefined)\n this._planes.push(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, 1), zLow, invisible)!);\n if (zHigh !== undefined)\n this._planes.push(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, -1), -zHigh, invisible)!);\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 from\n * the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from\n * the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ): void {\n const newInside = this.clipInsidePushOutside(xyz, outsideFragments, arrayCache);\n if (newInside)\n insideFragments.push(newInside);\n }\n /**\n * Create a convex clip set from a convex mesh.\n * * Create a plane for each facet.\n * * Assemble the planes as a single clip plane set.\n * * If the facets are closed by edge pairing, use the sign of the computed volume to point the plane normals inward.\n * * If the facets are not closed, the facet orientation determines plane orientation.\n * * The implication of this is that if the facets are a convex volume, the returned clip plane set is convex.\n * @param convexMesh input mesh. For best results, the mesh should be closed and convex.\n * @param result optional preallocated result to reuse and return\n * @return clipper and volume (zero if mesh is not closed)\n */\n public static createConvexPolyface(\n convexMesh: Polyface | PolyfaceVisitor, result?: ConvexClipPlaneSet,\n ): { clipper: ConvexClipPlaneSet, volume: number } {\n result = this.createEmpty(result);\n let vol = 0;\n if (PolyfaceQuery.isPolyfaceClosedByEdgePairing(convexMesh))\n vol = PolyfaceQuery.sumTetrahedralVolumes(convexMesh);\n const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward\n const normal = Vector3d.create();\n const plane = Plane3dByOriginAndUnitNormal.createXYPlane();\n const visitor = convexMesh instanceof Polyface ? convexMesh.createVisitor(0) : convexMesh;\n visitor.setNumWrap(0);\n for (visitor.reset(); visitor.moveToNextFacet(); ) {\n if (undefined !== PolygonOps.areaNormalGo(visitor.point, normal)) {\n normal.scaleInPlace(scale);\n if (undefined !== Plane3dByOriginAndUnitNormal.create(visitor.point.front()!, normal, plane))\n result.addPlaneToConvexSet(plane);\n }\n }\n return { clipper: result, volume: vol };\n }\n\n // FUNCTIONS SKIPPED DUE TO BSPLINES, VU, OR NON-USAGE IN NATIVE CODE----------------------------------------------------------------\n\n // Uses bsplines... skipping for now:\n // public convexAppendIntervalsFromBspline();\n\n // Uses pushing and clearing from/to a cache and added functionality for arrays. . . skipping for now\n // public convexPolygonClipInsideOutside(input: Point3d[], inside: Point3d[], outside: Point3d[], work1: Point3d[], work2: Point3d[],\n // clearOutside: boolean, distanceTolerance: number)\n}\n"]}
@@ -214,6 +214,7 @@ export * from "./polyface/BoxTopology";
214
214
  export * from "./polyface/FacetFaceData";
215
215
  export * from "./polyface/Polyface";
216
216
  export * from "./polyface/FacetLocationDetail";
217
+ export * from "./polyface/IndexedEdgeMatcher";
217
218
  export * from "./polyface/IndexedPolyfaceVisitor";
218
219
  export * from "./polyface/IndexedPolyfaceWalker";
219
220
  export * from "./polyface/multiclip/GriddedRaggedRange2dSet";
@@ -1 +1 @@
1
- {"version":3,"file":"core-geometry.d.ts","sourceRoot":"","sources":["../../src/core-geometry.ts"],"names":[],"mappings":"AAKA;;GAEG;AASH;;;GAGG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;;;;;;GASG;AAGH;;;;;;;;GAQG;AAGH;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;;;;;;GAUG;AAEH;;;GAGG;AAEH;;;GAGG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAA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