@itwin/core-geometry 5.3.0-dev.1 → 5.3.0-dev.10

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 (516) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.js.map +1 -1
  4. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  5. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  10. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  12. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  13. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  14. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  15. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  16. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  17. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  18. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  19. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  20. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  21. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  22. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  23. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  24. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  25. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  26. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  27. package/lib/cjs/core-geometry.js.map +1 -1
  28. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  29. package/lib/cjs/curve/Arc3d.js +5 -7
  30. package/lib/cjs/curve/Arc3d.js.map +1 -1
  31. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  32. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  33. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  34. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  35. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  36. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  37. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  38. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  39. package/lib/cjs/curve/CurveOps.d.ts +2 -5
  40. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  41. package/lib/cjs/curve/CurveOps.js +2 -5
  42. package/lib/cjs/curve/CurveOps.js.map +1 -1
  43. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  44. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  45. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  46. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  47. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  48. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  49. package/lib/cjs/curve/LineString3d.js.map +1 -1
  50. package/lib/cjs/curve/Loop.js.map +1 -1
  51. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  52. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  53. package/lib/cjs/curve/Path.js.map +1 -1
  54. package/lib/cjs/curve/PointString3d.js.map +1 -1
  55. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  56. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  57. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  58. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  59. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  60. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +50 -15
  61. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  62. package/lib/cjs/curve/Query/PlanarSubdivision.js +102 -84
  63. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  64. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  65. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  66. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  67. package/lib/cjs/curve/RegionOps.d.ts +44 -25
  68. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  69. package/lib/cjs/curve/RegionOps.js +74 -39
  70. package/lib/cjs/curve/RegionOps.js.map +1 -1
  71. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  72. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +8 -8
  73. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  74. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  75. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  83. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  84. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
  85. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  86. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +102 -92
  87. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  88. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  89. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  90. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  91. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  92. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  93. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  94. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  95. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  96. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  97. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  98. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  100. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  101. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  102. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  103. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  104. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  105. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  106. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  107. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  108. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  109. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  110. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  111. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  112. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  113. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  114. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  115. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  116. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  117. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  118. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  119. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  120. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  121. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  122. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  123. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  124. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +2 -1
  125. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  126. package/lib/cjs/geometry3d/GrowableXYArray.js +2 -1
  127. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  128. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +2 -1
  129. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  130. package/lib/cjs/geometry3d/GrowableXYZArray.js +2 -1
  131. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  132. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  133. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  134. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +9 -16
  135. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  136. package/lib/cjs/geometry3d/IndexedXYZCollection.js +3 -3
  137. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  138. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  139. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  140. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  141. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  142. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  143. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  144. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  145. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  146. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  147. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  148. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  149. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  150. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  151. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  152. package/lib/cjs/geometry3d/PolylineOps.d.ts +2 -2
  153. package/lib/cjs/geometry3d/PolylineOps.js +2 -2
  154. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  155. package/lib/cjs/geometry3d/Range.js.map +1 -1
  156. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  157. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  158. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  159. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  160. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  161. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  162. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  163. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  164. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  165. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  166. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  167. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  168. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  169. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  170. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  171. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  172. package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
  173. package/lib/cjs/numerics/ClusterableArray.js +2 -2
  174. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  175. package/lib/cjs/numerics/Complex.js.map +1 -1
  176. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  177. package/lib/cjs/numerics/Newton.js.map +1 -1
  178. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  179. package/lib/cjs/numerics/PolarData.js.map +1 -1
  180. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  181. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  182. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  183. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  184. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  185. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  186. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  187. package/lib/cjs/polyface/AuxData.js.map +1 -1
  188. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  189. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  190. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  191. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  192. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  193. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  194. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  195. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  196. package/lib/cjs/polyface/Polyface.js.map +1 -1
  197. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  198. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  199. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  200. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  201. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  202. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  203. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  204. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  205. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  206. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  207. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  208. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  209. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  210. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  211. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  212. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  213. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  214. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  215. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  216. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  217. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  218. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  219. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  220. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  221. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  222. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  223. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  224. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  225. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  226. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  227. package/lib/cjs/solid/Box.js.map +1 -1
  228. package/lib/cjs/solid/Cone.js.map +1 -1
  229. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  230. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  231. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  232. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  233. package/lib/cjs/solid/Sphere.js.map +1 -1
  234. package/lib/cjs/solid/SweepContour.js.map +1 -1
  235. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  236. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  237. package/lib/cjs/topology/Graph.js.map +1 -1
  238. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  239. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  240. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  241. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  242. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  243. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  244. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  245. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  246. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  247. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  248. package/lib/cjs/topology/MaskManager.js.map +1 -1
  249. package/lib/cjs/topology/Merging.d.ts +15 -7
  250. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  251. package/lib/cjs/topology/Merging.js +15 -10
  252. package/lib/cjs/topology/Merging.js.map +1 -1
  253. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  254. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  255. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  256. package/lib/cjs/topology/Triangulation.js.map +1 -1
  257. package/lib/cjs/topology/Voronoi.js.map +1 -1
  258. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  259. package/lib/esm/Constant.js.map +1 -1
  260. package/lib/esm/Geometry.js.map +1 -1
  261. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  262. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  263. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  264. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  265. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  266. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  267. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  268. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  269. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  270. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  271. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  272. package/lib/esm/bspline/KnotVector.js.map +1 -1
  273. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  274. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  275. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  276. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  277. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  278. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  279. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  280. package/lib/esm/clipping/ClipVector.js.map +1 -1
  281. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  282. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  283. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  284. package/lib/esm/core-geometry.js.map +1 -1
  285. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  286. package/lib/esm/curve/Arc3d.js +5 -7
  287. package/lib/esm/curve/Arc3d.js.map +1 -1
  288. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  289. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  290. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  291. package/lib/esm/curve/CurveCollection.js.map +1 -1
  292. package/lib/esm/curve/CurveCurve.js.map +1 -1
  293. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  294. package/lib/esm/curve/CurveFactory.js.map +1 -1
  295. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  296. package/lib/esm/curve/CurveOps.d.ts +2 -5
  297. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  298. package/lib/esm/curve/CurveOps.js +2 -5
  299. package/lib/esm/curve/CurveOps.js.map +1 -1
  300. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  301. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  302. package/lib/esm/curve/CurveTypes.js.map +1 -1
  303. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  304. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  305. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  306. package/lib/esm/curve/LineString3d.js.map +1 -1
  307. package/lib/esm/curve/Loop.js.map +1 -1
  308. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  309. package/lib/esm/curve/ParityRegion.js.map +1 -1
  310. package/lib/esm/curve/Path.js.map +1 -1
  311. package/lib/esm/curve/PointString3d.js.map +1 -1
  312. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  313. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  314. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  315. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  316. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  317. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +50 -15
  318. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  319. package/lib/esm/curve/Query/PlanarSubdivision.js +102 -84
  320. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  321. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  322. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  323. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  324. package/lib/esm/curve/RegionOps.d.ts +44 -25
  325. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  326. package/lib/esm/curve/RegionOps.js +72 -37
  327. package/lib/esm/curve/RegionOps.js.map +1 -1
  328. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  329. package/lib/esm/curve/RegionOpsClassificationSweeps.js +8 -8
  330. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  331. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  332. package/lib/esm/curve/UnionRegion.js.map +1 -1
  333. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  334. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  335. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  336. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  337. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  338. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  339. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  340. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  341. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
  342. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  343. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +102 -92
  344. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  345. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  346. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  347. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  348. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  349. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  350. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  351. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  352. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  353. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  354. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  355. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  356. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  357. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  358. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  359. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  360. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  361. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  362. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  363. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  364. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  365. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  366. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  367. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  368. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  369. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  370. package/lib/esm/geometry3d/Angle.js.map +1 -1
  371. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  372. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  373. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  374. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  375. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  376. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  377. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  378. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  379. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  380. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  381. package/lib/esm/geometry3d/GrowableXYArray.d.ts +2 -1
  382. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  383. package/lib/esm/geometry3d/GrowableXYArray.js +2 -1
  384. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  385. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +2 -1
  386. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  387. package/lib/esm/geometry3d/GrowableXYZArray.js +2 -1
  388. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  389. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  390. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  391. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +9 -16
  392. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  393. package/lib/esm/geometry3d/IndexedXYZCollection.js +3 -3
  394. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  395. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  396. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  397. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  398. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  399. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  400. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  401. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  402. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  403. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  404. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  405. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  406. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  407. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  408. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  409. package/lib/esm/geometry3d/PolylineOps.d.ts +2 -2
  410. package/lib/esm/geometry3d/PolylineOps.js +2 -2
  411. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  412. package/lib/esm/geometry3d/Range.js.map +1 -1
  413. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  414. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  415. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  416. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  417. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  418. package/lib/esm/geometry3d/Transform.js.map +1 -1
  419. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  420. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  421. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  422. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  423. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  424. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  425. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  426. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  427. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  428. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  429. package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
  430. package/lib/esm/numerics/ClusterableArray.js +2 -2
  431. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  432. package/lib/esm/numerics/Complex.js.map +1 -1
  433. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  434. package/lib/esm/numerics/Newton.js.map +1 -1
  435. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  436. package/lib/esm/numerics/PolarData.js.map +1 -1
  437. package/lib/esm/numerics/Polynomials.js.map +1 -1
  438. package/lib/esm/numerics/Quadrature.js.map +1 -1
  439. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  440. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  441. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  442. package/lib/esm/numerics/UnionFind.js.map +1 -1
  443. package/lib/esm/numerics/UsageSums.js.map +1 -1
  444. package/lib/esm/polyface/AuxData.js.map +1 -1
  445. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  446. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  447. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  448. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  449. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  450. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  451. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  452. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  453. package/lib/esm/polyface/Polyface.js.map +1 -1
  454. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  455. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  456. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  457. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  458. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  459. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  460. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  461. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  462. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  463. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  464. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  465. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  466. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  467. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  468. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  469. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  470. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  471. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  472. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  473. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  474. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  475. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  476. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  477. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  478. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  479. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  480. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  481. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  482. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  483. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  484. package/lib/esm/solid/Box.js.map +1 -1
  485. package/lib/esm/solid/Cone.js.map +1 -1
  486. package/lib/esm/solid/LinearSweep.js.map +1 -1
  487. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  488. package/lib/esm/solid/RuledSweep.js.map +1 -1
  489. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  490. package/lib/esm/solid/Sphere.js.map +1 -1
  491. package/lib/esm/solid/SweepContour.js.map +1 -1
  492. package/lib/esm/solid/TorusPipe.js.map +1 -1
  493. package/lib/esm/topology/ChainMerge.js.map +1 -1
  494. package/lib/esm/topology/Graph.js.map +1 -1
  495. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  496. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  497. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  498. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  499. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  500. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  501. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  502. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  503. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  504. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  505. package/lib/esm/topology/MaskManager.js.map +1 -1
  506. package/lib/esm/topology/Merging.d.ts +15 -7
  507. package/lib/esm/topology/Merging.d.ts.map +1 -1
  508. package/lib/esm/topology/Merging.js +15 -10
  509. package/lib/esm/topology/Merging.js.map +1 -1
  510. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  511. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  512. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  513. package/lib/esm/topology/Triangulation.js.map +1 -1
  514. package/lib/esm/topology/Voronoi.js.map +1 -1
  515. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  516. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"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AAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACtI,CAAC;;AA/kBH,8BAglBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3d } from \"../geometry3d/Plane3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XYAndZ, XYZProps } from \"../geometry3d/XYZProps\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { AnalyticRoots } from \"../numerics/Polynomials\";\nimport { Clipper, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/**\n * Wire format describing a [[ClipPlane]].\n * If either [[normal]] or [[dist]] are omitted, defaults to a normal of [[Vector3d.unitZ]] and a distance of zero.\n * @public\n */\nexport interface ClipPlaneProps {\n /** The plane's inward normal. */\n normal?: XYZProps;\n /** The plane's signed distance from the origin. */\n dist?: number;\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\n invisible?: boolean;\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\n interior?: boolean;\n}\n\n/**\n * A ClipPlane is a single plane represented as\n * * An inward unit normal (u,v,w)\n * * A signedDistance\n * More details can be found at docs/learning/geometry/Clipping.md\n *\n * Hence\n * * The halfspace function evaluation for \"point\" (x,y,z) is `(x,y,z) DOT (u,v,w) - signedDistance`.\n * * POSITIVE values of the halfspace function are \"inside\".\n * * ZERO value of the halfspace function is \"on\".\n * * NEGATIVE value of the halfspace function is \"outside\".\n * * A representative point on the plane is (signedDistance * u, signedDistance * v, signedDistance * w).\n * * Given a point on the plane and the inward normal of the plane, `signedDistance = point DOT normal`.\n * @public\n */\nexport class ClipPlane extends Plane3d implements Clipper, PolygonClipper {\n private _inwardNormal: Vector3d;\n /**\n * Construct a parallel plane through the origin.\n * * Move it to the actual position.\n * * _distanceFromOrigin is the distance it moved, with the (inward) normal direction as positive\n */\n private _distanceFromOrigin: number;\n private _invisible: boolean;\n private _interior: boolean;\n\n private constructor(normal: Vector3d, distance: number, invisible: boolean, interior: boolean) {\n super();\n this._invisible = invisible;\n this._interior = interior;\n this._inwardNormal = normal;\n this._distanceFromOrigin = distance;\n }\n /*\n private safeSetXYZDistance(nx: number, ny: number, nz: number, d: number) {\n this._inwardNormal.set(nx, ny, nz);\n this._distanceFromOrigin = d;\n }\n */\n /**\n * Return true if all members are almostEqual to corresponding members of other.\n * @param other clip plane to compare\n */\n public isAlmostEqual(other: ClipPlane): boolean {\n return Geometry.isSameCoordinate(this._distanceFromOrigin, other._distanceFromOrigin)\n && this._inwardNormal.isAlmostEqual(other._inwardNormal)\n && this._interior === other._interior\n && this._invisible === other._invisible;\n }\n /** Return a cloned plane */\n public clone(): ClipPlane {\n const result = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n return result;\n }\n /** Return a cloned plane with coordinate data negated. */\n public cloneNegated(): ClipPlane {\n const plane = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n plane.negateInPlace();\n return plane;\n }\n /** Create a ClipPlane from Plane3dByOriginAndUnitNormal. */\n public static createPlane(\n plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane {\n const distance = plane.getNormalRef().dotProduct(plane.getOriginRef());\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = plane.getNormalRef().clone();\n result._distanceFromOrigin = distance;\n return result;\n }\n return new ClipPlane(plane.getNormalRef().clone(), distance, invisible, interior);\n }\n /**\n * Create a ClipPlane with direct normal and signedDistance.\n * * The vector is normalized for storage.\n */\n public static createNormalAndDistance(\n normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a ClipPlane\n * * \"normal\" is the inward normal of the plane (it is internally normalized).\n * * \"point\" is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz as\n * a vector from the origin.)\n */\n public static createNormalAndPoint(\n normal: Vector3d, point: XYAndZ, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n const distance = normalized.dotProduct(point);\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a clip plane\n * @param origin any point on the plane.\n * @param vectorA any vector in the plane\n * @param vectorB any vector in the plane\n * @return undefined if the vectors are not independent.\n * * The stored inward normal is vectorB.crossProduct(vectorA).\n * * That is, the vectors are considered as a right-handed pair when viewed from the outside.\n */\n public static createOriginAndVectors(\n origin: Point3d,\n vectorA: Vector3d,\n vectorB: Vector3d,\n invisible: boolean = false,\n interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = vectorB.crossProduct(vectorA);\n return this.createNormalAndPoint(normalized, origin, invisible, interior, result);\n }\n /**\n * Create a ClipPlane\n * * \"normal\" (normalX, normalY, normalZ) is the inward normal of the plane.\n * * \"point\" (originX,originY,originZ) is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz\n * as a vector from the origin.)\n */\n public static createNormalAndPointXYZXYZ(\n normalX: number, normalY: number, normalZ: number,\n originX: number, originY: number, originZ: number,\n invisible: boolean = false, interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const q = Geometry.hypotenuseXYZ(normalX, normalY, normalZ);\n const r = Geometry.conditionalDivideFraction(1, q);\n if (r !== undefined) {\n if (result) {\n result._inwardNormal.set(normalX * r, normalY * r, normalZ * r);\n result._distanceFromOrigin = result._inwardNormal.dotProductXYZ(originX, originY, originZ);\n result._invisible = invisible;\n result._interior = interior;\n return result;\n }\n const normal = Vector3d.create(normalX * r, normalY * r, normalZ * r);\n return new ClipPlane(normal, normal.dotProductXYZ(originX, originY, originZ), invisible, interior);\n }\n return undefined;\n }\n /**\n * Return a json object of the form\n * `{\"normal\":[u,v,w],\"dist\":signedDistanceValue,\"interior\":true,\"invisible\":true}`\n */\n public toJSON(): ClipPlaneProps {\n const props: ClipPlaneProps = {\n normal: this.inwardNormalRef.toJSON(),\n dist: this.distance,\n };\n if (this.interior)\n props.interior = true;\n if (this.invisible)\n props.invisible = true;\n return props;\n }\n /** Parse json object to ClipPlane instance */\n public static fromJSON(json: ClipPlaneProps, result?: ClipPlane): ClipPlane | undefined {\n if (json && json.normal && undefined !== json.dist && Number.isFinite(json.dist))\n return ClipPlane.createNormalAndDistance(\n Vector3d.fromJSON(json.normal), json.dist, !!json.invisible, !!json.interior,\n );\n return ClipPlane.createNormalAndDistance(Vector3d.unitZ(), 0, false, false, result);\n }\n /** Set both the invisible and interior flags. */\n public setFlags(invisible: boolean, interior: boolean) {\n this._invisible = invisible;\n this._interior = interior;\n }\n /** Return the stored distanceFromOrigin property. */\n public get distance() {\n return this._distanceFromOrigin;\n }\n /** * Return the stored inward normal property. */\n public get inwardNormalRef(): Vector3d {\n return this._inwardNormal;\n }\n /** Return the \"interior\" property flag. Interpretation of this flag is algorithm-specific. */\n public get interior() {\n return this._interior;\n }\n /** Return the \"invisible\" property flag. Interpretation of this flag is algorithm-specific. */\n public get invisible() {\n return this._invisible;\n }\n /**\n * Create a plane defined by two points, an up vector, and a tilt angle relative to the up vector.\n * @param point0 start point of the edge\n * @param point1 end point of the edge\n * @param upVector vector perpendicular to the plane\n * @param tiltAngle angle to tilt the plane around the edge in the direction of the up vector.\n * @param result optional preallocated plane\n */\n public static createEdgeAndUpVector(\n point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane,\n ): ClipPlane | undefined {\n const edgeVector = Vector3d.createFrom(point1.minus(point0));\n let normal = (upVector.crossProduct(edgeVector)).normalize();\n\n if (normal) {\n if (tiltAngle !== undefined && !tiltAngle.isAlmostZero) {\n const tiltNormal = Vector3d.createRotateVectorAroundVector(normal, edgeVector, tiltAngle);\n if (tiltNormal) {\n normal = tiltNormal.clone();\n }\n }\n normal.negate(normal);\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n }\n return undefined;\n }\n /** Create a plane perpendicular to the edge between the xy parts of point0 and point1. */\n public static createEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined {\n const normal = Vector3d.create(point0.y - point1.y, point1.x - point0.x);\n if (normal.normalizeInPlace())\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n return undefined;\n }\n /**\n * Variant of [[createEdgeXY]] that computes the plane using the edge midpoint instead of its start point.\n * * This is more stable for creating a pair of clip planes from a long edge and its reversal, as is commonly found\n * in a [[UnionOfConvexClipPlaneSets]].\n */\n public static createMidPointEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined {\n return ClipPlane.createNormalAndPointXYZXYZ(\n point0.y - point1.y, point1.x - point0.x, 0,\n 0.5 * (point0.x + point1.x), 0.5 * (point0.y + point1.y), 0,\n false, false, result,\n );\n }\n /**\n * Return the Plane3d form of the plane.\n * * The plane origin is the point `distance * inwardNormal`\n * * The plane normal is the inward normal of the ClipPlane.\n */\n public getPlane3d(): Plane3dByOriginAndUnitNormal {\n const d = this._distanceFromOrigin;\n // normal should be normalized, will not return undefined\n return Plane3dByOriginAndUnitNormal.create(\n Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d),\n this._inwardNormal,\n )!;\n }\n /**\n * Return the Point4d d form of the plane.\n * * The homogeneous xyz are the inward normal xyz.\n * * The homogeneous weight is the negated ClipPlane distance.\n */\n public getPlane4d(): Point4d {\n return Point4d.create(\n this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin,\n );\n }\n /**\n * Set the plane from DPoint4d style plane.\n * * The saved plane has its direction normalized.\n * * This preserves the plane itself as a zero set but make plane evaluations act as true distances (even if the\n * plane coefficients are scaled otherwise).\n * @param plane the DPoint4d style plane.\n */\n public setPlane4d(plane: Point4d) {\n const a = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);\n const r = a === 0.0 ? 1.0 : 1.0 / a;\n this._inwardNormal.x = r * plane.x;\n this._inwardNormal.y = r * plane.y;\n this._inwardNormal.z = r * plane.z;\n this._distanceFromOrigin = -r * plane.w;\n }\n /**\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w\n * scale applied to distance.\n * @param point space point to test.\n */\n public weightedAltitude(point: Point4d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - point.w * this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space, i.e. (dot product with inward normal) minus distance.\n * @param point space point to test.\n */\n public altitude(point: Point3d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space with point given as x,y,z, i.e. (dot product with\n * inward normal) minus distance.\n * @param point space point to test.\n */\n public altitudeXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x\n + y * this._inwardNormal.y\n + z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalX(): number {\n return this._inwardNormal.x;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalY(): number {\n return this._inwardNormal.y;\n }\n /** Return the z component of the normal used to evaluate altitude. */\n public normalZ(): number {\n return this._inwardNormal.z;\n }\n /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin). */\n public velocity(vector: Vector3d): number {\n return vector.x * this._inwardNormal.x + vector.y * this._inwardNormal.y + vector.z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the x,yz, vector components (NOT using the plane's\n * distanceFromOrigin).\n */\n public velocityXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x + y * this._inwardNormal.y + z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the point (treating the point xyz as a vector, and NOT\n * using the plane's distanceFromOrigin).\n */\n public dotProductPlaneNormalPoint(point: Point3d): number {\n return point.x * this._inwardNormal.x + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z;\n }\n /**\n * Return true if spacePoint is inside or on the plane, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOnOrInside(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(spacePoint);\n if (tolerance) { value += tolerance; }\n return value >= 0.0;\n }\n /**\n * Return true if spacePoint is strictly inside the halfspace, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(point);\n if (tolerance) { value -= tolerance; }\n return value > 0.0;\n }\n /**\n * Return true if spacePoint is strictly on the plane, within tolerance\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOn(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n return Math.abs(this.altitude(point)) <= tolerance;\n }\n /**\n * Compute intersections of an (UNBOUNDED) arc with the plane. Append them (as radians) to a growing array.\n * @param arc arc to test. The angle limits of the arc are NOT considered.\n * @param intersectionRadians array to receive results\n */\n public appendIntersectionRadians(arc: Arc3d, intersectionRadians: GrowableFloat64Array) {\n const arcVectors = arc.toVectors();\n const alpha = this.altitude(arc.center);\n const beta = this.velocity(arcVectors.vector0);\n const gamma = this.velocity(arcVectors.vector90);\n AnalyticRoots.appendImplicitLineUnitCircleIntersections(\n alpha, beta, gamma, undefined, undefined, intersectionRadians,\n );\n }\n private static _clipArcFractionArray = new GrowableFloat64Array();\n /**\n * Announce fractional intervals of arc clip.\n * * Each call to `announce(fraction0, fraction1, arc)` announces one interval that is inside the clip plane.\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n const breaks = ClipPlane._clipArcFractionArray;\n breaks.clear();\n this.appendIntersectionRadians(arc, breaks);\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\n }\n /**\n * Compute intersection of (unbounded) segment with the plane.\n * * If the ends are on the same side of the plane, return undefined.\n * * If the intersection is an endpoint or interior to the segment return the fraction.\n * * If both ends are on, return undefined.\n */\n public getBoundedSegmentSimpleIntersection(pointA: Point3d, pointB: Point3d): number | undefined {\n const h0 = this.altitude(pointA);\n const h1 = this.altitude(pointB);\n if (h0 * h1 > 0.0)\n return undefined;\n if (h0 === 0.0 && h1 === 0.0) {\n return undefined;\n }\n return - h0 / (h1 - h0);\n }\n /** Apply transform to the origin. Apply inverse transpose of the matrix part to th normal vector. */\n public transformInPlace(transform: Transform): boolean {\n const plane: Plane3dByOriginAndUnitNormal = this.getPlane3d();\n const matrix: Matrix3d = transform.matrix;\n const newPoint = transform.multiplyPoint3d(plane.getOriginRef());\n // Normal transforms as the inverse transpose of the matrix part\n // BTW: If the matrix is orthogonal, this is a long way to multiply by the matrix part (mumble grumble)\n const newNormal = matrix.multiplyInverseTranspose(plane.getNormalRef());\n if (!newNormal)\n return false;\n\n plane.set(newPoint, newNormal);\n const normalized = (plane.getNormalRef()).normalize();\n if (!normalized)\n return false;\n this._inwardNormal = normalized;\n this._distanceFromOrigin = this._inwardNormal.dotProduct(plane.getOriginRef());\n return true;\n }\n /** Set the invisible flag. Interpretation of this flag is algorithm-specific. */\n public setInvisible(invisible: boolean) {\n this._invisible = invisible;\n }\n /** Reverse the sign of all coefficients, so outside and inside reverse */\n public negateInPlace() {\n this._inwardNormal = this._inwardNormal.negate();\n this._distanceFromOrigin = - this._distanceFromOrigin;\n }\n /**\n * Move the plane INWARD by given distance\n * @param offset distance of shift inwards\n */\n public offsetDistance(offset: number) {\n this._distanceFromOrigin += offset;\n }\n /**\n * Clip a polygon to the inside or outside of the plane.\n * * Results with 2 or fewer points are ignored.\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\n * * For a convex input polygon, the output polygon is also convex.\n * * For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a\n * valid clip in a parity sense (overlapping regions cancel).\n * @param xyz input points.\n * @param work optional work buffer\n * @param inside whether the positive side of the plane survives (true, default), or negative side (false).\n * @param tolerance distance tolerance for \"on plane\" decision. Default value is [[Geometry.smallMetricDistance]].\n * @return the number of crossings. If this is larger than 2, the input polygon was non-convex.\n * @see appendPolygonClip\n */\n public clipConvexPolygonInPlace(\n xyz: GrowableXYZArray,\n work?: GrowableXYZArray,\n inside: boolean = true,\n tolerance: number = Geometry.smallMetricDistance,\n ): number {\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\n }\n /**\n * Multiply the ClipPlane's DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\n * @param matrix matrix to apply\n * @return false if unable to invert\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\n * effect on the plane is the inverse transpose of matrixA\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n */\n public multiplyPlaneByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n const plane: Point4d = this.getPlane4d();\n if (invert) {\n const inverse = matrix.createInverse();\n if (inverse)\n return this.multiplyPlaneByMatrix4d(inverse, false, transpose);\n return false;\n }\n if (transpose)\n matrix.multiplyTransposePoint4d(plane, plane);\n else\n matrix.multiplyPoint4d(plane, plane);\n this.setPlane4d(plane);\n return true;\n }\n /** Announce the interval (if any) where a line is within the clip plane half space. */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void,\n ): boolean {\n if (f1 < f0)\n return false;\n const h0 = - this.altitude(pointA);\n const h1 = - this.altitude(pointB);\n const delta = h1 - h0;\n const f = Geometry.conditionalDivideFraction(-h0, delta);\n if (f === undefined) { // The segment is parallel to the plane.\n if (h0 <= 0.0) { if (announce) announce(f0, f1); return true; }\n return false;\n }\n if (delta > 0) { // segment aims OUT\n if (f < f1) f1 = f;\n } else {\n // segment aims IN\n if (f > f0)\n f0 = f;\n }\n if (f1 < f0)\n return false;\n if (announce) announce(f0, f1);\n return true;\n }\n /**\n * Return a coordinate frame with\n * * origin at closest point to global origin\n * * z axis points in\n * * x and y are \"in plane\"\n */\n public getFrame(): Transform {\n const d = this._distanceFromOrigin;\n const origin = Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d);\n const matrix = Matrix3d.createRigidHeadsUp(this._inwardNormal, AxisOrder.ZXY);\n return Transform.createOriginAndMatrix(origin, matrix);\n }\n /**\n * Return the intersection of the plane with a range cube.\n * @param range\n * @param xyzOut intersection polygon. This is convex.\n */\n public intersectRange(range: Range3d, addClosurePoint: boolean = false): GrowableXYZArray | undefined {\n if (range.isNull)\n return undefined;\n const corners = range.corners();\n const frameOnPlane = this.getFrame();\n frameOnPlane.multiplyInversePoint3dArrayInPlace(corners);\n const localRange = Range3d.createArray(corners);\n if (localRange.low.z * localRange.high.z > 0.0)\n return undefined;\n // oversized polygon on local z= 0\n const xyzOut = new GrowableXYZArray();\n xyzOut.pushXYZ(localRange.low.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.high.y, 0);\n xyzOut.pushXYZ(localRange.low.x, localRange.high.y, 0);\n xyzOut.multiplyTransformInPlace(frameOnPlane);\n IndexedXYZCollectionPolygonOps.intersectRangeConvexPolygonInPlace(range, xyzOut);\n if (xyzOut.length === 0)\n return undefined;\n if (addClosurePoint)\n xyzOut.pushWrap(1);\n return xyzOut;\n }\n /**\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\n * @param xyz convex polygon. This is not changed.\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n * @see clipConvexPolygonInPlace\n */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ): void {\n const perpendicularRange = Range1d.createNull();\n const newInside = arrayCache.grabFromCache();\n const newOutside = arrayCache.grabFromCache();\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\n this, xyz, newInside, newOutside, perpendicularRange,\n );\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\n }\n /** Project a point in space to the plane. */\n public projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d {\n return this.projectXYZToPlane(spacePoint.x, spacePoint.y, spacePoint.z, result);\n }\n /** Return the projection of (x,y,z) onto the plane. */\n public override projectXYZToPlane(x: number, y: number, z: number, result?: Point3d): Point3d {\n const scale = -this.altitudeXYZ(x, y, z);\n return Point3d.create(x + scale * this._inwardNormal.x, y + scale * this._inwardNormal.y, z + scale * this._inwardNormal.z, result);\n }\n}\n"]}
1
+ {"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,0CAAkD;AAElD,6EAA0E;AAC1E,qEAAkE;AAElE,qDAAkD;AAClD,mDAAgD;AAChD,6FAA0F;AAC1F,mEAAkE;AAClE,yDAA0E;AAC1E,+CAAuD;AAEvD,uDAAoD;AAGpD,mDAAgD;AAChD,yDAAwD;AACxD,2CAAqE;AAkBrE;;;;;;;;;;;;;;GAcG;AACH,MAAa,SAAU,SAAQ,iBAAO;IAC5B,aAAa,CAAW;IAChC;;;;OAIG;IACK,mBAAmB,CAAS;IAC5B,UAAU,CAAU;IACpB,SAAS,CAAU;IAE3B,YAAoB,MAAgB,EAAE,QAAgB,EAAE,SAAkB,EAAE,QAAiB;Q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CAAC;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC9C,2CAA8B,CAAC,oCAAoC,CACjE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,CACrD,CAAC;QACF,yBAAa,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QACvE,yBAAa,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IACD,6CAA6C;IACtC,mBAAmB,CAAC,UAAmB,EAAE,MAAgB;QAC9D,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClF,CAAC;IACD,uDAAuD;IACvC,iBAAiB,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,MAAgB;QACjF,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,OAAO,yBAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACtI,CAAC;;AA/kBH,8BAglBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3d } from \"../geometry3d/Plane3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { IndexedXYZCollectionPolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XYAndZ, XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { AnalyticRoots } from \"../numerics/Polynomials\";\r\nimport { Clipper, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\r\n\r\n/**\r\n * Wire format describing a [[ClipPlane]].\r\n * If either [[normal]] or [[dist]] are omitted, defaults to a normal of [[Vector3d.unitZ]] and a distance of zero.\r\n * @public\r\n */\r\nexport interface ClipPlaneProps {\r\n /** The plane's inward normal. */\r\n normal?: XYZProps;\r\n /** The plane's signed distance from the origin. */\r\n dist?: number;\r\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\r\n invisible?: boolean;\r\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\r\n interior?: boolean;\r\n}\r\n\r\n/**\r\n * A ClipPlane is a single plane represented as\r\n * * An inward unit normal (u,v,w)\r\n * * A signedDistance\r\n * More details can be found at docs/learning/geometry/Clipping.md\r\n *\r\n * Hence\r\n * * The halfspace function evaluation for \"point\" (x,y,z) is `(x,y,z) DOT (u,v,w) - signedDistance`.\r\n * * POSITIVE values of the halfspace function are \"inside\".\r\n * * ZERO value of the halfspace function is \"on\".\r\n * * NEGATIVE value of the halfspace function is \"outside\".\r\n * * A representative point on the plane is (signedDistance * u, signedDistance * v, signedDistance * w).\r\n * * Given a point on the plane and the inward normal of the plane, `signedDistance = point DOT normal`.\r\n * @public\r\n */\r\nexport class ClipPlane extends Plane3d implements Clipper, PolygonClipper {\r\n private _inwardNormal: Vector3d;\r\n /**\r\n * Construct a parallel plane through the origin.\r\n * * Move it to the actual position.\r\n * * _distanceFromOrigin is the distance it moved, with the (inward) normal direction as positive\r\n */\r\n private _distanceFromOrigin: number;\r\n private _invisible: boolean;\r\n private _interior: boolean;\r\n\r\n private constructor(normal: Vector3d, distance: number, invisible: boolean, interior: boolean) {\r\n super();\r\n this._invisible = invisible;\r\n this._interior = interior;\r\n this._inwardNormal = normal;\r\n this._distanceFromOrigin = distance;\r\n }\r\n /*\r\n private safeSetXYZDistance(nx: number, ny: number, nz: number, d: number) {\r\n this._inwardNormal.set(nx, ny, nz);\r\n this._distanceFromOrigin = d;\r\n }\r\n */\r\n /**\r\n * Return true if all members are almostEqual to corresponding members of other.\r\n * @param other clip plane to compare\r\n */\r\n public isAlmostEqual(other: ClipPlane): boolean {\r\n return Geometry.isSameCoordinate(this._distanceFromOrigin, other._distanceFromOrigin)\r\n && this._inwardNormal.isAlmostEqual(other._inwardNormal)\r\n && this._interior === other._interior\r\n && this._invisible === other._invisible;\r\n }\r\n /** Return a cloned plane */\r\n public clone(): ClipPlane {\r\n const result = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\r\n return result;\r\n }\r\n /** Return a cloned plane with coordinate data negated. */\r\n public cloneNegated(): ClipPlane {\r\n const plane = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\r\n plane.negateInPlace();\r\n return plane;\r\n }\r\n /** Create a ClipPlane from Plane3dByOriginAndUnitNormal. */\r\n public static createPlane(\r\n plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\r\n ): ClipPlane {\r\n const distance = plane.getNormalRef().dotProduct(plane.getOriginRef());\r\n if (result) {\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n result._inwardNormal = plane.getNormalRef().clone();\r\n result._distanceFromOrigin = distance;\r\n return result;\r\n }\r\n return new ClipPlane(plane.getNormalRef().clone(), distance, invisible, interior);\r\n }\r\n /**\r\n * Create a ClipPlane with direct normal and signedDistance.\r\n * * The vector is normalized for storage.\r\n */\r\n public static createNormalAndDistance(\r\n normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const normalized = normal.normalize();\r\n if (normalized) {\r\n if (result) {\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n result._inwardNormal = normalized;\r\n result._distanceFromOrigin = distance;\r\n }\r\n return new ClipPlane(normalized, distance, invisible, interior);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a ClipPlane\r\n * * \"normal\" is the inward normal of the plane (it is internally normalized).\r\n * * \"point\" is any point of the plane.\r\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz as\r\n * a vector from the origin.)\r\n */\r\n public static createNormalAndPoint(\r\n normal: Vector3d, point: XYAndZ, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const normalized = normal.normalize();\r\n if (normalized) {\r\n const distance = normalized.dotProduct(point);\r\n if (result) {\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n result._inwardNormal = normalized;\r\n result._distanceFromOrigin = distance;\r\n }\r\n return new ClipPlane(normalized, distance, invisible, interior);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a clip plane\r\n * @param origin any point on the plane.\r\n * @param vectorA any vector in the plane\r\n * @param vectorB any vector in the plane\r\n * @return undefined if the vectors are not independent.\r\n * * The stored inward normal is vectorB.crossProduct(vectorA).\r\n * * That is, the vectors are considered as a right-handed pair when viewed from the outside.\r\n */\r\n public static createOriginAndVectors(\r\n origin: Point3d,\r\n vectorA: Vector3d,\r\n vectorB: Vector3d,\r\n invisible: boolean = false,\r\n interior: boolean = false,\r\n result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const normalized = vectorB.crossProduct(vectorA);\r\n return this.createNormalAndPoint(normalized, origin, invisible, interior, result);\r\n }\r\n /**\r\n * Create a ClipPlane\r\n * * \"normal\" (normalX, normalY, normalZ) is the inward normal of the plane.\r\n * * \"point\" (originX,originY,originZ) is any point of the plane.\r\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz\r\n * as a vector from the origin.)\r\n */\r\n public static createNormalAndPointXYZXYZ(\r\n normalX: number, normalY: number, normalZ: number,\r\n originX: number, originY: number, originZ: number,\r\n invisible: boolean = false, interior: boolean = false,\r\n result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const q = Geometry.hypotenuseXYZ(normalX, normalY, normalZ);\r\n const r = Geometry.conditionalDivideFraction(1, q);\r\n if (r !== undefined) {\r\n if (result) {\r\n result._inwardNormal.set(normalX * r, normalY * r, normalZ * r);\r\n result._distanceFromOrigin = result._inwardNormal.dotProductXYZ(originX, originY, originZ);\r\n result._invisible = invisible;\r\n result._interior = interior;\r\n return result;\r\n }\r\n const normal = Vector3d.create(normalX * r, normalY * r, normalZ * r);\r\n return new ClipPlane(normal, normal.dotProductXYZ(originX, originY, originZ), invisible, interior);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a json object of the form\r\n * `{\"normal\":[u,v,w],\"dist\":signedDistanceValue,\"interior\":true,\"invisible\":true}`\r\n */\r\n public toJSON(): ClipPlaneProps {\r\n const props: ClipPlaneProps = {\r\n normal: this.inwardNormalRef.toJSON(),\r\n dist: this.distance,\r\n };\r\n if (this.interior)\r\n props.interior = true;\r\n if (this.invisible)\r\n props.invisible = true;\r\n return props;\r\n }\r\n /** Parse json object to ClipPlane instance */\r\n public static fromJSON(json: ClipPlaneProps, result?: ClipPlane): ClipPlane | undefined {\r\n if (json && json.normal && undefined !== json.dist && Number.isFinite(json.dist))\r\n return ClipPlane.createNormalAndDistance(\r\n Vector3d.fromJSON(json.normal), json.dist, !!json.invisible, !!json.interior,\r\n );\r\n return ClipPlane.createNormalAndDistance(Vector3d.unitZ(), 0, false, false, result);\r\n }\r\n /** Set both the invisible and interior flags. */\r\n public setFlags(invisible: boolean, interior: boolean) {\r\n this._invisible = invisible;\r\n this._interior = interior;\r\n }\r\n /** Return the stored distanceFromOrigin property. */\r\n public get distance() {\r\n return this._distanceFromOrigin;\r\n }\r\n /** * Return the stored inward normal property. */\r\n public get inwardNormalRef(): Vector3d {\r\n return this._inwardNormal;\r\n }\r\n /** Return the \"interior\" property flag. Interpretation of this flag is algorithm-specific. */\r\n public get interior() {\r\n return this._interior;\r\n }\r\n /** Return the \"invisible\" property flag. Interpretation of this flag is algorithm-specific. */\r\n public get invisible() {\r\n return this._invisible;\r\n }\r\n /**\r\n * Create a plane defined by two points, an up vector, and a tilt angle relative to the up vector.\r\n * @param point0 start point of the edge\r\n * @param point1 end point of the edge\r\n * @param upVector vector perpendicular to the plane\r\n * @param tiltAngle angle to tilt the plane around the edge in the direction of the up vector.\r\n * @param result optional preallocated plane\r\n */\r\n public static createEdgeAndUpVector(\r\n point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane,\r\n ): ClipPlane | undefined {\r\n const edgeVector = Vector3d.createFrom(point1.minus(point0));\r\n let normal = (upVector.crossProduct(edgeVector)).normalize();\r\n\r\n if (normal) {\r\n if (tiltAngle !== undefined && !tiltAngle.isAlmostZero) {\r\n const tiltNormal = Vector3d.createRotateVectorAroundVector(normal, edgeVector, tiltAngle);\r\n if (tiltNormal) {\r\n normal = tiltNormal.clone();\r\n }\r\n }\r\n normal.negate(normal);\r\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\r\n }\r\n return undefined;\r\n }\r\n /** Create a plane perpendicular to the edge between the xy parts of point0 and point1. */\r\n public static createEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined {\r\n const normal = Vector3d.create(point0.y - point1.y, point1.x - point0.x);\r\n if (normal.normalizeInPlace())\r\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\r\n return undefined;\r\n }\r\n /**\r\n * Variant of [[createEdgeXY]] that computes the plane using the edge midpoint instead of its start point.\r\n * * This is more stable for creating a pair of clip planes from a long edge and its reversal, as is commonly found\r\n * in a [[UnionOfConvexClipPlaneSets]].\r\n */\r\n public static createMidPointEdgeXY(point0: XYAndZ, point1: XYAndZ, result?: ClipPlane): ClipPlane | undefined {\r\n return ClipPlane.createNormalAndPointXYZXYZ(\r\n point0.y - point1.y, point1.x - point0.x, 0,\r\n 0.5 * (point0.x + point1.x), 0.5 * (point0.y + point1.y), 0,\r\n false, false, result,\r\n );\r\n }\r\n /**\r\n * Return the Plane3d form of the plane.\r\n * * The plane origin is the point `distance * inwardNormal`\r\n * * The plane normal is the inward normal of the ClipPlane.\r\n */\r\n public getPlane3d(): Plane3dByOriginAndUnitNormal {\r\n const d = this._distanceFromOrigin;\r\n // normal should be normalized, will not return undefined\r\n return Plane3dByOriginAndUnitNormal.create(\r\n Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d),\r\n this._inwardNormal,\r\n )!;\r\n }\r\n /**\r\n * Return the Point4d d form of the plane.\r\n * * The homogeneous xyz are the inward normal xyz.\r\n * * The homogeneous weight is the negated ClipPlane distance.\r\n */\r\n public getPlane4d(): Point4d {\r\n return Point4d.create(\r\n this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin,\r\n );\r\n }\r\n /**\r\n * Set the plane from DPoint4d style plane.\r\n * * The saved plane has its direction normalized.\r\n * * This preserves the plane itself as a zero set but make plane evaluations act as true distances (even if the\r\n * plane coefficients are scaled otherwise).\r\n * @param plane the DPoint4d style plane.\r\n */\r\n public setPlane4d(plane: Point4d) {\r\n const a = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);\r\n const r = a === 0.0 ? 1.0 : 1.0 / a;\r\n this._inwardNormal.x = r * plane.x;\r\n this._inwardNormal.y = r * plane.y;\r\n this._inwardNormal.z = r * plane.z;\r\n this._distanceFromOrigin = -r * plane.w;\r\n }\r\n /**\r\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w\r\n * scale applied to distance.\r\n * @param point space point to test.\r\n */\r\n public weightedAltitude(point: Point4d): number {\r\n return point.x * this._inwardNormal.x\r\n + point.y * this._inwardNormal.y\r\n + point.z * this._inwardNormal.z\r\n - point.w * this._distanceFromOrigin;\r\n }\r\n /**\r\n * Evaluate the distance from the plane to a point in space, i.e. (dot product with inward normal) minus distance.\r\n * @param point space point to test.\r\n */\r\n public altitude(point: Point3d): number {\r\n return point.x * this._inwardNormal.x\r\n + point.y * this._inwardNormal.y\r\n + point.z * this._inwardNormal.z\r\n - this._distanceFromOrigin;\r\n }\r\n /**\r\n * Evaluate the distance from the plane to a point in space with point given as x,y,z, i.e. (dot product with\r\n * inward normal) minus distance.\r\n * @param point space point to test.\r\n */\r\n public altitudeXYZ(x: number, y: number, z: number): number {\r\n return x * this._inwardNormal.x\r\n + y * this._inwardNormal.y\r\n + z * this._inwardNormal.z\r\n - this._distanceFromOrigin;\r\n }\r\n /** Return the x component of the normal used to evaluate altitude. */\r\n public normalX(): number {\r\n return this._inwardNormal.x;\r\n }\r\n /** Return the x component of the normal used to evaluate altitude. */\r\n public normalY(): number {\r\n return this._inwardNormal.y;\r\n }\r\n /** Return the z component of the normal used to evaluate altitude. */\r\n public normalZ(): number {\r\n return this._inwardNormal.z;\r\n }\r\n /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin). */\r\n public velocity(vector: Vector3d): number {\r\n return vector.x * this._inwardNormal.x + vector.y * this._inwardNormal.y + vector.z * this._inwardNormal.z;\r\n }\r\n /**\r\n * Return the dot product of the plane normal with the x,yz, vector components (NOT using the plane's\r\n * distanceFromOrigin).\r\n */\r\n public velocityXYZ(x: number, y: number, z: number): number {\r\n return x * this._inwardNormal.x + y * this._inwardNormal.y + z * this._inwardNormal.z;\r\n }\r\n /**\r\n * Return the dot product of the plane normal with the point (treating the point xyz as a vector, and NOT\r\n * using the plane's distanceFromOrigin).\r\n */\r\n public dotProductPlaneNormalPoint(point: Point3d): number {\r\n return point.x * this._inwardNormal.x + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z;\r\n }\r\n /**\r\n * Return true if spacePoint is inside or on the plane, with tolerance applied to \"on\".\r\n * @param spacePoint point to test.\r\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\r\n */\r\n public isPointOnOrInside(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n let value = this.altitude(spacePoint);\r\n if (tolerance) { value += tolerance; }\r\n return value >= 0.0;\r\n }\r\n /**\r\n * Return true if spacePoint is strictly inside the halfspace, with tolerance applied to \"on\".\r\n * @param spacePoint point to test.\r\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\r\n */\r\n public isPointInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n let value = this.altitude(point);\r\n if (tolerance) { value -= tolerance; }\r\n return value > 0.0;\r\n }\r\n /**\r\n * Return true if spacePoint is strictly on the plane, within tolerance\r\n * @param spacePoint point to test.\r\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\r\n */\r\n public isPointOn(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n return Math.abs(this.altitude(point)) <= tolerance;\r\n }\r\n /**\r\n * Compute intersections of an (UNBOUNDED) arc with the plane. Append them (as radians) to a growing array.\r\n * @param arc arc to test. The angle limits of the arc are NOT considered.\r\n * @param intersectionRadians array to receive results\r\n */\r\n public appendIntersectionRadians(arc: Arc3d, intersectionRadians: GrowableFloat64Array) {\r\n const arcVectors = arc.toVectors();\r\n const alpha = this.altitude(arc.center);\r\n const beta = this.velocity(arcVectors.vector0);\r\n const gamma = this.velocity(arcVectors.vector90);\r\n AnalyticRoots.appendImplicitLineUnitCircleIntersections(\r\n alpha, beta, gamma, undefined, undefined, intersectionRadians,\r\n );\r\n }\r\n private static _clipArcFractionArray = new GrowableFloat64Array();\r\n /**\r\n * Announce fractional intervals of arc clip.\r\n * * Each call to `announce(fraction0, fraction1, arc)` announces one interval that is inside the clip plane.\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n const breaks = ClipPlane._clipArcFractionArray;\r\n breaks.clear();\r\n this.appendIntersectionRadians(arc, breaks);\r\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\r\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\r\n }\r\n /**\r\n * Compute intersection of (unbounded) segment with the plane.\r\n * * If the ends are on the same side of the plane, return undefined.\r\n * * If the intersection is an endpoint or interior to the segment return the fraction.\r\n * * If both ends are on, return undefined.\r\n */\r\n public getBoundedSegmentSimpleIntersection(pointA: Point3d, pointB: Point3d): number | undefined {\r\n const h0 = this.altitude(pointA);\r\n const h1 = this.altitude(pointB);\r\n if (h0 * h1 > 0.0)\r\n return undefined;\r\n if (h0 === 0.0 && h1 === 0.0) {\r\n return undefined;\r\n }\r\n return - h0 / (h1 - h0);\r\n }\r\n /** Apply transform to the origin. Apply inverse transpose of the matrix part to th normal vector. */\r\n public transformInPlace(transform: Transform): boolean {\r\n const plane: Plane3dByOriginAndUnitNormal = this.getPlane3d();\r\n const matrix: Matrix3d = transform.matrix;\r\n const newPoint = transform.multiplyPoint3d(plane.getOriginRef());\r\n // Normal transforms as the inverse transpose of the matrix part\r\n // BTW: If the matrix is orthogonal, this is a long way to multiply by the matrix part (mumble grumble)\r\n const newNormal = matrix.multiplyInverseTranspose(plane.getNormalRef());\r\n if (!newNormal)\r\n return false;\r\n\r\n plane.set(newPoint, newNormal);\r\n const normalized = (plane.getNormalRef()).normalize();\r\n if (!normalized)\r\n return false;\r\n this._inwardNormal = normalized;\r\n this._distanceFromOrigin = this._inwardNormal.dotProduct(plane.getOriginRef());\r\n return true;\r\n }\r\n /** Set the invisible flag. Interpretation of this flag is algorithm-specific. */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\r\n /** Reverse the sign of all coefficients, so outside and inside reverse */\r\n public negateInPlace() {\r\n this._inwardNormal = this._inwardNormal.negate();\r\n this._distanceFromOrigin = - this._distanceFromOrigin;\r\n }\r\n /**\r\n * Move the plane INWARD by given distance\r\n * @param offset distance of shift inwards\r\n */\r\n public offsetDistance(offset: number) {\r\n this._distanceFromOrigin += offset;\r\n }\r\n /**\r\n * Clip a polygon to the inside or outside of the plane.\r\n * * Results with 2 or fewer points are ignored.\r\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\r\n * * For a convex input polygon, the output polygon is also convex.\r\n * * For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a\r\n * valid clip in a parity sense (overlapping regions cancel).\r\n * @param xyz input points.\r\n * @param work optional work buffer\r\n * @param inside whether the positive side of the plane survives (true, default), or negative side (false).\r\n * @param tolerance distance tolerance for \"on plane\" decision. Default value is [[Geometry.smallMetricDistance]].\r\n * @return the number of crossings. If this is larger than 2, the input polygon was non-convex.\r\n * @see appendPolygonClip\r\n */\r\n public clipConvexPolygonInPlace(\r\n xyz: GrowableXYZArray,\r\n work?: GrowableXYZArray,\r\n inside: boolean = true,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): number {\r\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\r\n }\r\n /**\r\n * Multiply the ClipPlane's DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\r\n * @param matrix matrix to apply\r\n * @return false if unable to invert\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\r\n * effect on the plane is the inverse transpose of matrixA\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n */\r\n public multiplyPlaneByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n const plane: Point4d = this.getPlane4d();\r\n if (invert) {\r\n const inverse = matrix.createInverse();\r\n if (inverse)\r\n return this.multiplyPlaneByMatrix4d(inverse, false, transpose);\r\n return false;\r\n }\r\n if (transpose)\r\n matrix.multiplyTransposePoint4d(plane, plane);\r\n else\r\n matrix.multiplyPoint4d(plane, plane);\r\n this.setPlane4d(plane);\r\n return true;\r\n }\r\n /** Announce the interval (if any) where a line is within the clip plane half space. */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void,\r\n ): boolean {\r\n if (f1 < f0)\r\n return false;\r\n const h0 = - this.altitude(pointA);\r\n const h1 = - this.altitude(pointB);\r\n const delta = h1 - h0;\r\n const f = Geometry.conditionalDivideFraction(-h0, delta);\r\n if (f === undefined) { // The segment is parallel to the plane.\r\n if (h0 <= 0.0) { if (announce) announce(f0, f1); return true; }\r\n return false;\r\n }\r\n if (delta > 0) { // segment aims OUT\r\n if (f < f1) f1 = f;\r\n } else {\r\n // segment aims IN\r\n if (f > f0)\r\n f0 = f;\r\n }\r\n if (f1 < f0)\r\n return false;\r\n if (announce) announce(f0, f1);\r\n return true;\r\n }\r\n /**\r\n * Return a coordinate frame with\r\n * * origin at closest point to global origin\r\n * * z axis points in\r\n * * x and y are \"in plane\"\r\n */\r\n public getFrame(): Transform {\r\n const d = this._distanceFromOrigin;\r\n const origin = Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d);\r\n const matrix = Matrix3d.createRigidHeadsUp(this._inwardNormal, AxisOrder.ZXY);\r\n return Transform.createOriginAndMatrix(origin, matrix);\r\n }\r\n /**\r\n * Return the intersection of the plane with a range cube.\r\n * @param range\r\n * @param xyzOut intersection polygon. This is convex.\r\n */\r\n public intersectRange(range: Range3d, addClosurePoint: boolean = false): GrowableXYZArray | undefined {\r\n if (range.isNull)\r\n return undefined;\r\n const corners = range.corners();\r\n const frameOnPlane = this.getFrame();\r\n frameOnPlane.multiplyInversePoint3dArrayInPlace(corners);\r\n const localRange = Range3d.createArray(corners);\r\n if (localRange.low.z * localRange.high.z > 0.0)\r\n return undefined;\r\n // oversized polygon on local z= 0\r\n const xyzOut = new GrowableXYZArray();\r\n xyzOut.pushXYZ(localRange.low.x, localRange.low.y, 0);\r\n xyzOut.pushXYZ(localRange.high.x, localRange.low.y, 0);\r\n xyzOut.pushXYZ(localRange.high.x, localRange.high.y, 0);\r\n xyzOut.pushXYZ(localRange.low.x, localRange.high.y, 0);\r\n xyzOut.multiplyTransformInPlace(frameOnPlane);\r\n IndexedXYZCollectionPolygonOps.intersectRangeConvexPolygonInPlace(range, xyzOut);\r\n if (xyzOut.length === 0)\r\n return undefined;\r\n if (addClosurePoint)\r\n xyzOut.pushWrap(1);\r\n return xyzOut;\r\n }\r\n /**\r\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\r\n * @param xyz convex polygon. This is not changed.\r\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed\r\n * from the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\r\n * from the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n * @see clipConvexPolygonInPlace\r\n */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ): void {\r\n const perpendicularRange = Range1d.createNull();\r\n const newInside = arrayCache.grabFromCache();\r\n const newOutside = arrayCache.grabFromCache();\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\r\n this, xyz, newInside, newOutside, perpendicularRange,\r\n );\r\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\r\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\r\n }\r\n /** Project a point in space to the plane. */\r\n public projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d {\r\n return this.projectXYZToPlane(spacePoint.x, spacePoint.y, spacePoint.z, result);\r\n }\r\n /** Return the projection of (x,y,z) onto the plane. */\r\n public override projectXYZToPlane(x: number, y: number, z: number, result?: Point3d): Point3d {\r\n const scale = -this.altitudeXYZ(x, y, z);\r\n return Point3d.create(x + scale * this._inwardNormal.x, y + scale * this._inwardNormal.y, z + scale * this._inwardNormal.z, result);\r\n }\r\n}\r\n"]}
@@ -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,6DAAyD;AACzD,2CAAwC;AACxC,2CAA4D;AAC5D,6DAA0D;AAC1D,6EAA2G;AAC3G,2EAAoE;AACpE,6DAA0D;AAC1D,2DAAwD;AAGxD,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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BAAkB,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { TransformProps, XYZProps } from \"../geometry3d/XYZProps\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\nimport { Triangulator } from \"../topology/Triangulation\";\nimport { ClipPlane } from \"./ClipPlane\";\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\nimport { UnionOfConvexClipPlaneSets, UnionOfConvexClipPlaneSetsProps } from \"./UnionOfConvexClipPlaneSets\";\nimport { AlternatingCCTreeNode } from \"./AlternatingConvexClipTree\";\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\nimport { PolylineOps } from \"../geometry3d/PolylineOps\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\n// cspell:word zlow\n// cspell:word zhigh\n/**\n * Bit mask type for referencing subsets of 6 planes of range box.\n * @public\n */\nexport enum ClipMaskXYZRangePlanes {\n /** no planes */\n None = 0x00,\n /** low x plane */\n XLow = 0x01,\n /** high x plane */\n XHigh = 0x02,\n /** low y plane */\n YLow = 0x04,\n /** high y plane */\n YHigh = 0x08,\n /** low z plane */\n ZLow = 0x10,\n /** high z plane */\n ZHigh = 0x20,\n /** all x and y planes, neither z plane */\n XAndY = 0x0f,\n /** all 6 planes */\n All = 0x3f,\n}\n\n/**\n * Wire format describing a [[ClipPrimitive]] defined by a set of clip planes.\n * @public\n */\nexport interface ClipPrimitivePlanesProps {\n planes?: {\n /** The set of clip planes. */\n clips?: UnionOfConvexClipPlaneSetsProps;\n /** `true` if the primitive is invisible. */\n invisible?: boolean;\n };\n}\n\n/**\n * Wire format describing a [[ClipShape]].\n * @public\n */\nexport interface ClipPrimitiveShapeProps {\n /** The clip polygon. */\n shape?: {\n /** Points of the polygon, in the xy plane of the local coordinate system. */\n points?: XYZProps[];\n /** Transform from local to world. */\n trans?: TransformProps;\n /** Lower bound on z (in local coordinates). */\n zlow?: number;\n /** Upper bound on z (in local coordinates). */\n zhigh?: number;\n /** `true` if this shape is considered a hole (keep geometry outside of the polygon). */\n mask?: boolean;\n /** `true` if this shape is invisible. */\n invisible?: boolean;\n };\n}\n\n/** Wire format describing a [[ClipPrimitive]].\n * @public\n */\nexport type ClipPrimitiveProps = ClipPrimitivePlanesProps | ClipPrimitiveShapeProps;\n\n/**\n * * ClipPrimitive is a base class for clipping implementations that use\n * * A UnionOfConvexClipPlaneSets designated \"clipPlanes\".\n * * An \"invisible\" flag.\n * * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.\n * * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.\n * * ClipPrimitive can be constructed with no planes.\n * * Derived class is responsible for filling the plane sets.\n * * At discretion of derived classes, plane construction can be done at construction time or \"on demand when\" queries\n * call `ensurePlaneSets ()`\n * * ClipPrimitive can be constructed directly with planes (and no derived class).\n * * The prevailing use is via a ClipShape derived class.\n * * The ClipShape has an \"isMask\" property\n * * isMask === false means the plane sets should cover the inside of its polygon.\n * * isMask === true means the plane sets should cover the outside of its polygon.\n * * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.\n * * In normal usage, callers get \"outside\" clip behavior using ONLY the ClipShape isMask property.\n * * The ClipShape happens to pass the _invisible bit down to ClipPlanes that it creates.\n * * At that level, the flag controls whether the cut edges are produced on the plane\n * @public\n */\nexport class ClipPrimitive implements Clipper {\n /** The (union of) convex regions. */\n protected _clipPlanes?: UnionOfConvexClipPlaneSets;\n /** If true, pointInside inverts the sense of the pointInside for the _clipPlanes */\n protected _invisible: boolean;\n /**\n * Get a reference to the `UnionOfConvexClipPlaneSets`.\n * * It triggers construction of the sets by `this.ensurePlaneSets()`.\n * * Derived class typically caches the set on the first such call.\n */\n public fetchClipPlanesRef(): UnionOfConvexClipPlaneSets | undefined {\n this.ensurePlaneSets();\n return this._clipPlanes;\n }\n /** Ask if this primitive is a hole. */\n public get invisible(): boolean {\n return this._invisible;\n }\n protected constructor(planeSet?: UnionOfConvexClipPlaneSets | undefined, isInvisible: boolean = false) {\n this._clipPlanes = planeSet;\n this._invisible = isInvisible;\n }\n /**\n * Create a ClipPrimitive, capturing the supplied plane set as the clip planes.\n * @param planes clipper\n * @param isInvisible set the invisible flag on the ClipPrimitive\n */\n public static createCapture(\n planes: UnionOfConvexClipPlaneSets | ConvexClipPlaneSet | undefined, isInvisible: boolean = false,\n ): ClipPrimitive {\n let planeData;\n if (planes instanceof UnionOfConvexClipPlaneSets)\n planeData = planes;\n if (planes instanceof ConvexClipPlaneSet)\n planeData = UnionOfConvexClipPlaneSets.createConvexSets([planes]);\n\n return new ClipPrimitive(planeData, isInvisible);\n }\n /** Emit json form of the clip planes */\n public toJSON(): ClipPrimitiveProps {\n const planes: ClipPrimitivePlanesProps[\"planes\"] = {};\n if (this._clipPlanes)\n planes.clips = this._clipPlanes.toJSON();\n\n if (this._invisible)\n planes.invisible = true;\n\n return { planes };\n }\n /**\n * Returns true if the planes are present.\n * * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct\n * the planes.\n */\n public arePlanesDefined(): boolean {\n return this._clipPlanes !== undefined;\n }\n /** Return a deep clone. */\n public clone(): ClipPrimitive {\n const newPlanes = this._clipPlanes ? this._clipPlanes.clone() : undefined;\n const result = new ClipPrimitive(newPlanes, this._invisible);\n return result;\n }\n /**\n * Trigger (if needed) computation of plane sets (if applicable) in the derived class.\n * * Base class is no op.\n * * In derived class, on first call create planes sets from defining data (e.g. swept shape).\n * * In derived class, if planes are present leave them alone.\n */\n public ensurePlaneSets() { }\n /**\n * Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,\n * return false.\n * * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept\n * this implementation using planes that it inserted in the base class.\n */\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\n this.ensurePlaneSets();\n let inside = true;\n if (this._clipPlanes)\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\n return inside;\n }\n /**\n * Method from [[Clipper]] interface.\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\n */\n public isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\n this.ensurePlaneSets();\n let inside = true;\n if (this._clipPlanes)\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\n return inside;\n }\n /**\n * Method from [[Clipper]] interface.\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\n */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\n ): boolean {\n this.ensurePlaneSets();\n let hasInsideParts = false;\n if (this._clipPlanes)\n hasInsideParts = this._clipPlanes.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\n return hasInsideParts;\n }\n /**\n * Method from [[Clipper]] interface.\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n this.ensurePlaneSets();\n let hasInsideParts = false;\n if (this._clipPlanes)\n hasInsideParts = this._clipPlanes.announceClippedArcIntervals(arc, announce);\n return hasInsideParts;\n }\n /**\n * Multiply all ClipPlanes DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).\n * @param matrix matrix to apply.\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\n * effect on the plane is the inverse transpose of matrixA.\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n */\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n if (invert) { // form inverse once here, reuse for all planes\n const inverse = matrix.createInverse();\n if (!inverse)\n return false;\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\n }\n if (this._clipPlanes)\n this._clipPlanes.multiplyPlanesByMatrix4d(matrix);\n return true;\n }\n /** Apply a transform to the clipper (e.g. transform all planes). */\n public transformInPlace(transform: Transform): boolean {\n if (this._clipPlanes)\n this._clipPlanes.transformInPlace(transform);\n return true;\n }\n /** Sets both the clip plane set and the mask set visibility */\n public setInvisible(invisible: boolean) {\n this._invisible = invisible;\n }\n /**\n * Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and\n * (b) finite distance from origin.\n */\n public containsZClip(): boolean {\n if (this.fetchClipPlanesRef() !== undefined)\n for (const convexSet of this._clipPlanes!.convexSets)\n for (const plane of convexSet.planes)\n if (Math.abs(plane.inwardNormalRef.z) > 1.0e-6 && Math.abs(plane.distance) !== Number.MAX_VALUE)\n return true;\n return false;\n }\n /**\n * Quick test of whether the given points fall completely inside or outside.\n * @param points points to test.\n * @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the\n * invisible setting.\n */\n public classifyPointContainment(points: Point3d[], ignoreInvisibleSetting: boolean): ClipPlaneContainment {\n this.ensurePlaneSets();\n const planes = this._clipPlanes;\n let inside = ClipPlaneContainment.StronglyInside;\n if (planes)\n inside = planes.classifyPointContainment(points, false);\n if (this._invisible && !ignoreInvisibleSetting)\n switch (inside) {\n case ClipPlaneContainment.StronglyInside:\n return ClipPlaneContainment.StronglyOutside;\n case ClipPlaneContainment.StronglyOutside:\n return ClipPlaneContainment.StronglyInside;\n case ClipPlaneContainment.Ambiguous:\n return ClipPlaneContainment.Ambiguous;\n }\n return inside;\n }\n /**\n * Promote json object form to class instance.\n * * First try to convert to a ClipShape.\n * * then try as a standalone instance of the base class ClipPrimitive.\n */\n public static fromJSON(json: ClipPrimitiveProps | undefined): ClipPrimitive | undefined {\n if (!json)\n return undefined;\n const shape = ClipShape.fromClipShapeJSON(json as ClipPrimitiveShapeProps);\n if (shape)\n return shape;\n return ClipPrimitive.fromJSONClipPrimitive(json as ClipPrimitivePlanesProps);\n }\n /** Specific converter producing the base class ClipPrimitive. */\n public static fromJSONClipPrimitive(json: ClipPrimitivePlanesProps | undefined): ClipPrimitive | undefined {\n const planes = json?.planes;\n if (!planes)\n return undefined;\n\n const clipPlanes = planes.clips ? UnionOfConvexClipPlaneSets.fromJSON(planes.clips) : undefined;\n const invisible = undefined !== planes.invisible ? planes.invisible : false;\n return new ClipPrimitive(clipPlanes, invisible);\n }\n}\n\n/** Internal helper class holding XYZ components that serves as a representation of polygon edges defined by clip planes */\nclass PolyEdge {\n public pointA: Point3d;\n public pointB: Point3d;\n public normal: Vector3d;\n\n public constructor(origin: Point3d, next: Point3d, normal: Vector3d, z: number) {\n this.pointA = Point3d.create(origin.x, origin.y, z);\n this.pointB = Point3d.create(next.x, next.y, z);\n this.normal = normal;\n }\n // Assume both normals are unit length.\n // old logic: use difference of (previously computed) normals as perpendicular to bisector.\n public static makeUnitPerpendicularToBisector(edgeA: PolyEdge, edgeB: PolyEdge, reverse: boolean): Vector3d | undefined {\n let candidate = edgeB.normal.minus(edgeA.normal);\n if (candidate.normalize(candidate) === undefined) {\n candidate = Vector3d.createStartEnd(edgeA.pointA, edgeB.pointB);\n if (candidate.normalize(candidate) === undefined)\n return undefined;\n }\n if (reverse)\n candidate.scale(-1.0, candidate);\n return candidate;\n }\n}\n\n/**\n * A clipping volume defined by a shape (an array of 3d points using only x and y dimensions).\n * May be given either a ClipPlaneSet to store directly, or an array of polygon points as well as other parameters\n * for parsing ClipPlanes from the shape later.\n * @public\n */\nexport class ClipShape extends ClipPrimitive {\n /** Points of the polygon, in the xy plane of the local coordinate system. */\n protected _polygon: Point3d[];\n /** optional low z (in local coordinates). */\n protected _zLow?: number;\n /** optional high z (in local coordinates). */\n protected _zHigh?: number;\n /** true if this is considered a hole (keep geometry outside of the polygon). */\n protected _isMask: boolean;\n /** transform from local to world. */\n protected _transformFromClip?: Transform;\n /** Transform from world to local. */\n protected _transformToClip?: Transform;\n\n protected constructor(\n polygon: Point3d[] = [], zLow?: number, zHigh?: number, transform?: Transform, isMask: boolean = false, invisible: boolean = false,\n ) {\n super(undefined, invisible); // ClipPlaneSets will be set up later after storing points\n this._isMask = false;\n this._polygon = polygon;\n this.initSecondaryProps(isMask, zLow, zHigh, transform);\n }\n /** Returns true if this ClipShape is marked as invisible. */\n public override get invisible(): boolean {\n return this._invisible;\n }\n /** Return this transformFromClip, which may be undefined. */\n public get transformFromClip(): Transform | undefined {\n return this._transformFromClip;\n }\n /** Return this transformToClip, which may be undefined. */\n public get transformToClip(): Transform | undefined {\n return this._transformToClip;\n }\n /** Returns true if this ClipShape's transforms are currently set. */\n public get transformValid(): boolean {\n return this.transformFromClip !== undefined;\n }\n /** Returns true if this ClipShape's lower z boundary is set. */\n public get zLowValid(): boolean {\n return this._zLow !== undefined;\n }\n /** Returns true if this ClipShape's upper z boundary is set. */\n public get zHighValid(): boolean {\n return this._zHigh !== undefined;\n }\n /** Return true if this ClipShape has a local to world transform */\n public get transformIsValid(): boolean {\n return this._transformFromClip !== undefined;\n }\n /** Return this zLow, which may be undefined. */\n public get zLow(): number | undefined {\n return this._zLow;\n }\n /** Return this zHigh, which may be undefined. */\n public get zHigh(): number | undefined {\n return this._zHigh;\n }\n /** Returns a reference to this ClipShape's polygon array. */\n public get polygon(): Point3d[] {\n return this._polygon;\n }\n /** Returns true if this ClipShape is a masking set. */\n public get isMask(): boolean {\n return this._isMask;\n }\n /** Sets the polygon points array of this ClipShape to the array given (by reference). */\n public setPolygon(polygon: Point3d[]) {\n // Add closure point\n if (!polygon[0].isAlmostEqual(polygon[polygon.length - 1]))\n polygon.push(polygon[0].clone());\n this._polygon = polygon;\n }\n /**\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`\n * and transform.\n */\n public override ensurePlaneSets() {\n if (this._clipPlanes !== undefined)\n return;\n this._clipPlanes = UnionOfConvexClipPlaneSets.createEmpty();\n this.parseClipPlanes(this._clipPlanes);\n if (this._transformFromClip)\n this._clipPlanes.transformInPlace(this._transformFromClip);\n }\n /**\n * Initialize the members of the ClipShape class that may at times be undefined.\n * zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.\n */\n public initSecondaryProps(isMask: boolean, zLow?: number, zHigh?: number, transform?: Transform) {\n this._isMask = isMask;\n this._zLow = zLow;\n this._zHigh = zHigh;\n\n if (transform !== undefined) {\n this._transformFromClip = transform;\n this._transformToClip = transform.inverse(); // could be undefined\n } else {\n this._transformFromClip = Transform.createIdentity();\n this._transformToClip = Transform.createIdentity();\n }\n }\n /** Emit json object form */\n public override toJSON(): ClipPrimitiveShapeProps {\n const shape: ClipPrimitiveShapeProps[\"shape\"] = {\n points: this._polygon.map((pt) => pt.toJSON()),\n };\n if (this.invisible)\n shape.invisible = true;\n if (this._transformFromClip && !this._transformFromClip.isIdentity)\n shape.trans = this._transformFromClip.toJSON();\n if (this.isMask)\n shape.mask = true;\n if (typeof (this.zLow) !== \"undefined\" && this.zLow !== -Number.MAX_VALUE)\n shape.zlow = this.zLow;\n if (typeof (this.zHigh) !== \"undefined\" && this.zHigh !== Number.MAX_VALUE)\n shape.zhigh = this.zHigh;\n return { shape };\n }\n /** Parse `json` to a clip shape. */\n public static fromClipShapeJSON(json: ClipPrimitiveShapeProps | undefined, result?: ClipShape): ClipShape | undefined {\n const shape = json?.shape;\n if (!shape)\n return undefined;\n const points: Point3d[] = shape.points ? shape.points.map((pt) => Point3d.fromJSON(pt)) : [];\n const trans = shape.trans ? Transform.fromJSON(shape.trans) : undefined;\n const zLow = typeof shape.zlow === \"number\" ? shape.zlow : undefined;\n const zHigh = typeof shape.zhigh === \"number\" ? shape.zhigh : undefined;\n const isMask = typeof shape.mask === \"boolean\" && shape.mask;\n const invisible = typeof shape.invisible === \"boolean\" && shape.invisible;\n\n return ClipShape.createShape(points, zLow, zHigh, trans, isMask, invisible, result);\n }\n /** Returns a new ClipShape that is a deep copy of the ClipShape given */\n public static createFrom(other: ClipShape, result?: ClipShape): ClipShape {\n const retVal = ClipShape.createEmpty(false, false, undefined, result);\n retVal._invisible = other._invisible;\n for (const point of other._polygon) {\n retVal._polygon.push(point.clone());\n }\n retVal._isMask = other._isMask;\n retVal._zLow = other._zLow;\n retVal._zHigh = other._zHigh;\n retVal._transformToClip = other._transformToClip ? other._transformToClip.clone() : undefined;\n retVal._transformFromClip = other._transformFromClip ? other._transformFromClip.clone() : undefined;\n return retVal;\n }\n /** Create a new ClipShape from an array of points that make up a 2d shape (stores a deep copy of these points). */\n public static createShape(\n polygon: Point3d[] = [],\n zLow?: number,\n zHigh?: number,\n transform?: Transform,\n isMask: boolean = false,\n invisible: boolean = false,\n result?: ClipShape,\n ): ClipShape | undefined {\n if (polygon.length < 3)\n return undefined;\n const pPoints = polygon.slice(0);\n // Add closure point.\n if (pPoints[0].isAlmostEqual(pPoints[pPoints.length - 1]))\n pPoints[0].clone(pPoints[pPoints.length - 1]);\n else\n pPoints.push(pPoints[0].clone());\n if (result) {\n result._clipPlanes = undefined; // Start as undefined\n result._invisible = invisible;\n result._polygon = pPoints;\n result.initSecondaryProps(isMask, zLow, zHigh, transform);\n return result;\n } else {\n return new ClipShape(pPoints, zLow, zHigh, transform, isMask, invisible);\n }\n }\n /**\n * Create a ClipShape that exists as a 3 dimensional box of the range given. Optionally choose to\n * also store this shape's zLow and zHigh members from the range through the use of a RangePlaneBitMask.\n */\n public static createBlock(\n extremities: Range3d,\n clipMask: ClipMaskXYZRangePlanes,\n isMask: boolean = false,\n invisible: boolean = false,\n transform?: Transform,\n result?: ClipShape,\n ): ClipShape {\n const low = extremities.low;\n const high = extremities.high;\n const blockPoints: Point3d[] = [];\n for (let i = 0; i < 5; i++)\n blockPoints.push(Point3d.create());\n blockPoints[0].x = blockPoints[3].x = blockPoints[4].x = low.x;\n blockPoints[1].x = blockPoints[2].x = high.x;\n blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;\n blockPoints[2].y = blockPoints[3].y = high.y;\n return ClipShape.createShape(\n blockPoints,\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined,\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined,\n transform,\n isMask,\n invisible,\n result,\n )!;\n }\n /** Creates a new ClipShape with undefined members and a polygon points array of zero length. */\n public static createEmpty(\n isMask = false, invisible: boolean = false, transform?: Transform, result?: ClipShape,\n ): ClipShape {\n if (result) {\n result._clipPlanes = undefined;\n result._invisible = invisible;\n result._polygon.length = 0;\n result.initSecondaryProps(isMask, undefined, undefined, transform);\n return result;\n }\n return new ClipShape([], undefined, undefined, transform, isMask, invisible);\n }\n /** Checks to ensure that the member polygon has an area, and that the polygon is closed. */\n public get isValidPolygon(): boolean {\n if (this._polygon.length < 3)\n return false;\n if (!this._polygon[0].isExactEqual(this._polygon[this._polygon.length - 1]))\n return false;\n return true;\n }\n /** Returns a deep copy of this instance of ClipShape, storing in an optional result. */\n public override clone(result?: ClipShape): ClipShape {\n return ClipShape.createFrom(this, result);\n }\n /**\n * Given the current polygon data, parses clip planes that together form an object, storing the result in\n * the set given, either clip planes or mask planes.\n */\n private parseClipPlanes(set: UnionOfConvexClipPlaneSets) {\n const points = this._polygon;\n if (points.length === 3 && !this._isMask && points[0].isExactEqual(points[points.length - 1])) {\n this.parseLinearPlanes(set, this._polygon[0], this._polygon[1]);\n return true;\n }\n if (!this.isMask) {\n const direction = PolygonOps.testXYPolygonTurningDirections(this.polygon);\n if (direction !== 0) {\n this.parseConvexPolygonPlanes(set, this._polygon, direction, false);\n return true;\n }\n }\n // REMARK: Pass all polygons to non-convex case. It will funnel\n // to concave case as appropriate.\n this.parsePolygonPlanes(set, this._polygon, this.isMask);\n return true;\n }\n /**\n * Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets\n * defining the bounded region of linear planes. Returns true if successful.\n */\n private parseLinearPlanes(\n set: UnionOfConvexClipPlaneSets, start: Point3d, end: Point3d, cameraFocalLength?: number,\n ): boolean {\n // Handles the degenerate case of 2 distinct points (used by select by line).\n const normal = start.vectorTo(end);\n if (normal.magnitude() === 0.0)\n return false;\n normal.normalize(normal);\n const convexSet = ConvexClipPlaneSet.createEmpty();\n if (cameraFocalLength === undefined) {\n const perpendicular = Vector2d.create(-normal.y, normal.x);\n convexSet.planes.push(\n ClipPlane.createNormalAndPoint(Vector3d.create(normal.x, normal.y), Point3d.createFrom(start), this._invisible)!,\n );\n convexSet.planes.push(\n ClipPlane.createNormalAndPoint(Vector3d.create(-normal.x, -normal.y), Point3d.createFrom(end), this._invisible)!,\n );\n convexSet.planes.push(\n ClipPlane.createNormalAndPoint(Vector3d.create(perpendicular.x, perpendicular.y), Point3d.createFrom(start), this._invisible)!,\n );\n convexSet.planes.push(\n ClipPlane.createNormalAndPoint(Vector3d.create(-perpendicular.x, -perpendicular.y), Point3d.createFrom(start), this._invisible)!,\n );\n } else {\n const start3d = Point3d.create(start.x, start.y, -cameraFocalLength);\n const end3d = Point3d.create(end.x, end.y, -cameraFocalLength);\n const vecEnd3d = Vector3d.createFrom(end3d);\n const perpendicular = vecEnd3d.crossProduct(Vector3d.createFrom(start3d)).normalize();\n let endNormal = Vector3d.createFrom(start3d).crossProduct(perpendicular!).normalize();\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\n perpendicular!.negate();\n endNormal = vecEnd3d.crossProduct(perpendicular!).normalize();\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\n }\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\n set.addConvexSet(convexSet);\n return true;\n }\n /**\n * Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with\n * ConvexClipPlaneSets defining the bounded region. Returns true if successful.\n */\n private parseConvexPolygonPlanes(\n set: UnionOfConvexClipPlaneSets,\n polygon: Point3d[],\n direction: number,\n buildExteriorClipper: boolean,\n cameraFocalLength?: number,\n ): boolean {\n const samePointTolerance = 1.0e-8; // This could possibly be replaced with more widely used constants\n const edges: PolyEdge[] = [];\n // const reverse = (direction < 0) !== this._isMask;\n const reverse = direction < 0;\n for (let i = 0; i < polygon.length - 1; i++) {\n const z = (cameraFocalLength === undefined) ? 0.0 : -cameraFocalLength;\n const dir = Vector3d.createStartEnd(polygon[i], polygon[i + 1]);\n const magnitude = dir.magnitude();\n dir.normalize(dir);\n if (magnitude > samePointTolerance) {\n const normal = Vector3d.create(reverse ? dir.y : -dir.y, reverse ? -dir.x : dir.x);\n edges.push(new PolyEdge(polygon[i], polygon[i + 1], normal, z));\n }\n }\n if (edges.length < 3) {\n return false;\n }\n if (buildExteriorClipper) {\n const last = edges.length - 1;\n for (let i = 0; i <= last; i++) {\n const edge = edges[i];\n const prevEdge = edges[i ? (i - 1) : last];\n const nextEdge = edges[(i === last) ? 0 : (i + 1)];\n const convexSet = ConvexClipPlaneSet.createEmpty();\n const previousPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(prevEdge, edge, !reverse);\n const nextPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(edge, nextEdge, reverse);\n // Create three-sided fans from each edge. Note we could define the correct region\n // with only two planes for edge, but cannot then designate the \"interior\" status of the edges accurately.\n\n if (previousPerpendicular)\n convexSet.planes.push(ClipPlane.createNormalAndPoint(previousPerpendicular, edge.pointA, this._invisible, true)!);\n convexSet.planes.push(ClipPlane.createNormalAndPoint(edge.normal, edge.pointB, this._invisible, false)!);\n if (nextPerpendicular)\n convexSet.planes.push(ClipPlane.createNormalAndPoint(nextPerpendicular, nextEdge.pointA, this._invisible, true)!);\n set.addConvexSet(convexSet);\n set.addOutsideZClipSets(this._invisible, this._zLow, this._zHigh);\n }\n } else {\n const convexSet = ConvexClipPlaneSet.createEmpty();\n if (cameraFocalLength === undefined) {\n for (const edge of edges)\n convexSet.planes.push(ClipPlane.createNormalAndPoint(Vector3d.create(edge.normal.x, edge.normal.y), edge.pointA)!);\n } else {\n if (reverse)\n for (const edge of edges)\n convexSet.planes.push(\n ClipPlane.createNormalAndDistance(\n Vector3d.createFrom(edge.pointA).crossProduct(Vector3d.createFrom(edge.pointB)).normalize()!, 0.0,\n )!,\n );\n else\n for (const edge of edges)\n convexSet.planes.push(\n ClipPlane.createNormalAndDistance(\n Vector3d.createFrom(edge.pointB).crossProduct(Vector3d.createFrom(edge.pointA)).normalize()!, 0.0,\n )!,\n );\n }\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\n set.addConvexSet(convexSet);\n }\n return true;\n }\n /**\n * Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets\n * with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.\n */\n private parsePolygonPlanes(set: UnionOfConvexClipPlaneSets, polygon: Point3d[], isMask: boolean, cameraFocalLength?: number,\n ): boolean {\n const cleanPolygon = PolylineOps.compressDanglers(polygon, true);\n const announceFace = (_graph: HalfEdgeGraph, edge: HalfEdge): boolean => {\n if (!edge.isMaskSet(HalfEdgeMask.EXTERIOR)) {\n const convexFacetPoints = edge.collectAroundFace((node: HalfEdge): any => {\n if (!node.isMaskSet(HalfEdgeMask.EXTERIOR))\n return Point3d.create(node.x, node.y, 0);\n });\n // parseConvexPolygonPlanes expects a closed loop (pushing the reference doesn't matter)\n convexFacetPoints.push(convexFacetPoints[0].clone());\n const direction = PolygonOps.testXYPolygonTurningDirections(convexFacetPoints); // ###TODO: Can we expect a direction coming out of graph facet?\n this.parseConvexPolygonPlanes(set, convexFacetPoints, direction, false, cameraFocalLength);\n }\n return true;\n };\n if (isMask) {\n const polygonA = Point3dArray.clonePoint3dArray(cleanPolygon);\n const hullAndInlets = AlternatingCCTreeNode.createHullAndInletsForPolygon(polygonA);\n const allLoops = hullAndInlets.extractLoops();\n if (allLoops.length === 0)\n return false;\n const hull = allLoops[0];\n const direction1 = PolygonOps.testXYPolygonTurningDirections(hull); // ###TODO: Can we expect a direction coming out of graph facet?\n this.parseConvexPolygonPlanes(set, hull, -direction1, true, cameraFocalLength);\n for (let i = 1; i < allLoops.length; i++) {\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(allLoops[i]);\n if (triangulatedPolygon) {\n Triangulator.flipTriangles(triangulatedPolygon);\n triangulatedPolygon.announceFaceLoops(announceFace);\n }\n }\n return true;\n } else {\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(cleanPolygon);\n if (triangulatedPolygon === undefined)\n return false;\n Triangulator.flipTriangles(triangulatedPolygon);\n triangulatedPolygon.announceFaceLoops(announceFace);\n }\n return true;\n }\n /**\n * Multiply all ClipPlanes DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).\n * @param matrix matrix to apply.\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect\n * on the plane is the inverse transpose of matrixA.\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n */\n public override multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n this.ensurePlaneSets();\n return super.multiplyPlanesByMatrix4d(matrix, invert, transpose);\n }\n /**\n * Apply `transform` to the local to world (`transformFromClip`) transform.\n * * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`\n * * the transform is passed to the base class to be applied to clip plane form of the clipper.\n */\n public override transformInPlace(transform: Transform): boolean {\n if (transform.isIdentity)\n return true;\n super.transformInPlace(transform);\n if (this._transformFromClip)\n transform.multiplyTransformTransform(this._transformFromClip, this._transformFromClip);\n else\n this._transformFromClip = transform.clone();\n this._transformToClip = this._transformFromClip.inverse(); // could be undefined\n return true;\n }\n /**\n * Return true if\n * * at least one point is defined\n * * The local to world transform (transformFromClip) either\n * * is undefined\n * * has no xy parts in its column Z (local frame Z is parallel to global Z)\n */\n public get isXYPolygon(): boolean {\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)\n return false;\n if (this._transformFromClip === undefined)\n return true;\n const zVector = this._transformFromClip.matrix.columnZ();\n return zVector.magnitudeXY() < 1.0e-8;\n }\n /** Transform the input point in place using this instance's `transformToClip` member */\n public performTransformToClip(point: Point3d): void {\n if (this._transformToClip !== undefined)\n this._transformToClip.multiplyPoint3d(point, point);\n }\n /** Transform the input point in place using this instance's `transformFromClip` member */\n public performTransformFromClip(point: Point3d): void {\n if (this._transformFromClip !== undefined)\n this._transformFromClip.multiplyPoint3d(point, point);\n }\n}\n"]}
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,6DAAyD;AACzD,2CAAwC;AACxC,2CAA4D;AAC5D,6DAA0D;AAC1D,6EAA2G;AAC3G,2EAAoE;AACpE,6DAA0D;AAC1D,2DAAwD;AAGxD,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,M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,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"]}