@itwin/core-geometry 5.5.0-dev.4 → 5.5.0-dev.6

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 (611) hide show
  1. package/lib/cjs/Geometry.d.ts +7 -0
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js +9 -0
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.js +2 -1
  7. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurveOps.js +4 -1
  10. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3d.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BezierCurve3d.js +14 -4
  13. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  14. package/lib/cjs/bspline/BezierCurve3dH.d.ts +2 -0
  15. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  16. package/lib/cjs/bspline/BezierCurve3dH.js +19 -3
  17. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  18. package/lib/cjs/bspline/BezierCurveBase.d.ts +8 -2
  19. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  20. package/lib/cjs/bspline/BezierCurveBase.js +10 -4
  21. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  22. package/lib/cjs/clipping/AlternatingConvexClipTree.js +4 -4
  23. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  24. package/lib/cjs/clipping/ClipPlane.d.ts +0 -3
  25. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  26. package/lib/cjs/clipping/ClipPlane.js +9 -2
  27. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  28. package/lib/cjs/clipping/ClipPrimitive.d.ts +59 -9
  29. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  30. package/lib/cjs/clipping/ClipPrimitive.js +124 -55
  31. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  32. package/lib/cjs/clipping/ClipUtils.js +1 -1
  33. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  34. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  35. package/lib/cjs/clipping/ClipVector.js +12 -8
  36. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  37. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +0 -2
  38. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  39. package/lib/cjs/clipping/ConvexClipPlaneSet.js +19 -18
  40. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  41. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +1 -1
  42. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  43. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +4 -5
  44. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  45. package/lib/cjs/core-geometry.d.ts +0 -1
  46. package/lib/cjs/core-geometry.d.ts.map +1 -1
  47. package/lib/cjs/core-geometry.js +0 -1
  48. package/lib/cjs/core-geometry.js.map +1 -1
  49. package/lib/cjs/curve/Arc3d.js +2 -2
  50. package/lib/cjs/curve/Arc3d.js.map +1 -1
  51. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +12 -4
  52. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +52 -33
  54. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  55. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  56. package/lib/cjs/curve/CurveCollection.js +13 -6
  57. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  58. package/lib/cjs/curve/CurveCurve.js +1 -1
  59. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  60. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  61. package/lib/cjs/curve/CurveFactory.js +13 -1
  62. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  63. package/lib/cjs/curve/CurveLocationDetail.d.ts +12 -4
  64. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  65. package/lib/cjs/curve/CurveLocationDetail.js +14 -5
  66. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  67. package/lib/cjs/curve/CurvePrimitive.d.ts +5 -4
  68. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  69. package/lib/cjs/curve/CurvePrimitive.js +7 -4
  70. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  71. package/lib/cjs/curve/LineString3d.d.ts +25 -16
  72. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  73. package/lib/cjs/curve/LineString3d.js +90 -72
  74. package/lib/cjs/curve/LineString3d.js.map +1 -1
  75. package/lib/cjs/curve/Path.d.ts +0 -3
  76. package/lib/cjs/curve/Path.d.ts.map +1 -1
  77. package/lib/cjs/curve/Path.js +9 -2
  78. package/lib/cjs/curve/Path.js.map +1 -1
  79. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  80. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  81. package/lib/cjs/curve/Query/PlanarSubdivision.js +25 -31
  82. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  83. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +7 -1
  84. package/lib/cjs/curve/Query/StrokeCountChain.d.ts.map +1 -1
  85. package/lib/cjs/curve/Query/StrokeCountChain.js +27 -36
  86. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  87. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  88. package/lib/cjs/curve/RegionMomentsXY.js +7 -1
  89. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  90. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  91. package/lib/cjs/curve/RegionOps.js +8 -5
  92. package/lib/cjs/curve/RegionOps.js.map +1 -1
  93. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  94. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +6 -6
  95. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  96. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  97. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js +4 -1
  98. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  100. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +6 -1
  101. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  102. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +5 -21
  103. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  104. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +29 -73
  105. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  106. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +55 -13
  107. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  108. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +238 -110
  109. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  110. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +1 -1
  111. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  112. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +1 -4
  113. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  114. package/lib/cjs/curve/spiral/DirectSpiral3d.js +9 -9
  115. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  116. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +11 -14
  117. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  118. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +18 -18
  119. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  120. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts +7 -1
  121. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  122. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  123. package/lib/cjs/geometry3d/Ellipsoid.d.ts +19 -7
  124. package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
  125. package/lib/cjs/geometry3d/Ellipsoid.js +26 -11
  126. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  127. package/lib/cjs/geometry3d/FrustumAnimation.d.ts.map +1 -1
  128. package/lib/cjs/geometry3d/FrustumAnimation.js +11 -1
  129. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  130. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +5 -1
  131. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  132. package/lib/cjs/geometry3d/GrowableFloat64Array.js +11 -1
  133. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  134. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  135. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  136. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  137. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +49 -8
  138. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  139. package/lib/cjs/geometry3d/GrowableXYZArray.js +90 -37
  140. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  141. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +100 -3
  142. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  143. package/lib/cjs/geometry3d/IndexedXYZCollection.js +125 -0
  144. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  145. package/lib/cjs/geometry3d/Matrix3d.d.ts +10 -1
  146. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  147. package/lib/cjs/geometry3d/Matrix3d.js +53 -34
  148. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  149. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +1 -1
  150. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  151. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +49 -2
  152. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  153. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +67 -9
  154. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  155. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  156. package/lib/cjs/geometry3d/Point3dVector3d.js +1 -1
  157. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  158. package/lib/cjs/geometry3d/PointStreaming.js +1 -1
  159. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  160. package/lib/cjs/geometry3d/PolygonOps.d.ts +24 -32
  161. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  162. package/lib/cjs/geometry3d/PolygonOps.js +147 -180
  163. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  164. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +5 -5
  165. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  166. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  167. package/lib/cjs/geometry3d/PolylineOps.js +13 -3
  168. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  169. package/lib/cjs/geometry3d/Range.js.map +1 -1
  170. package/lib/cjs/geometry3d/Ray3d.d.ts +0 -3
  171. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  172. package/lib/cjs/geometry3d/Ray3d.js +5 -1
  173. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  174. package/lib/cjs/geometry3d/SortablePolygon.d.ts +2 -2
  175. package/lib/cjs/geometry3d/SortablePolygon.d.ts.map +1 -1
  176. package/lib/cjs/geometry3d/SortablePolygon.js +14 -18
  177. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  178. package/lib/cjs/geometry3d/Transform.d.ts +8 -0
  179. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  180. package/lib/cjs/geometry3d/Transform.js +15 -9
  181. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  182. package/lib/cjs/numerics/ClusterableArray.d.ts +4 -2
  183. package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
  184. package/lib/cjs/numerics/ClusterableArray.js +6 -4
  185. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  186. package/lib/cjs/numerics/Newton.d.ts +3 -1
  187. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  188. package/lib/cjs/numerics/Newton.js +5 -1
  189. package/lib/cjs/numerics/Newton.js.map +1 -1
  190. package/lib/cjs/polyface/AuxData.d.ts +1 -4
  191. package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
  192. package/lib/cjs/polyface/AuxData.js +5 -1
  193. package/lib/cjs/polyface/AuxData.js.map +1 -1
  194. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js +3 -3
  195. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  196. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  197. package/lib/cjs/polyface/Polyface.js +14 -16
  198. package/lib/cjs/polyface/Polyface.js.map +1 -1
  199. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +84 -28
  200. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  201. package/lib/cjs/polyface/PolyfaceBuilder.js +277 -217
  202. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  203. package/lib/cjs/polyface/PolyfaceClip.d.ts +4 -3
  204. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  205. package/lib/cjs/polyface/PolyfaceClip.js +11 -4
  206. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  207. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  208. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  209. package/lib/cjs/polyface/PolyfaceQuery.js +9 -7
  210. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  211. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -1
  212. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js +3 -2
  213. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  214. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +1 -1
  215. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +2 -2
  216. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  217. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  218. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +14 -12
  219. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  220. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.d.ts +1 -1
  221. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  222. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +10 -6
  223. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  224. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +4 -3
  225. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  226. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  227. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +3 -5
  228. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  229. package/lib/cjs/polyface/multiclip/XYPointBuckets.d.ts +1 -1
  230. package/lib/cjs/polyface/multiclip/XYPointBuckets.d.ts.map +1 -1
  231. package/lib/cjs/polyface/multiclip/XYPointBuckets.js +4 -8
  232. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  233. package/lib/cjs/serialization/BGFBAccessors.d.ts.map +1 -1
  234. package/lib/cjs/serialization/BGFBAccessors.js +1 -0
  235. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  236. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  237. package/lib/cjs/serialization/BGFBReader.js +37 -7
  238. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  239. package/lib/cjs/serialization/BGFBWriter.d.ts +4 -4
  240. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  241. package/lib/cjs/serialization/BGFBWriter.js +24 -40
  242. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  243. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  244. package/lib/cjs/serialization/IModelJsonSchema.js +9 -3
  245. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  246. package/lib/cjs/serialization/SerializationHelpers.d.ts +0 -3
  247. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
  248. package/lib/cjs/serialization/SerializationHelpers.js +16 -7
  249. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  250. package/lib/cjs/solid/Box.d.ts +2 -2
  251. package/lib/cjs/solid/Box.d.ts.map +1 -1
  252. package/lib/cjs/solid/Box.js.map +1 -1
  253. package/lib/cjs/solid/Cone.d.ts +3 -2
  254. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  255. package/lib/cjs/solid/Cone.js +4 -1
  256. package/lib/cjs/solid/Cone.js.map +1 -1
  257. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  258. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  259. package/lib/cjs/solid/LinearSweep.js +1 -1
  260. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  261. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  262. package/lib/cjs/solid/RotationalSweep.js +1 -3
  263. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  264. package/lib/cjs/solid/TorusPipe.d.ts +4 -3
  265. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  266. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  267. package/lib/cjs/topology/ChainMerge.d.ts +4 -4
  268. package/lib/cjs/topology/ChainMerge.d.ts.map +1 -1
  269. package/lib/cjs/topology/ChainMerge.js +11 -1
  270. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  271. package/lib/cjs/topology/Graph.d.ts +2 -0
  272. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  273. package/lib/cjs/topology/Graph.js +5 -0
  274. package/lib/cjs/topology/Graph.js.map +1 -1
  275. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  276. package/lib/cjs/topology/HalfEdgeGraphSearch.js +2 -0
  277. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  278. package/lib/cjs/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  279. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +23 -16
  280. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  281. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts +20 -9
  282. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  283. package/lib/cjs/topology/HalfEdgePositionDetail.js +17 -13
  284. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  285. package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  286. package/lib/cjs/topology/HalfEdgePriorityQueue.js +3 -1
  287. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  288. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts +6 -2
  289. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  290. package/lib/cjs/topology/InsertAndRetriangulateContext.js +41 -35
  291. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  292. package/lib/cjs/topology/MaskManager.d.ts +7 -3
  293. package/lib/cjs/topology/MaskManager.d.ts.map +1 -1
  294. package/lib/cjs/topology/MaskManager.js +10 -4
  295. package/lib/cjs/topology/MaskManager.js.map +1 -1
  296. package/lib/cjs/topology/RegularizeFace.d.ts.map +1 -1
  297. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  298. package/lib/cjs/topology/Triangulation.d.ts +2 -1
  299. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  300. package/lib/cjs/topology/Triangulation.js +12 -7
  301. package/lib/cjs/topology/Triangulation.js.map +1 -1
  302. package/lib/esm/Geometry.d.ts +7 -0
  303. package/lib/esm/Geometry.d.ts.map +1 -1
  304. package/lib/esm/Geometry.js +9 -0
  305. package/lib/esm/Geometry.js.map +1 -1
  306. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  307. package/lib/esm/bspline/BSplineCurve.js +2 -1
  308. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  309. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  310. package/lib/esm/bspline/BSplineCurveOps.js +4 -1
  311. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  312. package/lib/esm/bspline/BezierCurve3d.d.ts.map +1 -1
  313. package/lib/esm/bspline/BezierCurve3d.js +14 -4
  314. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  315. package/lib/esm/bspline/BezierCurve3dH.d.ts +2 -0
  316. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  317. package/lib/esm/bspline/BezierCurve3dH.js +19 -3
  318. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  319. package/lib/esm/bspline/BezierCurveBase.d.ts +8 -2
  320. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  321. package/lib/esm/bspline/BezierCurveBase.js +10 -4
  322. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  323. package/lib/esm/clipping/AlternatingConvexClipTree.js +4 -4
  324. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  325. package/lib/esm/clipping/ClipPlane.d.ts +0 -3
  326. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  327. package/lib/esm/clipping/ClipPlane.js +9 -2
  328. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  329. package/lib/esm/clipping/ClipPrimitive.d.ts +59 -9
  330. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  331. package/lib/esm/clipping/ClipPrimitive.js +124 -55
  332. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  333. package/lib/esm/clipping/ClipUtils.js +1 -1
  334. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  335. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  336. package/lib/esm/clipping/ClipVector.js +12 -8
  337. package/lib/esm/clipping/ClipVector.js.map +1 -1
  338. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +0 -2
  339. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  340. package/lib/esm/clipping/ConvexClipPlaneSet.js +20 -19
  341. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  342. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +1 -1
  343. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  344. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +4 -5
  345. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  346. package/lib/esm/core-geometry.d.ts +0 -1
  347. package/lib/esm/core-geometry.d.ts.map +1 -1
  348. package/lib/esm/core-geometry.js +0 -1
  349. package/lib/esm/core-geometry.js.map +1 -1
  350. package/lib/esm/curve/Arc3d.js +2 -2
  351. package/lib/esm/curve/Arc3d.js.map +1 -1
  352. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +12 -4
  353. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  354. package/lib/esm/curve/CurveChainWithDistanceIndex.js +53 -34
  355. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  356. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  357. package/lib/esm/curve/CurveCollection.js +13 -6
  358. package/lib/esm/curve/CurveCollection.js.map +1 -1
  359. package/lib/esm/curve/CurveCurve.js +1 -1
  360. package/lib/esm/curve/CurveCurve.js.map +1 -1
  361. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  362. package/lib/esm/curve/CurveFactory.js +13 -1
  363. package/lib/esm/curve/CurveFactory.js.map +1 -1
  364. package/lib/esm/curve/CurveLocationDetail.d.ts +12 -4
  365. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  366. package/lib/esm/curve/CurveLocationDetail.js +14 -5
  367. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  368. package/lib/esm/curve/CurvePrimitive.d.ts +5 -4
  369. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  370. package/lib/esm/curve/CurvePrimitive.js +7 -4
  371. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  372. package/lib/esm/curve/LineString3d.d.ts +25 -16
  373. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  374. package/lib/esm/curve/LineString3d.js +90 -72
  375. package/lib/esm/curve/LineString3d.js.map +1 -1
  376. package/lib/esm/curve/Path.d.ts +0 -3
  377. package/lib/esm/curve/Path.d.ts.map +1 -1
  378. package/lib/esm/curve/Path.js +9 -2
  379. package/lib/esm/curve/Path.js.map +1 -1
  380. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  381. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  382. package/lib/esm/curve/Query/PlanarSubdivision.js +25 -31
  383. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  384. package/lib/esm/curve/Query/StrokeCountChain.d.ts +7 -1
  385. package/lib/esm/curve/Query/StrokeCountChain.d.ts.map +1 -1
  386. package/lib/esm/curve/Query/StrokeCountChain.js +27 -36
  387. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  388. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  389. package/lib/esm/curve/RegionMomentsXY.js +7 -1
  390. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  391. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  392. package/lib/esm/curve/RegionOps.js +8 -5
  393. package/lib/esm/curve/RegionOps.js.map +1 -1
  394. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  395. package/lib/esm/curve/RegionOpsClassificationSweeps.js +6 -6
  396. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  397. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  398. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js +4 -1
  399. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  400. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  401. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +6 -1
  402. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  403. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +5 -21
  404. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  405. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +29 -73
  406. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  407. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +55 -13
  408. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  409. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +239 -111
  410. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  411. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +1 -1
  412. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  413. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +1 -4
  414. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  415. package/lib/esm/curve/spiral/DirectSpiral3d.js +9 -9
  416. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  417. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +11 -14
  418. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  419. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +18 -18
  420. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  421. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts +7 -1
  422. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  423. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  424. package/lib/esm/geometry3d/Ellipsoid.d.ts +19 -7
  425. package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
  426. package/lib/esm/geometry3d/Ellipsoid.js +26 -11
  427. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  428. package/lib/esm/geometry3d/FrustumAnimation.d.ts.map +1 -1
  429. package/lib/esm/geometry3d/FrustumAnimation.js +11 -1
  430. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  431. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +5 -1
  432. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  433. package/lib/esm/geometry3d/GrowableFloat64Array.js +11 -1
  434. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  435. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  436. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  437. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  438. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +49 -8
  439. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  440. package/lib/esm/geometry3d/GrowableXYZArray.js +90 -37
  441. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  442. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +100 -3
  443. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  444. package/lib/esm/geometry3d/IndexedXYZCollection.js +125 -0
  445. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  446. package/lib/esm/geometry3d/Matrix3d.d.ts +10 -1
  447. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  448. package/lib/esm/geometry3d/Matrix3d.js +53 -34
  449. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  450. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +1 -1
  451. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  452. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +49 -2
  453. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  454. package/lib/esm/geometry3d/Point3dArrayCarrier.js +67 -9
  455. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  456. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  457. package/lib/esm/geometry3d/Point3dVector3d.js +1 -1
  458. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  459. package/lib/esm/geometry3d/PointStreaming.js +1 -1
  460. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  461. package/lib/esm/geometry3d/PolygonOps.d.ts +24 -32
  462. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  463. package/lib/esm/geometry3d/PolygonOps.js +147 -180
  464. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  465. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +5 -5
  466. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  467. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  468. package/lib/esm/geometry3d/PolylineOps.js +13 -3
  469. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  470. package/lib/esm/geometry3d/Range.js.map +1 -1
  471. package/lib/esm/geometry3d/Ray3d.d.ts +0 -3
  472. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  473. package/lib/esm/geometry3d/Ray3d.js +5 -1
  474. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  475. package/lib/esm/geometry3d/SortablePolygon.d.ts +2 -2
  476. package/lib/esm/geometry3d/SortablePolygon.d.ts.map +1 -1
  477. package/lib/esm/geometry3d/SortablePolygon.js +14 -18
  478. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  479. package/lib/esm/geometry3d/Transform.d.ts +8 -0
  480. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  481. package/lib/esm/geometry3d/Transform.js +15 -9
  482. package/lib/esm/geometry3d/Transform.js.map +1 -1
  483. package/lib/esm/numerics/ClusterableArray.d.ts +4 -2
  484. package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
  485. package/lib/esm/numerics/ClusterableArray.js +6 -4
  486. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  487. package/lib/esm/numerics/Newton.d.ts +3 -1
  488. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  489. package/lib/esm/numerics/Newton.js +5 -1
  490. package/lib/esm/numerics/Newton.js.map +1 -1
  491. package/lib/esm/polyface/AuxData.d.ts +1 -4
  492. package/lib/esm/polyface/AuxData.d.ts.map +1 -1
  493. package/lib/esm/polyface/AuxData.js +5 -1
  494. package/lib/esm/polyface/AuxData.js.map +1 -1
  495. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js +3 -3
  496. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  497. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  498. package/lib/esm/polyface/Polyface.js +14 -16
  499. package/lib/esm/polyface/Polyface.js.map +1 -1
  500. package/lib/esm/polyface/PolyfaceBuilder.d.ts +84 -28
  501. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  502. package/lib/esm/polyface/PolyfaceBuilder.js +277 -217
  503. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  504. package/lib/esm/polyface/PolyfaceClip.d.ts +4 -3
  505. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  506. package/lib/esm/polyface/PolyfaceClip.js +11 -4
  507. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  508. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  509. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  510. package/lib/esm/polyface/PolyfaceQuery.js +9 -7
  511. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  512. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -1
  513. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js +3 -2
  514. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  515. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +1 -1
  516. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +2 -2
  517. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  518. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  519. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +14 -12
  520. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  521. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.d.ts +1 -1
  522. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  523. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +10 -6
  524. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  525. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +4 -3
  526. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  527. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  528. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +3 -5
  529. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  530. package/lib/esm/polyface/multiclip/XYPointBuckets.d.ts +1 -1
  531. package/lib/esm/polyface/multiclip/XYPointBuckets.d.ts.map +1 -1
  532. package/lib/esm/polyface/multiclip/XYPointBuckets.js +4 -8
  533. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  534. package/lib/esm/serialization/BGFBAccessors.d.ts.map +1 -1
  535. package/lib/esm/serialization/BGFBAccessors.js +1 -0
  536. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  537. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  538. package/lib/esm/serialization/BGFBReader.js +37 -7
  539. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  540. package/lib/esm/serialization/BGFBWriter.d.ts +4 -4
  541. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  542. package/lib/esm/serialization/BGFBWriter.js +24 -40
  543. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  544. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  545. package/lib/esm/serialization/IModelJsonSchema.js +9 -3
  546. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  547. package/lib/esm/serialization/SerializationHelpers.d.ts +0 -3
  548. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
  549. package/lib/esm/serialization/SerializationHelpers.js +16 -7
  550. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  551. package/lib/esm/solid/Box.d.ts +2 -2
  552. package/lib/esm/solid/Box.d.ts.map +1 -1
  553. package/lib/esm/solid/Box.js.map +1 -1
  554. package/lib/esm/solid/Cone.d.ts +3 -2
  555. package/lib/esm/solid/Cone.d.ts.map +1 -1
  556. package/lib/esm/solid/Cone.js +4 -1
  557. package/lib/esm/solid/Cone.js.map +1 -1
  558. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  559. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  560. package/lib/esm/solid/LinearSweep.js +1 -1
  561. package/lib/esm/solid/LinearSweep.js.map +1 -1
  562. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  563. package/lib/esm/solid/RotationalSweep.js +1 -3
  564. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  565. package/lib/esm/solid/TorusPipe.d.ts +4 -3
  566. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  567. package/lib/esm/solid/TorusPipe.js.map +1 -1
  568. package/lib/esm/topology/ChainMerge.d.ts +4 -4
  569. package/lib/esm/topology/ChainMerge.d.ts.map +1 -1
  570. package/lib/esm/topology/ChainMerge.js +11 -1
  571. package/lib/esm/topology/ChainMerge.js.map +1 -1
  572. package/lib/esm/topology/Graph.d.ts +2 -0
  573. package/lib/esm/topology/Graph.d.ts.map +1 -1
  574. package/lib/esm/topology/Graph.js +5 -0
  575. package/lib/esm/topology/Graph.js.map +1 -1
  576. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  577. package/lib/esm/topology/HalfEdgeGraphSearch.js +2 -0
  578. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  579. package/lib/esm/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  580. package/lib/esm/topology/HalfEdgePointInGraphSearch.js +23 -16
  581. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  582. package/lib/esm/topology/HalfEdgePositionDetail.d.ts +20 -9
  583. package/lib/esm/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  584. package/lib/esm/topology/HalfEdgePositionDetail.js +17 -13
  585. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  586. package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  587. package/lib/esm/topology/HalfEdgePriorityQueue.js +4 -2
  588. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  589. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts +6 -2
  590. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  591. package/lib/esm/topology/InsertAndRetriangulateContext.js +41 -35
  592. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  593. package/lib/esm/topology/MaskManager.d.ts +7 -3
  594. package/lib/esm/topology/MaskManager.d.ts.map +1 -1
  595. package/lib/esm/topology/MaskManager.js +10 -4
  596. package/lib/esm/topology/MaskManager.js.map +1 -1
  597. package/lib/esm/topology/RegularizeFace.d.ts.map +1 -1
  598. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  599. package/lib/esm/topology/Triangulation.d.ts +2 -1
  600. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  601. package/lib/esm/topology/Triangulation.js +12 -7
  602. package/lib/esm/topology/Triangulation.js.map +1 -1
  603. package/package.json +3 -3
  604. package/lib/cjs/serialization/GeometrySamples.d.ts +0 -705
  605. package/lib/cjs/serialization/GeometrySamples.d.ts.map +0 -1
  606. package/lib/cjs/serialization/GeometrySamples.js +0 -2433
  607. package/lib/cjs/serialization/GeometrySamples.js.map +0 -1
  608. package/lib/esm/serialization/GeometrySamples.d.ts +0 -705
  609. package/lib/esm/serialization/GeometrySamples.d.ts.map +0 -1
  610. package/lib/esm/serialization/GeometrySamples.js +0 -2428
  611. package/lib/esm/serialization/GeometrySamples.js.map +0 -1
@@ -1 +1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AAS,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,WAAW,CAAC;IACrB,CAAC;IAXe,oCAAc,iBAW7B,CAAA;AACH,CAAC,EAlBgB,qBAAqB,qCAArB,qBAAqB,QAkBrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Segment1d } from \"../geometry3d/Segment1d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { BooleanClipNodeIntersection } from \"./BooleanClipNode\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { ClipMaskXYZRangePlanes, ClipPrimitive, ClipPrimitiveProps, ClipShape } from \"./ClipPrimitive\";\r\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\n\r\n/**\r\n * Wire format describing a [[ClipVector]].\r\n * @public\r\n */\r\nexport type ClipVectorProps = ClipPrimitiveProps[];\r\n\r\n/**\r\n * Class holding an array structure of shapes defined by `ClipPrimitive`\r\n * * The `ClipVector` defines an intersection of the member `ClipPrimitive` regions.\r\n * * In the most common usage, one of the `ClipPrimitive` will be an outer region, and all others are holes with marker\r\n * flag indicating that the outside of each hole is live.\r\n * @public\r\n */\r\nexport class ClipVector implements Clipper {\r\n private _clips: ClipPrimitive[];\r\n /**\r\n * Range acting as first filter.\r\n * * This is understood as overall range limit, not as precise planes.\r\n * * Applying any rotation to the whole ClipVector generally expands this range, rather than exactly transforming\r\n * its planes.\r\n */\r\n public boundingRange: Range3d = Range3d.createNull();\r\n /** Returns a reference to the array of ClipShapes. */\r\n public get clips() { return this._clips; }\r\n private constructor(clips?: ClipPrimitive[]) {\r\n this._clips = clips ? clips : [];\r\n }\r\n /** Returns true if this ClipVector contains a ClipPrimitive. */\r\n public get isValid(): boolean { return this._clips.length > 0; }\r\n /** Create a ClipVector with an empty set of ClipShapes. */\r\n public static createEmpty(result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips.length = 0;\r\n return result;\r\n }\r\n return new ClipVector();\r\n }\r\n /** Create a ClipVector from an array of ClipPrimitives (or derived classes) (capture the pointers) */\r\n public static createCapture(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips = clips;\r\n return result;\r\n }\r\n return new ClipVector(clips);\r\n }\r\n /** Create a ClipVector from (clones of) an array of ClipPrimitives */\r\n public static create(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n const clipClones: ClipPrimitive[] = [];\r\n for (const clip of clips)\r\n clipClones.push(clip.clone());\r\n return ClipVector.createCapture(clipClones, result);\r\n }\r\n /** Create a deep copy of another ClipVector */\r\n public clone(result?: ClipVector): ClipVector {\r\n const retVal = result ? result : new ClipVector();\r\n retVal._clips.length = 0;\r\n for (const clip of this._clips) {\r\n retVal._clips.push(clip.clone());\r\n }\r\n retVal.boundingRange.setFrom(this.boundingRange);\r\n return retVal;\r\n }\r\n /** Parse this ClipVector into a JSON object. */\r\n public toJSON(): ClipVectorProps {\r\n if (!this.isValid)\r\n return [];\r\n\r\n return this.clips.map((clip) => clip.toJSON());\r\n }\r\n /** Parse a JSON object into a new ClipVector. */\r\n public static fromJSON(json: ClipVectorProps | undefined, result?: ClipVector): ClipVector {\r\n result = result ? result : new ClipVector();\r\n result.clear();\r\n if (!Array.isArray(json))\r\n return result;\r\n try {\r\n for (const clip of json) {\r\n const clipPrim = ClipPrimitive.fromJSON(clip);\r\n if (clipPrim)\r\n result._clips.push(clipPrim);\r\n }\r\n } catch {\r\n result.clear();\r\n }\r\n return result;\r\n }\r\n /** Empties out the array of ClipShapes. */\r\n public clear() {\r\n this._clips.length = 0;\r\n }\r\n /** Append a deep copy of the given ClipPrimitive to this ClipVector. */\r\n public appendClone(clip: ClipPrimitive) {\r\n this._clips.push(clip.clone());\r\n }\r\n /** Append a reference of the given ClipPrimitive to this ClipVector. */\r\n public appendReference(clip: ClipPrimitive) {\r\n this._clips.push(clip);\r\n }\r\n /** Create and append a new ClipPrimitive to the array given a shape as an array of points. Returns true if successful. */\r\n public appendShape(shape: Point3d[], zLow?: number, zHigh?: number,\r\n transform?: Transform, isMask: boolean = false, invisible: boolean = false): boolean {\r\n const clip = ClipShape.createShape(shape, zLow, zHigh, transform, isMask, invisible);\r\n if (!clip)\r\n return false;\r\n this._clips.push(clip);\r\n return true;\r\n }\r\n /** Returns true if the given point lies inside all of this ClipVector's ClipShapes (by rule of intersection).*/\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n return this.isPointOnOrInside(point, onTolerance);\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n if (!this.boundingRange.isNull && !this.boundingRange.containsPoint(point))\r\n return false;\r\n\r\n for (const clip of this._clips) {\r\n if (!clip.pointInside(point, onTolerance))\r\n return false;\r\n }\r\n return true;\r\n }\r\n // Proxy object to implement line and arc clip.\r\n private _clipNodeProxy?: BooleanClipNodeIntersection;\r\n private ensureProxyClipNode(): boolean {\r\n if (this._clipNodeProxy)\r\n return true;\r\n this._clipNodeProxy = new BooleanClipNodeIntersection(true);\r\n let numChildren = 0;\r\n for (const child of this._clips) {\r\n const q = child.fetchClipPlanesRef();\r\n if (q) {\r\n numChildren++;\r\n this._clipNodeProxy.captureChild(q);\r\n }\r\n }\r\n return numChildren > 0;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n return this._clipNodeProxy.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\r\n return false;\r\n }\r\n /** Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n return this._clipNodeProxy.announceClippedArcIntervals(arc, announce);\r\n return false;\r\n }\r\n /** Execute polygon clip as intersection of the child primitives. */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache) {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n this._clipNodeProxy.appendPolygonClip(xyz, insideFragments, outsideFragments, arrayCache);\r\n }\r\n /**\r\n * Transforms this ClipVector to a new coordinate-system.\r\n * Note that if the transform has rotate and scale the boundingRange member expands.\r\n * Returns true if successful.\r\n */\r\n public transformInPlace(transform: Transform): boolean {\r\n for (const clip of this._clips)\r\n if (clip.transformInPlace(transform) === false)\r\n return false;\r\n\r\n if (!this.boundingRange.isNull)\r\n transform.multiplyRange(this.boundingRange, this.boundingRange);\r\n\r\n return true;\r\n }\r\n /**\r\n * A simple way of packaging this ClipVector's ClipShape points into a multidimensional array, while also\r\n * taking into account each ClipPrimitive's individual transforms.\r\n * ClipPrimitives OTHER THAN ClipShape are ignored.\r\n * Information out:\r\n * - All of the loop points are stored in the multidimensional Point3d array given (will return unchanged upon failure).\r\n * - If given a transform, will be set from the transformFromClip of the first ClipPrimitive.\r\n * - The ClipMask of the final ClipPrimitive is stored in the returned array at index 0.\r\n * - The last valid zLow found is stored in the returned array at index 1.\r\n * - The last valid zHigh found is stored in the returned array at index 2.\r\n */\r\n public extractBoundaryLoops(loopPoints: Point3d[][], transform?: Transform): number[] {\r\n let clipM = ClipMaskXYZRangePlanes.None;\r\n let zBack = -Number.MAX_VALUE;\r\n let zFront = Number.MAX_VALUE;\r\n const retVal: number[] = [];\r\n let nLoops = 0;\r\n\r\n if (this._clips.length === 0)\r\n return retVal;\r\n let firstClipShape: ClipShape | undefined;\r\n const deltaTrans = Transform.createIdentity();\r\n\r\n for (const clip of this._clips) {\r\n if (clip instanceof ClipShape) {\r\n if (firstClipShape !== undefined && clip !== firstClipShape) { // Is not the first iteration\r\n let fwdTrans = Transform.createIdentity();\r\n let invTrans = Transform.createIdentity();\r\n\r\n if (firstClipShape.transformValid && clip.transformValid) {\r\n fwdTrans = clip.transformFromClip!.clone();\r\n invTrans = firstClipShape.transformToClip!.clone();\r\n }\r\n deltaTrans.setFrom(invTrans.multiplyTransformTransform(fwdTrans));\r\n }\r\n if (!firstClipShape)\r\n firstClipShape = clip;\r\n loopPoints[nLoops] = [];\r\n\r\n if (clip.polygon !== undefined) {\r\n clipM = ClipMaskXYZRangePlanes.XAndY;\r\n\r\n if (clip.zHighValid) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZHigh;\r\n zFront = clip.zHigh!;\r\n }\r\n if (clip.zLowValid) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZLow;\r\n zBack = clip.zLow!;\r\n }\r\n\r\n for (const point of clip.polygon)\r\n loopPoints[nLoops].push(point.clone());\r\n deltaTrans.multiplyPoint3dArray(loopPoints[nLoops], loopPoints[nLoops]);\r\n nLoops++;\r\n }\r\n }\r\n }\r\n retVal.push(clipM);\r\n retVal.push(zBack);\r\n retVal.push(zFront);\r\n if (transform && firstClipShape)\r\n transform.setFrom(firstClipShape.transformFromClip!);\r\n return retVal;\r\n }\r\n /** Sets this ClipVector and all of its members to the visibility specified. */\r\n public setInvisible(invisible: boolean) {\r\n for (const clip of this._clips)\r\n clip.setInvisible(invisible);\r\n }\r\n /**\r\n * For every clip, parse the member point array into the member clip plane object (only for clipPlanes member,\r\n * not the mask)\r\n */\r\n public parseClipPlanes() {\r\n for (const clip of this._clips)\r\n clip.fetchClipPlanesRef();\r\n }\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n * @returns false if matrix inversion fails.\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n // no inverse necessary -- lower level cannot fail.\r\n for (const clip of this._clips)\r\n clip.multiplyPlanesByMatrix4d(matrix, false, transpose);\r\n return true;\r\n }\r\n /**\r\n * Determines whether the given points fall inside or outside this set of ClipShapes. If any set is defined\r\n * by masking planes, checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the\r\n * _clipPlanes member.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreMasks: boolean = false): ClipPlaneContainment {\r\n let currentContainment = ClipPlaneContainment.Ambiguous;\r\n\r\n for (const primitive of this._clips) {\r\n const thisContainment = primitive.classifyPointContainment(points, ignoreMasks);\r\n\r\n if (ClipPlaneContainment.Ambiguous === thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n\r\n if (ClipPlaneContainment.Ambiguous === currentContainment)\r\n currentContainment = thisContainment;\r\n else if (currentContainment !== thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return currentContainment;\r\n }\r\n /**\r\n * Determines whether a 3D range lies inside or outside this set of ClipShapes. If any set is defined by masking planes,\r\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the clip planes member.\r\n */\r\n public classifyRangeContainment(range: Range3d, ignoreMasks: boolean): ClipPlaneContainment {\r\n const corners: Point3d[] = range.corners();\r\n return this.classifyPointContainment(corners, ignoreMasks);\r\n }\r\n /**\r\n * For an array of points (making up a LineString), tests whether the segment between each point lies inside the\r\n * ClipVector.\r\n * If true, returns true immediately.\r\n */\r\n public isAnyLineStringPointInside(points: Point3d[]): boolean {\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n if (clipPlaneSet.isAnyPointInOrOnFromSegment(segment))\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n /** Note: Line segments are used to represent 1 dimensional intervals here, rather than segments. */\r\n public sumSizes(intervals: Segment1d[], begin: number, end: number): number {\r\n let s = 0.0;\r\n for (let i = begin; i < end; i++)\r\n s += (intervals[i].x1 - intervals[i].x0);\r\n return s;\r\n }\r\n private static readonly _TARGET_FRACTION_SUM = 0.99999999;\r\n /**\r\n * For an array of points that make up a LineString, develops a line segment between each point pair,\r\n * and returns true if all segments lie inside this ClipVector.\r\n */\r\n public isLineStringCompletelyContained(points: Point3d[]): boolean {\r\n const clipIntervals: Segment1d[] = [];\r\n\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n let fractionSum = 0.0;\r\n let index0 = 0;\r\n\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n clipPlaneSet.appendIntervalsFromSegment(segment, clipIntervals);\r\n const index1 = clipIntervals.length;\r\n fractionSum += this.sumSizes(clipIntervals, index0, index1);\r\n index0 = index1;\r\n // ASSUME primitives are non-overlapping...\r\n if (fractionSum >= ClipVector._TARGET_FRACTION_SUM)\r\n break;\r\n }\r\n }\r\n if (fractionSum < ClipVector._TARGET_FRACTION_SUM)\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Serializes this ClipVector to a compact string representation appropriate for transmission as part of a URL.\r\n * Chiefly used for requesting [Tile]($frontend)s with section cut facets.\r\n * UnionOfConvexClipPlaneSets is obtained for each ClipPrimitive. The encoding is as follows:\r\n * ClipVector:\r\n * ClipPrimitive[]\r\n * _\r\n * ClipPrimitive:\r\n * invisible: 0|1\r\n * ConvexClipPlaneSet[]\r\n * _\r\n * ConvexClipPlaneSet:\r\n * ClipPlane[]\r\n * _\r\n * ClipPlane:\r\n * flags: 0|1|2|3, where 1=invisible and 2=interior\r\n * inwardNormal: Number[3]\r\n * distance: Number\r\n * Number:\r\n * number\r\n * _\r\n */\r\n public toCompactString(): string {\r\n function formatNumber(num: number) {\r\n return `${num.toString()}_`;\r\n }\r\n function formatVector3d(vec: Vector3d) {\r\n return `${formatNumber(vec.x)}${formatNumber(vec.y)}${formatNumber(vec.z)}`;\r\n }\r\n function formatFlags(flags: number) {\r\n const f = flags.toString();\r\n assert(1 === f.length);\r\n return f;\r\n }\r\n function formatPlane(plane: ClipPlane) {\r\n let flags = plane.invisible ? 1 : 0;\r\n flags |= (plane.interior ? 2 : 0);\r\n return `${formatFlags(flags)}${formatVector3d(plane.inwardNormalRef)}${formatNumber(plane.distance)}`;\r\n }\r\n function formatPlaneSet(set: ConvexClipPlaneSet) {\r\n let planes = \"\";\r\n for (const plane of set.planes)\r\n planes = `${planes}${formatPlane(plane)}`;\r\n\r\n return `${planes}_`;\r\n }\r\n function formatPrimitive(prim: ClipPrimitive) {\r\n const flags = prim.invisible ? 1 : 0;\r\n let str = flags.toString();\r\n assert(1 === str.length);\r\n\r\n const union = prim.fetchClipPlanesRef();\r\n if (union) {\r\n for (const s of union.convexSets)\r\n str = `${str}${formatPlaneSet(s)}`;\r\n }\r\n return `${str}_`;\r\n }\r\n let result = \"\";\r\n for (const primitive of this.clips)\r\n result = `${result}${formatPrimitive(primitive)}`;\r\n return `${result}_`;\r\n }\r\n}\r\n\r\n/**\r\n * Bundles a [[ClipVector]] with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @see [[StringifiedClipVector.fromClipVector]] to create from a ClipVector.\r\n * @see [[ClipVector.toCompactString]] for a description of the string representation.\r\n * @alpha\r\n */\r\nexport type StringifiedClipVector = ClipVector & { readonly clipString: string };\r\n\r\n/**\r\n * Bundles a ClipVector with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @alpha\r\n */\r\nexport namespace StringifiedClipVector { // eslint-disable-line @typescript-eslint/no-redeclare\r\n /** Create from a ClipVector.\r\n * @param clip The ClipVector to stringify.\r\n * @returns The input ClipVector with its compact string representation, or undefined if the input is undefined or empty.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n */\r\n export function fromClipVector(clip?: ClipVector): StringifiedClipVector | undefined {\r\n if (!clip || !clip.isValid)\r\n return undefined;\r\n\r\n const ret = clip as any;\r\n if (undefined === ret.clipString)\r\n ret.clipString = clip.toCompactString();\r\n\r\n const stringified = ret as StringifiedClipVector;\r\n assert(undefined !== stringified.clipString);\r\n return stringified;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AAG,IAAW,CAAC;QACxB,IAAI,SAAS,KAAK,GAAG,CAAC,UAAU;YAC9B,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE1C,MAAM,WAAW,GAAG,GAA4B,CAAC;QACjD,IAAA,qBAAM,EAAC,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,WAAW,CAAC;IACrB,CAAC;IAXe,oCAAc,iBAW7B,CAAA;AACH,CAAC,EAlBgB,qBAAqB,qCAArB,qBAAqB,QAkBrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Segment1d } from \"../geometry3d/Segment1d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { BooleanClipNodeIntersection } from \"./BooleanClipNode\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { ClipMaskXYZRangePlanes, ClipPrimitive, ClipPrimitiveProps, ClipShape } from \"./ClipPrimitive\";\r\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\n\r\n/**\r\n * Wire format describing a [[ClipVector]].\r\n * @public\r\n */\r\nexport type ClipVectorProps = ClipPrimitiveProps[];\r\n\r\n/**\r\n * Class holding an array structure of shapes defined by `ClipPrimitive`\r\n * * The `ClipVector` defines an intersection of the member `ClipPrimitive` regions.\r\n * * In the most common usage, one of the `ClipPrimitive` will be an outer region, and all others are holes with marker\r\n * flag indicating that the outside of each hole is live.\r\n * @public\r\n */\r\nexport class ClipVector implements Clipper {\r\n private _clips: ClipPrimitive[];\r\n /**\r\n * Range acting as first filter.\r\n * * This is understood as overall range limit, not as precise planes.\r\n * * Applying any rotation to the whole ClipVector generally expands this range, rather than exactly transforming\r\n * its planes.\r\n */\r\n public boundingRange: Range3d = Range3d.createNull();\r\n /** Returns a reference to the array of ClipShapes. */\r\n public get clips() { return this._clips; }\r\n private constructor(clips?: ClipPrimitive[]) {\r\n this._clips = clips ? clips : [];\r\n }\r\n /** Returns true if this ClipVector contains a ClipPrimitive. */\r\n public get isValid(): boolean { return this._clips.length > 0; }\r\n /** Create a ClipVector with an empty set of ClipShapes. */\r\n public static createEmpty(result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips.length = 0;\r\n return result;\r\n }\r\n return new ClipVector();\r\n }\r\n /** Create a ClipVector from an array of ClipPrimitives (or derived classes) (capture the pointers) */\r\n public static createCapture(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips = clips;\r\n return result;\r\n }\r\n return new ClipVector(clips);\r\n }\r\n /** Create a ClipVector from (clones of) an array of ClipPrimitives */\r\n public static create(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n const clipClones: ClipPrimitive[] = [];\r\n for (const clip of clips)\r\n clipClones.push(clip.clone());\r\n return ClipVector.createCapture(clipClones, result);\r\n }\r\n /** Create a deep copy of another ClipVector */\r\n public clone(result?: ClipVector): ClipVector {\r\n const retVal = result ? result : new ClipVector();\r\n retVal._clips.length = 0;\r\n for (const clip of this._clips) {\r\n retVal._clips.push(clip.clone());\r\n }\r\n retVal.boundingRange.setFrom(this.boundingRange);\r\n return retVal;\r\n }\r\n /** Parse this ClipVector into a JSON object. */\r\n public toJSON(): ClipVectorProps {\r\n if (!this.isValid)\r\n return [];\r\n\r\n return this.clips.map((clip) => clip.toJSON());\r\n }\r\n /** Parse a JSON object into a new ClipVector. */\r\n public static fromJSON(json: ClipVectorProps | undefined, result?: ClipVector): ClipVector {\r\n result = result ? result : new ClipVector();\r\n result.clear();\r\n if (!Array.isArray(json))\r\n return result;\r\n try {\r\n for (const clip of json) {\r\n const clipPrim = ClipPrimitive.fromJSON(clip);\r\n if (clipPrim)\r\n result._clips.push(clipPrim);\r\n }\r\n } catch {\r\n result.clear();\r\n }\r\n return result;\r\n }\r\n /** Empties out the array of ClipShapes. */\r\n public clear() {\r\n this._clips.length = 0;\r\n }\r\n /** Append a deep copy of the given ClipPrimitive to this ClipVector. */\r\n public appendClone(clip: ClipPrimitive) {\r\n this._clips.push(clip.clone());\r\n }\r\n /** Append a reference of the given ClipPrimitive to this ClipVector. */\r\n public appendReference(clip: ClipPrimitive) {\r\n this._clips.push(clip);\r\n }\r\n /** Create and append a new ClipPrimitive to the array given a shape as an array of points. Returns true if successful. */\r\n public appendShape(shape: Point3d[], zLow?: number, zHigh?: number,\r\n transform?: Transform, isMask: boolean = false, invisible: boolean = false): boolean {\r\n const clip = ClipShape.createShape(shape, zLow, zHigh, transform, isMask, invisible);\r\n if (!clip)\r\n return false;\r\n this._clips.push(clip);\r\n return true;\r\n }\r\n /** Returns true if the given point lies inside all of this ClipVector's ClipShapes (by rule of intersection).*/\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n return this.isPointOnOrInside(point, onTolerance);\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n if (!this.boundingRange.isNull && !this.boundingRange.containsPoint(point))\r\n return false;\r\n\r\n for (const clip of this._clips) {\r\n if (!clip.pointInside(point, onTolerance))\r\n return false;\r\n }\r\n return true;\r\n }\r\n // Proxy object to implement line and arc clip.\r\n private _clipNodeProxy?: BooleanClipNodeIntersection;\r\n private ensureProxyClipNode(): boolean {\r\n if (this._clipNodeProxy)\r\n return true;\r\n this._clipNodeProxy = new BooleanClipNodeIntersection(true);\r\n let numChildren = 0;\r\n for (const child of this._clips) {\r\n const q = child.fetchClipPlanesRef();\r\n if (q) {\r\n numChildren++;\r\n this._clipNodeProxy.captureChild(q);\r\n }\r\n }\r\n return numChildren > 0;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n return this._clipNodeProxy.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\r\n return false;\r\n }\r\n /** Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n return this._clipNodeProxy.announceClippedArcIntervals(arc, announce);\r\n return false;\r\n }\r\n /** Execute polygon clip as intersection of the child primitives. */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache) {\r\n this.ensureProxyClipNode();\r\n if (this._clipNodeProxy)\r\n this._clipNodeProxy.appendPolygonClip(xyz, insideFragments, outsideFragments, arrayCache);\r\n }\r\n /**\r\n * Transforms this ClipVector to a new coordinate-system.\r\n * Note that if the transform has rotate and scale the boundingRange member expands.\r\n * Returns true if successful.\r\n */\r\n public transformInPlace(transform: Transform): boolean {\r\n for (const clip of this._clips)\r\n if (clip.transformInPlace(transform) === false)\r\n return false;\r\n\r\n if (!this.boundingRange.isNull)\r\n transform.multiplyRange(this.boundingRange, this.boundingRange);\r\n\r\n return true;\r\n }\r\n /**\r\n * A simple way of packaging this ClipVector's ClipShape points into a multidimensional array, while also\r\n * taking into account each ClipPrimitive's individual transforms.\r\n * ClipPrimitives OTHER THAN ClipShape are ignored.\r\n * Information out:\r\n * - All of the loop points are stored in the multidimensional Point3d array given (will return unchanged upon failure).\r\n * - If given a transform, will be set from the transformFromClip of the first ClipPrimitive.\r\n * - The ClipMask of the final ClipPrimitive is stored in the returned array at index 0.\r\n * - The last valid zLow found is stored in the returned array at index 1.\r\n * - The last valid zHigh found is stored in the returned array at index 2.\r\n */\r\n public extractBoundaryLoops(loopPoints: Point3d[][], transform?: Transform): number[] {\r\n let clipM = ClipMaskXYZRangePlanes.None;\r\n let zBack = -Number.MAX_VALUE;\r\n let zFront = Number.MAX_VALUE;\r\n const retVal: number[] = [];\r\n let nLoops = 0;\r\n\r\n if (this._clips.length === 0)\r\n return retVal;\r\n let firstClipShape: ClipShape | undefined;\r\n const fwdTrans = Transform.createIdentity();\r\n const invTrans = Transform.createIdentity();\r\n const deltaTrans = Transform.createIdentity();\r\n\r\n for (const clip of this._clips) {\r\n if (clip instanceof ClipShape) {\r\n if (firstClipShape !== undefined && clip !== firstClipShape) { // Is not the first iteration\r\n fwdTrans.setIdentity();\r\n invTrans.setIdentity();\r\n\r\n if (firstClipShape.hasTransformToClip()) {\r\n if (clip.hasTransformFromClip()) {\r\n clip.transformFromClip.clone(fwdTrans);\r\n firstClipShape.transformToClip.clone(invTrans);\r\n }\r\n }\r\n deltaTrans.setFrom(invTrans.multiplyTransformTransform(fwdTrans));\r\n }\r\n if (!firstClipShape)\r\n firstClipShape = clip;\r\n loopPoints[nLoops] = [];\r\n\r\n if (clip.polygon !== undefined) {\r\n clipM = ClipMaskXYZRangePlanes.XAndY;\r\n\r\n if (clip.hasZHigh()) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZHigh;\r\n zFront = clip.zHigh;\r\n }\r\n if (clip.hasZLow()) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZLow;\r\n zBack = clip.zLow;\r\n }\r\n\r\n for (const point of clip.polygon)\r\n loopPoints[nLoops].push(point.clone());\r\n deltaTrans.multiplyPoint3dArray(loopPoints[nLoops], loopPoints[nLoops]);\r\n nLoops++;\r\n }\r\n }\r\n }\r\n retVal.push(clipM);\r\n retVal.push(zBack);\r\n retVal.push(zFront);\r\n if (transform && firstClipShape && firstClipShape.hasTransformFromClip())\r\n transform.setFrom(firstClipShape.transformFromClip);\r\n return retVal;\r\n }\r\n /** Sets this ClipVector and all of its members to the visibility specified. */\r\n public setInvisible(invisible: boolean) {\r\n for (const clip of this._clips)\r\n clip.setInvisible(invisible);\r\n }\r\n /**\r\n * For every clip, parse the member point array into the member clip plane object (only for clipPlanes member,\r\n * not the mask)\r\n */\r\n public parseClipPlanes() {\r\n for (const clip of this._clips)\r\n clip.fetchClipPlanesRef();\r\n }\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n * @returns false if matrix inversion fails.\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n // no inverse necessary -- lower level cannot fail.\r\n for (const clip of this._clips)\r\n clip.multiplyPlanesByMatrix4d(matrix, false, transpose);\r\n return true;\r\n }\r\n /**\r\n * Determines whether the given points fall inside or outside this set of ClipShapes. If any set is defined\r\n * by masking planes, checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the\r\n * _clipPlanes member.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreMasks: boolean = false): ClipPlaneContainment {\r\n let currentContainment = ClipPlaneContainment.Ambiguous;\r\n\r\n for (const primitive of this._clips) {\r\n const thisContainment = primitive.classifyPointContainment(points, ignoreMasks);\r\n\r\n if (ClipPlaneContainment.Ambiguous === thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n\r\n if (ClipPlaneContainment.Ambiguous === currentContainment)\r\n currentContainment = thisContainment;\r\n else if (currentContainment !== thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return currentContainment;\r\n }\r\n /**\r\n * Determines whether a 3D range lies inside or outside this set of ClipShapes. If any set is defined by masking planes,\r\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the clip planes member.\r\n */\r\n public classifyRangeContainment(range: Range3d, ignoreMasks: boolean): ClipPlaneContainment {\r\n const corners: Point3d[] = range.corners();\r\n return this.classifyPointContainment(corners, ignoreMasks);\r\n }\r\n /**\r\n * For an array of points (making up a LineString), tests whether the segment between each point lies inside the\r\n * ClipVector.\r\n * If true, returns true immediately.\r\n */\r\n public isAnyLineStringPointInside(points: Point3d[]): boolean {\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n if (clipPlaneSet.isAnyPointInOrOnFromSegment(segment))\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n /** Note: Line segments are used to represent 1 dimensional intervals here, rather than segments. */\r\n public sumSizes(intervals: Segment1d[], begin: number, end: number): number {\r\n let s = 0.0;\r\n for (let i = begin; i < end; i++)\r\n s += (intervals[i].x1 - intervals[i].x0);\r\n return s;\r\n }\r\n private static readonly _TARGET_FRACTION_SUM = 0.99999999;\r\n /**\r\n * For an array of points that make up a LineString, develops a line segment between each point pair,\r\n * and returns true if all segments lie inside this ClipVector.\r\n */\r\n public isLineStringCompletelyContained(points: Point3d[]): boolean {\r\n const clipIntervals: Segment1d[] = [];\r\n\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n let fractionSum = 0.0;\r\n let index0 = 0;\r\n\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n clipPlaneSet.appendIntervalsFromSegment(segment, clipIntervals);\r\n const index1 = clipIntervals.length;\r\n fractionSum += this.sumSizes(clipIntervals, index0, index1);\r\n index0 = index1;\r\n // ASSUME primitives are non-overlapping...\r\n if (fractionSum >= ClipVector._TARGET_FRACTION_SUM)\r\n break;\r\n }\r\n }\r\n if (fractionSum < ClipVector._TARGET_FRACTION_SUM)\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Serializes this ClipVector to a compact string representation appropriate for transmission as part of a URL.\r\n * Chiefly used for requesting [Tile]($frontend)s with section cut facets.\r\n * UnionOfConvexClipPlaneSets is obtained for each ClipPrimitive. The encoding is as follows:\r\n * ClipVector:\r\n * ClipPrimitive[]\r\n * _\r\n * ClipPrimitive:\r\n * invisible: 0|1\r\n * ConvexClipPlaneSet[]\r\n * _\r\n * ConvexClipPlaneSet:\r\n * ClipPlane[]\r\n * _\r\n * ClipPlane:\r\n * flags: 0|1|2|3, where 1=invisible and 2=interior\r\n * inwardNormal: Number[3]\r\n * distance: Number\r\n * Number:\r\n * number\r\n * _\r\n */\r\n public toCompactString(): string {\r\n function formatNumber(num: number) {\r\n return `${num.toString()}_`;\r\n }\r\n function formatVector3d(vec: Vector3d) {\r\n return `${formatNumber(vec.x)}${formatNumber(vec.y)}${formatNumber(vec.z)}`;\r\n }\r\n function formatFlags(flags: number) {\r\n const f = flags.toString();\r\n assert(1 === f.length);\r\n return f;\r\n }\r\n function formatPlane(plane: ClipPlane) {\r\n let flags = plane.invisible ? 1 : 0;\r\n flags |= (plane.interior ? 2 : 0);\r\n return `${formatFlags(flags)}${formatVector3d(plane.inwardNormalRef)}${formatNumber(plane.distance)}`;\r\n }\r\n function formatPlaneSet(set: ConvexClipPlaneSet) {\r\n let planes = \"\";\r\n for (const plane of set.planes)\r\n planes = `${planes}${formatPlane(plane)}`;\r\n\r\n return `${planes}_`;\r\n }\r\n function formatPrimitive(prim: ClipPrimitive) {\r\n const flags = prim.invisible ? 1 : 0;\r\n let str = flags.toString();\r\n assert(1 === str.length);\r\n\r\n const union = prim.fetchClipPlanesRef();\r\n if (union) {\r\n for (const s of union.convexSets)\r\n str = `${str}${formatPlaneSet(s)}`;\r\n }\r\n return `${str}_`;\r\n }\r\n let result = \"\";\r\n for (const primitive of this.clips)\r\n result = `${result}${formatPrimitive(primitive)}`;\r\n return `${result}_`;\r\n }\r\n}\r\n\r\n/**\r\n * Bundles a [[ClipVector]] with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @see [[StringifiedClipVector.fromClipVector]] to create from a ClipVector.\r\n * @see [[ClipVector.toCompactString]] for a description of the string representation.\r\n * @alpha\r\n */\r\nexport type StringifiedClipVector = ClipVector & { readonly clipString: string };\r\n\r\n/**\r\n * Bundles a ClipVector with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @alpha\r\n */\r\nexport namespace StringifiedClipVector { // eslint-disable-line @typescript-eslint/no-redeclare\r\n /** Create from a ClipVector.\r\n * @param clip The ClipVector to stringify.\r\n * @returns The input ClipVector with its compact string representation, or undefined if the input is undefined or empty.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n */\r\n export function fromClipVector(clip?: ClipVector): StringifiedClipVector | undefined {\r\n if (!clip || !clip.isValid)\r\n return undefined;\r\n\r\n const ret = clip as any;\r\n if (undefined === ret.clipString)\r\n ret.clipString = clip.toCompactString();\r\n\r\n const stringified = ret as StringifiedClipVector;\r\n assert(undefined !== stringified.clipString);\r\n return stringified;\r\n }\r\n}\r\n"]}
@@ -93,8 +93,6 @@ export declare class ConvexClipPlaneSet implements Clipper, PolygonClipper {
93
93
  * Set (or reset) a plane and ConvexClipPlaneSet for a convex array, such as a convex facet used for xy clip.
94
94
  * * The planeOfPolygon is (re)initialized with the normal from 3 points, but not otherwise referenced.
95
95
  * * The ConvexClipPlaneSet is filled with outward normals of the facet edges as viewed to xy plane.
96
- * @param points
97
- * @param result
98
96
  */
99
97
  static setPlaneAndXYLoopCCW(points: GrowableXYZArray, planeOfPolygon: ClipPlane, frustum: ConvexClipPlaneSet): void;
100
98
  /** Deep clone of all planes. */
@@ -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,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAA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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;CA6BnD"}
@@ -105,18 +105,19 @@ class ConvexClipPlaneSet {
105
105
  */
106
106
  static createRange3dPlanes(range, lowX = true, highX = true, lowY = true, highY = true, lowZ = true, highZ = true) {
107
107
  const result = ConvexClipPlaneSet.createEmpty();
108
+ // all normals are nonzero, so ClipPlane creation can only fail on out-of-memory
108
109
  if (lowX)
109
- result.planes.push(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(1, 0, 0, range.low.x, 0, 0));
110
+ result.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(1, 0, 0, range.low.x, 0, 0));
110
111
  if (highX)
111
- result.planes.push(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(-1, 0, 0, range.high.x, 0, 0));
112
+ result.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(-1, 0, 0, range.high.x, 0, 0));
112
113
  if (lowY)
113
- result.planes.push(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, 1, 0, 0, range.low.y, 0));
114
+ result.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, 1, 0, 0, range.low.y, 0));
114
115
  if (highY)
115
- result.planes.push(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, -1, 0, 0, range.high.y, 0));
116
+ result.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, -1, 0, 0, range.high.y, 0));
116
117
  if (lowZ)
117
- result.planes.push(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, range.low.z));
118
+ result.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, range.low.z));
118
119
  if (highZ)
119
- result.planes.push(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, 0, -1, 0, 0, range.high.z));
120
+ result.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(0, 0, -1, 0, 0, range.high.z));
120
121
  return result;
121
122
  }
122
123
  /** Create an empty `ConvexClipPlaneSet` */
@@ -203,8 +204,6 @@ class ConvexClipPlaneSet {
203
204
  * Set (or reset) a plane and ConvexClipPlaneSet for a convex array, such as a convex facet used for xy clip.
204
205
  * * The planeOfPolygon is (re)initialized with the normal from 3 points, but not otherwise referenced.
205
206
  * * The ConvexClipPlaneSet is filled with outward normals of the facet edges as viewed to xy plane.
206
- * @param points
207
- * @param result
208
207
  */
209
208
  static setPlaneAndXYLoopCCW(points, planeOfPolygon, frustum) {
210
209
  const i0 = points.length - 1;
@@ -215,8 +214,8 @@ class ConvexClipPlaneSet {
215
214
  frustum._planes.length = 0;
216
215
  const z0 = points.getZAtUncheckedPointIndex(i0); // z for planes can stay fixed
217
216
  const planeNormal = points.crossProductIndexIndexIndex(0, 2, 1);
218
- ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(planeNormal.x, planeNormal.y, planeNormal.z, x0, y0, z0, false, false, planeOfPolygon);
219
- if (planeNormal.normalizeInPlace()) {
217
+ if (planeNormal?.normalizeInPlace()) {
218
+ ClipPlane_1.ClipPlane.createNormalAndPointXYZXYZ(planeNormal.x, planeNormal.y, planeNormal.z, x0, y0, z0, false, false, planeOfPolygon);
220
219
  for (let i1 = 0; i1 < n; i1++, x0 = x1, y0 = y1) {
221
220
  x1 = points.getXAtUncheckedPointIndex(i1);
222
221
  y1 = points.getYAtUncheckedPointIndex(i1);
@@ -672,6 +671,7 @@ class ConvexClipPlaneSet {
672
671
  computePlanePlanePlaneIntersections(points, rangeToExtend, transform, testContainment = true) {
673
672
  const normalRows = Matrix3d_1.Matrix3d.createIdentity();
674
673
  const allPlanes = this._planes;
674
+ const xyz = Point3dVector3d_1.Point3d.createZero();
675
675
  const n = allPlanes.length;
676
676
  let numPoints = 0; // explicitly count points -- can't wait to end for points.length because it may be an optional output.
677
677
  for (let i = 0; i < n; i++) {
@@ -679,13 +679,13 @@ class ConvexClipPlaneSet {
679
679
  for (let k = j + 1; k < n; k++) {
680
680
  Matrix3d_1.Matrix3d.createRowValues(allPlanes[i].inwardNormalRef.x, allPlanes[i].inwardNormalRef.y, allPlanes[i].inwardNormalRef.z, allPlanes[j].inwardNormalRef.x, allPlanes[j].inwardNormalRef.y, allPlanes[j].inwardNormalRef.z, allPlanes[k].inwardNormalRef.x, allPlanes[k].inwardNormalRef.y, allPlanes[k].inwardNormalRef.z, normalRows);
681
681
  if (normalRows.computeCachedInverse(false)) {
682
- const xyz = normalRows.multiplyInverseXYZAsPoint3d(allPlanes[i].distance, allPlanes[j].distance, allPlanes[k].distance);
682
+ normalRows.multiplyInverseXYZAsPoint3d(allPlanes[i].distance, allPlanes[j].distance, allPlanes[k].distance, xyz);
683
683
  if (!testContainment || this.isPointOnOrInside(xyz, Geometry_1.Geometry.smallMetricDistance)) {
684
684
  numPoints++;
685
685
  if (transform)
686
686
  transform.multiplyPoint3d(xyz, xyz);
687
687
  if (points)
688
- points.push(xyz);
688
+ points.push(xyz.clone());
689
689
  if (rangeToExtend)
690
690
  rangeToExtend.extendPoint(xyz);
691
691
  }
@@ -711,9 +711,9 @@ class ConvexClipPlaneSet {
711
711
  */
712
712
  addZClipPlanes(invisible, zLow, zHigh) {
713
713
  if (zLow !== undefined)
714
- this._planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(Point3dVector3d_1.Vector3d.create(0, 0, 1), zLow, invisible));
714
+ this.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(Point3dVector3d_1.Vector3d.create(0, 0, 1), zLow, invisible));
715
715
  if (zHigh !== undefined)
716
- this._planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(Point3dVector3d_1.Vector3d.create(0, 0, -1), -zHigh, invisible));
716
+ this.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(Point3dVector3d_1.Vector3d.create(0, 0, -1), -zHigh, invisible));
717
717
  }
718
718
  /**
719
719
  * Implement appendPolygonClip, as defined in interface PolygonClipper.
@@ -747,15 +747,16 @@ class ConvexClipPlaneSet {
747
747
  if (PolyfaceQuery_1.PolyfaceQuery.isPolyfaceClosedByEdgePairing(convexMesh))
748
748
  vol = PolyfaceQuery_1.PolyfaceQuery.sumTetrahedralVolumes(convexMesh);
749
749
  const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward
750
- const normal = Point3dVector3d_1.Vector3d.create();
750
+ const origin = Point3dVector3d_1.Point3d.createZero();
751
+ const normal = Point3dVector3d_1.Vector3d.createZero();
751
752
  const plane = Plane3dByOriginAndUnitNormal_1.Plane3dByOriginAndUnitNormal.createXYPlane();
752
753
  const visitor = convexMesh instanceof Polyface_1.Polyface ? convexMesh.createVisitor(0) : convexMesh;
753
754
  visitor.setNumWrap(0);
754
755
  for (visitor.reset(); visitor.moveToNextFacet();) {
755
- if (undefined !== PolygonOps_1.PolygonOps.areaNormalGo(visitor.point, normal)) {
756
+ if (PolygonOps_1.PolygonOps.areaNormalGo(visitor.point, normal)) {
756
757
  normal.scaleInPlace(scale);
757
- if (undefined !== Plane3dByOriginAndUnitNormal_1.Plane3dByOriginAndUnitNormal.create(visitor.point.front(), normal, plane))
758
- result.addPlaneToConvexSet(plane);
758
+ visitor.point.front(origin); // won't fail because we computed a normal
759
+ result.addPlaneToConvexSet(Plane3dByOriginAndUnitNormal_1.Plane3dByOriginAndUnitNormal.create(origin, normal, plane)); // all inputs cloned
759
760
  }
760
761
  }
761
762
  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,0CAAuC;AAEvC,6EAA0E;AAC1E,qEAAkE;AAElE,qDAAkD;AAClD,6FAA0F;AAC1F,mEAAkE;AAClE,yDAAsF;AACtF,+CAAuD;AAKvD,mDAAiE;AACjE,6DAA0D;AAC1D,2CAAwD;AACxD,2CAA2F;AAO3F;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,iEAAiE;IAC1D,MAAM,CAAU,OAAO,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACjC,OAAO,CAAc;IAC7B,+CAA+C;IAC/C,+CAA+C;IAC/C,6DAA6D;IAC7D,YAAoB,MAAoB;QACtC,oBAAoB;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,CAAC;IACD,0DAA0D;IAC1D,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD;;;OAGG;IACI,MAAM;QACX,MAAM,GAAG,GAAqB,EAAE,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO;YAC9B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAyC,EAAE,MAA2B;QAC3F,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,kBAAkB,EAAE,CAAC;QACpD,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YACtB,OAAO,MAAM,CAAC;QAChB,KAAK,MAA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,GAAG,EAAE,CAAC;IAC1C,CAAC;;AA5wBH,gDAsxBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { Polyface, PolyfaceVisitor } from \"../polyface/Polyface\";\r\nimport { PolyfaceQuery } from \"../polyface/PolyfaceQuery\";\r\nimport { ClipPlane, ClipPlaneProps } from \"./ClipPlane\";\r\nimport { Clipper, ClipPlaneContainment, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\r\n\r\n/** Wire format describing a [[ConvexClipPlaneSet]].\r\n * @public\r\n */\r\nexport type ConvexClipPlaneSetProps = ClipPlaneProps[];\r\n\r\n/**\r\n * A ConvexClipPlaneSet is a collection of ClipPlanes, often used for bounding regions of space.\r\n * @public\r\n */\r\nexport class ConvexClipPlaneSet implements Clipper, PolygonClipper {\r\n /** Value acting as \"at infinity\" for coordinates along a ray. */\r\n public static readonly hugeVal = 1e37;\r\n /** Planes that define the convex set. */\r\n private _planes: ClipPlane[];\r\n // private _parity: number; <--- Not yet used\r\n // public get parity() { return this._parity; }\r\n // public set parity(value: number) { this._parity = value; }\r\n private constructor(planes?: ClipPlane[]) {\r\n // this._parity = 1;\r\n this._planes = planes ? planes : [];\r\n }\r\n /** Return the (reference to the) array of `ClipPlane`. */\r\n public get planes(): ClipPlane[] {\r\n return this._planes;\r\n }\r\n /**\r\n * Return an array containing all the planes of the convex set.\r\n * * Note that this has no leading keyword identifying it as a ConvexClipPlaneSet.\r\n */\r\n public toJSON(): ConvexClipPlaneSetProps {\r\n const val: ClipPlaneProps[] = [];\r\n for (const plane of this._planes)\r\n val.push(plane.toJSON());\r\n return val;\r\n }\r\n /**\r\n * Extract clip planes from a json array `[ clipPlane, clipPlane ]`.\r\n * * Non-clipPlane members are ignored.\r\n */\r\n public static fromJSON(json: ConvexClipPlaneSetProps | undefined, result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n if (!Array.isArray(json))\r\n return result;\r\n for (const thisJson of json) {\r\n const plane = ClipPlane.fromJSON(thisJson);\r\n if (plane)\r\n result._planes.push(plane);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return true if all members are almostEqual to corresponding members of other. This includes identical order in array.\r\n * @param other clip plane to compare\r\n */\r\n public isAlmostEqual(other: ConvexClipPlaneSet): boolean {\r\n if (this._planes.length !== other._planes.length)\r\n return false;\r\n for (let i = 0; i < this._planes.length; i++)\r\n if (!this._planes[i].isAlmostEqual(other._planes[i]))\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * Create ConvexClipPlaneSet from an array of planes.\r\n * * Each plane reference in the `planes` array is taken into the result.\r\n * * The input array itself is NOT taken into the result.\r\n */\r\n public static createPlanes(\r\n planes: (ClipPlane | Plane3dByOriginAndUnitNormal)[], result?: ConvexClipPlaneSet,\r\n ): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n for (const plane of planes) {\r\n if (plane instanceof ClipPlane) {\r\n result._planes.push(plane);\r\n } else if (plane instanceof Plane3dByOriginAndUnitNormal) {\r\n const clipPlane = ClipPlane.createPlane(plane);\r\n result._planes.push(clipPlane);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create new convex set using selected planes of a Range3d.\r\n * @param range range with coordinates\r\n * @param lowX true to clip at the low x plane\r\n * @param highX true to clip at the high x plane\r\n * @param lowY true to clip at the low y plane\r\n * @param highY true to clip at the high z plane\r\n * @param lowZ true to clip at the low z plane\r\n * @param highZ true to clip at the high z plane\r\n */\r\n public static createRange3dPlanes(\r\n range: Range3d,\r\n lowX: boolean = true,\r\n highX: boolean = true,\r\n lowY: boolean = true,\r\n highY: boolean = true,\r\n lowZ: boolean = true,\r\n highZ: boolean = true,\r\n ): ConvexClipPlaneSet {\r\n const result = ConvexClipPlaneSet.createEmpty();\r\n\r\n if (lowX)\r\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(1, 0, 0, range.low.x, 0, 0)!);\r\n if (highX)\r\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(-1, 0, 0, range.high.x, 0, 0)!);\r\n\r\n if (lowY)\r\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 1, 0, 0, range.low.y, 0)!);\r\n if (highY)\r\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, -1, 0, 0, range.high.y, 0)!);\r\n\r\n if (lowZ)\r\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, range.low.z)!);\r\n if (highZ)\r\n result.planes.push(ClipPlane.createNormalAndPointXYZXYZ(0, 0, -1, 0, 0, range.high.z)!);\r\n\r\n return result;\r\n }\r\n /** Create an empty `ConvexClipPlaneSet` */\r\n public static createEmpty(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n if (result) {\r\n result._planes.length = 0;\r\n return result;\r\n }\r\n return new ConvexClipPlaneSet();\r\n }\r\n /** Negate all planes of the set. */\r\n public negateAllPlanes(): void {\r\n for (const plane of this._planes)\r\n plane.negateInPlace();\r\n }\r\n /**\r\n * Create a convex clip plane set that clips to `x0 <= x <= x1` and `y0 <= y <= y1`.\r\n * * Note that there is no test for the usual ordering `x0 <= x1` or `y0 <= y1`.\r\n * * if the usual ordering is violated, the convex set is an empty set.\r\n * * More details can be found at docs/learning/geometry/Clipping.md\r\n */\r\n public static createXYBox(\r\n x0: number, y0: number, x1: number, y1: number, result?: ConvexClipPlaneSet,\r\n ): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n const clip0 = ClipPlane.createNormalAndDistance(Vector3d.create(-1, 0, 0), -x1, false, true);\r\n const clip1 = ClipPlane.createNormalAndDistance(Vector3d.create(1, 0, 0), x0, false, true);\r\n const clip2 = ClipPlane.createNormalAndDistance(Vector3d.create(0, -1, 0), -y1, false, true);\r\n const clip3 = ClipPlane.createNormalAndDistance(Vector3d.create(0, 1, 0), y0, false, true);\r\n if (clip0 && clip1 && clip2 && clip3) {\r\n result._planes.push(clip0, clip1, clip2, clip3);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a convex set containing a half space for each edge between points of a polyline.\r\n * * Caller is responsible for assuring the polyline is convex.\r\n * @param points array of points. Only xy parts are considered.\r\n * @param interior array whose boolean value is used as both the `interior` and `invisible` bits of the plane for the\r\n * succeeding segment. If this array is not provided, both are false.\r\n * @param leftIsInside if true, the interior is \"to the left\" of the segments. If false, interior is \"to the right\".\r\n */\r\n public static createXYPolyLine(\r\n points: Point3d[], interior: boolean[] | undefined, leftIsInside: boolean, result?: ConvexClipPlaneSet,\r\n ): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\r\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\r\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\r\n perp.z = 0.0;\r\n\r\n if (!leftIsInside)\r\n perp.scaleInPlace(-1.0);\r\n\r\n const perpNormalized = perp.normalize();\r\n if (perpNormalized) {\r\n const flag = interior !== undefined ? interior[i0] : false;\r\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], flag, flag);\r\n if (clip) {\r\n result._planes.push(clip);\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a convexClipPlaneSet with planes whose \"inside\" normal is to the left of each segment.\r\n * @param points array of points.\r\n */\r\n public static createXYPolyLineInsideLeft(points: Point3d[], result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\r\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\r\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\r\n perp.z = 0.0;\r\n\r\n const perpNormalized = perp.normalize();\r\n if (perpNormalized) {\r\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], false, false);\r\n if (clip) { result._planes.push(clip); }\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Set (or reset) a plane and ConvexClipPlaneSet for a convex array, such as a convex facet used for xy clip.\r\n * * The planeOfPolygon is (re)initialized with the normal from 3 points, but not otherwise referenced.\r\n * * The ConvexClipPlaneSet is filled with outward normals of the facet edges as viewed to xy plane.\r\n * @param points\r\n * @param result\r\n */\r\n public static setPlaneAndXYLoopCCW(points: GrowableXYZArray, planeOfPolygon: ClipPlane, frustum: ConvexClipPlaneSet) {\r\n const i0 = points.length - 1;\r\n const n = points.length;\r\n let x0 = points.getXAtUncheckedPointIndex(i0);\r\n let y0 = points.getYAtUncheckedPointIndex(i0);\r\n let x1, y1, nx, ny;\r\n frustum._planes.length = 0;\r\n const z0 = points.getZAtUncheckedPointIndex(i0); // z for planes can stay fixed\r\n const planeNormal = points.crossProductIndexIndexIndex(0, 2, 1)!;\r\n ClipPlane.createNormalAndPointXYZXYZ(planeNormal.x, planeNormal.y, planeNormal.z, x0, y0, z0, false, false, planeOfPolygon);\r\n if (planeNormal.normalizeInPlace()) {\r\n for (let i1 = 0; i1 < n; i1++, x0 = x1, y0 = y1) {\r\n x1 = points.getXAtUncheckedPointIndex(i1);\r\n y1 = points.getYAtUncheckedPointIndex(i1);\r\n nx = -(y1 - y0);\r\n ny = x1 - x0;\r\n const clipper = ClipPlane.createNormalAndPointXYZXYZ(nx, ny, 0, x1, y1, z0);\r\n if (clipper)\r\n frustum._planes.push(clipper);\r\n }\r\n }\r\n }\r\n /** Deep clone of all planes. */\r\n public clone(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n for (const plane of this._planes)\r\n result._planes.push(plane.clone());\r\n return result;\r\n }\r\n /**\r\n * Test if there is any intersection with a ray defined by origin and direction.\r\n * * Optionally record the range (null or otherwise) in caller-allocated result.\r\n * * If the ray is unbounded inside the clip, result can contain positive or negative\r\n * \"Geometry.largeCoordinateResult\" values.\r\n * * If no result is provide, there are no object allocations.\r\n * @param result optional Range1d to receive parameters along the ray.\r\n */\r\n public hasIntersectionWithRay(ray: Ray3d, result?: Range1d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n // form low and high values in locals that do not require allocation.\r\n // transfer to caller-supplied result at end\r\n let t0 = -Geometry.largeCoordinateResult;\r\n let t1 = Geometry.largeCoordinateResult;\r\n if (result)\r\n result.setNull();\r\n const velocityTolerance = 1.0e-13;\r\n for (const plane of this._planes) {\r\n const vD = plane.velocity(ray.direction);\r\n const vN = plane.altitude(ray.origin);\r\n\r\n if (Math.abs(vD) <= velocityTolerance) {\r\n // Ray is parallel... No need to continue testing if outside halfspace.\r\n if (vN < -tolerance)\r\n return false; // and result is a null range.\r\n } else {\r\n const rayFraction = - vN / vD;\r\n if (vD < 0.0) {\r\n if (rayFraction < t1)\r\n t1 = rayFraction;\r\n } else {\r\n if (rayFraction > t0)\r\n t0 = rayFraction;\r\n }\r\n }\r\n }\r\n if (t1 < t0)\r\n return false; // and result is a null range.\r\n if (result) {\r\n result.extendX(t0);\r\n result.extendX(t1);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Multiply all the ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect\r\n * on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n for (const plane of this._planes) {\r\n plane.multiplyPlaneByMatrix4d(matrix, false, transpose);\r\n }\r\n return true;\r\n }\r\n /** Return true if `point` satisfies `point.isPointInside` for all planes */\r\n public isPointInside(point: Point3d): boolean {\r\n for (const plane of this._planes) {\r\n // Defaults to strict inside check. Other clipping classes may use \"on or inside\" check for the \"on\" case\r\n if (!plane.isPointInside(point))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Return true if `point` satisfies `point.isPointOnOrInside` for all planes */\r\n public isPointOnOrInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n const interiorTolerance = Math.abs(tolerance); // Interior tolerance should always be positive. (TFS# 246598).\r\n for (const plane of this._planes) {\r\n if (!plane.isPointOnOrInside(point, (plane.interior ? interiorTolerance : tolerance)))\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if a sphere is completely inside the convex set.\r\n * @param centerPoint center of sphere\r\n * @param radius radius of sphere.\r\n */\r\n public isSphereInside(centerPoint: Point3d, radius: number): boolean {\r\n const r1 = Math.abs(radius) + Geometry.smallMetricDistance;\r\n for (const plane of this._planes) {\r\n if (!plane.isPointOnOrInside(centerPoint, r1)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Find the parts of the line segment (if any) that is within the convex clip volume.\r\n * * The line segment is defined by `pointA` and `pointB`.\r\n * * The input fractional interval from `fraction0` to `fraction1` (increasing) is the active part to consider.\r\n * * To clip to the usual bounded line segment, start with fractions (0,1).\r\n * If the clip volume is unbounded, the line interval may also be unbounded.\r\n * * An unbounded line portion will have fraction coordinates positive or negative `Number.MAX_VALUE`.\r\n * @param f0 fraction that is the initial lower fraction of the active interval (e.g., 0.0 for bounded segment).\r\n * @param f1 fraction that is the initial upper fraction of the active interval (e.g., 1.0 for bounded segment).\r\n * @param pointA segment start (fraction 0)\r\n * @param pointB segment end (fraction 1)\r\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\r\n * @returns true if a segment was announced, false if entirely outside.\r\n */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n let fraction: number | undefined;\r\n if (f1 < f0)\r\n return false;\r\n for (const plane of this._planes) {\r\n const hA = -plane.altitude(pointA);\r\n const hB = -plane.altitude(pointB);\r\n fraction = Geometry.conditionalDivideFraction(-hA, (hB - hA));\r\n if (fraction === undefined) {\r\n // Line parallel to the plane. If positive, it is all OUT\r\n if (hA > 0.0)\r\n return false;\r\n } else if (hB > hA) { // STRICTLY moving outward\r\n if (fraction < f0)\r\n return false;\r\n if (fraction < f1)\r\n f1 = fraction;\r\n } else if (hA > hB) { // STRICTLY moving inward\r\n if (fraction > f1)\r\n return false;\r\n if (fraction > f0)\r\n f0 = fraction;\r\n } else {\r\n // Strictly equal evaluations\r\n if (hA > 0.0)\r\n return false;\r\n }\r\n }\r\n if (f1 >= f0) {\r\n if (announce)\r\n announce(f0, f1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n private static _clipArcFractionArray = new GrowableFloat64Array();\r\n /**\r\n * Find fractional parts of the arc that are within this ClipPlaneSet, and announce each as\r\n * * `announce(fraction, fraction, curve)`\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n const breaks = ConvexClipPlaneSet._clipArcFractionArray;\r\n breaks.clear();\r\n for (const clipPlane of this.planes) {\r\n clipPlane.appendIntersectionRadians(arc, breaks);\r\n }\r\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\r\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\r\n }\r\n /**\r\n * Find the parts of the (unbounded) line segment (if any) that is within the convex clip volume.\r\n * @param pointA segment start (fraction 0)\r\n * @param pointB segment end (fraction 1)\r\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\r\n * @returns true if a segment was announced, false if entirely outside.\r\n */\r\n public clipUnboundedSegment(pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber): boolean {\r\n return this.announceClippedSegmentIntervals(-Number.MAX_VALUE, Number.MAX_VALUE, pointA, pointB, announce);\r\n }\r\n /** transform each plane in place. */\r\n public transformInPlace(transform: Transform) {\r\n for (const plane of this._planes) {\r\n plane.transformInPlace(transform);\r\n }\r\n }\r\n /**\r\n * Clip a polygon to the inside of the convex set.\r\n * * Results with 2 or fewer points are ignored.\r\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\r\n * @param xyz input points.\r\n * @param work work buffer\r\n * @param tolerance tolerance for \"on plane\" decision.\r\n */\r\n public clipConvexPolygonInPlace(\r\n xyz: GrowableXYZArray, work: GrowableXYZArray, tolerance: number = Geometry.smallMetricDistance,\r\n ): void {\r\n for (const plane of this._planes) {\r\n plane.clipConvexPolygonInPlace(xyz, work, true, tolerance);\r\n if (xyz.length < 3)\r\n return;\r\n }\r\n }\r\n /**\r\n * Clip a convex polygon to (a single) inside part and (possibly many) outside parts.\r\n * @param xyz input polygon.\r\n * @param outsideFragments an array to receive (via push, with no preliminary clear) outside fragments\r\n * @param arrayCache cache for work arrays.\r\n * @return the surviving inside part (if any)\r\n * @see polygonClip\r\n */\r\n public clipInsidePushOutside(\r\n xyz: IndexedXYZCollection, outsideFragments: GrowableXYZArray[] | undefined, arrayCache: GrowableXYZArrayCache,\r\n ): GrowableXYZArray | undefined {\r\n const perpendicularRange = Range1d.createNull();\r\n let newInside = arrayCache.grabFromCache();\r\n let newOutside = arrayCache.grabFromCache();\r\n let insidePart = arrayCache.grabFromCache(); // this is empty ...\r\n insidePart.pushFrom(xyz);\r\n // While looping through planes . .\r\n // the outside part for the current plane is definitely outside and can be stashed to the final outside\r\n // the inside part for the current plane passes forward to be further split by the remaining planes.\r\n for (const plane of this._planes) {\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\r\n plane, insidePart, newInside, newOutside, perpendicularRange,\r\n );\r\n if (newOutside.length > 0) {\r\n // the newOutside fragment is definitely outside the ConvexClipPlaneSet\r\n if (outsideFragments) // save the definitely outside part as return data.\r\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\r\n newOutside = arrayCache.grabFromCache();\r\n if (newInside.length < 3) { // ignore inside slivers\r\n insidePart.length = 0;\r\n break;\r\n }\r\n // insideWork is changed ... swap it with insidePart\r\n arrayCache.dropToCache(insidePart);\r\n insidePart = newInside;\r\n newInside = arrayCache.grabFromCache();\r\n } else {\r\n // newOutside is empty => newInside is identical to insidePart. Let insidePart feed through to the next clipper.\r\n }\r\n }\r\n // at break or fall out ...\r\n // ALWAYS drop `newInside` and `newOutside` to the cache\r\n arrayCache.dropToCache(newInside);\r\n arrayCache.dropToCache(newOutside);\r\n // if `insidePart` is alive, return it to caller. Otherwise drop it to cache and return undefined.\r\n if (insidePart.length > 0)\r\n return insidePart;\r\n arrayCache.dropToCache(insidePart);\r\n return undefined;\r\n }\r\n /**\r\n * Returns 1, 2, or 3 based on whether point array is strongly inside, ambiguous, or strongly outside respectively.\r\n * * This has a peculiar expected use case as a very fast pre-filter for more precise clipping.\r\n * * The expected point set is for a polygon.\r\n * * Hence any clipping will eventually have to consider the lines between the points.\r\n * * This method looks for the special case of a single clip plane that has all the points outside.\r\n * * In this case the whole polygon must be outside.\r\n * * Note that this does not detect a polygon that is outside but \"crosses a corner\" -- it is mixed with respect to\r\n * multiple planes.\r\n */\r\n public classifyPointContainment(points: Point3d[], onIsOutside: boolean): ClipPlaneContainment {\r\n let allInside = true;\r\n const onTolerance = onIsOutside ? 1.0e-8 : -1.0e-8;\r\n const interiorTolerance = 1.0e-8; // Interior tolerance should always be positive\r\n\r\n for (const plane of this._planes) {\r\n let nOutside = 0;\r\n for (const point of points) {\r\n if (plane.altitude(point) < (plane.interior ? interiorTolerance : onTolerance)) {\r\n nOutside++;\r\n allInside = false;\r\n }\r\n }\r\n if (nOutside === points.length)\r\n return ClipPlaneContainment.StronglyOutside;\r\n }\r\n return allInside ? ClipPlaneContainment.StronglyInside : ClipPlaneContainment.Ambiguous;\r\n }\r\n /**\r\n * * Create a convex clip set for a polygon swept with possible tilt angle.\r\n * * planes are constructed by ClipPlane.createEdgeAndUpVector, using successive points from the array.\r\n * * If the first and last points match, the polygon area is checked. If the area is negative, points are used in\r\n * reverse order.\r\n * * If first and last points do not match, points are used in order given\r\n * @param points polygon points. (Closure point optional)\r\n * @param upVector primary sweep direction, as applied by ClipPlane.createEdgeAndUpVector\r\n * @param tiltAngle angle to tilt sweep planes away from the sweep direction.\r\n */\r\n public static createSweptPolyline(\r\n points: Point3d[], upVector: Vector3d, tiltAngle?: Angle,\r\n ): ConvexClipPlaneSet | undefined {\r\n const result = ConvexClipPlaneSet.createEmpty();\r\n let reverse = false;\r\n if (points.length > 3 && points[0].isAlmostEqual(points[points.length - 1])) {\r\n const polygonNormal: Vector3d = PolygonOps.areaNormal(points);\r\n const normalDot = polygonNormal.dotProduct(upVector);\r\n if (normalDot > 0.0)\r\n reverse = true;\r\n }\r\n for (let i = 0; (i + 1) < points.length; i++) {\r\n if (reverse) {\r\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i + 1], points[i], upVector, tiltAngle);\r\n if (toAdd) { // clipPlane creation could result in undefined\r\n result.addPlaneToConvexSet(toAdd);\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i], points[i + 1], upVector, tiltAngle);\r\n if (toAdd) { // clipPlane creation could result in undefined\r\n result.addPlaneToConvexSet(toAdd);\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Add a plane to the convex set.\r\n * @param plane plane to add\r\n */\r\n public addPlaneToConvexSet(plane: ClipPlane | Plane3dByOriginAndUnitNormal | undefined) {\r\n if (plane instanceof ClipPlane)\r\n this._planes.push(plane);\r\n else if (plane instanceof Plane3dByOriginAndUnitNormal)\r\n this._planes.push(ClipPlane.createPlane(plane));\r\n }\r\n /**\r\n * Test many points. Distribute them to arrays depending on in/out result.\r\n * @param points points to test\r\n * @param inOrOn points that are in or on the set\r\n * @param out points that are out.\r\n */\r\n public clipPointsOnOrInside(points: Point3d[], inOrOn: Point3d[], out: Point3d[]) {\r\n inOrOn.length = 0;\r\n out.length = 0;\r\n for (const xyz of points) {\r\n if (this.isPointOnOrInside(xyz, 0.0)) {\r\n inOrOn.push(xyz);\r\n } else {\r\n out.push(xyz);\r\n }\r\n }\r\n }\r\n /**\r\n * Clip a polygon to the planes of the clip plane set.\r\n * * For a convex input polygon, the output polygon is also convex.\r\n * * For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a\r\n * valid clip in a parity sense (overlapping regions cancel).\r\n * @param input polygon, usually convex. Unchanged.\r\n * @param output output polygon\r\n * @param work optional work array.\r\n * @param planeToSkip if this plane is found in the convex set, it is NOT applied.\r\n * This is useful when caller knows the polygon lies in one of the instance planes.\r\n * @param tolerance distance tolerance for \"on plane\" decision. Default value is [[Geometry.smallMetricDistance]].\r\n * @see appendPolygonClip\r\n */\r\n public polygonClip(\r\n input: GrowableXYZArray | Point3d[],\r\n output: GrowableXYZArray,\r\n work?: GrowableXYZArray,\r\n planeToSkip?: ClipPlane,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): void {\r\n if (input instanceof GrowableXYZArray)\r\n input.clone(output);\r\n else\r\n GrowableXYZArray.create(input, output);\r\n if (!work)\r\n work = new GrowableXYZArray();\r\n for (const plane of this._planes) {\r\n if (planeToSkip === plane)\r\n continue;\r\n if (output.length === 0)\r\n break;\r\n plane.clipConvexPolygonInPlace(output, work, true, tolerance);\r\n }\r\n }\r\n /**\r\n * * Define new planes in this ConvexClipPlaneSet so it clips to the inside of a polygon.\r\n * * always create planes for the swept edges of the polygon\r\n * * optionally (with nonzero sideSelect) create a cap plane using the polygon normal.\r\n * @param points Points of a bounding polygon\r\n * @param sweepDirection direction to sweep.\r\n * @param sideSelect 0 to have no cap polygon, 1 if the sweep vector side is in, -1 if sweep vector side is out.\r\n */\r\n public reloadSweptPolygon(points: Point3d[], sweepDirection: Vector3d, sideSelect: number): number {\r\n this._planes.length = 0;\r\n const n = points.length;\r\n if (n <= 2)\r\n return 0;\r\n\r\n const planeNormal: Vector3d = PolygonOps.areaNormal(points);\r\n const isCCW = sweepDirection.dotProduct(planeNormal) > 0.0;\r\n\r\n const delta = isCCW ? 1 : n - 1;\r\n for (let i = 0; i < n; i++) {\r\n const i1 = (i + delta) % n;\r\n const xyz0: Point3d = points[i];\r\n const xyz1: Point3d = points[i1];\r\n if (xyz0.isAlmostEqual(xyz1))\r\n continue;\r\n const edgeVector: Vector3d = Vector3d.createStartEnd(xyz0, xyz1);\r\n const inwardNormal: Vector3d = Vector3d.createCrossProduct(sweepDirection.x, sweepDirection.y, sweepDirection.z,\r\n edgeVector.x, edgeVector.y, edgeVector.z);\r\n const inwardNormalNormalized = inwardNormal.normalize();\r\n let distance;\r\n if (inwardNormalNormalized) { // should never fail... simply a check due to the format of the normalize function return\r\n distance = inwardNormalNormalized.dotProduct(xyz0);\r\n const clipToAdd = ClipPlane.createNormalAndDistance(inwardNormalNormalized, distance, false, false);\r\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\r\n }\r\n }\r\n if (sideSelect !== 0.0) {\r\n let planeNormalNormalized = planeNormal.normalize();\r\n if (planeNormalNormalized) { // Again.. should never fail\r\n const a = sweepDirection.dotProduct(planeNormalNormalized) * sideSelect;\r\n if (a < 0.0)\r\n planeNormalNormalized = planeNormalNormalized.negate();\r\n const xyz0: Point3d = points[0];\r\n const distance = planeNormalNormalized.dotProduct(xyz0);\r\n const clipToAdd = ClipPlane.createNormalAndDistance(planeNormalNormalized, distance, false, false);\r\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\r\n }\r\n }\r\n return isCCW ? 1 : -1;\r\n }\r\n /**\r\n * Compute intersections among all combinations of 3 planes in the convex set.\r\n * * optionally throw out points that are not in the set.\r\n * * optionally push the points in the caller-supplied point array.\r\n * * optionally extend a caller supplied range.\r\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\r\n * range is the range of the convex set.\r\n * * If the convex set is unbounded, the range only contains the range of the accepted (corner) points, and the\r\n * range is not a representative of the \"range of all points in the set\".\r\n * @param points (optional) array to which computed points are to be added.\r\n * @param rangeToExtend (optional) range to be extended by the computed points\r\n * @param transform (optional) transform to apply to the accepted points.\r\n * @param testContainment if true, test each point to see if it is within the convex set. (send false if confident\r\n * that the convex set is rectilinear set such as a slab. Send true if chiseled corners are possible).\r\n * @returns number of points.\r\n */\r\n public computePlanePlanePlaneIntersections(\r\n points: Point3d[] | undefined,\r\n rangeToExtend: Range3d | undefined,\r\n transform?: Transform,\r\n testContainment: boolean = true,\r\n ): number {\r\n const normalRows = Matrix3d.createIdentity();\r\n const allPlanes = this._planes;\r\n const n = allPlanes.length;\r\n let numPoints = 0; // explicitly count points -- can't wait to end for points.length because it may be an optional output.\r\n for (let i = 0; i < n; i++) {\r\n for (let j = i + 1; j < n; j++)\r\n for (let k = j + 1; k < n; k++) {\r\n Matrix3d.createRowValues(\r\n allPlanes[i].inwardNormalRef.x, allPlanes[i].inwardNormalRef.y, allPlanes[i].inwardNormalRef.z,\r\n allPlanes[j].inwardNormalRef.x, allPlanes[j].inwardNormalRef.y, allPlanes[j].inwardNormalRef.z,\r\n allPlanes[k].inwardNormalRef.x, allPlanes[k].inwardNormalRef.y, allPlanes[k].inwardNormalRef.z,\r\n normalRows);\r\n if (normalRows.computeCachedInverse(false)) {\r\n const xyz = normalRows.multiplyInverseXYZAsPoint3d(allPlanes[i].distance, allPlanes[j].distance, allPlanes[k].distance)!;\r\n if (!testContainment || this.isPointOnOrInside(xyz, Geometry.smallMetricDistance)) {\r\n numPoints++;\r\n if (transform)\r\n transform.multiplyPoint3d(xyz, xyz);\r\n if (points)\r\n points.push(xyz);\r\n if (rangeToExtend)\r\n rangeToExtend.extendPoint(xyz);\r\n }\r\n }\r\n }\r\n }\r\n return numPoints;\r\n }\r\n /**\r\n * Set the `invisible` property on each plane of the convex set.\r\n * @param invisible value to store\r\n */\r\n public setInvisible(invisible: boolean) {\r\n for (const plane of this._planes) {\r\n plane.setInvisible(invisible);\r\n }\r\n }\r\n /**\r\n * Add planes for z-direction clip between low and high z levels.\r\n * @param invisible value to apply to the `invisible` bit for the new planes\r\n * @param zLow low z value. The plane clips out points with z below this.\r\n * @param zHigh high z value. The plane clips out points with z above this.\r\n */\r\n public addZClipPlanes(invisible: boolean, zLow?: number, zHigh?: number) {\r\n if (zLow !== undefined)\r\n this._planes.push(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, 1), zLow, invisible)!);\r\n if (zHigh !== undefined)\r\n this._planes.push(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, -1), -zHigh, invisible)!);\r\n }\r\n /**\r\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\r\n * @param xyz convex polygon. This is not changed.\r\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from\r\n * the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from\r\n * the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n * @see polygonClip\r\n */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ): void {\r\n const newInside = this.clipInsidePushOutside(xyz, outsideFragments, arrayCache);\r\n if (newInside)\r\n insideFragments.push(newInside);\r\n }\r\n /**\r\n * Create a convex clip set from a convex mesh.\r\n * * Create a plane for each facet.\r\n * * Assemble the planes as a single clip plane set.\r\n * * If the facets are closed by edge pairing, use the sign of the computed volume to point the plane normals inward.\r\n * * If the facets are not closed, the facet orientation determines plane orientation.\r\n * * The implication of this is that if the facets are a convex volume, the returned clip plane set is convex.\r\n * @param convexMesh input mesh. For best results, the mesh should be closed and convex.\r\n * @param result optional preallocated result to reuse and return\r\n * @return clipper and volume (zero if mesh is not closed)\r\n */\r\n public static createConvexPolyface(\r\n convexMesh: Polyface | PolyfaceVisitor, result?: ConvexClipPlaneSet,\r\n ): { clipper: ConvexClipPlaneSet, volume: number } {\r\n result = this.createEmpty(result);\r\n let vol = 0;\r\n if (PolyfaceQuery.isPolyfaceClosedByEdgePairing(convexMesh))\r\n vol = PolyfaceQuery.sumTetrahedralVolumes(convexMesh);\r\n const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward\r\n const normal = Vector3d.create();\r\n const plane = Plane3dByOriginAndUnitNormal.createXYPlane();\r\n const visitor = convexMesh instanceof Polyface ? convexMesh.createVisitor(0) : convexMesh;\r\n visitor.setNumWrap(0);\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n if (undefined !== PolygonOps.areaNormalGo(visitor.point, normal)) {\r\n normal.scaleInPlace(scale);\r\n if (undefined !== Plane3dByOriginAndUnitNormal.create(visitor.point.front()!, normal, plane))\r\n result.addPlaneToConvexSet(plane);\r\n }\r\n }\r\n return { clipper: result, volume: vol };\r\n }\r\n\r\n // FUNCTIONS SKIPPED DUE TO BSPLINES, VU, OR NON-USAGE IN NATIVE CODE----------------------------------------------------------------\r\n\r\n // Uses bsplines... skipping for now:\r\n // public convexAppendIntervalsFromBspline();\r\n\r\n // Uses pushing and clearing from/to a cache and added functionality for arrays. . . skipping for now\r\n // public convexPolygonClipInsideOutside(input: Point3d[], inside: Point3d[], outside: Point3d[], work1: Point3d[], work2: Point3d[],\r\n // clearOutside: boolean, distanceTolerance: number)\r\n}\r\n"]}
1
+ {"version":3,"file":"ConvexClipPlaneSet.js","sourceRoot":"","sources":["../../../src/clipping/ConvexClipPlaneSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,0CAAuC;AAEvC,6EAA0E;AAC1E,qEAAkE;AAElE,qDAAkD;AAClD,6FAA0F;AAC1F,mEAAkE;AAClE,yDAAsF;AACtF,+CAAuD;AAKvD,mDAAiE;AACjE,6DAA0D;AAC1D,2CAAwD;AACxD,2CAA2F;AAO3F;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,iEAAiE;IAC1D,MAAM,CAAU,OAAO,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACjC,OAAO,CAAc;IAC7B,+CAA+C;IAC/C,+CAA+C;IAC/C,6DAA6D;IAC7D,YAAoB,MAAoB;QACtC,oBAAoB;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,CAAC;IACD,0DAA0D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C3D,MAAM,OAAO,GAAG,UAAU,YAAY,mBAAQ,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,GAAG,CAAC;YACjD,IAAI,uBAAU,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;gBACnD,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,0CAA0C;gBACvE,MAAM,CAAC,mBAAmB,CAAC,2DAA4B,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAoB;YAC9G,CAAC;QACH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC1C,CAAC;;AA5wBH,gDAsxBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { Polyface, PolyfaceVisitor } from \"../polyface/Polyface\";\r\nimport { PolyfaceQuery } from \"../polyface/PolyfaceQuery\";\r\nimport { ClipPlane, ClipPlaneProps } from \"./ClipPlane\";\r\nimport { Clipper, ClipPlaneContainment, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\r\n\r\n/** Wire format describing a [[ConvexClipPlaneSet]].\r\n * @public\r\n */\r\nexport type ConvexClipPlaneSetProps = ClipPlaneProps[];\r\n\r\n/**\r\n * A ConvexClipPlaneSet is a collection of ClipPlanes, often used for bounding regions of space.\r\n * @public\r\n */\r\nexport class ConvexClipPlaneSet implements Clipper, PolygonClipper {\r\n /** Value acting as \"at infinity\" for coordinates along a ray. */\r\n public static readonly hugeVal = 1e37;\r\n /** Planes that define the convex set. */\r\n private _planes: ClipPlane[];\r\n // private _parity: number; <--- Not yet used\r\n // public get parity() { return this._parity; }\r\n // public set parity(value: number) { this._parity = value; }\r\n private constructor(planes?: ClipPlane[]) {\r\n // this._parity = 1;\r\n this._planes = planes ? planes : [];\r\n }\r\n /** Return the (reference to the) array of `ClipPlane`. */\r\n public get planes(): ClipPlane[] {\r\n return this._planes;\r\n }\r\n /**\r\n * Return an array containing all the planes of the convex set.\r\n * * Note that this has no leading keyword identifying it as a ConvexClipPlaneSet.\r\n */\r\n public toJSON(): ConvexClipPlaneSetProps {\r\n const val: ClipPlaneProps[] = [];\r\n for (const plane of this._planes)\r\n val.push(plane.toJSON());\r\n return val;\r\n }\r\n /**\r\n * Extract clip planes from a json array `[ clipPlane, clipPlane ]`.\r\n * * Non-clipPlane members are ignored.\r\n */\r\n public static fromJSON(json: ConvexClipPlaneSetProps | undefined, result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n if (!Array.isArray(json))\r\n return result;\r\n for (const thisJson of json) {\r\n const plane = ClipPlane.fromJSON(thisJson);\r\n if (plane)\r\n result._planes.push(plane);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return true if all members are almostEqual to corresponding members of other. This includes identical order in array.\r\n * @param other clip plane to compare\r\n */\r\n public isAlmostEqual(other: ConvexClipPlaneSet): boolean {\r\n if (this._planes.length !== other._planes.length)\r\n return false;\r\n for (let i = 0; i < this._planes.length; i++)\r\n if (!this._planes[i].isAlmostEqual(other._planes[i]))\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * Create ConvexClipPlaneSet from an array of planes.\r\n * * Each plane reference in the `planes` array is taken into the result.\r\n * * The input array itself is NOT taken into the result.\r\n */\r\n public static createPlanes(\r\n planes: (ClipPlane | Plane3dByOriginAndUnitNormal)[], result?: ConvexClipPlaneSet,\r\n ): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n for (const plane of planes) {\r\n if (plane instanceof ClipPlane) {\r\n result._planes.push(plane);\r\n } else if (plane instanceof Plane3dByOriginAndUnitNormal) {\r\n const clipPlane = ClipPlane.createPlane(plane);\r\n result._planes.push(clipPlane);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create new convex set using selected planes of a Range3d.\r\n * @param range range with coordinates\r\n * @param lowX true to clip at the low x plane\r\n * @param highX true to clip at the high x plane\r\n * @param lowY true to clip at the low y plane\r\n * @param highY true to clip at the high z plane\r\n * @param lowZ true to clip at the low z plane\r\n * @param highZ true to clip at the high z plane\r\n */\r\n public static createRange3dPlanes(\r\n range: Range3d,\r\n lowX: boolean = true,\r\n highX: boolean = true,\r\n lowY: boolean = true,\r\n highY: boolean = true,\r\n lowZ: boolean = true,\r\n highZ: boolean = true,\r\n ): ConvexClipPlaneSet {\r\n const result = ConvexClipPlaneSet.createEmpty();\r\n // all normals are nonzero, so ClipPlane creation can only fail on out-of-memory\r\n if (lowX)\r\n result.addPlaneToConvexSet(ClipPlane.createNormalAndPointXYZXYZ(1, 0, 0, range.low.x, 0, 0));\r\n if (highX)\r\n result.addPlaneToConvexSet(ClipPlane.createNormalAndPointXYZXYZ(-1, 0, 0, range.high.x, 0, 0));\r\n\r\n if (lowY)\r\n result.addPlaneToConvexSet(ClipPlane.createNormalAndPointXYZXYZ(0, 1, 0, 0, range.low.y, 0));\r\n if (highY)\r\n result.addPlaneToConvexSet(ClipPlane.createNormalAndPointXYZXYZ(0, -1, 0, 0, range.high.y, 0));\r\n\r\n if (lowZ)\r\n result.addPlaneToConvexSet(ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, range.low.z));\r\n if (highZ)\r\n result.addPlaneToConvexSet(ClipPlane.createNormalAndPointXYZXYZ(0, 0, -1, 0, 0, range.high.z));\r\n\r\n return result;\r\n }\r\n /** Create an empty `ConvexClipPlaneSet` */\r\n public static createEmpty(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n if (result) {\r\n result._planes.length = 0;\r\n return result;\r\n }\r\n return new ConvexClipPlaneSet();\r\n }\r\n /** Negate all planes of the set. */\r\n public negateAllPlanes(): void {\r\n for (const plane of this._planes)\r\n plane.negateInPlace();\r\n }\r\n /**\r\n * Create a convex clip plane set that clips to `x0 <= x <= x1` and `y0 <= y <= y1`.\r\n * * Note that there is no test for the usual ordering `x0 <= x1` or `y0 <= y1`.\r\n * * if the usual ordering is violated, the convex set is an empty set.\r\n * * More details can be found at docs/learning/geometry/Clipping.md\r\n */\r\n public static createXYBox(\r\n x0: number, y0: number, x1: number, y1: number, result?: ConvexClipPlaneSet,\r\n ): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n const clip0 = ClipPlane.createNormalAndDistance(Vector3d.create(-1, 0, 0), -x1, false, true);\r\n const clip1 = ClipPlane.createNormalAndDistance(Vector3d.create(1, 0, 0), x0, false, true);\r\n const clip2 = ClipPlane.createNormalAndDistance(Vector3d.create(0, -1, 0), -y1, false, true);\r\n const clip3 = ClipPlane.createNormalAndDistance(Vector3d.create(0, 1, 0), y0, false, true);\r\n if (clip0 && clip1 && clip2 && clip3) {\r\n result._planes.push(clip0, clip1, clip2, clip3);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a convex set containing a half space for each edge between points of a polyline.\r\n * * Caller is responsible for assuring the polyline is convex.\r\n * @param points array of points. Only xy parts are considered.\r\n * @param interior array whose boolean value is used as both the `interior` and `invisible` bits of the plane for the\r\n * succeeding segment. If this array is not provided, both are false.\r\n * @param leftIsInside if true, the interior is \"to the left\" of the segments. If false, interior is \"to the right\".\r\n */\r\n public static createXYPolyLine(\r\n points: Point3d[], interior: boolean[] | undefined, leftIsInside: boolean, result?: ConvexClipPlaneSet,\r\n ): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\r\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\r\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\r\n perp.z = 0.0;\r\n\r\n if (!leftIsInside)\r\n perp.scaleInPlace(-1.0);\r\n\r\n const perpNormalized = perp.normalize();\r\n if (perpNormalized) {\r\n const flag = interior !== undefined ? interior[i0] : false;\r\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], flag, flag);\r\n if (clip) {\r\n result._planes.push(clip);\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a convexClipPlaneSet with planes whose \"inside\" normal is to the left of each segment.\r\n * @param points array of points.\r\n */\r\n public static createXYPolyLineInsideLeft(points: Point3d[], result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n for (let i0 = 0; (i0 + 1) < points.length; i0++) {\r\n const edgeVector: Vector3d = Vector3d.createStartEnd(points[i0], points[i0 + 1]);\r\n const perp: Vector3d = edgeVector.unitPerpendicularXY();\r\n perp.z = 0.0;\r\n\r\n const perpNormalized = perp.normalize();\r\n if (perpNormalized) {\r\n const clip = ClipPlane.createNormalAndPoint(perp, points[i0], false, false);\r\n if (clip) { result._planes.push(clip); }\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Set (or reset) a plane and ConvexClipPlaneSet for a convex array, such as a convex facet used for xy clip.\r\n * * The planeOfPolygon is (re)initialized with the normal from 3 points, but not otherwise referenced.\r\n * * The ConvexClipPlaneSet is filled with outward normals of the facet edges as viewed to xy plane.\r\n */\r\n public static setPlaneAndXYLoopCCW(points: GrowableXYZArray, planeOfPolygon: ClipPlane, frustum: ConvexClipPlaneSet) {\r\n const i0 = points.length - 1;\r\n const n = points.length;\r\n let x0 = points.getXAtUncheckedPointIndex(i0);\r\n let y0 = points.getYAtUncheckedPointIndex(i0);\r\n let x1, y1, nx, ny;\r\n frustum._planes.length = 0;\r\n const z0 = points.getZAtUncheckedPointIndex(i0); // z for planes can stay fixed\r\n const planeNormal = points.crossProductIndexIndexIndex(0, 2, 1);\r\n if (planeNormal?.normalizeInPlace()) {\r\n ClipPlane.createNormalAndPointXYZXYZ(planeNormal.x, planeNormal.y, planeNormal.z, x0, y0, z0, false, false, planeOfPolygon);\r\n for (let i1 = 0; i1 < n; i1++, x0 = x1, y0 = y1) {\r\n x1 = points.getXAtUncheckedPointIndex(i1);\r\n y1 = points.getYAtUncheckedPointIndex(i1);\r\n nx = -(y1 - y0);\r\n ny = x1 - x0;\r\n const clipper = ClipPlane.createNormalAndPointXYZXYZ(nx, ny, 0, x1, y1, z0);\r\n if (clipper)\r\n frustum._planes.push(clipper);\r\n }\r\n }\r\n }\r\n /** Deep clone of all planes. */\r\n public clone(result?: ConvexClipPlaneSet): ConvexClipPlaneSet {\r\n result = result ? result : new ConvexClipPlaneSet();\r\n result._planes.length = 0;\r\n for (const plane of this._planes)\r\n result._planes.push(plane.clone());\r\n return result;\r\n }\r\n /**\r\n * Test if there is any intersection with a ray defined by origin and direction.\r\n * * Optionally record the range (null or otherwise) in caller-allocated result.\r\n * * If the ray is unbounded inside the clip, result can contain positive or negative\r\n * \"Geometry.largeCoordinateResult\" values.\r\n * * If no result is provide, there are no object allocations.\r\n * @param result optional Range1d to receive parameters along the ray.\r\n */\r\n public hasIntersectionWithRay(ray: Ray3d, result?: Range1d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n // form low and high values in locals that do not require allocation.\r\n // transfer to caller-supplied result at end\r\n let t0 = -Geometry.largeCoordinateResult;\r\n let t1 = Geometry.largeCoordinateResult;\r\n if (result)\r\n result.setNull();\r\n const velocityTolerance = 1.0e-13;\r\n for (const plane of this._planes) {\r\n const vD = plane.velocity(ray.direction);\r\n const vN = plane.altitude(ray.origin);\r\n\r\n if (Math.abs(vD) <= velocityTolerance) {\r\n // Ray is parallel... No need to continue testing if outside halfspace.\r\n if (vN < -tolerance)\r\n return false; // and result is a null range.\r\n } else {\r\n const rayFraction = - vN / vD;\r\n if (vD < 0.0) {\r\n if (rayFraction < t1)\r\n t1 = rayFraction;\r\n } else {\r\n if (rayFraction > t0)\r\n t0 = rayFraction;\r\n }\r\n }\r\n }\r\n if (t1 < t0)\r\n return false; // and result is a null range.\r\n if (result) {\r\n result.extendX(t0);\r\n result.extendX(t1);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Multiply all the ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect\r\n * on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n for (const plane of this._planes) {\r\n plane.multiplyPlaneByMatrix4d(matrix, false, transpose);\r\n }\r\n return true;\r\n }\r\n /** Return true if `point` satisfies `point.isPointInside` for all planes */\r\n public isPointInside(point: Point3d): boolean {\r\n for (const plane of this._planes) {\r\n // Defaults to strict inside check. Other clipping classes may use \"on or inside\" check for the \"on\" case\r\n if (!plane.isPointInside(point))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Return true if `point` satisfies `point.isPointOnOrInside` for all planes */\r\n public isPointOnOrInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n const interiorTolerance = Math.abs(tolerance); // Interior tolerance should always be positive. (TFS# 246598).\r\n for (const plane of this._planes) {\r\n if (!plane.isPointOnOrInside(point, (plane.interior ? interiorTolerance : tolerance)))\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if a sphere is completely inside the convex set.\r\n * @param centerPoint center of sphere\r\n * @param radius radius of sphere.\r\n */\r\n public isSphereInside(centerPoint: Point3d, radius: number): boolean {\r\n const r1 = Math.abs(radius) + Geometry.smallMetricDistance;\r\n for (const plane of this._planes) {\r\n if (!plane.isPointOnOrInside(centerPoint, r1)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Find the parts of the line segment (if any) that is within the convex clip volume.\r\n * * The line segment is defined by `pointA` and `pointB`.\r\n * * The input fractional interval from `fraction0` to `fraction1` (increasing) is the active part to consider.\r\n * * To clip to the usual bounded line segment, start with fractions (0,1).\r\n * If the clip volume is unbounded, the line interval may also be unbounded.\r\n * * An unbounded line portion will have fraction coordinates positive or negative `Number.MAX_VALUE`.\r\n * @param f0 fraction that is the initial lower fraction of the active interval (e.g., 0.0 for bounded segment).\r\n * @param f1 fraction that is the initial upper fraction of the active interval (e.g., 1.0 for bounded segment).\r\n * @param pointA segment start (fraction 0)\r\n * @param pointB segment end (fraction 1)\r\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\r\n * @returns true if a segment was announced, false if entirely outside.\r\n */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n let fraction: number | undefined;\r\n if (f1 < f0)\r\n return false;\r\n for (const plane of this._planes) {\r\n const hA = -plane.altitude(pointA);\r\n const hB = -plane.altitude(pointB);\r\n fraction = Geometry.conditionalDivideFraction(-hA, (hB - hA));\r\n if (fraction === undefined) {\r\n // Line parallel to the plane. If positive, it is all OUT\r\n if (hA > 0.0)\r\n return false;\r\n } else if (hB > hA) { // STRICTLY moving outward\r\n if (fraction < f0)\r\n return false;\r\n if (fraction < f1)\r\n f1 = fraction;\r\n } else if (hA > hB) { // STRICTLY moving inward\r\n if (fraction > f1)\r\n return false;\r\n if (fraction > f0)\r\n f0 = fraction;\r\n } else {\r\n // Strictly equal evaluations\r\n if (hA > 0.0)\r\n return false;\r\n }\r\n }\r\n if (f1 >= f0) {\r\n if (announce)\r\n announce(f0, f1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n private static _clipArcFractionArray = new GrowableFloat64Array();\r\n /**\r\n * Find fractional parts of the arc that are within this ClipPlaneSet, and announce each as\r\n * * `announce(fraction, fraction, curve)`\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n const breaks = ConvexClipPlaneSet._clipArcFractionArray;\r\n breaks.clear();\r\n for (const clipPlane of this.planes) {\r\n clipPlane.appendIntersectionRadians(arc, breaks);\r\n }\r\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\r\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\r\n }\r\n /**\r\n * Find the parts of the (unbounded) line segment (if any) that is within the convex clip volume.\r\n * @param pointA segment start (fraction 0)\r\n * @param pointB segment end (fraction 1)\r\n * @param announce function to be called to announce a fraction interval that is within the convex clip volume.\r\n * @returns true if a segment was announced, false if entirely outside.\r\n */\r\n public clipUnboundedSegment(pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber): boolean {\r\n return this.announceClippedSegmentIntervals(-Number.MAX_VALUE, Number.MAX_VALUE, pointA, pointB, announce);\r\n }\r\n /** transform each plane in place. */\r\n public transformInPlace(transform: Transform) {\r\n for (const plane of this._planes) {\r\n plane.transformInPlace(transform);\r\n }\r\n }\r\n /**\r\n * Clip a polygon to the inside of the convex set.\r\n * * Results with 2 or fewer points are ignored.\r\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\r\n * @param xyz input points.\r\n * @param work work buffer\r\n * @param tolerance tolerance for \"on plane\" decision.\r\n */\r\n public clipConvexPolygonInPlace(\r\n xyz: GrowableXYZArray, work: GrowableXYZArray, tolerance: number = Geometry.smallMetricDistance,\r\n ): void {\r\n for (const plane of this._planes) {\r\n plane.clipConvexPolygonInPlace(xyz, work, true, tolerance);\r\n if (xyz.length < 3)\r\n return;\r\n }\r\n }\r\n /**\r\n * Clip a convex polygon to (a single) inside part and (possibly many) outside parts.\r\n * @param xyz input polygon.\r\n * @param outsideFragments an array to receive (via push, with no preliminary clear) outside fragments\r\n * @param arrayCache cache for work arrays.\r\n * @return the surviving inside part (if any)\r\n * @see polygonClip\r\n */\r\n public clipInsidePushOutside(\r\n xyz: IndexedXYZCollection, outsideFragments: GrowableXYZArray[] | undefined, arrayCache: GrowableXYZArrayCache,\r\n ): GrowableXYZArray | undefined {\r\n const perpendicularRange = Range1d.createNull();\r\n let newInside = arrayCache.grabFromCache();\r\n let newOutside = arrayCache.grabFromCache();\r\n let insidePart = arrayCache.grabFromCache(); // this is empty ...\r\n insidePart.pushFrom(xyz);\r\n // While looping through planes . .\r\n // the outside part for the current plane is definitely outside and can be stashed to the final outside\r\n // the inside part for the current plane passes forward to be further split by the remaining planes.\r\n for (const plane of this._planes) {\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\r\n plane, insidePart, newInside, newOutside, perpendicularRange,\r\n );\r\n if (newOutside.length > 0) {\r\n // the newOutside fragment is definitely outside the ConvexClipPlaneSet\r\n if (outsideFragments) // save the definitely outside part as return data.\r\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\r\n newOutside = arrayCache.grabFromCache();\r\n if (newInside.length < 3) { // ignore inside slivers\r\n insidePart.length = 0;\r\n break;\r\n }\r\n // insideWork is changed ... swap it with insidePart\r\n arrayCache.dropToCache(insidePart);\r\n insidePart = newInside;\r\n newInside = arrayCache.grabFromCache();\r\n } else {\r\n // newOutside is empty => newInside is identical to insidePart. Let insidePart feed through to the next clipper.\r\n }\r\n }\r\n // at break or fall out ...\r\n // ALWAYS drop `newInside` and `newOutside` to the cache\r\n arrayCache.dropToCache(newInside);\r\n arrayCache.dropToCache(newOutside);\r\n // if `insidePart` is alive, return it to caller. Otherwise drop it to cache and return undefined.\r\n if (insidePart.length > 0)\r\n return insidePart;\r\n arrayCache.dropToCache(insidePart);\r\n return undefined;\r\n }\r\n /**\r\n * Returns 1, 2, or 3 based on whether point array is strongly inside, ambiguous, or strongly outside respectively.\r\n * * This has a peculiar expected use case as a very fast pre-filter for more precise clipping.\r\n * * The expected point set is for a polygon.\r\n * * Hence any clipping will eventually have to consider the lines between the points.\r\n * * This method looks for the special case of a single clip plane that has all the points outside.\r\n * * In this case the whole polygon must be outside.\r\n * * Note that this does not detect a polygon that is outside but \"crosses a corner\" -- it is mixed with respect to\r\n * multiple planes.\r\n */\r\n public classifyPointContainment(points: Point3d[], onIsOutside: boolean): ClipPlaneContainment {\r\n let allInside = true;\r\n const onTolerance = onIsOutside ? 1.0e-8 : -1.0e-8;\r\n const interiorTolerance = 1.0e-8; // Interior tolerance should always be positive\r\n\r\n for (const plane of this._planes) {\r\n let nOutside = 0;\r\n for (const point of points) {\r\n if (plane.altitude(point) < (plane.interior ? interiorTolerance : onTolerance)) {\r\n nOutside++;\r\n allInside = false;\r\n }\r\n }\r\n if (nOutside === points.length)\r\n return ClipPlaneContainment.StronglyOutside;\r\n }\r\n return allInside ? ClipPlaneContainment.StronglyInside : ClipPlaneContainment.Ambiguous;\r\n }\r\n /**\r\n * * Create a convex clip set for a polygon swept with possible tilt angle.\r\n * * planes are constructed by ClipPlane.createEdgeAndUpVector, using successive points from the array.\r\n * * If the first and last points match, the polygon area is checked. If the area is negative, points are used in\r\n * reverse order.\r\n * * If first and last points do not match, points are used in order given\r\n * @param points polygon points. (Closure point optional)\r\n * @param upVector primary sweep direction, as applied by ClipPlane.createEdgeAndUpVector\r\n * @param tiltAngle angle to tilt sweep planes away from the sweep direction.\r\n */\r\n public static createSweptPolyline(\r\n points: Point3d[], upVector: Vector3d, tiltAngle?: Angle,\r\n ): ConvexClipPlaneSet | undefined {\r\n const result = ConvexClipPlaneSet.createEmpty();\r\n let reverse = false;\r\n if (points.length > 3 && points[0].isAlmostEqual(points[points.length - 1])) {\r\n const polygonNormal: Vector3d = PolygonOps.areaNormal(points);\r\n const normalDot = polygonNormal.dotProduct(upVector);\r\n if (normalDot > 0.0)\r\n reverse = true;\r\n }\r\n for (let i = 0; (i + 1) < points.length; i++) {\r\n if (reverse) {\r\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i + 1], points[i], upVector, tiltAngle);\r\n if (toAdd) { // clipPlane creation could result in undefined\r\n result.addPlaneToConvexSet(toAdd);\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n const toAdd = ClipPlane.createEdgeAndUpVector(points[i], points[i + 1], upVector, tiltAngle);\r\n if (toAdd) { // clipPlane creation could result in undefined\r\n result.addPlaneToConvexSet(toAdd);\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Add a plane to the convex set.\r\n * @param plane plane to add\r\n */\r\n public addPlaneToConvexSet(plane: ClipPlane | Plane3dByOriginAndUnitNormal | undefined) {\r\n if (plane instanceof ClipPlane)\r\n this._planes.push(plane);\r\n else if (plane instanceof Plane3dByOriginAndUnitNormal)\r\n this._planes.push(ClipPlane.createPlane(plane));\r\n }\r\n /**\r\n * Test many points. Distribute them to arrays depending on in/out result.\r\n * @param points points to test\r\n * @param inOrOn points that are in or on the set\r\n * @param out points that are out.\r\n */\r\n public clipPointsOnOrInside(points: Point3d[], inOrOn: Point3d[], out: Point3d[]) {\r\n inOrOn.length = 0;\r\n out.length = 0;\r\n for (const xyz of points) {\r\n if (this.isPointOnOrInside(xyz, 0.0)) {\r\n inOrOn.push(xyz);\r\n } else {\r\n out.push(xyz);\r\n }\r\n }\r\n }\r\n /**\r\n * Clip a polygon to the planes of the clip plane set.\r\n * * For a convex input polygon, the output polygon is also convex.\r\n * * For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a\r\n * valid clip in a parity sense (overlapping regions cancel).\r\n * @param input polygon, usually convex. Unchanged.\r\n * @param output output polygon\r\n * @param work optional work array.\r\n * @param planeToSkip if this plane is found in the convex set, it is NOT applied.\r\n * This is useful when caller knows the polygon lies in one of the instance planes.\r\n * @param tolerance distance tolerance for \"on plane\" decision. Default value is [[Geometry.smallMetricDistance]].\r\n * @see appendPolygonClip\r\n */\r\n public polygonClip(\r\n input: GrowableXYZArray | Point3d[],\r\n output: GrowableXYZArray,\r\n work?: GrowableXYZArray,\r\n planeToSkip?: ClipPlane,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): void {\r\n if (input instanceof GrowableXYZArray)\r\n input.clone(output);\r\n else\r\n GrowableXYZArray.create(input, output);\r\n if (!work)\r\n work = new GrowableXYZArray();\r\n for (const plane of this._planes) {\r\n if (planeToSkip === plane)\r\n continue;\r\n if (output.length === 0)\r\n break;\r\n plane.clipConvexPolygonInPlace(output, work, true, tolerance);\r\n }\r\n }\r\n /**\r\n * * Define new planes in this ConvexClipPlaneSet so it clips to the inside of a polygon.\r\n * * always create planes for the swept edges of the polygon\r\n * * optionally (with nonzero sideSelect) create a cap plane using the polygon normal.\r\n * @param points Points of a bounding polygon\r\n * @param sweepDirection direction to sweep.\r\n * @param sideSelect 0 to have no cap polygon, 1 if the sweep vector side is in, -1 if sweep vector side is out.\r\n */\r\n public reloadSweptPolygon(points: Point3d[], sweepDirection: Vector3d, sideSelect: number): number {\r\n this._planes.length = 0;\r\n const n = points.length;\r\n if (n <= 2)\r\n return 0;\r\n\r\n const planeNormal: Vector3d = PolygonOps.areaNormal(points);\r\n const isCCW = sweepDirection.dotProduct(planeNormal) > 0.0;\r\n\r\n const delta = isCCW ? 1 : n - 1;\r\n for (let i = 0; i < n; i++) {\r\n const i1 = (i + delta) % n;\r\n const xyz0: Point3d = points[i];\r\n const xyz1: Point3d = points[i1];\r\n if (xyz0.isAlmostEqual(xyz1))\r\n continue;\r\n const edgeVector: Vector3d = Vector3d.createStartEnd(xyz0, xyz1);\r\n const inwardNormal: Vector3d = Vector3d.createCrossProduct(sweepDirection.x, sweepDirection.y, sweepDirection.z,\r\n edgeVector.x, edgeVector.y, edgeVector.z);\r\n const inwardNormalNormalized = inwardNormal.normalize();\r\n let distance;\r\n if (inwardNormalNormalized) { // should never fail... simply a check due to the format of the normalize function return\r\n distance = inwardNormalNormalized.dotProduct(xyz0);\r\n const clipToAdd = ClipPlane.createNormalAndDistance(inwardNormalNormalized, distance, false, false);\r\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\r\n }\r\n }\r\n if (sideSelect !== 0.0) {\r\n let planeNormalNormalized = planeNormal.normalize();\r\n if (planeNormalNormalized) { // Again.. should never fail\r\n const a = sweepDirection.dotProduct(planeNormalNormalized) * sideSelect;\r\n if (a < 0.0)\r\n planeNormalNormalized = planeNormalNormalized.negate();\r\n const xyz0: Point3d = points[0];\r\n const distance = planeNormalNormalized.dotProduct(xyz0);\r\n const clipToAdd = ClipPlane.createNormalAndDistance(planeNormalNormalized, distance, false, false);\r\n if (clipToAdd) { this._planes.push(clipToAdd); } // clipPlane creation could result in undefined\r\n }\r\n }\r\n return isCCW ? 1 : -1;\r\n }\r\n /**\r\n * Compute intersections among all combinations of 3 planes in the convex set.\r\n * * optionally throw out points that are not in the set.\r\n * * optionally push the points in the caller-supplied point array.\r\n * * optionally extend a caller supplied range.\r\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\r\n * range is the range of the convex set.\r\n * * If the convex set is unbounded, the range only contains the range of the accepted (corner) points, and the\r\n * range is not a representative of the \"range of all points in the set\".\r\n * @param points (optional) array to which computed points are to be added.\r\n * @param rangeToExtend (optional) range to be extended by the computed points\r\n * @param transform (optional) transform to apply to the accepted points.\r\n * @param testContainment if true, test each point to see if it is within the convex set. (send false if confident\r\n * that the convex set is rectilinear set such as a slab. Send true if chiseled corners are possible).\r\n * @returns number of points.\r\n */\r\n public computePlanePlanePlaneIntersections(\r\n points: Point3d[] | undefined,\r\n rangeToExtend: Range3d | undefined,\r\n transform?: Transform,\r\n testContainment: boolean = true,\r\n ): number {\r\n const normalRows = Matrix3d.createIdentity();\r\n const allPlanes = this._planes;\r\n const xyz = Point3d.createZero();\r\n const n = allPlanes.length;\r\n let numPoints = 0; // explicitly count points -- can't wait to end for points.length because it may be an optional output.\r\n for (let i = 0; i < n; i++) {\r\n for (let j = i + 1; j < n; j++)\r\n for (let k = j + 1; k < n; k++) {\r\n Matrix3d.createRowValues(\r\n allPlanes[i].inwardNormalRef.x, allPlanes[i].inwardNormalRef.y, allPlanes[i].inwardNormalRef.z,\r\n allPlanes[j].inwardNormalRef.x, allPlanes[j].inwardNormalRef.y, allPlanes[j].inwardNormalRef.z,\r\n allPlanes[k].inwardNormalRef.x, allPlanes[k].inwardNormalRef.y, allPlanes[k].inwardNormalRef.z,\r\n normalRows);\r\n if (normalRows.computeCachedInverse(false)) {\r\n normalRows.multiplyInverseXYZAsPoint3d(allPlanes[i].distance, allPlanes[j].distance, allPlanes[k].distance, xyz);\r\n if (!testContainment || this.isPointOnOrInside(xyz, Geometry.smallMetricDistance)) {\r\n numPoints++;\r\n if (transform)\r\n transform.multiplyPoint3d(xyz, xyz);\r\n if (points)\r\n points.push(xyz.clone());\r\n if (rangeToExtend)\r\n rangeToExtend.extendPoint(xyz);\r\n }\r\n }\r\n }\r\n }\r\n return numPoints;\r\n }\r\n /**\r\n * Set the `invisible` property on each plane of the convex set.\r\n * @param invisible value to store\r\n */\r\n public setInvisible(invisible: boolean) {\r\n for (const plane of this._planes) {\r\n plane.setInvisible(invisible);\r\n }\r\n }\r\n /**\r\n * Add planes for z-direction clip between low and high z levels.\r\n * @param invisible value to apply to the `invisible` bit for the new planes\r\n * @param zLow low z value. The plane clips out points with z below this.\r\n * @param zHigh high z value. The plane clips out points with z above this.\r\n */\r\n public addZClipPlanes(invisible: boolean, zLow?: number, zHigh?: number) {\r\n if (zLow !== undefined)\r\n this.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, 1), zLow, invisible));\r\n if (zHigh !== undefined)\r\n this.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(Vector3d.create(0, 0, -1), -zHigh, invisible));\r\n }\r\n /**\r\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\r\n * @param xyz convex polygon. This is not changed.\r\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from\r\n * the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed from\r\n * the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n * @see polygonClip\r\n */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ): void {\r\n const newInside = this.clipInsidePushOutside(xyz, outsideFragments, arrayCache);\r\n if (newInside)\r\n insideFragments.push(newInside);\r\n }\r\n /**\r\n * Create a convex clip set from a convex mesh.\r\n * * Create a plane for each facet.\r\n * * Assemble the planes as a single clip plane set.\r\n * * If the facets are closed by edge pairing, use the sign of the computed volume to point the plane normals inward.\r\n * * If the facets are not closed, the facet orientation determines plane orientation.\r\n * * The implication of this is that if the facets are a convex volume, the returned clip plane set is convex.\r\n * @param convexMesh input mesh. For best results, the mesh should be closed and convex.\r\n * @param result optional preallocated result to reuse and return\r\n * @return clipper and volume (zero if mesh is not closed)\r\n */\r\n public static createConvexPolyface(\r\n convexMesh: Polyface | PolyfaceVisitor, result?: ConvexClipPlaneSet,\r\n ): { clipper: ConvexClipPlaneSet, volume: number } {\r\n result = this.createEmpty(result);\r\n let vol = 0;\r\n if (PolyfaceQuery.isPolyfaceClosedByEdgePairing(convexMesh))\r\n vol = PolyfaceQuery.sumTetrahedralVolumes(convexMesh);\r\n const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward\r\n const origin = Point3d.createZero();\r\n const normal = Vector3d.createZero();\r\n const plane = Plane3dByOriginAndUnitNormal.createXYPlane();\r\n const visitor = convexMesh instanceof Polyface ? convexMesh.createVisitor(0) : convexMesh;\r\n visitor.setNumWrap(0);\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n if (PolygonOps.areaNormalGo(visitor.point, normal)) {\r\n normal.scaleInPlace(scale);\r\n visitor.point.front(origin); // won't fail because we computed a normal\r\n result.addPlaneToConvexSet(Plane3dByOriginAndUnitNormal.create(origin, normal, plane)); // all inputs cloned\r\n }\r\n }\r\n return { clipper: result, volume: vol };\r\n }\r\n\r\n // FUNCTIONS SKIPPED DUE TO BSPLINES, VU, OR NON-USAGE IN NATIVE CODE----------------------------------------------------------------\r\n\r\n // Uses bsplines... skipping for now:\r\n // public convexAppendIntervalsFromBspline();\r\n\r\n // Uses pushing and clearing from/to a cache and added functionality for arrays. . . skipping for now\r\n // public convexPolygonClipInsideOutside(input: Point3d[], inside: Point3d[], outside: Point3d[], work1: Point3d[], work2: Point3d[],\r\n // clearOutside: boolean, distanceTolerance: number)\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
+ import { IndexedXYZCollection } from "../../geometry3d/IndexedXYZCollection";
1
2
  import { Vector3d } from "../../geometry3d/Point3dVector3d";
2
3
  import { UnionOfConvexClipPlaneSets } from "../UnionOfConvexClipPlaneSets";
3
- import { IndexedXYZCollection } from "../../geometry3d/IndexedXYZCollection";
4
4
  /**
5
5
  * Class for building clip sets for offset regions.
6
6
  * @internal