@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
@@ -8,20 +8,21 @@ exports.ClipShape = exports.ClipPrimitive = exports.ClipMaskXYZRangePlanes = voi
8
8
  /** @packageDocumentation
9
9
  * @module CartesianGeometry
10
10
  */
11
+ const core_bentley_1 = require("@itwin/core-bentley");
11
12
  const Geometry_1 = require("../Geometry");
12
13
  const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
13
14
  const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
15
+ const PointHelpers_1 = require("../geometry3d/PointHelpers");
14
16
  const PolygonOps_1 = require("../geometry3d/PolygonOps");
17
+ const PolylineOps_1 = require("../geometry3d/PolylineOps");
15
18
  const Transform_1 = require("../geometry3d/Transform");
16
19
  const Graph_1 = require("../topology/Graph");
17
20
  const Triangulation_1 = require("../topology/Triangulation");
21
+ const AlternatingConvexClipTree_1 = require("./AlternatingConvexClipTree");
18
22
  const ClipPlane_1 = require("./ClipPlane");
19
23
  const ClipUtils_1 = require("./ClipUtils");
20
24
  const ConvexClipPlaneSet_1 = require("./ConvexClipPlaneSet");
21
25
  const UnionOfConvexClipPlaneSets_1 = require("./UnionOfConvexClipPlaneSets");
22
- const AlternatingConvexClipTree_1 = require("./AlternatingConvexClipTree");
23
- const PointHelpers_1 = require("../geometry3d/PointHelpers");
24
- const PolylineOps_1 = require("../geometry3d/PolylineOps");
25
26
  // cspell:word zlow
26
27
  // cspell:word zhigh
27
28
  /**
@@ -218,11 +219,13 @@ class ClipPrimitive {
218
219
  * (b) finite distance from origin.
219
220
  */
220
221
  containsZClip() {
221
- if (this.fetchClipPlanesRef() !== undefined)
222
- for (const convexSet of this._clipPlanes.convexSets)
222
+ const clipPlanes = this.fetchClipPlanesRef();
223
+ if (clipPlanes !== undefined) {
224
+ for (const convexSet of clipPlanes.convexSets)
223
225
  for (const plane of convexSet.planes)
224
226
  if (Math.abs(plane.inwardNormalRef.z) > 1.0e-6 && Math.abs(plane.distance) !== Number.MAX_VALUE)
225
227
  return true;
228
+ }
226
229
  return false;
227
230
  }
228
231
  /**
@@ -286,10 +289,10 @@ class PolyEdge {
286
289
  // old logic: use difference of (previously computed) normals as perpendicular to bisector.
287
290
  static makeUnitPerpendicularToBisector(edgeA, edgeB, reverse) {
288
291
  let candidate = edgeB.normal.minus(edgeA.normal);
289
- if (candidate.normalize(candidate) === undefined) {
292
+ if (candidate.normalize(candidate) === undefined) { // adjacent edges are parallel: try chord as bisector normal
290
293
  candidate = Point3dVector3d_1.Vector3d.createStartEnd(edgeA.pointA, edgeB.pointB);
291
294
  if (candidate.normalize(candidate) === undefined)
292
- return undefined;
295
+ return undefined; // no chord => backtracking edge => fail
293
296
  }
294
297
  if (reverse)
295
298
  candidate.scale(-1.0, candidate);
@@ -325,30 +328,71 @@ class ClipShape extends ClipPrimitive {
325
328
  get invisible() {
326
329
  return this._invisible;
327
330
  }
328
- /** Return this transformFromClip, which may be undefined. */
331
+ /** Return local to world transform, which may be undefined. */
329
332
  get transformFromClip() {
330
333
  return this._transformFromClip;
331
334
  }
332
- /** Return this transformToClip, which may be undefined. */
335
+ /** Return world to local transform, which may be undefined. */
333
336
  get transformToClip() {
334
337
  return this._transformToClip;
335
338
  }
336
- /** Returns true if this ClipShape's transforms are currently set. */
339
+ /**
340
+ * Returns true if this ClipShape has a local to world transform.
341
+ * @see type guards [[hasTransformFromClip]], [[hasTransformToClip]], and [[hasTransforms]].
342
+ */
337
343
  get transformValid() {
338
- return this.transformFromClip !== undefined;
344
+ return this._transformFromClip !== undefined;
339
345
  }
340
- /** Returns true if this ClipShape's lower z boundary is set. */
346
+ /**
347
+ * Returns true if this ClipShape's lower z boundary is set.
348
+ * @see type guard [[hasZLow]].
349
+ */
341
350
  get zLowValid() {
342
351
  return this._zLow !== undefined;
343
352
  }
344
- /** Returns true if this ClipShape's upper z boundary is set. */
353
+ /**
354
+ * Returns true if this ClipShape's upper z boundary is set.
355
+ * @see type guard [[hasZHigh]].
356
+ */
345
357
  get zHighValid() {
346
358
  return this._zHigh !== undefined;
347
359
  }
348
- /** Return true if this ClipShape has a local to world transform */
360
+ /**
361
+ * Return true if this ClipShape has a local to world transform
362
+ * @deprecated Use duplicate property [[transformValid]] or type guard [[hasTransformFromClip]] instead.
363
+ */
349
364
  get transformIsValid() {
350
365
  return this._transformFromClip !== undefined;
351
366
  }
367
+ /** Type guard for [[zLow]]. */
368
+ hasZLow() {
369
+ return this._zLow !== undefined;
370
+ }
371
+ /** Type guard for [[zHigh]]. */
372
+ hasZHigh() {
373
+ return this._zHigh !== undefined;
374
+ }
375
+ /**
376
+ * Type guard for [[transformFromClip]].
377
+ * @see related type guards [[hasTransformToClip]] and [[hasTransforms]].
378
+ */
379
+ hasTransformFromClip() {
380
+ return this._transformFromClip !== undefined;
381
+ }
382
+ /**
383
+ * Type guard for [[transformToClip]].
384
+ * @see related type guards [[hasTransformFromClip]] and [[hasTransforms]].
385
+ */
386
+ hasTransformToClip() {
387
+ return this._transformToClip !== undefined;
388
+ }
389
+ /**
390
+ * Type guard for both [[transformFromClip]] and [[transformToClip]].
391
+ * @see individual type guards [[hasTransformFromClip]] and [[hasTransformToClip]].
392
+ */
393
+ hasTransforms() {
394
+ return this._transformFromClip !== undefined && this._transformToClip !== undefined;
395
+ }
352
396
  /** Return this zLow, which may be undefined. */
353
397
  get zLow() {
354
398
  return this._zLow;
@@ -481,7 +525,9 @@ class ClipShape extends ClipPrimitive {
481
525
  blockPoints[1].x = blockPoints[2].x = high.x;
482
526
  blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;
483
527
  blockPoints[2].y = blockPoints[3].y = high.y;
484
- return ClipShape.createShape(blockPoints, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined, transform, isMask, invisible, result);
528
+ const shape = ClipShape.createShape(blockPoints, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined, transform, isMask, invisible, result);
529
+ (0, core_bentley_1.assert)(shape !== undefined, "expect defined because blockPoints.length > 2");
530
+ return shape;
485
531
  }
486
532
  /** Creates a new ClipShape with undefined members and a polygon points array of zero length. */
487
533
  static createEmpty(isMask = false, invisible = false, transform, result) {
@@ -531,33 +577,38 @@ class ClipShape extends ClipPrimitive {
531
577
  /**
532
578
  * Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets
533
579
  * defining the bounded region of linear planes. Returns true if successful.
580
+ * * This handles the degenerate 2-point polygon case, e.g., select by line. See [[parseConvexPolygonPlanes]].
534
581
  */
535
582
  parseLinearPlanes(set, start, end, cameraFocalLength) {
536
- // Handles the degenerate case of 2 distinct points (used by select by line).
537
- const normal = start.vectorTo(end);
538
- if (normal.magnitude() === 0.0)
539
- return false;
540
- normal.normalize(normal);
583
+ const normal = Point2dVector2d_1.Vector2d.createStartEnd(start, end); // xy only!
584
+ if (!normal.normalize(normal))
585
+ return false; // filter out trivial edge
586
+ if (cameraFocalLength === 0.0)
587
+ cameraFocalLength = undefined; // ensure when camera is defined, vecStart/End3d are nonzero
541
588
  const convexSet = ConvexClipPlaneSet_1.ConvexClipPlaneSet.createEmpty();
542
589
  if (cameraFocalLength === undefined) {
543
- const perpendicular = Point2dVector2d_1.Vector2d.create(-normal.y, normal.x);
544
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(normal.x, normal.y), Point3dVector3d_1.Point3d.createFrom(start), this._invisible));
545
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(-normal.x, -normal.y), Point3dVector3d_1.Point3d.createFrom(end), this._invisible));
546
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(perpendicular.x, perpendicular.y), Point3dVector3d_1.Point3d.createFrom(start), this._invisible));
547
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(-perpendicular.x, -perpendicular.y), Point3dVector3d_1.Point3d.createFrom(start), this._invisible));
590
+ // normal and perp are nonzero, so ClipPlane creation can only fail on out-of-memory
591
+ const perp = Point2dVector2d_1.Vector2d.create(-normal.y, normal.x);
592
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(normal.x, normal.y), start, this._invisible));
593
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(-normal.x, -normal.y), end, this._invisible));
594
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(perp.x, perp.y), start, this._invisible));
595
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(-perp.x, -perp.y), start, this._invisible));
548
596
  }
549
597
  else {
550
- const start3d = Point3dVector3d_1.Point3d.create(start.x, start.y, -cameraFocalLength);
551
- const end3d = Point3dVector3d_1.Point3d.create(end.x, end.y, -cameraFocalLength);
552
- const vecEnd3d = Point3dVector3d_1.Vector3d.createFrom(end3d);
553
- const perpendicular = vecEnd3d.crossProduct(Point3dVector3d_1.Vector3d.createFrom(start3d)).normalize();
554
- let endNormal = Point3dVector3d_1.Vector3d.createFrom(start3d).crossProduct(perpendicular).normalize();
555
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(perpendicular, 0.0, this._invisible));
556
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(endNormal, 0.0, this._invisible));
557
- perpendicular.negate();
558
- endNormal = vecEnd3d.crossProduct(perpendicular).normalize();
559
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(perpendicular, 0.0, this._invisible));
560
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(endNormal, 0.0, this._invisible));
598
+ // The cross products are nonzero because their inputs are nonzero and nonparallel (because start/end are xy-distinct).
599
+ // Thus ClipPlane creation can only fail on out-of-memory.
600
+ const vecStart3d = Point3dVector3d_1.Vector3d.create(start.x, start.y, -cameraFocalLength);
601
+ const vecEnd3d = Point3dVector3d_1.Vector3d.create(end.x, end.y, -cameraFocalLength);
602
+ const perpendicular = Point3dVector3d_1.Vector3d.createZero();
603
+ const endNormal = Point3dVector3d_1.Vector3d.createZero();
604
+ vecEnd3d.crossProduct(vecStart3d, perpendicular).normalize(perpendicular);
605
+ vecStart3d.crossProduct(perpendicular, endNormal).normalize(endNormal);
606
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(perpendicular, 0.0, this._invisible));
607
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(endNormal, 0.0, this._invisible));
608
+ perpendicular.negate(perpendicular);
609
+ vecEnd3d.crossProduct(perpendicular, endNormal).normalize(endNormal);
610
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(perpendicular, 0.0, this._invisible));
611
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(endNormal, 0.0, this._invisible));
561
612
  }
562
613
  convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);
563
614
  set.addConvexSet(convexSet);
@@ -566,18 +617,23 @@ class ClipShape extends ClipPrimitive {
566
617
  /**
567
618
  * Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with
568
619
  * ConvexClipPlaneSets defining the bounded region. Returns true if successful.
620
+ * @param polygon convex polygon with closure point. z-coordinates are ignored.
621
+ * @param direction whether the area described by the polygon is found on its directed edges' left (nonnegative) or
622
+ * right (negative). Typically this is positive for CCW xy-polygons.
623
+ * @param buildExteriorClipper whether the returned clippers represent the xy-region *outside* the polygon.
624
+ * When this is true, `direction` is typically set accordingly. For example, for a CCW polygon, to return clippers
625
+ * for the exterior region, pass `direction < 0` and `buildExteriorClipper = true`. Currently not implemented for
626
+ * camera view.
569
627
  */
570
628
  parseConvexPolygonPlanes(set, polygon, direction, buildExteriorClipper, cameraFocalLength) {
571
- const samePointTolerance = 1.0e-8; // This could possibly be replaced with more widely used constants
572
629
  const edges = [];
573
- // const reverse = (direction < 0) !== this._isMask;
574
630
  const reverse = direction < 0;
631
+ if (cameraFocalLength === 0.0)
632
+ cameraFocalLength = undefined; // ensure when camera is defined, edges[].pointA/B are nonzero
633
+ const z = (cameraFocalLength === undefined) ? 0.0 : -cameraFocalLength;
575
634
  for (let i = 0; i < polygon.length - 1; i++) {
576
- const z = (cameraFocalLength === undefined) ? 0.0 : -cameraFocalLength;
577
- const dir = Point3dVector3d_1.Vector3d.createStartEnd(polygon[i], polygon[i + 1]);
578
- const magnitude = dir.magnitude();
579
- dir.normalize(dir);
580
- if (magnitude > samePointTolerance) {
635
+ const dir = Point2dVector2d_1.Vector2d.createStartEnd(polygon[i], polygon[i + 1]); // xy only!
636
+ if (dir.normalize(dir)) { // filter out trivial edges
581
637
  const normal = Point3dVector3d_1.Vector3d.create(reverse ? dir.y : -dir.y, reverse ? -dir.x : dir.x);
582
638
  edges.push(new PolyEdge(polygon[i], polygon[i + 1], normal, z));
583
639
  }
@@ -585,7 +641,12 @@ class ClipShape extends ClipPrimitive {
585
641
  if (edges.length < 3) {
586
642
  return false;
587
643
  }
644
+ // NOTE: ClipPlane creation below fails only on out-of-memory because we ensure each input normal is nonzero:
645
+ // * edges[] normals are nonzero because the array is populated only with nontrivial edges.
646
+ // * with camera, edges[].pointA/B is nonzero and never parallel as vectors, thus their cross is nonzero.
647
+ // * bisector planes are only created for nonzero bisector normals.
588
648
  if (buildExteriorClipper) {
649
+ (0, core_bentley_1.assert)(cameraFocalLength === undefined, "TODO: implement camera logic for exterior clipper creation");
589
650
  const last = edges.length - 1;
590
651
  for (let i = 0; i <= last; i++) {
591
652
  const edge = edges[i];
@@ -594,13 +655,14 @@ class ClipShape extends ClipPrimitive {
594
655
  const convexSet = ConvexClipPlaneSet_1.ConvexClipPlaneSet.createEmpty();
595
656
  const previousPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(prevEdge, edge, !reverse);
596
657
  const nextPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(edge, nextEdge, reverse);
597
- // Create three-sided fans from each edge. Note we could define the correct region
598
- // with only two planes for edge, but cannot then designate the "interior" status of the edges accurately.
658
+ // Create three-sided fans from each edge:
659
+ // * We could define the region with only two planes per edge, but then we wouldn't be able to designate the "interior" status accurately.
660
+ // * Silently ignore undefined bisector normal. This can happen if input violates the convexity assumption with a pair of backtracking edges.
599
661
  if (previousPerpendicular)
600
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(previousPerpendicular, edge.pointA, this._invisible, true));
601
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(edge.normal, edge.pointB, this._invisible, false));
662
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(previousPerpendicular, edge.pointA, this._invisible, true));
663
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(edge.normal, edge.pointB, this._invisible, false));
602
664
  if (nextPerpendicular)
603
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(nextPerpendicular, nextEdge.pointA, this._invisible, true));
665
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(nextPerpendicular, nextEdge.pointA, this._invisible, true));
604
666
  set.addConvexSet(convexSet);
605
667
  set.addOutsideZClipSets(this._invisible, this._zLow, this._zHigh);
606
668
  }
@@ -609,15 +671,22 @@ class ClipShape extends ClipPrimitive {
609
671
  const convexSet = ConvexClipPlaneSet_1.ConvexClipPlaneSet.createEmpty();
610
672
  if (cameraFocalLength === undefined) {
611
673
  for (const edge of edges)
612
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndPoint(Point3dVector3d_1.Vector3d.create(edge.normal.x, edge.normal.y), edge.pointA));
674
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndPoint(edge.normal, edge.pointA));
613
675
  }
614
676
  else {
615
- if (reverse)
616
- for (const edge of edges)
617
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(Point3dVector3d_1.Vector3d.createFrom(edge.pointA).crossProduct(Point3dVector3d_1.Vector3d.createFrom(edge.pointB)).normalize(), 0.0));
618
- else
619
- for (const edge of edges)
620
- convexSet.planes.push(ClipPlane_1.ClipPlane.createNormalAndDistance(Point3dVector3d_1.Vector3d.createFrom(edge.pointB).crossProduct(Point3dVector3d_1.Vector3d.createFrom(edge.pointA)).normalize(), 0.0));
677
+ const cross = Point3dVector3d_1.Vector3d.createZero();
678
+ if (reverse) {
679
+ for (const edge of edges) {
680
+ Point3dVector3d_1.Vector3d.createFrom(edge.pointA).crossProduct(Point3dVector3d_1.Vector3d.createFrom(edge.pointB), cross).normalize(cross);
681
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(cross, 0.0));
682
+ }
683
+ }
684
+ else {
685
+ for (const edge of edges) {
686
+ Point3dVector3d_1.Vector3d.createFrom(edge.pointB).crossProduct(Point3dVector3d_1.Vector3d.createFrom(edge.pointA), cross).normalize(cross);
687
+ convexSet.addPlaneToConvexSet(ClipPlane_1.ClipPlane.createNormalAndDistance(cross, 0.0));
688
+ }
689
+ }
621
690
  }
622
691
  convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);
623
692
  set.addConvexSet(convexSet);
@@ -1 +1 @@
1
- {"version":3,"file":"ClipPrimitive.js","sourceRoot":"","sources":["../../../src/clipping/ClipPrimitive.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,mEAAyD;AACzD,mEAAkE;AAClE,yDAAsD;AAGtD,uDAAoD;AAEpD,6CAA0E;AAC1E,6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C;IACD;;;;OAIG;IACa,gBAAgB,CAAC,SAAoB;QACnD,IAAI,SAAS,CAAC,UAAU;YACtB,OAAO,IAAI,CAAC;QACd,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,kBAAkB;YACzB,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;;YAEvF,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;QAC9C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,qBAAqB;QAChF,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;;;OAMG;IACH,IAAW,WAAW;QACpB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,uGAAuG;YACrI,OAAO,KAAK,CAAC;QACf,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS;YACvC,OAAO,IAAI,CAAC;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACzD,OAAO,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC;IACxC,CAAC;IACD,wFAAwF;IACjF,sBAAsB,CAAC,KAAc;QAC1C,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS;YACrC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IACD,0FAA0F;IACnF,wBAAwB,CAAC,KAAc;QAC5C,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS;YACvC,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF;AA1dD,8BA0dC","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 { Geometry } from \"../Geometry\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { TransformProps, XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { Triangulator } from \"../topology/Triangulation\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets, UnionOfConvexClipPlaneSetsProps } from \"./UnionOfConvexClipPlaneSets\";\r\nimport { AlternatingCCTreeNode } from \"./AlternatingConvexClipTree\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { PolylineOps } from \"../geometry3d/PolylineOps\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\n// cspell:word zlow\r\n// cspell:word zhigh\r\n/**\r\n * Bit mask type for referencing subsets of 6 planes of range box.\r\n * @public\r\n */\r\nexport enum ClipMaskXYZRangePlanes {\r\n /** no planes */\r\n None = 0x00,\r\n /** low x plane */\r\n XLow = 0x01,\r\n /** high x plane */\r\n XHigh = 0x02,\r\n /** low y plane */\r\n YLow = 0x04,\r\n /** high y plane */\r\n YHigh = 0x08,\r\n /** low z plane */\r\n ZLow = 0x10,\r\n /** high z plane */\r\n ZHigh = 0x20,\r\n /** all x and y planes, neither z plane */\r\n XAndY = 0x0f,\r\n /** all 6 planes */\r\n All = 0x3f,\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipPrimitive]] defined by a set of clip planes.\r\n * @public\r\n */\r\nexport interface ClipPrimitivePlanesProps {\r\n planes?: {\r\n /** The set of clip planes. */\r\n clips?: UnionOfConvexClipPlaneSetsProps;\r\n /** `true` if the primitive is invisible. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipShape]].\r\n * @public\r\n */\r\nexport interface ClipPrimitiveShapeProps {\r\n /** The clip polygon. */\r\n shape?: {\r\n /** Points of the polygon, in the xy plane of the local coordinate system. */\r\n points?: XYZProps[];\r\n /** Transform from local to world. */\r\n trans?: TransformProps;\r\n /** Lower bound on z (in local coordinates). */\r\n zlow?: number;\r\n /** Upper bound on z (in local coordinates). */\r\n zhigh?: number;\r\n /** `true` if this shape is considered a hole (keep geometry outside of the polygon). */\r\n mask?: boolean;\r\n /** `true` if this shape is invisible. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/** Wire format describing a [[ClipPrimitive]].\r\n * @public\r\n */\r\nexport type ClipPrimitiveProps = ClipPrimitivePlanesProps | ClipPrimitiveShapeProps;\r\n\r\n/**\r\n * * ClipPrimitive is a base class for clipping implementations that use\r\n * * A UnionOfConvexClipPlaneSets designated \"clipPlanes\".\r\n * * An \"invisible\" flag.\r\n * * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.\r\n * * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.\r\n * * ClipPrimitive can be constructed with no planes.\r\n * * Derived class is responsible for filling the plane sets.\r\n * * At discretion of derived classes, plane construction can be done at construction time or \"on demand when\" queries\r\n * call `ensurePlaneSets ()`\r\n * * ClipPrimitive can be constructed directly with planes (and no derived class).\r\n * * The prevailing use is via a ClipShape derived class.\r\n * * The ClipShape has an \"isMask\" property\r\n * * isMask === false means the plane sets should cover the inside of its polygon.\r\n * * isMask === true means the plane sets should cover the outside of its polygon.\r\n * * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.\r\n * * In normal usage, callers get \"outside\" clip behavior using ONLY the ClipShape isMask property.\r\n * * The ClipShape happens to pass the _invisible bit down to ClipPlanes that it creates.\r\n * * At that level, the flag controls whether the cut edges are produced on the plane\r\n * @public\r\n */\r\nexport class ClipPrimitive implements Clipper {\r\n /** The (union of) convex regions. */\r\n protected _clipPlanes?: UnionOfConvexClipPlaneSets;\r\n /** If true, pointInside inverts the sense of the pointInside for the _clipPlanes */\r\n protected _invisible: boolean;\r\n /**\r\n * Get a reference to the `UnionOfConvexClipPlaneSets`.\r\n * * It triggers construction of the sets by `this.ensurePlaneSets()`.\r\n * * Derived class typically caches the set on the first such call.\r\n */\r\n public fetchClipPlanesRef(): UnionOfConvexClipPlaneSets | undefined {\r\n this.ensurePlaneSets();\r\n return this._clipPlanes;\r\n }\r\n /** Ask if this primitive is a hole. */\r\n public get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n protected constructor(planeSet?: UnionOfConvexClipPlaneSets | undefined, isInvisible: boolean = false) {\r\n this._clipPlanes = planeSet;\r\n this._invisible = isInvisible;\r\n }\r\n /**\r\n * Create a ClipPrimitive, capturing the supplied plane set as the clip planes.\r\n * @param planes clipper\r\n * @param isInvisible set the invisible flag on the ClipPrimitive\r\n */\r\n public static createCapture(\r\n planes: UnionOfConvexClipPlaneSets | ConvexClipPlaneSet | undefined, isInvisible: boolean = false,\r\n ): ClipPrimitive {\r\n let planeData;\r\n if (planes instanceof UnionOfConvexClipPlaneSets)\r\n planeData = planes;\r\n if (planes instanceof ConvexClipPlaneSet)\r\n planeData = UnionOfConvexClipPlaneSets.createConvexSets([planes]);\r\n\r\n return new ClipPrimitive(planeData, isInvisible);\r\n }\r\n /** Emit json form of the clip planes */\r\n public toJSON(): ClipPrimitiveProps {\r\n const planes: ClipPrimitivePlanesProps[\"planes\"] = {};\r\n if (this._clipPlanes)\r\n planes.clips = this._clipPlanes.toJSON();\r\n\r\n if (this._invisible)\r\n planes.invisible = true;\r\n\r\n return { planes };\r\n }\r\n /**\r\n * Returns true if the planes are present.\r\n * * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct\r\n * the planes.\r\n */\r\n public arePlanesDefined(): boolean {\r\n return this._clipPlanes !== undefined;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): ClipPrimitive {\r\n const newPlanes = this._clipPlanes ? this._clipPlanes.clone() : undefined;\r\n const result = new ClipPrimitive(newPlanes, this._invisible);\r\n return result;\r\n }\r\n /**\r\n * Trigger (if needed) computation of plane sets (if applicable) in the derived class.\r\n * * Base class is no op.\r\n * * In derived class, on first call create planes sets from defining data (e.g. swept shape).\r\n * * In derived class, if planes are present leave them alone.\r\n */\r\n public ensurePlaneSets() { }\r\n /**\r\n * Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,\r\n * return false.\r\n * * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept\r\n * this implementation using planes that it inserted in the base class.\r\n */\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\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 this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\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.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\r\n return hasInsideParts;\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 announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedArcIntervals(arc, announce);\r\n return hasInsideParts;\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 * @param matrix matrix to apply.\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\r\n * effect on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n */\r\n public 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 if (this._clipPlanes)\r\n this._clipPlanes.multiplyPlanesByMatrix4d(matrix);\r\n return true;\r\n }\r\n /** Apply a transform to the clipper (e.g. transform all planes). */\r\n public transformInPlace(transform: Transform): boolean {\r\n if (this._clipPlanes)\r\n this._clipPlanes.transformInPlace(transform);\r\n return true;\r\n }\r\n /** Sets both the clip plane set and the mask set visibility */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\r\n /**\r\n * Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and\r\n * (b) finite distance from origin.\r\n */\r\n public containsZClip(): boolean {\r\n if (this.fetchClipPlanesRef() !== undefined)\r\n for (const convexSet of this._clipPlanes!.convexSets)\r\n for (const plane of convexSet.planes)\r\n if (Math.abs(plane.inwardNormalRef.z) > 1.0e-6 && Math.abs(plane.distance) !== Number.MAX_VALUE)\r\n return true;\r\n return false;\r\n }\r\n /**\r\n * Quick test of whether the given points fall completely inside or outside.\r\n * @param points points to test.\r\n * @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the\r\n * invisible setting.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreInvisibleSetting: boolean): ClipPlaneContainment {\r\n this.ensurePlaneSets();\r\n const planes = this._clipPlanes;\r\n let inside = ClipPlaneContainment.StronglyInside;\r\n if (planes)\r\n inside = planes.classifyPointContainment(points, false);\r\n if (this._invisible && !ignoreInvisibleSetting)\r\n switch (inside) {\r\n case ClipPlaneContainment.StronglyInside:\r\n return ClipPlaneContainment.StronglyOutside;\r\n case ClipPlaneContainment.StronglyOutside:\r\n return ClipPlaneContainment.StronglyInside;\r\n case ClipPlaneContainment.Ambiguous:\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return inside;\r\n }\r\n /**\r\n * Promote json object form to class instance.\r\n * * First try to convert to a ClipShape.\r\n * * then try as a standalone instance of the base class ClipPrimitive.\r\n */\r\n public static fromJSON(json: ClipPrimitiveProps | undefined): ClipPrimitive | undefined {\r\n if (!json)\r\n return undefined;\r\n const shape = ClipShape.fromClipShapeJSON(json as ClipPrimitiveShapeProps);\r\n if (shape)\r\n return shape;\r\n return ClipPrimitive.fromJSONClipPrimitive(json as ClipPrimitivePlanesProps);\r\n }\r\n /** Specific converter producing the base class ClipPrimitive. */\r\n public static fromJSONClipPrimitive(json: ClipPrimitivePlanesProps | undefined): ClipPrimitive | undefined {\r\n const planes = json?.planes;\r\n if (!planes)\r\n return undefined;\r\n\r\n const clipPlanes = planes.clips ? UnionOfConvexClipPlaneSets.fromJSON(planes.clips) : undefined;\r\n const invisible = undefined !== planes.invisible ? planes.invisible : false;\r\n return new ClipPrimitive(clipPlanes, invisible);\r\n }\r\n}\r\n\r\n/** Internal helper class holding XYZ components that serves as a representation of polygon edges defined by clip planes */\r\nclass PolyEdge {\r\n public pointA: Point3d;\r\n public pointB: Point3d;\r\n public normal: Vector3d;\r\n\r\n public constructor(origin: Point3d, next: Point3d, normal: Vector3d, z: number) {\r\n this.pointA = Point3d.create(origin.x, origin.y, z);\r\n this.pointB = Point3d.create(next.x, next.y, z);\r\n this.normal = normal;\r\n }\r\n // Assume both normals are unit length.\r\n // old logic: use difference of (previously computed) normals as perpendicular to bisector.\r\n public static makeUnitPerpendicularToBisector(edgeA: PolyEdge, edgeB: PolyEdge, reverse: boolean): Vector3d | undefined {\r\n let candidate = edgeB.normal.minus(edgeA.normal);\r\n if (candidate.normalize(candidate) === undefined) {\r\n candidate = Vector3d.createStartEnd(edgeA.pointA, edgeB.pointB);\r\n if (candidate.normalize(candidate) === undefined)\r\n return undefined;\r\n }\r\n if (reverse)\r\n candidate.scale(-1.0, candidate);\r\n return candidate;\r\n }\r\n}\r\n\r\n/**\r\n * A clipping volume defined by a shape (an array of 3d points using only x and y dimensions).\r\n * May be given either a ClipPlaneSet to store directly, or an array of polygon points as well as other parameters\r\n * for parsing ClipPlanes from the shape later.\r\n * @public\r\n */\r\nexport class ClipShape extends ClipPrimitive {\r\n /** Points of the polygon, in the xy plane of the local coordinate system. */\r\n protected _polygon: Point3d[];\r\n /** optional low z (in local coordinates). */\r\n protected _zLow?: number;\r\n /** optional high z (in local coordinates). */\r\n protected _zHigh?: number;\r\n /** true if this is considered a hole (keep geometry outside of the polygon). */\r\n protected _isMask: boolean;\r\n /** transform from local to world. */\r\n protected _transformFromClip?: Transform;\r\n /** Transform from world to local. */\r\n protected _transformToClip?: Transform;\r\n\r\n protected constructor(\r\n polygon: Point3d[] = [], zLow?: number, zHigh?: number, transform?: Transform, isMask: boolean = false, invisible: boolean = false,\r\n ) {\r\n super(undefined, invisible); // ClipPlaneSets will be set up later after storing points\r\n this._isMask = false;\r\n this._polygon = polygon;\r\n this.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n }\r\n /** Returns true if this ClipShape is marked as invisible. */\r\n public override get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n /** Return this transformFromClip, which may be undefined. */\r\n public get transformFromClip(): Transform | undefined {\r\n return this._transformFromClip;\r\n }\r\n /** Return this transformToClip, which may be undefined. */\r\n public get transformToClip(): Transform | undefined {\r\n return this._transformToClip;\r\n }\r\n /** Returns true if this ClipShape's transforms are currently set. */\r\n public get transformValid(): boolean {\r\n return this.transformFromClip !== undefined;\r\n }\r\n /** Returns true if this ClipShape's lower z boundary is set. */\r\n public get zLowValid(): boolean {\r\n return this._zLow !== undefined;\r\n }\r\n /** Returns true if this ClipShape's upper z boundary is set. */\r\n public get zHighValid(): boolean {\r\n return this._zHigh !== undefined;\r\n }\r\n /** Return true if this ClipShape has a local to world transform */\r\n public get transformIsValid(): boolean {\r\n return this._transformFromClip !== undefined;\r\n }\r\n /** Return this zLow, which may be undefined. */\r\n public get zLow(): number | undefined {\r\n return this._zLow;\r\n }\r\n /** Return this zHigh, which may be undefined. */\r\n public get zHigh(): number | undefined {\r\n return this._zHigh;\r\n }\r\n /** Returns a reference to this ClipShape's polygon array. */\r\n public get polygon(): Point3d[] {\r\n return this._polygon;\r\n }\r\n /** Returns true if this ClipShape is a masking set. */\r\n public get isMask(): boolean {\r\n return this._isMask;\r\n }\r\n /** Sets the polygon points array of this ClipShape to the array given (by reference). */\r\n public setPolygon(polygon: Point3d[]) {\r\n // Add closure point\r\n if (!polygon[0].isAlmostEqual(polygon[polygon.length - 1]))\r\n polygon.push(polygon[0].clone());\r\n this._polygon = polygon;\r\n }\r\n /**\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`\r\n * and transform.\r\n */\r\n public override ensurePlaneSets() {\r\n if (this._clipPlanes !== undefined)\r\n return;\r\n this._clipPlanes = UnionOfConvexClipPlaneSets.createEmpty();\r\n this.parseClipPlanes(this._clipPlanes);\r\n if (this._transformFromClip)\r\n this._clipPlanes.transformInPlace(this._transformFromClip);\r\n }\r\n /**\r\n * Initialize the members of the ClipShape class that may at times be undefined.\r\n * zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.\r\n */\r\n public initSecondaryProps(isMask: boolean, zLow?: number, zHigh?: number, transform?: Transform) {\r\n this._isMask = isMask;\r\n this._zLow = zLow;\r\n this._zHigh = zHigh;\r\n\r\n if (transform !== undefined) {\r\n this._transformFromClip = transform;\r\n this._transformToClip = transform.inverse(); // could be undefined\r\n } else {\r\n this._transformFromClip = Transform.createIdentity();\r\n this._transformToClip = Transform.createIdentity();\r\n }\r\n }\r\n /** Emit json object form */\r\n public override toJSON(): ClipPrimitiveShapeProps {\r\n const shape: ClipPrimitiveShapeProps[\"shape\"] = {\r\n points: this._polygon.map((pt) => pt.toJSON()),\r\n };\r\n if (this.invisible)\r\n shape.invisible = true;\r\n if (this._transformFromClip && !this._transformFromClip.isIdentity)\r\n shape.trans = this._transformFromClip.toJSON();\r\n if (this.isMask)\r\n shape.mask = true;\r\n if (typeof (this.zLow) !== \"undefined\" && this.zLow !== -Number.MAX_VALUE)\r\n shape.zlow = this.zLow;\r\n if (typeof (this.zHigh) !== \"undefined\" && this.zHigh !== Number.MAX_VALUE)\r\n shape.zhigh = this.zHigh;\r\n return { shape };\r\n }\r\n /** Parse `json` to a clip shape. */\r\n public static fromClipShapeJSON(json: ClipPrimitiveShapeProps | undefined, result?: ClipShape): ClipShape | undefined {\r\n const shape = json?.shape;\r\n if (!shape)\r\n return undefined;\r\n const points: Point3d[] = shape.points ? shape.points.map((pt) => Point3d.fromJSON(pt)) : [];\r\n const trans = shape.trans ? Transform.fromJSON(shape.trans) : undefined;\r\n const zLow = typeof shape.zlow === \"number\" ? shape.zlow : undefined;\r\n const zHigh = typeof shape.zhigh === \"number\" ? shape.zhigh : undefined;\r\n const isMask = typeof shape.mask === \"boolean\" && shape.mask;\r\n const invisible = typeof shape.invisible === \"boolean\" && shape.invisible;\r\n\r\n return ClipShape.createShape(points, zLow, zHigh, trans, isMask, invisible, result);\r\n }\r\n /** Returns a new ClipShape that is a deep copy of the ClipShape given */\r\n public static createFrom(other: ClipShape, result?: ClipShape): ClipShape {\r\n const retVal = ClipShape.createEmpty(false, false, undefined, result);\r\n retVal._invisible = other._invisible;\r\n for (const point of other._polygon) {\r\n retVal._polygon.push(point.clone());\r\n }\r\n retVal._isMask = other._isMask;\r\n retVal._zLow = other._zLow;\r\n retVal._zHigh = other._zHigh;\r\n retVal._transformToClip = other._transformToClip ? other._transformToClip.clone() : undefined;\r\n retVal._transformFromClip = other._transformFromClip ? other._transformFromClip.clone() : undefined;\r\n return retVal;\r\n }\r\n /** Create a new ClipShape from an array of points that make up a 2d shape (stores a deep copy of these points). */\r\n public static createShape(\r\n polygon: Point3d[] = [],\r\n zLow?: number,\r\n zHigh?: number,\r\n transform?: Transform,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n result?: ClipShape,\r\n ): ClipShape | undefined {\r\n if (polygon.length < 3)\r\n return undefined;\r\n const pPoints = polygon.slice(0);\r\n // Add closure point.\r\n if (pPoints[0].isAlmostEqual(pPoints[pPoints.length - 1]))\r\n pPoints[0].clone(pPoints[pPoints.length - 1]);\r\n else\r\n pPoints.push(pPoints[0].clone());\r\n if (result) {\r\n result._clipPlanes = undefined; // Start as undefined\r\n result._invisible = invisible;\r\n result._polygon = pPoints;\r\n result.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n return result;\r\n } else {\r\n return new ClipShape(pPoints, zLow, zHigh, transform, isMask, invisible);\r\n }\r\n }\r\n /**\r\n * Create a ClipShape that exists as a 3 dimensional box of the range given. Optionally choose to\r\n * also store this shape's zLow and zHigh members from the range through the use of a RangePlaneBitMask.\r\n */\r\n public static createBlock(\r\n extremities: Range3d,\r\n clipMask: ClipMaskXYZRangePlanes,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n transform?: Transform,\r\n result?: ClipShape,\r\n ): ClipShape {\r\n const low = extremities.low;\r\n const high = extremities.high;\r\n const blockPoints: Point3d[] = [];\r\n for (let i = 0; i < 5; i++)\r\n blockPoints.push(Point3d.create());\r\n blockPoints[0].x = blockPoints[3].x = blockPoints[4].x = low.x;\r\n blockPoints[1].x = blockPoints[2].x = high.x;\r\n blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;\r\n blockPoints[2].y = blockPoints[3].y = high.y;\r\n return ClipShape.createShape(\r\n blockPoints,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined,\r\n transform,\r\n isMask,\r\n invisible,\r\n result,\r\n )!;\r\n }\r\n /** Creates a new ClipShape with undefined members and a polygon points array of zero length. */\r\n public static createEmpty(\r\n isMask = false, invisible: boolean = false, transform?: Transform, result?: ClipShape,\r\n ): ClipShape {\r\n if (result) {\r\n result._clipPlanes = undefined;\r\n result._invisible = invisible;\r\n result._polygon.length = 0;\r\n result.initSecondaryProps(isMask, undefined, undefined, transform);\r\n return result;\r\n }\r\n return new ClipShape([], undefined, undefined, transform, isMask, invisible);\r\n }\r\n /** Checks to ensure that the member polygon has an area, and that the polygon is closed. */\r\n public get isValidPolygon(): boolean {\r\n if (this._polygon.length < 3)\r\n return false;\r\n if (!this._polygon[0].isExactEqual(this._polygon[this._polygon.length - 1]))\r\n return false;\r\n return true;\r\n }\r\n /** Returns a deep copy of this instance of ClipShape, storing in an optional result. */\r\n public override clone(result?: ClipShape): ClipShape {\r\n return ClipShape.createFrom(this, result);\r\n }\r\n /**\r\n * Given the current polygon data, parses clip planes that together form an object, storing the result in\r\n * the set given, either clip planes or mask planes.\r\n */\r\n private parseClipPlanes(set: UnionOfConvexClipPlaneSets) {\r\n const points = this._polygon;\r\n if (points.length === 3 && !this._isMask && points[0].isExactEqual(points[points.length - 1])) {\r\n this.parseLinearPlanes(set, this._polygon[0], this._polygon[1]);\r\n return true;\r\n }\r\n if (!this.isMask) {\r\n const direction = PolygonOps.testXYPolygonTurningDirections(this.polygon);\r\n if (direction !== 0) {\r\n this.parseConvexPolygonPlanes(set, this._polygon, direction, false);\r\n return true;\r\n }\r\n }\r\n // REMARK: Pass all polygons to non-convex case. It will funnel\r\n // to concave case as appropriate.\r\n this.parsePolygonPlanes(set, this._polygon, this.isMask);\r\n return true;\r\n }\r\n /**\r\n * Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets\r\n * defining the bounded region of linear planes. Returns true if successful.\r\n */\r\n private parseLinearPlanes(\r\n set: UnionOfConvexClipPlaneSets, start: Point3d, end: Point3d, cameraFocalLength?: number,\r\n ): boolean {\r\n // Handles the degenerate case of 2 distinct points (used by select by line).\r\n const normal = start.vectorTo(end);\r\n if (normal.magnitude() === 0.0)\r\n return false;\r\n normal.normalize(normal);\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n const perpendicular = Vector2d.create(-normal.y, normal.x);\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(normal.x, normal.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(-normal.x, -normal.y), Point3d.createFrom(end), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(perpendicular.x, perpendicular.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(-perpendicular.x, -perpendicular.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n } else {\r\n const start3d = Point3d.create(start.x, start.y, -cameraFocalLength);\r\n const end3d = Point3d.create(end.x, end.y, -cameraFocalLength);\r\n const vecEnd3d = Vector3d.createFrom(end3d);\r\n const perpendicular = vecEnd3d.crossProduct(Vector3d.createFrom(start3d)).normalize();\r\n let endNormal = Vector3d.createFrom(start3d).crossProduct(perpendicular!).normalize();\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\r\n perpendicular!.negate();\r\n endNormal = vecEnd3d.crossProduct(perpendicular!).normalize();\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n return true;\r\n }\r\n /**\r\n * Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with\r\n * ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n */\r\n private parseConvexPolygonPlanes(\r\n set: UnionOfConvexClipPlaneSets,\r\n polygon: Point3d[],\r\n direction: number,\r\n buildExteriorClipper: boolean,\r\n cameraFocalLength?: number,\r\n ): boolean {\r\n const samePointTolerance = 1.0e-8; // This could possibly be replaced with more widely used constants\r\n const edges: PolyEdge[] = [];\r\n // const reverse = (direction < 0) !== this._isMask;\r\n const reverse = direction < 0;\r\n for (let i = 0; i < polygon.length - 1; i++) {\r\n const z = (cameraFocalLength === undefined) ? 0.0 : -cameraFocalLength;\r\n const dir = Vector3d.createStartEnd(polygon[i], polygon[i + 1]);\r\n const magnitude = dir.magnitude();\r\n dir.normalize(dir);\r\n if (magnitude > samePointTolerance) {\r\n const normal = Vector3d.create(reverse ? dir.y : -dir.y, reverse ? -dir.x : dir.x);\r\n edges.push(new PolyEdge(polygon[i], polygon[i + 1], normal, z));\r\n }\r\n }\r\n if (edges.length < 3) {\r\n return false;\r\n }\r\n if (buildExteriorClipper) {\r\n const last = edges.length - 1;\r\n for (let i = 0; i <= last; i++) {\r\n const edge = edges[i];\r\n const prevEdge = edges[i ? (i - 1) : last];\r\n const nextEdge = edges[(i === last) ? 0 : (i + 1)];\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n const previousPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(prevEdge, edge, !reverse);\r\n const nextPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(edge, nextEdge, reverse);\r\n // Create three-sided fans from each edge. Note we could define the correct region\r\n // with only two planes for edge, but cannot then designate the \"interior\" status of the edges accurately.\r\n\r\n if (previousPerpendicular)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(previousPerpendicular, edge.pointA, this._invisible, true)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(edge.normal, edge.pointB, this._invisible, false)!);\r\n if (nextPerpendicular)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(nextPerpendicular, nextEdge.pointA, this._invisible, true)!);\r\n set.addConvexSet(convexSet);\r\n set.addOutsideZClipSets(this._invisible, this._zLow, this._zHigh);\r\n }\r\n } else {\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n for (const edge of edges)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(Vector3d.create(edge.normal.x, edge.normal.y), edge.pointA)!);\r\n } else {\r\n if (reverse)\r\n for (const edge of edges)\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndDistance(\r\n Vector3d.createFrom(edge.pointA).crossProduct(Vector3d.createFrom(edge.pointB)).normalize()!, 0.0,\r\n )!,\r\n );\r\n else\r\n for (const edge of edges)\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndDistance(\r\n Vector3d.createFrom(edge.pointB).crossProduct(Vector3d.createFrom(edge.pointA)).normalize()!, 0.0,\r\n )!,\r\n );\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets\r\n * with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n */\r\n private parsePolygonPlanes(set: UnionOfConvexClipPlaneSets, polygon: Point3d[], isMask: boolean, cameraFocalLength?: number,\r\n ): boolean {\r\n const cleanPolygon = PolylineOps.compressDanglers(polygon, true);\r\n const announceFace = (_graph: HalfEdgeGraph, edge: HalfEdge): boolean => {\r\n if (!edge.isMaskSet(HalfEdgeMask.EXTERIOR)) {\r\n const convexFacetPoints = edge.collectAroundFace((node: HalfEdge): any => {\r\n if (!node.isMaskSet(HalfEdgeMask.EXTERIOR))\r\n return Point3d.create(node.x, node.y, 0);\r\n });\r\n // parseConvexPolygonPlanes expects a closed loop (pushing the reference doesn't matter)\r\n convexFacetPoints.push(convexFacetPoints[0].clone());\r\n const direction = PolygonOps.testXYPolygonTurningDirections(convexFacetPoints); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, convexFacetPoints, direction, false, cameraFocalLength);\r\n }\r\n return true;\r\n };\r\n if (isMask) {\r\n const polygonA = Point3dArray.clonePoint3dArray(cleanPolygon);\r\n const hullAndInlets = AlternatingCCTreeNode.createHullAndInletsForPolygon(polygonA);\r\n const allLoops = hullAndInlets.extractLoops();\r\n if (allLoops.length === 0)\r\n return false;\r\n const hull = allLoops[0];\r\n const direction1 = PolygonOps.testXYPolygonTurningDirections(hull); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, hull, -direction1, true, cameraFocalLength);\r\n for (let i = 1; i < allLoops.length; i++) {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(allLoops[i]);\r\n if (triangulatedPolygon) {\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n }\r\n return true;\r\n } else {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(cleanPolygon);\r\n if (triangulatedPolygon === undefined)\r\n return false;\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n return true;\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 * @param matrix matrix to apply.\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 */\r\n public override multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n this.ensurePlaneSets();\r\n return super.multiplyPlanesByMatrix4d(matrix, invert, transpose);\r\n }\r\n /**\r\n * Apply `transform` to the local to world (`transformFromClip`) transform.\r\n * * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`\r\n * * the transform is passed to the base class to be applied to clip plane form of the clipper.\r\n */\r\n public override transformInPlace(transform: Transform): boolean {\r\n if (transform.isIdentity)\r\n return true;\r\n super.transformInPlace(transform);\r\n if (this._transformFromClip)\r\n transform.multiplyTransformTransform(this._transformFromClip, this._transformFromClip);\r\n else\r\n this._transformFromClip = transform.clone();\r\n this._transformToClip = this._transformFromClip.inverse(); // could be undefined\r\n return true;\r\n }\r\n /**\r\n * Return true if\r\n * * at least one point is defined\r\n * * The local to world transform (transformFromClip) either\r\n * * is undefined\r\n * * has no xy parts in its column Z (local frame Z is parallel to global Z)\r\n */\r\n public get isXYPolygon(): boolean {\r\n if (this._polygon.length === 0) // Note: This is a lenient check, as points array could also contain less than 3 points (not a polygon)\r\n return false;\r\n if (this._transformFromClip === undefined)\r\n return true;\r\n const zVector = this._transformFromClip.matrix.columnZ();\r\n return zVector.magnitudeXY() < 1.0e-8;\r\n }\r\n /** Transform the input point in place using this instance's `transformToClip` member */\r\n public performTransformToClip(point: Point3d): void {\r\n if (this._transformToClip !== undefined)\r\n this._transformToClip.multiplyPoint3d(point, point);\r\n }\r\n /** Transform the input point in place using this instance's `transformFromClip` member */\r\n public performTransformFromClip(point: Point3d): void {\r\n if (this._transformFromClip !== undefined)\r\n this._transformFromClip.multiplyPoint3d(point, point);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ClipPrimitive.js","sourceRoot":"","sources":["../../../src/clipping/ClipPrimitive.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAG7C,0CAAuC;AACvC,mEAAyD;AACzD,mEAAkE;AAClE,6DAA0D;AAC1D,yDAAsD;AACtD,2DAAwD;AAExD,uDAAoD;AAGpD,6CAA0E;AAC1E,6DAAyD;AACzD,2EAAoE;AACpE,2CAAwC;AACxC,2CAA4D;AAC5D,6DAA0D;AAC1D,6EAA2G;AAE3G,mBAAmB;AACnB,oBAAoB;AACpB;;;GAGG;AACH,IAAY,sBAmBX;AAnBD,WAAY,sBAAsB;IAChC,gBAAgB;IAChB,mEAAW,CAAA;IACX,kBAAkB;IAClB,mEAAW,CAAA;IACX,mBAAmB;IACnB,qEAAY,CAAA;IACZ,kBAAkB;IAClB,mEAAW,CAAA;IACX,mBAAmB;IACnB,qEAAY,CAAA;IACZ,kBAAkB;IAClB,oEAAW,CAAA;IACX,mBAAmB;IACnB,sEAAY,CAAA;IACZ,0CAA0C;IAC1C,sEAAY,CAAA;IACZ,mBAAmB;IACnB,kEAAU,CAAA;AACZ,CAAC,EAnBW,sBAAsB,sCAAtB,sBAAsB,QAmBjC;AA0CD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,aAAa;IACxB,qCAAqC;IAC3B,WAAW,CAA8B;IACnD,oFAAoF;IAC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,kBAAkB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF;AA1gBD,8BA0gBC","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 { Geometry } from \"../Geometry\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { PolylineOps } from \"../geometry3d/PolylineOps\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { TransformProps, XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { Triangulator } from \"../topology/Triangulation\";\r\nimport { AlternatingCCTreeNode } from \"./AlternatingConvexClipTree\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets, UnionOfConvexClipPlaneSetsProps } from \"./UnionOfConvexClipPlaneSets\";\r\n\r\n// cspell:word zlow\r\n// cspell:word zhigh\r\n/**\r\n * Bit mask type for referencing subsets of 6 planes of range box.\r\n * @public\r\n */\r\nexport enum ClipMaskXYZRangePlanes {\r\n /** no planes */\r\n None = 0x00,\r\n /** low x plane */\r\n XLow = 0x01,\r\n /** high x plane */\r\n XHigh = 0x02,\r\n /** low y plane */\r\n YLow = 0x04,\r\n /** high y plane */\r\n YHigh = 0x08,\r\n /** low z plane */\r\n ZLow = 0x10,\r\n /** high z plane */\r\n ZHigh = 0x20,\r\n /** all x and y planes, neither z plane */\r\n XAndY = 0x0f,\r\n /** all 6 planes */\r\n All = 0x3f,\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipPrimitive]] defined by a set of clip planes.\r\n * @public\r\n */\r\nexport interface ClipPrimitivePlanesProps {\r\n planes?: {\r\n /** The set of clip planes. */\r\n clips?: UnionOfConvexClipPlaneSetsProps;\r\n /** `true` if the primitive is invisible. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipShape]].\r\n * @public\r\n */\r\nexport interface ClipPrimitiveShapeProps {\r\n /** The clip polygon. */\r\n shape?: {\r\n /** Points of the polygon, in the xy plane of the local coordinate system. */\r\n points?: XYZProps[];\r\n /** Transform from local to world. */\r\n trans?: TransformProps;\r\n /** Lower bound on z (in local coordinates). */\r\n zlow?: number;\r\n /** Upper bound on z (in local coordinates). */\r\n zhigh?: number;\r\n /** `true` if this shape is considered a hole (keep geometry outside of the polygon). */\r\n mask?: boolean;\r\n /** `true` if this shape is invisible. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/** Wire format describing a [[ClipPrimitive]].\r\n * @public\r\n */\r\nexport type ClipPrimitiveProps = ClipPrimitivePlanesProps | ClipPrimitiveShapeProps;\r\n\r\n/**\r\n * * ClipPrimitive is a base class for clipping implementations that use\r\n * * A UnionOfConvexClipPlaneSets designated \"clipPlanes\".\r\n * * An \"invisible\" flag.\r\n * * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.\r\n * * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.\r\n * * ClipPrimitive can be constructed with no planes.\r\n * * Derived class is responsible for filling the plane sets.\r\n * * At discretion of derived classes, plane construction can be done at construction time or \"on demand when\" queries\r\n * call `ensurePlaneSets ()`\r\n * * ClipPrimitive can be constructed directly with planes (and no derived class).\r\n * * The prevailing use is via a ClipShape derived class.\r\n * * The ClipShape has an \"isMask\" property\r\n * * isMask === false means the plane sets should cover the inside of its polygon.\r\n * * isMask === true means the plane sets should cover the outside of its polygon.\r\n * * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.\r\n * * In normal usage, callers get \"outside\" clip behavior using ONLY the ClipShape isMask property.\r\n * * The ClipShape happens to pass the _invisible bit down to ClipPlanes that it creates.\r\n * * At that level, the flag controls whether the cut edges are produced on the plane\r\n * @public\r\n */\r\nexport class ClipPrimitive implements Clipper {\r\n /** The (union of) convex regions. */\r\n protected _clipPlanes?: UnionOfConvexClipPlaneSets;\r\n /** If true, pointInside inverts the sense of the pointInside for the _clipPlanes */\r\n protected _invisible: boolean;\r\n /**\r\n * Get a reference to the `UnionOfConvexClipPlaneSets`.\r\n * * It triggers construction of the sets by `this.ensurePlaneSets()`.\r\n * * Derived class typically caches the set on the first such call.\r\n */\r\n public fetchClipPlanesRef(): UnionOfConvexClipPlaneSets | undefined {\r\n this.ensurePlaneSets();\r\n return this._clipPlanes;\r\n }\r\n /** Ask if this primitive is a hole. */\r\n public get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n protected constructor(planeSet?: UnionOfConvexClipPlaneSets | undefined, isInvisible: boolean = false) {\r\n this._clipPlanes = planeSet;\r\n this._invisible = isInvisible;\r\n }\r\n /**\r\n * Create a ClipPrimitive, capturing the supplied plane set as the clip planes.\r\n * @param planes clipper\r\n * @param isInvisible set the invisible flag on the ClipPrimitive\r\n */\r\n public static createCapture(\r\n planes: UnionOfConvexClipPlaneSets | ConvexClipPlaneSet | undefined, isInvisible: boolean = false,\r\n ): ClipPrimitive {\r\n let planeData;\r\n if (planes instanceof UnionOfConvexClipPlaneSets)\r\n planeData = planes;\r\n if (planes instanceof ConvexClipPlaneSet)\r\n planeData = UnionOfConvexClipPlaneSets.createConvexSets([planes]);\r\n\r\n return new ClipPrimitive(planeData, isInvisible);\r\n }\r\n /** Emit json form of the clip planes */\r\n public toJSON(): ClipPrimitiveProps {\r\n const planes: ClipPrimitivePlanesProps[\"planes\"] = {};\r\n if (this._clipPlanes)\r\n planes.clips = this._clipPlanes.toJSON();\r\n\r\n if (this._invisible)\r\n planes.invisible = true;\r\n\r\n return { planes };\r\n }\r\n /**\r\n * Returns true if the planes are present.\r\n * * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct\r\n * the planes.\r\n */\r\n public arePlanesDefined(): boolean {\r\n return this._clipPlanes !== undefined;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): ClipPrimitive {\r\n const newPlanes = this._clipPlanes ? this._clipPlanes.clone() : undefined;\r\n const result = new ClipPrimitive(newPlanes, this._invisible);\r\n return result;\r\n }\r\n /**\r\n * Trigger (if needed) computation of plane sets (if applicable) in the derived class.\r\n * * Base class is no op.\r\n * * In derived class, on first call create planes sets from defining data (e.g. swept shape).\r\n * * In derived class, if planes are present leave them alone.\r\n */\r\n public ensurePlaneSets() { }\r\n /**\r\n * Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,\r\n * return false.\r\n * * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept\r\n * this implementation using planes that it inserted in the base class.\r\n */\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\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 this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\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.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\r\n return hasInsideParts;\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 announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedArcIntervals(arc, announce);\r\n return hasInsideParts;\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 * @param matrix matrix to apply.\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\r\n * effect on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n */\r\n public 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 if (this._clipPlanes)\r\n this._clipPlanes.multiplyPlanesByMatrix4d(matrix);\r\n return true;\r\n }\r\n /** Apply a transform to the clipper (e.g. transform all planes). */\r\n public transformInPlace(transform: Transform): boolean {\r\n if (this._clipPlanes)\r\n this._clipPlanes.transformInPlace(transform);\r\n return true;\r\n }\r\n /** Sets both the clip plane set and the mask set visibility */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\r\n /**\r\n * Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and\r\n * (b) finite distance from origin.\r\n */\r\n public containsZClip(): boolean {\r\n const clipPlanes = this.fetchClipPlanesRef();\r\n if (clipPlanes !== undefined) {\r\n for (const convexSet of clipPlanes.convexSets)\r\n for (const plane of convexSet.planes)\r\n if (Math.abs(plane.inwardNormalRef.z) > 1.0e-6 && Math.abs(plane.distance) !== Number.MAX_VALUE)\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Quick test of whether the given points fall completely inside or outside.\r\n * @param points points to test.\r\n * @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the\r\n * invisible setting.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreInvisibleSetting: boolean): ClipPlaneContainment {\r\n this.ensurePlaneSets();\r\n const planes = this._clipPlanes;\r\n let inside = ClipPlaneContainment.StronglyInside;\r\n if (planes)\r\n inside = planes.classifyPointContainment(points, false);\r\n if (this._invisible && !ignoreInvisibleSetting)\r\n switch (inside) {\r\n case ClipPlaneContainment.StronglyInside:\r\n return ClipPlaneContainment.StronglyOutside;\r\n case ClipPlaneContainment.StronglyOutside:\r\n return ClipPlaneContainment.StronglyInside;\r\n case ClipPlaneContainment.Ambiguous:\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return inside;\r\n }\r\n /**\r\n * Promote json object form to class instance.\r\n * * First try to convert to a ClipShape.\r\n * * then try as a standalone instance of the base class ClipPrimitive.\r\n */\r\n public static fromJSON(json: ClipPrimitiveProps | undefined): ClipPrimitive | undefined {\r\n if (!json)\r\n return undefined;\r\n const shape = ClipShape.fromClipShapeJSON(json as ClipPrimitiveShapeProps);\r\n if (shape)\r\n return shape;\r\n return ClipPrimitive.fromJSONClipPrimitive(json as ClipPrimitivePlanesProps);\r\n }\r\n /** Specific converter producing the base class ClipPrimitive. */\r\n public static fromJSONClipPrimitive(json: ClipPrimitivePlanesProps | undefined): ClipPrimitive | undefined {\r\n const planes = json?.planes;\r\n if (!planes)\r\n return undefined;\r\n\r\n const clipPlanes = planes.clips ? UnionOfConvexClipPlaneSets.fromJSON(planes.clips) : undefined;\r\n const invisible = undefined !== planes.invisible ? planes.invisible : false;\r\n return new ClipPrimitive(clipPlanes, invisible);\r\n }\r\n}\r\n\r\n/** Internal helper class holding XYZ components that serves as a representation of polygon edges defined by clip planes */\r\nclass PolyEdge {\r\n public pointA: Point3d;\r\n public pointB: Point3d;\r\n public normal: Vector3d;\r\n\r\n public constructor(origin: Point3d, next: Point3d, normal: Vector3d, z: number) {\r\n this.pointA = Point3d.create(origin.x, origin.y, z);\r\n this.pointB = Point3d.create(next.x, next.y, z);\r\n this.normal = normal;\r\n }\r\n // Assume both normals are unit length.\r\n // old logic: use difference of (previously computed) normals as perpendicular to bisector.\r\n public static makeUnitPerpendicularToBisector(edgeA: PolyEdge, edgeB: PolyEdge, reverse: boolean): Vector3d | undefined {\r\n let candidate = edgeB.normal.minus(edgeA.normal);\r\n if (candidate.normalize(candidate) === undefined) { // adjacent edges are parallel: try chord as bisector normal\r\n candidate = Vector3d.createStartEnd(edgeA.pointA, edgeB.pointB);\r\n if (candidate.normalize(candidate) === undefined)\r\n return undefined; // no chord => backtracking edge => fail\r\n }\r\n if (reverse)\r\n candidate.scale(-1.0, candidate);\r\n return candidate;\r\n }\r\n}\r\n\r\n/**\r\n * A clipping volume defined by a shape (an array of 3d points using only x and y dimensions).\r\n * May be given either a ClipPlaneSet to store directly, or an array of polygon points as well as other parameters\r\n * for parsing ClipPlanes from the shape later.\r\n * @public\r\n */\r\nexport class ClipShape extends ClipPrimitive {\r\n /** Points of the polygon, in the xy plane of the local coordinate system. */\r\n protected _polygon: Point3d[];\r\n /** optional low z (in local coordinates). */\r\n protected _zLow?: number;\r\n /** optional high z (in local coordinates). */\r\n protected _zHigh?: number;\r\n /** true if this is considered a hole (keep geometry outside of the polygon). */\r\n protected _isMask: boolean;\r\n /** transform from local to world. */\r\n protected _transformFromClip?: Transform;\r\n /** Transform from world to local. */\r\n protected _transformToClip?: Transform;\r\n\r\n protected constructor(\r\n polygon: Point3d[] = [], zLow?: number, zHigh?: number, transform?: Transform, isMask: boolean = false, invisible: boolean = false,\r\n ) {\r\n super(undefined, invisible); // ClipPlaneSets will be set up later after storing points\r\n this._isMask = false;\r\n this._polygon = polygon;\r\n this.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n }\r\n /** Returns true if this ClipShape is marked as invisible. */\r\n public override get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n /** Return local to world transform, which may be undefined. */\r\n public get transformFromClip(): Transform | undefined {\r\n return this._transformFromClip;\r\n }\r\n /** Return world to local transform, which may be undefined. */\r\n public get transformToClip(): Transform | undefined {\r\n return this._transformToClip;\r\n }\r\n /**\r\n * Returns true if this ClipShape has a local to world transform.\r\n * @see type guards [[hasTransformFromClip]], [[hasTransformToClip]], and [[hasTransforms]].\r\n */\r\n public get transformValid(): boolean {\r\n return this._transformFromClip !== undefined;\r\n }\r\n /**\r\n * Returns true if this ClipShape's lower z boundary is set.\r\n * @see type guard [[hasZLow]].\r\n */\r\n public get zLowValid(): boolean {\r\n return this._zLow !== undefined;\r\n }\r\n /**\r\n * Returns true if this ClipShape's upper z boundary is set.\r\n * @see type guard [[hasZHigh]].\r\n */\r\n public get zHighValid(): boolean {\r\n return this._zHigh !== undefined;\r\n }\r\n /**\r\n * Return true if this ClipShape has a local to world transform\r\n * @deprecated Use duplicate property [[transformValid]] or type guard [[hasTransformFromClip]] instead.\r\n */\r\n public get transformIsValid(): boolean {\r\n return this._transformFromClip !== undefined;\r\n }\r\n /** Type guard for [[zLow]]. */\r\n public hasZLow(): this is { zLow: number } {\r\n return this._zLow !== undefined;\r\n }\r\n /** Type guard for [[zHigh]]. */\r\n public hasZHigh(): this is { zHigh: number } {\r\n return this._zHigh !== undefined;\r\n }\r\n /**\r\n * Type guard for [[transformFromClip]].\r\n * @see related type guards [[hasTransformToClip]] and [[hasTransforms]].\r\n */\r\n public hasTransformFromClip(): this is { transformFromClip: Transform } {\r\n return this._transformFromClip !== undefined;\r\n }\r\n /**\r\n * Type guard for [[transformToClip]].\r\n * @see related type guards [[hasTransformFromClip]] and [[hasTransforms]].\r\n */\r\n public hasTransformToClip(): this is { transformToClip: Transform } {\r\n return this._transformToClip !== undefined;\r\n }\r\n /**\r\n * Type guard for both [[transformFromClip]] and [[transformToClip]].\r\n * @see individual type guards [[hasTransformFromClip]] and [[hasTransformToClip]].\r\n */\r\n public hasTransforms(): this is { transformFromClip: Transform, transformToClip: Transform } {\r\n return this._transformFromClip !== undefined && this._transformToClip !== undefined;\r\n }\r\n /** Return this zLow, which may be undefined. */\r\n public get zLow(): number | undefined {\r\n return this._zLow;\r\n }\r\n /** Return this zHigh, which may be undefined. */\r\n public get zHigh(): number | undefined {\r\n return this._zHigh;\r\n }\r\n /** Returns a reference to this ClipShape's polygon array. */\r\n public get polygon(): Point3d[] {\r\n return this._polygon;\r\n }\r\n /** Returns true if this ClipShape is a masking set. */\r\n public get isMask(): boolean {\r\n return this._isMask;\r\n }\r\n /** Sets the polygon points array of this ClipShape to the array given (by reference). */\r\n public setPolygon(polygon: Point3d[]) {\r\n // Add closure point\r\n if (!polygon[0].isAlmostEqual(polygon[polygon.length - 1]))\r\n polygon.push(polygon[0].clone());\r\n this._polygon = polygon;\r\n }\r\n /**\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`\r\n * and transform.\r\n */\r\n public override ensurePlaneSets() {\r\n if (this._clipPlanes !== undefined)\r\n return;\r\n this._clipPlanes = UnionOfConvexClipPlaneSets.createEmpty();\r\n this.parseClipPlanes(this._clipPlanes);\r\n if (this._transformFromClip)\r\n this._clipPlanes.transformInPlace(this._transformFromClip);\r\n }\r\n /**\r\n * Initialize the members of the ClipShape class that may at times be undefined.\r\n * zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.\r\n */\r\n public initSecondaryProps(isMask: boolean, zLow?: number, zHigh?: number, transform?: Transform) {\r\n this._isMask = isMask;\r\n this._zLow = zLow;\r\n this._zHigh = zHigh;\r\n\r\n if (transform !== undefined) {\r\n this._transformFromClip = transform;\r\n this._transformToClip = transform.inverse(); // could be undefined\r\n } else {\r\n this._transformFromClip = Transform.createIdentity();\r\n this._transformToClip = Transform.createIdentity();\r\n }\r\n }\r\n /** Emit json object form */\r\n public override toJSON(): ClipPrimitiveShapeProps {\r\n const shape: ClipPrimitiveShapeProps[\"shape\"] = {\r\n points: this._polygon.map((pt) => pt.toJSON()),\r\n };\r\n if (this.invisible)\r\n shape.invisible = true;\r\n if (this._transformFromClip && !this._transformFromClip.isIdentity)\r\n shape.trans = this._transformFromClip.toJSON();\r\n if (this.isMask)\r\n shape.mask = true;\r\n if (typeof (this.zLow) !== \"undefined\" && this.zLow !== -Number.MAX_VALUE)\r\n shape.zlow = this.zLow;\r\n if (typeof (this.zHigh) !== \"undefined\" && this.zHigh !== Number.MAX_VALUE)\r\n shape.zhigh = this.zHigh;\r\n return { shape };\r\n }\r\n /** Parse `json` to a clip shape. */\r\n public static fromClipShapeJSON(json: ClipPrimitiveShapeProps | undefined, result?: ClipShape): ClipShape | undefined {\r\n const shape = json?.shape;\r\n if (!shape)\r\n return undefined;\r\n const points: Point3d[] = shape.points ? shape.points.map((pt) => Point3d.fromJSON(pt)) : [];\r\n const trans = shape.trans ? Transform.fromJSON(shape.trans) : undefined;\r\n const zLow = typeof shape.zlow === \"number\" ? shape.zlow : undefined;\r\n const zHigh = typeof shape.zhigh === \"number\" ? shape.zhigh : undefined;\r\n const isMask = typeof shape.mask === \"boolean\" && shape.mask;\r\n const invisible = typeof shape.invisible === \"boolean\" && shape.invisible;\r\n\r\n return ClipShape.createShape(points, zLow, zHigh, trans, isMask, invisible, result);\r\n }\r\n /** Returns a new ClipShape that is a deep copy of the ClipShape given */\r\n public static createFrom(other: ClipShape, result?: ClipShape): ClipShape {\r\n const retVal = ClipShape.createEmpty(false, false, undefined, result);\r\n retVal._invisible = other._invisible;\r\n for (const point of other._polygon) {\r\n retVal._polygon.push(point.clone());\r\n }\r\n retVal._isMask = other._isMask;\r\n retVal._zLow = other._zLow;\r\n retVal._zHigh = other._zHigh;\r\n retVal._transformToClip = other._transformToClip ? other._transformToClip.clone() : undefined;\r\n retVal._transformFromClip = other._transformFromClip ? other._transformFromClip.clone() : undefined;\r\n return retVal;\r\n }\r\n /** Create a new ClipShape from an array of points that make up a 2d shape (stores a deep copy of these points). */\r\n public static createShape(\r\n polygon: Point3d[] = [],\r\n zLow?: number,\r\n zHigh?: number,\r\n transform?: Transform,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n result?: ClipShape,\r\n ): ClipShape | undefined {\r\n if (polygon.length < 3)\r\n return undefined;\r\n const pPoints = polygon.slice(0);\r\n // Add closure point.\r\n if (pPoints[0].isAlmostEqual(pPoints[pPoints.length - 1]))\r\n pPoints[0].clone(pPoints[pPoints.length - 1]);\r\n else\r\n pPoints.push(pPoints[0].clone());\r\n if (result) {\r\n result._clipPlanes = undefined; // Start as undefined\r\n result._invisible = invisible;\r\n result._polygon = pPoints;\r\n result.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n return result;\r\n } else {\r\n return new ClipShape(pPoints, zLow, zHigh, transform, isMask, invisible);\r\n }\r\n }\r\n /**\r\n * Create a ClipShape that exists as a 3 dimensional box of the range given. Optionally choose to\r\n * also store this shape's zLow and zHigh members from the range through the use of a RangePlaneBitMask.\r\n */\r\n public static createBlock(\r\n extremities: Range3d,\r\n clipMask: ClipMaskXYZRangePlanes,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n transform?: Transform,\r\n result?: ClipShape,\r\n ): ClipShape {\r\n const low = extremities.low;\r\n const high = extremities.high;\r\n const blockPoints: Point3d[] = [];\r\n for (let i = 0; i < 5; i++)\r\n blockPoints.push(Point3d.create());\r\n blockPoints[0].x = blockPoints[3].x = blockPoints[4].x = low.x;\r\n blockPoints[1].x = blockPoints[2].x = high.x;\r\n blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;\r\n blockPoints[2].y = blockPoints[3].y = high.y;\r\n const shape = ClipShape.createShape(\r\n blockPoints,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined,\r\n transform,\r\n isMask,\r\n invisible,\r\n result,\r\n );\r\n assert(shape !== undefined, \"expect defined because blockPoints.length > 2\");\r\n return shape;\r\n }\r\n /** Creates a new ClipShape with undefined members and a polygon points array of zero length. */\r\n public static createEmpty(\r\n isMask = false, invisible: boolean = false, transform?: Transform, result?: ClipShape,\r\n ): ClipShape {\r\n if (result) {\r\n result._clipPlanes = undefined;\r\n result._invisible = invisible;\r\n result._polygon.length = 0;\r\n result.initSecondaryProps(isMask, undefined, undefined, transform);\r\n return result;\r\n }\r\n return new ClipShape([], undefined, undefined, transform, isMask, invisible);\r\n }\r\n /** Checks to ensure that the member polygon has an area, and that the polygon is closed. */\r\n public get isValidPolygon(): boolean {\r\n if (this._polygon.length < 3)\r\n return false;\r\n if (!this._polygon[0].isExactEqual(this._polygon[this._polygon.length - 1]))\r\n return false;\r\n return true;\r\n }\r\n /** Returns a deep copy of this instance of ClipShape, storing in an optional result. */\r\n public override clone(result?: ClipShape): ClipShape {\r\n return ClipShape.createFrom(this, result);\r\n }\r\n /**\r\n * Given the current polygon data, parses clip planes that together form an object, storing the result in\r\n * the set given, either clip planes or mask planes.\r\n */\r\n private parseClipPlanes(set: UnionOfConvexClipPlaneSets) {\r\n const points = this._polygon;\r\n if (points.length === 3 && !this._isMask && points[0].isExactEqual(points[points.length - 1])) {\r\n this.parseLinearPlanes(set, this._polygon[0], this._polygon[1]);\r\n return true;\r\n }\r\n if (!this.isMask) {\r\n const direction = PolygonOps.testXYPolygonTurningDirections(this.polygon);\r\n if (direction !== 0) {\r\n this.parseConvexPolygonPlanes(set, this._polygon, direction, false);\r\n return true;\r\n }\r\n }\r\n // REMARK: Pass all polygons to non-convex case. It will funnel\r\n // to concave case as appropriate.\r\n this.parsePolygonPlanes(set, this._polygon, this.isMask);\r\n return true;\r\n }\r\n /**\r\n * Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets\r\n * defining the bounded region of linear planes. Returns true if successful.\r\n * * This handles the degenerate 2-point polygon case, e.g., select by line. See [[parseConvexPolygonPlanes]].\r\n */\r\n private parseLinearPlanes(\r\n set: UnionOfConvexClipPlaneSets, start: Point3d, end: Point3d, cameraFocalLength?: number,\r\n ): boolean {\r\n const normal = Vector2d.createStartEnd(start, end); // xy only!\r\n if (!normal.normalize(normal))\r\n return false; // filter out trivial edge\r\n if (cameraFocalLength === 0.0)\r\n cameraFocalLength = undefined; // ensure when camera is defined, vecStart/End3d are nonzero\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n // normal and perp are nonzero, so ClipPlane creation can only fail on out-of-memory\r\n const perp = Vector2d.create(-normal.y, normal.x);\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(Vector3d.create(normal.x, normal.y), start, this._invisible));\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(Vector3d.create(-normal.x, -normal.y), end, this._invisible));\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(Vector3d.create(perp.x, perp.y), start, this._invisible));\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(Vector3d.create(-perp.x, -perp.y), start, this._invisible));\r\n } else {\r\n // The cross products are nonzero because their inputs are nonzero and nonparallel (because start/end are xy-distinct).\r\n // Thus ClipPlane creation can only fail on out-of-memory.\r\n const vecStart3d = Vector3d.create(start.x, start.y, -cameraFocalLength);\r\n const vecEnd3d = Vector3d.create(end.x, end.y, -cameraFocalLength);\r\n const perpendicular = Vector3d.createZero();\r\n const endNormal = Vector3d.createZero();\r\n vecEnd3d.crossProduct(vecStart3d, perpendicular).normalize(perpendicular);\r\n vecStart3d.crossProduct(perpendicular, endNormal).normalize(endNormal);\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(perpendicular, 0.0, this._invisible));\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(endNormal, 0.0, this._invisible));\r\n perpendicular.negate(perpendicular);\r\n vecEnd3d.crossProduct(perpendicular, endNormal).normalize(endNormal);\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(perpendicular, 0.0, this._invisible));\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(endNormal, 0.0, this._invisible));\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n return true;\r\n }\r\n /**\r\n * Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with\r\n * ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n * @param polygon convex polygon with closure point. z-coordinates are ignored.\r\n * @param direction whether the area described by the polygon is found on its directed edges' left (nonnegative) or\r\n * right (negative). Typically this is positive for CCW xy-polygons.\r\n * @param buildExteriorClipper whether the returned clippers represent the xy-region *outside* the polygon.\r\n * When this is true, `direction` is typically set accordingly. For example, for a CCW polygon, to return clippers\r\n * for the exterior region, pass `direction < 0` and `buildExteriorClipper = true`. Currently not implemented for\r\n * camera view.\r\n */\r\n private parseConvexPolygonPlanes(\r\n set: UnionOfConvexClipPlaneSets,\r\n polygon: Point3d[],\r\n direction: number,\r\n buildExteriorClipper: boolean,\r\n cameraFocalLength?: number,\r\n ): boolean {\r\n const edges: PolyEdge[] = [];\r\n const reverse = direction < 0;\r\n if (cameraFocalLength === 0.0)\r\n cameraFocalLength = undefined; // ensure when camera is defined, edges[].pointA/B are nonzero\r\n const z = (cameraFocalLength === undefined) ? 0.0 : -cameraFocalLength;\r\n for (let i = 0; i < polygon.length - 1; i++) {\r\n const dir = Vector2d.createStartEnd(polygon[i], polygon[i + 1]); // xy only!\r\n if (dir.normalize(dir)) { // filter out trivial edges\r\n const normal = Vector3d.create(reverse ? dir.y : -dir.y, reverse ? -dir.x : dir.x);\r\n edges.push(new PolyEdge(polygon[i], polygon[i + 1], normal, z));\r\n }\r\n }\r\n if (edges.length < 3) {\r\n return false;\r\n }\r\n // NOTE: ClipPlane creation below fails only on out-of-memory because we ensure each input normal is nonzero:\r\n // * edges[] normals are nonzero because the array is populated only with nontrivial edges.\r\n // * with camera, edges[].pointA/B is nonzero and never parallel as vectors, thus their cross is nonzero.\r\n // * bisector planes are only created for nonzero bisector normals.\r\n if (buildExteriorClipper) {\r\n assert(cameraFocalLength === undefined, \"TODO: implement camera logic for exterior clipper creation\");\r\n const last = edges.length - 1;\r\n for (let i = 0; i <= last; i++) {\r\n const edge = edges[i];\r\n const prevEdge = edges[i ? (i - 1) : last];\r\n const nextEdge = edges[(i === last) ? 0 : (i + 1)];\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n const previousPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(prevEdge, edge, !reverse);\r\n const nextPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(edge, nextEdge, reverse);\r\n // Create three-sided fans from each edge:\r\n // * We could define the region with only two planes per edge, but then we wouldn't be able to designate the \"interior\" status accurately.\r\n // * Silently ignore undefined bisector normal. This can happen if input violates the convexity assumption with a pair of backtracking edges.\r\n if (previousPerpendicular)\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(previousPerpendicular, edge.pointA, this._invisible, true));\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(edge.normal, edge.pointB, this._invisible, false));\r\n if (nextPerpendicular)\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(nextPerpendicular, nextEdge.pointA, this._invisible, true));\r\n set.addConvexSet(convexSet);\r\n set.addOutsideZClipSets(this._invisible, this._zLow, this._zHigh);\r\n }\r\n } else {\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n for (const edge of edges)\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(edge.normal, edge.pointA));\r\n } else {\r\n const cross = Vector3d.createZero();\r\n if (reverse) {\r\n for (const edge of edges) {\r\n Vector3d.createFrom(edge.pointA).crossProduct(Vector3d.createFrom(edge.pointB), cross).normalize(cross);\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(cross, 0.0));\r\n }\r\n } else {\r\n for (const edge of edges) {\r\n Vector3d.createFrom(edge.pointB).crossProduct(Vector3d.createFrom(edge.pointA), cross).normalize(cross);\r\n convexSet.addPlaneToConvexSet(ClipPlane.createNormalAndDistance(cross, 0.0));\r\n }\r\n }\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets\r\n * with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n */\r\n private parsePolygonPlanes(set: UnionOfConvexClipPlaneSets, polygon: Point3d[], isMask: boolean, cameraFocalLength?: number,\r\n ): boolean {\r\n const cleanPolygon = PolylineOps.compressDanglers(polygon, true);\r\n const announceFace = (_graph: HalfEdgeGraph, edge: HalfEdge): boolean => {\r\n if (!edge.isMaskSet(HalfEdgeMask.EXTERIOR)) {\r\n const convexFacetPoints = edge.collectAroundFace((node: HalfEdge): any => {\r\n if (!node.isMaskSet(HalfEdgeMask.EXTERIOR))\r\n return Point3d.create(node.x, node.y, 0);\r\n });\r\n // parseConvexPolygonPlanes expects a closed loop (pushing the reference doesn't matter)\r\n convexFacetPoints.push(convexFacetPoints[0].clone());\r\n const direction = PolygonOps.testXYPolygonTurningDirections(convexFacetPoints); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, convexFacetPoints, direction, false, cameraFocalLength);\r\n }\r\n return true;\r\n };\r\n if (isMask) {\r\n const polygonA = Point3dArray.clonePoint3dArray(cleanPolygon);\r\n const hullAndInlets = AlternatingCCTreeNode.createHullAndInletsForPolygon(polygonA);\r\n const allLoops = hullAndInlets.extractLoops();\r\n if (allLoops.length === 0)\r\n return false;\r\n const hull = allLoops[0];\r\n const direction1 = PolygonOps.testXYPolygonTurningDirections(hull); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, hull, -direction1, true, cameraFocalLength);\r\n for (let i = 1; i < allLoops.length; i++) {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(allLoops[i]);\r\n if (triangulatedPolygon) {\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n }\r\n return true;\r\n } else {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(cleanPolygon);\r\n if (triangulatedPolygon === undefined)\r\n return false;\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n return true;\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 * @param matrix matrix to apply.\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 */\r\n public override multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n this.ensurePlaneSets();\r\n return super.multiplyPlanesByMatrix4d(matrix, invert, transpose);\r\n }\r\n /**\r\n * Apply `transform` to the local to world (`transformFromClip`) transform.\r\n * * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`\r\n * * the transform is passed to the base class to be applied to clip plane form of the clipper.\r\n */\r\n public override transformInPlace(transform: Transform): boolean {\r\n if (transform.isIdentity)\r\n return true;\r\n super.transformInPlace(transform);\r\n if (this._transformFromClip)\r\n transform.multiplyTransformTransform(this._transformFromClip, this._transformFromClip);\r\n else\r\n this._transformFromClip = transform.clone();\r\n this._transformToClip = this._transformFromClip.inverse(); // could be undefined\r\n return true;\r\n }\r\n /**\r\n * Return true if\r\n * * at least one point is defined\r\n * * The local to world transform (transformFromClip) either\r\n * * is undefined\r\n * * has no xy parts in its column Z (local frame Z is parallel to global Z)\r\n */\r\n public get isXYPolygon(): boolean {\r\n if (this._polygon.length === 0) // Note: This is a lenient check, as points array could also contain less than 3 points (not a polygon)\r\n return false;\r\n if (this._transformFromClip === undefined)\r\n return true;\r\n const zVector = this._transformFromClip.matrix.columnZ();\r\n return zVector.magnitudeXY() < 1.0e-8;\r\n }\r\n /** Transform the input point in place using this instance's `transformToClip` member */\r\n public performTransformToClip(point: Point3d): void {\r\n if (this._transformToClip !== undefined)\r\n this._transformToClip.multiplyPoint3d(point, point);\r\n }\r\n /** Transform the input point in place using this instance's `transformFromClip` member */\r\n public performTransformFromClip(point: Point3d): void {\r\n if (this._transformFromClip !== undefined)\r\n this._transformFromClip.multiplyPoint3d(point, point);\r\n }\r\n}\r\n"]}
@@ -295,8 +295,8 @@ class ClipUtilities {
295
295
  if (ignoreInvisiblePlanes && plane.invisible)
296
296
  continue;
297
297
  const pointsClippedToRange = plane.intersectRange(range, true);
298
- const finalPoints = new GrowableXYZArray_1.GrowableXYZArray();
299
298
  if (pointsClippedToRange) {
299
+ const finalPoints = new GrowableXYZArray_1.GrowableXYZArray();
300
300
  convexSet.polygonClip(pointsClippedToRange, finalPoints, work, plane);
301
301
  if (finalPoints.length > 0)
302
302
  loopFunction(finalPoints);