@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
@@ -8,20 +8,28 @@ import { ParityRegion } from "../ParityRegion";
8
8
  */
9
9
  export declare class PlanarSubdivision {
10
10
  /**
11
- * Create a graph from an array of curves, and an array of the curves' precomputed intersections.
12
- * Z-coordinates are ignored.
11
+ * Create a graph from curves and precomputed intersections.
12
+ * * Z-coordinates are ignored.
13
+ * @param primitives input curves
14
+ * @param allPairs array of curve-curve xy-intersections
15
+ * @param mergeTolerance optional distance tolerance for clustering vertices. Default value is [[Geometry.smallMetricDistance]].
13
16
  */
14
17
  static assembleHalfEdgeGraph(primitives: CurvePrimitive[], allPairs: CurveLocationDetailPair[], mergeTolerance?: number): HalfEdgeGraph;
15
18
  /**
16
- * Create a pair of mated half edges referencing an interval of a primitive.
17
- * * no action if start and end points are identical.
19
+ * Filter for trivial curve fragment: fast computation if line segment; otherwise clip, flatten, and measure.
20
+ * * Different metrics are employed for expedience.
21
+ */
22
+ private static isCurveTrivialXY;
23
+ /**
24
+ * Create a pair of mated half edges referencing a non-trivial interval of a primitive.
18
25
  * @param graph containing graph
19
26
  * @param p the curve
20
27
  * @param point0 start point
21
28
  * @param fraction0 starting fraction
22
29
  * @param point1 end point
23
30
  * @param fraction1 end fraction
24
- * @returns end point and fraction, or start point and fraction if no action
31
+ * @param mergeTolerance optional maximum xy-length of a trivial edge
32
+ * @returns end point and fraction
25
33
  */
26
34
  private static addHalfEdge;
27
35
  /**
@@ -39,27 +47,54 @@ export declare class PlanarSubdivision {
39
47
  /**
40
48
  * Create a [[Loop]] for the given face or super face.
41
49
  * @param face a node in the face loop, or an array of HalfEdges that comprise a loop (e.g., a super face).
42
- * @param announce optional callback invoked on each edge/curve of the face/Loop.
43
- * @param compress whether to consolidate adjacent curves in the output Loop (default `false`).
44
- * If `announce` is provided, no compression is performed, as edges and curves would no longer be in 1-1 correspondence.
45
- * @param closureTol absolute xy-distance for confirming the returned Loop is closed (default [[Geometry.smallMetricDistance]]).
50
+ * @param options bundle of options.
46
51
  * @returns the Loop, or `undefined` if it is not closed within xy-tolerance.
47
52
  */
48
- static createLoopInFace(face: HalfEdge | HalfEdge[], announce?: (he: HalfEdge, curve: CurvePrimitive, loop: Loop) => void, compress?: boolean, closureTol?: number): Loop | undefined;
53
+ static createLoopInFace(face: HalfEdge | HalfEdge[], options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | undefined;
49
54
  /**
50
55
  * Create a [[Loop]] or [[ParityRegion]] for the given face.
51
56
  * * A ParityRegion is created for a split-washer type face by removing bridge edges.
52
57
  * @param face a node in the face loop.
53
- * @param bridgeMask mask preset on bridge edges (default is `HalfEdgeMask.BRIDGE_EDGE`).
54
- * @param visitMask mask to use for visiting edges in the face loop (default is `HalfEdgeMask.VISITED`).
55
- * @param closureTol absolute xy-distance for confirming the returned Loop is closed (default [[Geometry.smallMetricDistance]]).
56
- * @returns the Loop or ParityRegion, or `undefined` if one could not be computed
58
+ * @param options bundle of options.
59
+ * @returns the Loop or ParityRegion, or `undefined` if one could not be computed.
57
60
  */
58
- static createLoopOrParityRegionInFace(face: HalfEdge, bridgeMask?: HalfEdgeMask, visitMask?: HalfEdgeMask, closureTol?: number): Loop | ParityRegion | undefined;
61
+ static createLoopOrParityRegionInFace(face: HalfEdge, options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | ParityRegion | undefined;
59
62
  /** Return true if there are only two edges in the face loop, and their start curvatures are the same. */
60
63
  private static isNullFace;
61
64
  /** Look across edge mates (possibly several) for a non-null mate face. */
62
65
  private static getNonNullEdgeMate;
63
66
  static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, zeroAreaTolerance?: number): SignedLoops[];
64
67
  }
68
+ /**
69
+ * @internal
70
+ */
71
+ export declare namespace PlanarSubdivision {
72
+ /** Options bundle for [[PlanarSubdivision.createLoopInFace]] and [[PlanarSubdivision.createLoopOrParityRegionInFace]]. */
73
+ interface CreateRegionInFaceOptions {
74
+ /**
75
+ * Optional callback invoked on each `edge` before its `curve` is added to `loop`.
76
+ * * Note that if a [[ParityRegion]] is being constructed, `curve` and `loop` may subsequently be reversed.
77
+ */
78
+ announceEdge?: (edge: HalfEdge, curve: CurvePrimitive, loop: Loop) => void;
79
+ /**
80
+ * Whether to consolidate adjacent curves in an output [[Loop]]. Default value is `false`.
81
+ * * If `announce` is defined, no compression is performed, as edges and curves would no longer be in 1-1 correspondence.
82
+ */
83
+ compress?: boolean;
84
+ /** Absolute xy-distance for confirming a returned Loop is closed. Default value is [[Geometry.smallMetricDistance]]. */
85
+ closureTol?: number;
86
+ /**
87
+ * Mask preset on bridge edges. Default value is `HalfEdgeMask.BRIDGE_EDGE`.
88
+ * * This mask is used to distinguish a split-washer type face, which can result in a [[ParityRegion]].
89
+ */
90
+ bridgeMask?: HalfEdgeMask;
91
+ /** Mask to use for visiting edges when creating a [[ParityRegion]] from a split-washer type face. Default value is `HalfEdgeMask.VISITED`. */
92
+ visitMask?: HalfEdgeMask;
93
+ /**
94
+ * Optional z-coordinate for the result region.
95
+ * * If undefined, graph z-coordinates are used, but this may result in a non-planar region if the graph is not planar!
96
+ */
97
+ z?: number;
98
+ }
99
+ }
65
100
  //# sourceMappingURL=PlanarSubdivision.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanarSubdivision.d.ts","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAI7E,OAAO,EAAuB,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,EAAE,IAAI,EAAsB,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAyE/C;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;;OAGG;WACW,qBAAqB,CACjC,UAAU,EAAE,cAAc,EAAE,EAC5B,QAAQ,EAAE,uBAAuB,EAAE,EACnC,cAAc,GAAE,MAAqC,GACpD,aAAa;IA2ChB;;;;;;;;;;OAUG;IACH,OAAO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C,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;QAC3E;;;WAGG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,wHAAwH;QACxH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;;WAGG;QACH,UAAU,CAAC,EAAE,YAAY,CAAC;QAC1B,8IAA8I;QAC9I,SAAS,CAAC,EAAE,YAAY,CAAC;QACzB;;;WAGG;QACH,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;CACF"}
@@ -7,6 +7,7 @@ exports.PlanarSubdivision = void 0;
7
7
  *--------------------------------------------------------------------------------------------*/
8
8
  const core_bentley_1 = require("@itwin/core-bentley");
9
9
  const Geometry_1 = require("../../Geometry");
10
+ const Transform_1 = require("../../geometry3d/Transform");
10
11
  const Graph_1 = require("../../topology/Graph");
11
12
  const HalfEdgeGraphSearch_1 = require("../../topology/HalfEdgeGraphSearch");
12
13
  const Merging_1 = require("../../topology/Merging");
@@ -21,6 +22,25 @@ const RegionOpsClassificationSweeps_1 = require("../RegionOpsClassificationSweep
21
22
  /** @packageDocumentation
22
23
  * @module Curve
23
24
  */
25
+ function computeSortAngle(curve, fraction, reverse) {
26
+ const ray = curve.fractionToPointAndDerivative(fraction);
27
+ const s = reverse ? -1.0 : 1.0;
28
+ return Math.atan2(s * ray.direction.y, s * ray.direction.x);
29
+ }
30
+ function getFractionOnCurve(pair, curve) {
31
+ if (pair.detailA.curve === curve)
32
+ return pair.detailA.fraction;
33
+ if (pair.detailB.curve === curve)
34
+ return pair.detailB.fraction;
35
+ return undefined;
36
+ }
37
+ function getDetailOnCurve(pair, curve) {
38
+ if (pair.detailA.curve === curve)
39
+ return pair.detailA;
40
+ if (pair.detailB.curve === curve)
41
+ return pair.detailB;
42
+ return undefined;
43
+ }
24
44
  class MapCurvePrimitiveToCurveLocationDetailPairArray {
25
45
  primitiveToPair = new Map();
26
46
  // index assigned to this primitive (for debugging)
@@ -83,8 +103,11 @@ class MapCurvePrimitiveToCurveLocationDetailPairArray {
83
103
  */
84
104
  class PlanarSubdivision {
85
105
  /**
86
- * Create a graph from an array of curves, and an array of the curves' precomputed intersections.
87
- * Z-coordinates are ignored.
106
+ * Create a graph from curves and precomputed intersections.
107
+ * * Z-coordinates are ignored.
108
+ * @param primitives input curves
109
+ * @param allPairs array of curve-curve xy-intersections
110
+ * @param mergeTolerance optional distance tolerance for clustering vertices. Default value is [[Geometry.smallMetricDistance]].
88
111
  */
89
112
  static assembleHalfEdgeGraph(primitives, allPairs, mergeTolerance = Geometry_1.Geometry.smallMetricDistance) {
90
113
  // map from key CurvePrimitive to CurveLocationDetailPair
@@ -130,31 +153,45 @@ class PlanarSubdivision {
130
153
  return graph;
131
154
  }
132
155
  /**
133
- * Create a pair of mated half edges referencing an interval of a primitive.
134
- * * no action if start and end points are identical.
156
+ * Filter for trivial curve fragment: fast computation if line segment; otherwise clip, flatten, and measure.
157
+ * * Different metrics are employed for expedience.
158
+ */
159
+ static isCurveTrivialXY(p, point0, fraction0, point1, fraction1, mergeTolerance) {
160
+ if (Geometry_1.Geometry.isSmallRelative(fraction0 - fraction1))
161
+ return true;
162
+ if (!(p instanceof LineSegment3d_1.LineSegment3d)) {
163
+ const p0 = p.clonePartialCurve(fraction0, fraction1);
164
+ if (p0?.tryTransformInPlace(Transform_1.Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0))) // flatten
165
+ return p0.curveLength() <= mergeTolerance; // Euclidean
166
+ }
167
+ return point0.isAlmostEqualXY(point1, mergeTolerance); // Manhattan
168
+ }
169
+ /**
170
+ * Create a pair of mated half edges referencing a non-trivial interval of a primitive.
135
171
  * @param graph containing graph
136
172
  * @param p the curve
137
173
  * @param point0 start point
138
174
  * @param fraction0 starting fraction
139
175
  * @param point1 end point
140
176
  * @param fraction1 end fraction
141
- * @returns end point and fraction, or start point and fraction if no action
177
+ * @param mergeTolerance optional maximum xy-length of a trivial edge
178
+ * @returns end point and fraction
142
179
  */
143
180
  static addHalfEdge(graph, p, point0, fraction0, point1, fraction1, mergeTolerance = Geometry_1.Geometry.smallMetricDistance) {
144
- if (point0.isAlmostEqualXY(point1, mergeTolerance))
145
- return { point: point0, fraction: fraction0 };
146
- const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);
147
- if (p.parent && p.parent instanceof RegionOpsClassificationSweeps_1.RegionGroupMember && p.parent.parentGroup.groupOpType === RegionOpsClassificationSweeps_1.RegionGroupOpType.NonBounding)
148
- halfEdge.setMaskAroundEdge(Graph_1.HalfEdgeMask.BRIDGE_EDGE);
149
- const detail01 = CurveLocationDetail_1.CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);
150
- const mate = halfEdge.edgeMate;
151
- halfEdge.edgeTag = detail01;
152
- halfEdge.sortData = 1.0;
153
- mate.edgeTag = detail01;
154
- mate.sortData = -1.0;
155
- halfEdge.sortAngle = sortAngle(p, fraction0, false);
156
- mate.sortAngle = sortAngle(p, fraction1, true);
157
- return { point: point1, fraction: fraction1 };
181
+ if (!this.isCurveTrivialXY(p, point0, fraction0, point1, fraction1, mergeTolerance)) {
182
+ const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);
183
+ if (p.parent && p.parent instanceof RegionOpsClassificationSweeps_1.RegionGroupMember && p.parent.parentGroup.groupOpType === RegionOpsClassificationSweeps_1.RegionGroupOpType.NonBounding)
184
+ halfEdge.setMaskAroundEdge(Graph_1.HalfEdgeMask.BRIDGE_EDGE);
185
+ const detail01 = CurveLocationDetail_1.CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);
186
+ const mate = halfEdge.edgeMate;
187
+ halfEdge.edgeTag = detail01;
188
+ halfEdge.sortData = 1.0;
189
+ mate.edgeTag = detail01;
190
+ mate.sortData = -1.0;
191
+ halfEdge.sortAngle = computeSortAngle(p, fraction0, false);
192
+ mate.sortAngle = computeSortAngle(p, fraction1, true);
193
+ }
194
+ return { point: point1, fraction: fraction1 }; // where the next curve fragment starts
158
195
  }
159
196
  /**
160
197
  * Based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative,
@@ -190,32 +227,31 @@ class PlanarSubdivision {
190
227
  return undefined;
191
228
  }
192
229
  /** Create the geometry for a topological edge. */
193
- static createCurveInEdge(edge) {
230
+ static createCurveInEdge(edge, z) {
231
+ let result;
194
232
  const info = this.extractGeometryFromEdge(edge);
195
- if (info) {
196
- if (info.reversed)
197
- return info.detail.curve.clonePartialCurve(info.detail.fraction1, info.detail.fraction);
198
- return info.detail.curve.clonePartialCurve(info.detail.fraction, info.detail.fraction1);
233
+ if (info && info.detail.curve && info.detail.fraction1) {
234
+ const f0 = info.reversed ? info.detail.fraction1 : info.detail.fraction;
235
+ const f1 = info.reversed ? info.detail.fraction : info.detail.fraction1;
236
+ result = info.detail.curve.clonePartialCurve(f0, f1);
237
+ if (result && z !== undefined)
238
+ result.tryTransformInPlace(Transform_1.Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, z));
199
239
  }
200
- return undefined;
240
+ return result;
201
241
  }
202
242
  /**
203
243
  * Create a [[Loop]] for the given face or super face.
204
244
  * @param face a node in the face loop, or an array of HalfEdges that comprise a loop (e.g., a super face).
205
- * @param announce optional callback invoked on each edge/curve of the face/Loop.
206
- * @param compress whether to consolidate adjacent curves in the output Loop (default `false`).
207
- * If `announce` is provided, no compression is performed, as edges and curves would no longer be in 1-1 correspondence.
208
- * @param closureTol absolute xy-distance for confirming the returned Loop is closed (default [[Geometry.smallMetricDistance]]).
245
+ * @param options bundle of options.
209
246
  * @returns the Loop, or `undefined` if it is not closed within xy-tolerance.
210
247
  */
211
- static createLoopInFace(face, announce, compress = false, closureTol = Geometry_1.Geometry.smallMetricDistance) {
212
- if (announce)
213
- compress = false;
248
+ static createLoopInFace(face, options) {
249
+ const consolidate = options?.announceEdge ? false : options?.compress ?? false; // can't compress if announcing
214
250
  const loop = Loop_1.Loop.create();
215
- const addEdgeCurve = (he) => {
216
- const curve = this.createCurveInEdge(he);
251
+ const addEdgeCurve = (edge) => {
252
+ const curve = this.createCurveInEdge(edge, options?.z);
217
253
  if (curve) {
218
- announce?.(he, curve, loop);
254
+ options?.announceEdge?.(edge, curve, loop);
219
255
  loop.tryAddChild(curve);
220
256
  }
221
257
  };
@@ -223,12 +259,12 @@ class PlanarSubdivision {
223
259
  face.forEach(addEdgeCurve);
224
260
  else
225
261
  face.announceEdgesInFace(addEdgeCurve);
226
- if (compress) {
227
- const options = new RegionOps_1.ConsolidateAdjacentCurvePrimitivesOptions();
228
- options.consolidateLoopSeam = true;
229
- RegionOps_1.RegionOps.consolidateAdjacentPrimitives(loop, options);
262
+ if (consolidate) {
263
+ const consolidateOptions = new RegionOps_1.ConsolidateAdjacentCurvePrimitivesOptions();
264
+ consolidateOptions.consolidateLoopSeam = true;
265
+ RegionOps_1.RegionOps.consolidateAdjacentPrimitives(loop, consolidateOptions);
230
266
  }
231
- if (loop.isPhysicallyClosedCurve(closureTol, true))
267
+ if (loop.isPhysicallyClosedCurve(options?.closureTol, true))
232
268
  return loop;
233
269
  (0, core_bentley_1.assert)(() => false, "face is not physically closed");
234
270
  return undefined;
@@ -237,17 +273,19 @@ class PlanarSubdivision {
237
273
  * Create a [[Loop]] or [[ParityRegion]] for the given face.
238
274
  * * A ParityRegion is created for a split-washer type face by removing bridge edges.
239
275
  * @param face a node in the face loop.
240
- * @param bridgeMask mask preset on bridge edges (default is `HalfEdgeMask.BRIDGE_EDGE`).
241
- * @param visitMask mask to use for visiting edges in the face loop (default is `HalfEdgeMask.VISITED`).
242
- * @param closureTol absolute xy-distance for confirming the returned Loop is closed (default [[Geometry.smallMetricDistance]]).
243
- * @returns the Loop or ParityRegion, or `undefined` if one could not be computed
276
+ * @param options bundle of options.
277
+ * @returns the Loop or ParityRegion, or `undefined` if one could not be computed.
244
278
  */
245
- static createLoopOrParityRegionInFace(face, bridgeMask = Graph_1.HalfEdgeMask.BRIDGE_EDGE, visitMask = Graph_1.HalfEdgeMask.VISITED, closureTol = Geometry_1.Geometry.smallMetricDistance) {
279
+ static createLoopOrParityRegionInFace(face, options) {
246
280
  let region;
247
- if (face.isSplitWasherFace(bridgeMask)) {
281
+ const visitMask = options?.visitMask ?? Graph_1.HalfEdgeMask.VISITED;
282
+ const bridgeMask = options?.bridgeMask ?? Graph_1.HalfEdgeMask.BRIDGE_EDGE;
283
+ let startBridgeEdge;
284
+ // is it a split-washer face?
285
+ if (face.isSplitWasherFace(bridgeMask) && (startBridgeEdge = face.findMaskAroundFace(bridgeMask, true))) {
248
286
  const loops = [];
249
287
  const loopEdges = [];
250
- const bridgeStack = [face.findMaskAroundFace(bridgeMask, true)];
288
+ const bridgeStack = [startBridgeEdge];
251
289
  const announceEdge = (he) => { he.setMask(visitMask); loopEdges.push(he); };
252
290
  const announceBridge = (he) => { if (!he.isMaskSet(visitMask))
253
291
  bridgeStack.push(he); };
@@ -261,7 +299,7 @@ class PlanarSubdivision {
261
299
  continue;
262
300
  loopEdges.length = 0;
263
301
  if (loopSeed.announceEdgesInSuperFace(bridgeMask, announceEdge, announceBridge)) {
264
- const loop = this.createLoopInFace(loopEdges, undefined, true, closureTol);
302
+ const loop = this.createLoopInFace(loopEdges, options);
265
303
  if (loop) {
266
304
  loops.push(loop);
267
305
  continue;
@@ -273,7 +311,7 @@ class PlanarSubdivision {
273
311
  region = RegionOps_1.RegionOps.simplifyRegion(region);
274
312
  }
275
313
  else {
276
- region = this.createLoopInFace(face, undefined, true, closureTol);
314
+ region = this.createLoopInFace(face, options);
277
315
  }
278
316
  return (region && (region instanceof Loop_1.Loop || region instanceof ParityRegion_1.ParityRegion)) ? region : undefined;
279
317
  }
@@ -310,24 +348,23 @@ class PlanarSubdivision {
310
348
  const edges = [];
311
349
  for (const faceSeed of faceSeeds) {
312
350
  const isNullFace = this.isNullFace(faceSeed);
313
- const loop = this.createLoopInFace(faceSeed, (he, curveC, loopC) => {
314
- if (!isNullFace) {
315
- const mate = this.getNonNullEdgeMate(graph, he);
316
- if (mate !== undefined) {
317
- const e = edgeMap.get(mate);
318
- if (e === undefined) {
319
- // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge
320
- const e1 = new Loop_1.LoopCurveLoopCurve(loopC, curveC, undefined, undefined);
321
- edgeMap.set(he, e1);
322
- }
323
- else if (e instanceof Loop_1.LoopCurveLoopCurve) {
324
- e.setB(loopC, curveC);
325
- edges.push(e);
326
- edgeMap.delete(mate);
327
- }
351
+ const announceEdge = isNullFace ? undefined : (he, curveC, loopC) => {
352
+ const mate = this.getNonNullEdgeMate(graph, he);
353
+ if (mate !== undefined) {
354
+ const e = edgeMap.get(mate);
355
+ if (e === undefined) {
356
+ // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge
357
+ const e1 = new Loop_1.LoopCurveLoopCurve(loopC, curveC, undefined, undefined);
358
+ edgeMap.set(he, e1);
359
+ }
360
+ else if (e instanceof Loop_1.LoopCurveLoopCurve) {
361
+ e.setB(loopC, curveC);
362
+ edges.push(e);
363
+ edgeMap.delete(mate);
328
364
  }
329
365
  }
330
- });
366
+ };
367
+ const loop = this.createLoopInFace(faceSeed, { announceEdge });
331
368
  if (loop)
332
369
  this.collectSignedLoop(loop, componentAreas, zeroAreaTolerance, isNullFace);
333
370
  }
@@ -339,23 +376,4 @@ class PlanarSubdivision {
339
376
  }
340
377
  }
341
378
  exports.PlanarSubdivision = PlanarSubdivision;
342
- function sortAngle(curve, fraction, reverse) {
343
- const ray = curve.fractionToPointAndDerivative(fraction);
344
- const s = reverse ? -1.0 : 1.0;
345
- return Math.atan2(s * ray.direction.y, s * ray.direction.x);
346
- }
347
- function getFractionOnCurve(pair, curve) {
348
- if (pair.detailA.curve === curve)
349
- return pair.detailA.fraction;
350
- if (pair.detailB.curve === curve)
351
- return pair.detailB.fraction;
352
- return undefined;
353
- }
354
- function getDetailOnCurve(pair, curve) {
355
- if (pair.detailA.curve === curve)
356
- return pair.detailA;
357
- if (pair.detailB.curve === curve)
358
- return pair.detailB;
359
- return undefined;
360
- }
361
379
  //# sourceMappingURL=PlanarSubdivision.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanarSubdivision.js","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAA6C;AAC7C,6CAA0C;AAE1C,gDAA6E;AAC7E,4EAAyE;AACzE,oDAA4D;AAC5D,oCAAiC;AACjC,gEAAsF;AAGtF,oDAAiD;AACjD,kDAA+C;AAC/C,kCAAgE;AAChE,kDAA+C;AAC/C,4CAAoF;AACpF,oFAAwF;AAExF;;GAEG;AAEH,MAAM,+CAA+C;IAC5C,eAAe,GAAG,IAAI,GAAG,EAA6C,CAAC;IAC9E,mDAAmD;IAC5C,gBAAgB,GAAG,IAAI,GAAG,EAA0B,CAAC;IACpD,qBAAqB,GAAW,CAAC,CAAC;IACnC,oBAAoB,CAAC,SAAqC;QAC/D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;IACH,CAAC;IACM,qBAAqB,CAAC,SAAqC,EAAE,IAA6B;QAC/F,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;YACrC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAC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AAO,CAAC;IACtB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../../Geometry\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../../topology/Graph\";\nimport { HalfEdgeGraphSearch } from \"../../topology/HalfEdgeGraphSearch\";\nimport { HalfEdgeGraphMerge } from \"../../topology/Merging\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { AnyRegion } from \"../CurveTypes\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop, LoopCurveLoopCurve, SignedLoops } from \"../Loop\";\nimport { ParityRegion } from \"../ParityRegion\";\nimport { ConsolidateAdjacentCurvePrimitivesOptions, RegionOps } from \"../RegionOps\";\nimport { RegionGroupMember, RegionGroupOpType } from \"../RegionOpsClassificationSweeps\";\n\n/** @packageDocumentation\n * @module Curve\n */\n\nclass MapCurvePrimitiveToCurveLocationDetailPairArray {\n public primitiveToPair = new Map<CurvePrimitive, CurveLocationDetailPair[]>();\n // index assigned to this primitive (for debugging)\n public primitiveToIndex = new Map<CurvePrimitive, number>();\n private _numIndexedPrimitives: number = 0;\n public assignPrimitiveIndex(primitive: CurvePrimitive | undefined) {\n if (primitive !== undefined) {\n const index = this.primitiveToIndex.get(primitive);\n if (index === undefined) {\n this.primitiveToIndex.set(primitive, this._numIndexedPrimitives++);\n }\n }\n }\n public insertPrimitiveToPair(primitive: CurvePrimitive | undefined, pair: CurveLocationDetailPair) {\n if (primitive) {\n const priorPairs = this.primitiveToPair.get(primitive);\n this.assignPrimitiveIndex(primitive);\n if (!priorPairs) {\n this.primitiveToPair.set(primitive, [pair]);\n } else {\n priorPairs.push(pair);\n }\n }\n }\n public insertPair(pair: CurveLocationDetailPair) {\n const primitiveA = pair.detailA.curve;\n if (primitiveA)\n this.insertPrimitiveToPair(primitiveA, pair);\n const primitiveB = pair.detailB.curve;\n if (primitiveB)\n this.insertPrimitiveToPair(primitiveB, pair);\n }\n /**\n * Split closed missing primitives in half and add new intersection pairs.\n * * When bridge edges aren't included in the primitives array, a closed primitive with no intersections will not be\n * added to the graph because it isn't in the `primitiveToPair` map. By splitting such a missing primitive in two, we\n * introduce two intersections for each half, which allows the primitive to be represented in the map.\n */\n public splitAndAppendMissingClosedPrimitives(\n primitives: CurvePrimitive[], tolerance: number = Geometry.smallMetricDistance,\n ): void {\n for (const p of primitives) {\n let closedCurveSplitCandidate = false;\n if (p instanceof Arc3d)\n closedCurveSplitCandidate = p.sweep.isFullCircle;\n else if (!(p instanceof LineSegment3d) && !(p instanceof LineString3d)) // TODO: probably should do this for all types. Lots of spline-type primitives can be closed.\n closedCurveSplitCandidate = p.startPoint().isAlmostEqualXY(p.endPoint(), tolerance);\n if (closedCurveSplitCandidate && !this.primitiveToPair.has(p)) {\n const p0 = p.clonePartialCurve(0.0, 0.5);\n const p1 = p.clonePartialCurve(0.5, 1.0);\n if (p0 && p1) {\n this.insertPair(CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 0.0),\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 1.0),\n ));\n this.insertPair(CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 1.0),\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 0.0),\n ));\n }\n }\n }\n }\n}\n\n/**\n * @internal\n */\nexport class PlanarSubdivision {\n /**\n * Create a graph from an array of curves, and an array of the curves' precomputed intersections.\n * Z-coordinates are ignored.\n */\n public static assembleHalfEdgeGraph(\n primitives: CurvePrimitive[],\n allPairs: CurveLocationDetailPair[],\n mergeTolerance: number = Geometry.smallMetricDistance,\n ): HalfEdgeGraph {\n // map from key CurvePrimitive to CurveLocationDetailPair\n const detailByPrimitive = new MapCurvePrimitiveToCurveLocationDetailPairArray();\n for (const pair of allPairs)\n detailByPrimitive.insertPair(pair);\n if (primitives.length > detailByPrimitive.primitiveToPair.size) {\n // otherwise, these single-primitive loops are missing from the graph\n detailByPrimitive.splitAndAppendMissingClosedPrimitives(primitives, mergeTolerance);\n }\n const graph = new HalfEdgeGraph();\n for (const entry of detailByPrimitive.primitiveToPair.entries()) {\n const p = entry[0];\n // convert each interval intersection into two isolated intersections\n const details = entry[1].reduce((accumulator: CurveLocationDetailPair[], detailPair) => {\n if (!detailPair.detailA.hasFraction1)\n return [...accumulator, detailPair];\n const detail = getDetailOnCurve(detailPair, p)!;\n const detail0 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction, detail.point);\n const detail1 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction1!, detail.point1!);\n return [\n ...accumulator,\n CurveLocationDetailPair.createCapture(detail0, detail0),\n CurveLocationDetailPair.createCapture(detail1, detail1),\n ];\n }, []);\n // lexical sort on p intersection fraction\n details.sort((pairA: CurveLocationDetailPair, pairB: CurveLocationDetailPair) => {\n const fractionA = getFractionOnCurve(pairA, p)!;\n const fractionB = getFractionOnCurve(pairB, p)!;\n return fractionA - fractionB;\n });\n let last = { point: p.startPoint(), fraction: 0.0 };\n for (const detailPair of details) {\n const detail = getDetailOnCurve(detailPair, p)!;\n const detailFraction = Geometry.restrictToInterval(detail.fraction, 0, 1); // truncate fraction, but don't snap point; clustering happens later\n last = this.addHalfEdge(graph, p, last.point, last.fraction, detail.point, detailFraction, mergeTolerance);\n }\n this.addHalfEdge(graph, p, last.point, last.fraction, p.endPoint(), 1.0, mergeTolerance);\n }\n // every edge got its sortAngle defined by addHalfEdge\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph, (he: HalfEdge) => he.sortAngle ?? 0, mergeTolerance);\n return graph;\n }\n /**\n * Create a pair of mated half edges referencing an interval of a primitive.\n * * no action if start and end points are identical.\n * @param graph containing graph\n * @param p the curve\n * @param point0 start point\n * @param fraction0 starting fraction\n * @param point1 end point\n * @param fraction1 end fraction\n * @returns end point and fraction, or start point and fraction if no action\n */\n private static addHalfEdge(\n graph: HalfEdgeGraph,\n p: CurvePrimitive,\n point0: Point3d,\n fraction0: number,\n point1: Point3d,\n fraction1: number,\n mergeTolerance: number = Geometry.smallMetricDistance,\n ): { point: Point3d, fraction: number } {\n if (point0.isAlmostEqualXY(point1, mergeTolerance))\n return { point: point0, fraction: fraction0 };\n const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);\n if (p.parent && p.parent instanceof RegionGroupMember && p.parent.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\n halfEdge.setMaskAroundEdge(HalfEdgeMask.BRIDGE_EDGE);\n const detail01 = CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);\n const mate = halfEdge.edgeMate;\n halfEdge.edgeTag = detail01;\n halfEdge.sortData = 1.0;\n mate.edgeTag = detail01;\n mate.sortData = -1.0;\n halfEdge.sortAngle = sortAngle(p, fraction0, false);\n mate.sortAngle = sortAngle(p, fraction1, true);\n return { point: point1, fraction: fraction1 };\n }\n /**\n * Based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative,\n * or sliver loops.\n * @param zeroAreaTolerance absolute area tolerance for sliver face detection\n * @param isSliverFace whether the loop is known a priori (e.g., via topology) to have zero area\n * @returns the area (forced to zero if within tolerance)\n */\n public static collectSignedLoop(\n loop: Loop, outLoops: SignedLoops, zeroAreaTolerance: number = 1.0e-10, isSliverFace?: boolean,\n ): number {\n let area = isSliverFace ? 0.0 : RegionOps.computeXYArea(loop);\n if (area === undefined)\n area = 0;\n if (Math.abs(area) < zeroAreaTolerance)\n area = 0.0;\n (loop as any).computedAreaInPlanarSubdivision = area;\n if (area > 0)\n outLoops.positiveAreaLoops.push(loop);\n else if (area < 0)\n outLoops.negativeAreaLoops.push(loop);\n else\n outLoops.slivers.push(loop);\n return area;\n }\n /** Extract geometric info from a topological edge. */\n private static extractGeometryFromEdge(edge: HalfEdge): { detail: CurveLocationDetail, reversed: boolean } | undefined {\n if (edge.sortData !== undefined && edge.edgeTag && edge.edgeTag instanceof CurveLocationDetail) {\n const detail = edge.edgeTag;\n if (detail.curve && detail.fraction1 !== undefined) {\n const reversed = edge.sortData < 0;\n return { detail, reversed };\n }\n }\n return undefined;\n }\n /** Create the geometry for a topological edge. */\n private static createCurveInEdge(edge: HalfEdge): CurvePrimitive | undefined {\n const info = this.extractGeometryFromEdge(edge);\n if (info) {\n if (info.reversed)\n return info.detail.curve!.clonePartialCurve(info.detail.fraction1!, info.detail.fraction);\n return info.detail.curve!.clonePartialCurve(info.detail.fraction, info.detail.fraction1!);\n }\n return undefined;\n }\n /**\n * Create a [[Loop]] for the given face or super face.\n * @param face a node in the face loop, or an array of HalfEdges that comprise a loop (e.g., a super face).\n * @param announce optional callback invoked on each edge/curve of the face/Loop.\n * @param compress whether to consolidate adjacent curves in the output Loop (default `false`).\n * If `announce` is provided, no compression is performed, as edges and curves would no longer be in 1-1 correspondence.\n * @param closureTol absolute xy-distance for confirming the returned Loop is closed (default [[Geometry.smallMetricDistance]]).\n * @returns the Loop, or `undefined` if it is not closed within xy-tolerance.\n */\n public static createLoopInFace(\n face: HalfEdge | HalfEdge[],\n announce?: (he: HalfEdge, curve: CurvePrimitive, loop: Loop) => void,\n compress: boolean = false,\n closureTol: number = Geometry.smallMetricDistance,\n ): Loop | undefined {\n if (announce)\n compress = false;\n const loop = Loop.create();\n const addEdgeCurve = (he: HalfEdge): void => {\n const curve = this.createCurveInEdge(he);\n if (curve) {\n announce?.(he, curve, loop);\n loop.tryAddChild(curve);\n }\n };\n if (Array.isArray(face))\n face.forEach(addEdgeCurve);\n else\n face.announceEdgesInFace(addEdgeCurve);\n if (compress) {\n const options = new ConsolidateAdjacentCurvePrimitivesOptions();\n options.consolidateLoopSeam = true;\n RegionOps.consolidateAdjacentPrimitives(loop, options);\n }\n if (loop.isPhysicallyClosedCurve(closureTol, true))\n return loop;\n assert(() => false, \"face is not physically closed\");\n return undefined;\n }\n /**\n * Create a [[Loop]] or [[ParityRegion]] for the given face.\n * * A ParityRegion is created for a split-washer type face by removing bridge edges.\n * @param face a node in the face loop.\n * @param bridgeMask mask preset on bridge edges (default is `HalfEdgeMask.BRIDGE_EDGE`).\n * @param visitMask mask to use for visiting edges in the face loop (default is `HalfEdgeMask.VISITED`).\n * @param closureTol absolute xy-distance for confirming the returned Loop is closed (default [[Geometry.smallMetricDistance]]).\n * @returns the Loop or ParityRegion, or `undefined` if one could not be computed\n */\n public static createLoopOrParityRegionInFace(\n face: HalfEdge,\n bridgeMask: HalfEdgeMask = HalfEdgeMask.BRIDGE_EDGE,\n visitMask: HalfEdgeMask = HalfEdgeMask.VISITED,\n closureTol: number = Geometry.smallMetricDistance,\n ): Loop | ParityRegion | undefined {\n let region: AnyRegion | undefined;\n if (face.isSplitWasherFace(bridgeMask)) {\n const loops: Loop[] = [];\n const loopEdges: HalfEdge[] = [];\n const bridgeStack: HalfEdge[] = [face.findMaskAroundFace(bridgeMask, true)!];\n const announceEdge = (he: HalfEdge) => { he.setMask(visitMask); loopEdges.push(he); };\n const announceBridge = (he: HalfEdge) => { if (!he.isMaskSet(visitMask)) bridgeStack.push(he); };\n face.clearMaskAroundFace(visitMask);\n let bridge: HalfEdge | undefined;\n while (undefined !== (bridge = bridgeStack.pop())) {\n bridge.setMask(visitMask);\n const loopSeed = bridge.findMaskAroundFace(bridgeMask, false); // advance to next loop\n if (loopSeed) {\n if (loopSeed.isMaskSet(visitMask))\n continue;\n loopEdges.length = 0;\n if (loopSeed.announceEdgesInSuperFace(bridgeMask, announceEdge, announceBridge)) {\n const loop = this.createLoopInFace(loopEdges, undefined, true, closureTol);\n if (loop) {\n loops.push(loop);\n continue;\n }\n }\n }\n }\n region = RegionOps.sortOuterAndHoleLoopsXY(loops);\n region = RegionOps.simplifyRegion(region);\n } else {\n region = this.createLoopInFace(face, undefined, true, closureTol);\n }\n return (region && (region instanceof Loop || region instanceof ParityRegion)) ? region : undefined;\n }\n /** Return true if there are only two edges in the face loop, and their start curvatures are the same. */\n private static isNullFace(he: HalfEdge): boolean {\n const faceHasTwoEdges = (he.faceSuccessor.faceSuccessor === he);\n let faceIsBanana = false;\n if (faceHasTwoEdges) {\n const c0 = HalfEdgeGraphMerge.curvatureSortKey(he);\n const c1 = HalfEdgeGraphMerge.curvatureSortKey(he.faceSuccessor.edgeMate);\n if (!Geometry.isSameCoordinate(c0, c1)) // default tol!\n faceIsBanana = true; // heuristic: we could also check end curvatures, and/or higher derivatives...\n }\n return faceHasTwoEdges && !faceIsBanana;\n }\n /** Look across edge mates (possibly several) for a non-null mate face. */\n private static getNonNullEdgeMate(_graph: HalfEdgeGraph, e: HalfEdge): HalfEdge | undefined {\n if (this.isNullFace(e))\n return undefined;\n let e1 = e.edgeMate;\n while (this.isNullFace(e1)) {\n e1 = e1.faceSuccessor.edgeMate;\n if (e1 === e)\n return undefined;\n }\n return e1;\n }\n public static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, zeroAreaTolerance: number = 1.0e-10): SignedLoops[] {\n const q = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\n const result: SignedLoops[] = [];\n const edgeMap = new Map<HalfEdge, LoopCurveLoopCurve>();\n for (const faceSeeds of q) {\n const componentAreas: SignedLoops = { positiveAreaLoops: [], negativeAreaLoops: [], slivers: [] };\n const edges: LoopCurveLoopCurve[] = [];\n for (const faceSeed of faceSeeds) {\n const isNullFace = this.isNullFace(faceSeed);\n const loop = this.createLoopInFace(faceSeed, (he: HalfEdge, curveC: CurvePrimitive, loopC: Loop) => {\n if (!isNullFace) {\n const mate = this.getNonNullEdgeMate(graph, he);\n if (mate !== undefined) {\n const e = edgeMap.get(mate);\n if (e === undefined) {\n // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge\n const e1 = new LoopCurveLoopCurve(loopC, curveC, undefined, undefined);\n edgeMap.set(he, e1);\n } else if (e instanceof LoopCurveLoopCurve) {\n e.setB(loopC, curveC);\n edges.push(e);\n edgeMap.delete(mate);\n }\n }\n }\n });\n if (loop)\n this.collectSignedLoop(loop, componentAreas, zeroAreaTolerance, isNullFace);\n }\n componentAreas.edges = edges;\n result.push(componentAreas);\n edgeMap.clear();\n }\n return result;\n }\n}\n\nfunction sortAngle(curve: CurvePrimitive, fraction: number, reverse: boolean): number {\n const ray = curve.fractionToPointAndDerivative(fraction);\n const s = reverse ? -1.0 : 1.0;\n return Math.atan2(s * ray.direction.y, s * ray.direction.x);\n}\n\nfunction getFractionOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): number | undefined {\n if (pair.detailA.curve === curve)\n return pair.detailA.fraction;\n if (pair.detailB.curve === curve)\n return pair.detailB.fraction;\n return undefined;\n}\nfunction getDetailOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): CurveLocationDetail | undefined {\n if (pair.detailA.curve === curve)\n return pair.detailA;\n if (pair.detailB.curve === curve)\n return pair.detailB;\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"PlanarSubdivision.js","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAA6C;AAC7C,6CAA0C;AAE1C,0DAAuD;AACvD,gDAA6E;AAC7E,4EAAyE;AACzE,oDAA4D;AAC5D,oCAAiC;AACjC,gEAAsF;AAGtF,oDAAiD;AACjD,kDAA+C;AAC/C,kCAAgE;AAChE,kDAA+C;AAC/C,4CAAoF;AACpF,oFAAwF;AAExF;;GAEG;AAEH,SAAS,gBAAgB,CAAC,KAAqB,EAAE,QAAgB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W,EAAE,EAAE;oBAClG,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBAChD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;wBACvB,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;wBAC5B,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;4BACpB,oGAAoG;4BACpG,MAAM,EAAE,GAAG,IAAI,yBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;4BACvE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;wBACtB,CAAC;6BAAM,IAAI,CAAC,YAAY,yBAAkB,EAAE,CAAC;4BAC3C,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;4BACtB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;4BACd,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBACvB,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC;gBACF,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;gBAC/D,IAAI,IAAI;oBACN,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAC;YAChF,CAAC;YACD,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA9RD,8CA8RC","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\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../../topology/Graph\";\r\nimport { HalfEdgeGraphSearch } from \"../../topology/HalfEdgeGraphSearch\";\r\nimport { HalfEdgeGraphMerge } from \"../../topology/Merging\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { AnyRegion } from \"../CurveTypes\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop, LoopCurveLoopCurve, SignedLoops } from \"../Loop\";\r\nimport { ParityRegion } from \"../ParityRegion\";\r\nimport { ConsolidateAdjacentCurvePrimitivesOptions, RegionOps } from \"../RegionOps\";\r\nimport { RegionGroupMember, RegionGroupOpType } from \"../RegionOpsClassificationSweeps\";\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nfunction computeSortAngle(curve: CurvePrimitive, fraction: number, reverse: boolean): number {\r\n const ray = curve.fractionToPointAndDerivative(fraction);\r\n const s = reverse ? -1.0 : 1.0;\r\n return Math.atan2(s * ray.direction.y, s * ray.direction.x);\r\n}\r\nfunction getFractionOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): number | undefined {\r\n if (pair.detailA.curve === curve)\r\n return pair.detailA.fraction;\r\n if (pair.detailB.curve === curve)\r\n return pair.detailB.fraction;\r\n return undefined;\r\n}\r\nfunction getDetailOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): CurveLocationDetail | undefined {\r\n if (pair.detailA.curve === curve)\r\n return pair.detailA;\r\n if (pair.detailB.curve === curve)\r\n return pair.detailB;\r\n return undefined;\r\n}\r\n\r\nclass MapCurvePrimitiveToCurveLocationDetailPairArray {\r\n public primitiveToPair = new Map<CurvePrimitive, CurveLocationDetailPair[]>();\r\n // index assigned to this primitive (for debugging)\r\n public primitiveToIndex = new Map<CurvePrimitive, number>();\r\n private _numIndexedPrimitives: number = 0;\r\n public assignPrimitiveIndex(primitive: CurvePrimitive | undefined) {\r\n if (primitive !== undefined) {\r\n const index = this.primitiveToIndex.get(primitive);\r\n if (index === undefined) {\r\n this.primitiveToIndex.set(primitive, this._numIndexedPrimitives++);\r\n }\r\n }\r\n }\r\n public insertPrimitiveToPair(primitive: CurvePrimitive | undefined, pair: CurveLocationDetailPair) {\r\n if (primitive) {\r\n const priorPairs = this.primitiveToPair.get(primitive);\r\n this.assignPrimitiveIndex(primitive);\r\n if (!priorPairs) {\r\n this.primitiveToPair.set(primitive, [pair]);\r\n } else {\r\n priorPairs.push(pair);\r\n }\r\n }\r\n }\r\n public insertPair(pair: CurveLocationDetailPair) {\r\n const primitiveA = pair.detailA.curve;\r\n if (primitiveA)\r\n this.insertPrimitiveToPair(primitiveA, pair);\r\n const primitiveB = pair.detailB.curve;\r\n if (primitiveB)\r\n this.insertPrimitiveToPair(primitiveB, pair);\r\n }\r\n /**\r\n * Split closed missing primitives in half and add new intersection pairs.\r\n * * When bridge edges aren't included in the primitives array, a closed primitive with no intersections will not be\r\n * added to the graph because it isn't in the `primitiveToPair` map. By splitting such a missing primitive in two, we\r\n * introduce two intersections for each half, which allows the primitive to be represented in the map.\r\n */\r\n public splitAndAppendMissingClosedPrimitives(\r\n primitives: CurvePrimitive[], tolerance: number = Geometry.smallMetricDistance,\r\n ): void {\r\n for (const p of primitives) {\r\n let closedCurveSplitCandidate = false;\r\n if (p instanceof Arc3d)\r\n closedCurveSplitCandidate = p.sweep.isFullCircle;\r\n else if (!(p instanceof LineSegment3d) && !(p instanceof LineString3d)) // TODO: probably should do this for all types. Lots of spline-type primitives can be closed.\r\n closedCurveSplitCandidate = p.startPoint().isAlmostEqualXY(p.endPoint(), tolerance);\r\n if (closedCurveSplitCandidate && !this.primitiveToPair.has(p)) {\r\n const p0 = p.clonePartialCurve(0.0, 0.5);\r\n const p1 = p.clonePartialCurve(0.5, 1.0);\r\n if (p0 && p1) {\r\n this.insertPair(CurveLocationDetailPair.createCapture(\r\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 0.0),\r\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 1.0),\r\n ));\r\n this.insertPair(CurveLocationDetailPair.createCapture(\r\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 1.0),\r\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 0.0),\r\n ));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class PlanarSubdivision {\r\n /**\r\n * Create a graph from curves and precomputed intersections.\r\n * * Z-coordinates are ignored.\r\n * @param primitives input curves\r\n * @param allPairs array of curve-curve xy-intersections\r\n * @param mergeTolerance optional distance tolerance for clustering vertices. Default value is [[Geometry.smallMetricDistance]].\r\n */\r\n public static assembleHalfEdgeGraph(\r\n primitives: CurvePrimitive[],\r\n allPairs: CurveLocationDetailPair[],\r\n mergeTolerance: number = Geometry.smallMetricDistance,\r\n ): HalfEdgeGraph {\r\n // map from key CurvePrimitive to CurveLocationDetailPair\r\n const detailByPrimitive = new MapCurvePrimitiveToCurveLocationDetailPairArray();\r\n for (const pair of allPairs)\r\n detailByPrimitive.insertPair(pair);\r\n if (primitives.length > detailByPrimitive.primitiveToPair.size) {\r\n // otherwise, these single-primitive loops are missing from the graph\r\n detailByPrimitive.splitAndAppendMissingClosedPrimitives(primitives, mergeTolerance);\r\n }\r\n const graph = new HalfEdgeGraph();\r\n for (const entry of detailByPrimitive.primitiveToPair.entries()) {\r\n const p = entry[0];\r\n // convert each interval intersection into two isolated intersections\r\n const details = entry[1].reduce((accumulator: CurveLocationDetailPair[], detailPair) => {\r\n if (!detailPair.detailA.hasFraction1)\r\n return [...accumulator, detailPair];\r\n const detail = getDetailOnCurve(detailPair, p)!;\r\n const detail0 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction, detail.point);\r\n const detail1 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction1!, detail.point1!);\r\n return [\r\n ...accumulator,\r\n CurveLocationDetailPair.createCapture(detail0, detail0),\r\n CurveLocationDetailPair.createCapture(detail1, detail1),\r\n ];\r\n }, []);\r\n // lexical sort on p intersection fraction\r\n details.sort((pairA: CurveLocationDetailPair, pairB: CurveLocationDetailPair) => {\r\n const fractionA = getFractionOnCurve(pairA, p)!;\r\n const fractionB = getFractionOnCurve(pairB, p)!;\r\n return fractionA - fractionB;\r\n });\r\n let last = { point: p.startPoint(), fraction: 0.0 };\r\n for (const detailPair of details) {\r\n const detail = getDetailOnCurve(detailPair, p)!;\r\n const detailFraction = Geometry.restrictToInterval(detail.fraction, 0, 1); // truncate fraction, but don't snap point; clustering happens later\r\n last = this.addHalfEdge(graph, p, last.point, last.fraction, detail.point, detailFraction, mergeTolerance);\r\n }\r\n this.addHalfEdge(graph, p, last.point, last.fraction, p.endPoint(), 1.0, mergeTolerance);\r\n }\r\n // every edge got its sortAngle defined by addHalfEdge\r\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph, (he: HalfEdge) => he.sortAngle ?? 0, mergeTolerance);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Filter for trivial curve fragment: fast computation if line segment; otherwise clip, flatten, and measure.\r\n * * Different metrics are employed for expedience.\r\n */\r\n private static isCurveTrivialXY(p: CurvePrimitive, point0: Point3d, fraction0: number, point1: Point3d, fraction1: number, mergeTolerance: number): boolean {\r\n if (Geometry.isSmallRelative(fraction0 - fraction1))\r\n return true;\r\n if (!(p instanceof LineSegment3d)) {\r\n const p0 = p.clonePartialCurve(fraction0, fraction1);\r\n if (p0?.tryTransformInPlace(Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0))) // flatten\r\n return p0.curveLength() <= mergeTolerance; // Euclidean\r\n }\r\n return point0.isAlmostEqualXY(point1, mergeTolerance); // Manhattan\r\n }\r\n\r\n /**\r\n * Create a pair of mated half edges referencing a non-trivial interval of a primitive.\r\n * @param graph containing graph\r\n * @param p the curve\r\n * @param point0 start point\r\n * @param fraction0 starting fraction\r\n * @param point1 end point\r\n * @param fraction1 end fraction\r\n * @param mergeTolerance optional maximum xy-length of a trivial edge\r\n * @returns end point and fraction\r\n */\r\n private static addHalfEdge(\r\n graph: HalfEdgeGraph,\r\n p: CurvePrimitive,\r\n point0: Point3d,\r\n fraction0: number,\r\n point1: Point3d,\r\n fraction1: number,\r\n mergeTolerance: number = Geometry.smallMetricDistance,\r\n ): { point: Point3d, fraction: number } {\r\n if (!this.isCurveTrivialXY(p, point0, fraction0, point1, fraction1, mergeTolerance)) {\r\n const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);\r\n if (p.parent && p.parent instanceof RegionGroupMember && p.parent.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\r\n halfEdge.setMaskAroundEdge(HalfEdgeMask.BRIDGE_EDGE);\r\n const detail01 = CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);\r\n const mate = halfEdge.edgeMate;\r\n halfEdge.edgeTag = detail01;\r\n halfEdge.sortData = 1.0;\r\n mate.edgeTag = detail01;\r\n mate.sortData = -1.0;\r\n halfEdge.sortAngle = computeSortAngle(p, fraction0, false);\r\n mate.sortAngle = computeSortAngle(p, fraction1, true);\r\n }\r\n return { point: point1, fraction: fraction1 }; // where the next curve fragment starts\r\n }\r\n /**\r\n * Based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative,\r\n * or sliver loops.\r\n * @param zeroAreaTolerance absolute area tolerance for sliver face detection\r\n * @param isSliverFace whether the loop is known a priori (e.g., via topology) to have zero area\r\n * @returns the area (forced to zero if within tolerance)\r\n */\r\n public static collectSignedLoop(\r\n loop: Loop, outLoops: SignedLoops, zeroAreaTolerance: number = 1.0e-10, isSliverFace?: boolean,\r\n ): number {\r\n let area = isSliverFace ? 0.0 : RegionOps.computeXYArea(loop);\r\n if (area === undefined)\r\n area = 0;\r\n if (Math.abs(area) < zeroAreaTolerance)\r\n area = 0.0;\r\n (loop as any).computedAreaInPlanarSubdivision = area;\r\n if (area > 0)\r\n outLoops.positiveAreaLoops.push(loop);\r\n else if (area < 0)\r\n outLoops.negativeAreaLoops.push(loop);\r\n else\r\n outLoops.slivers.push(loop);\r\n return area;\r\n }\r\n /** Extract geometric info from a topological edge. */\r\n private static extractGeometryFromEdge(edge: HalfEdge): { detail: CurveLocationDetail, reversed: boolean } | undefined {\r\n if (edge.sortData !== undefined && edge.edgeTag && edge.edgeTag instanceof CurveLocationDetail) {\r\n const detail = edge.edgeTag;\r\n if (detail.curve && detail.fraction1 !== undefined) {\r\n const reversed = edge.sortData < 0;\r\n return { detail, reversed };\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Create the geometry for a topological edge. */\r\n private static createCurveInEdge(edge: HalfEdge, z?: number): CurvePrimitive | undefined {\r\n let result: CurvePrimitive | undefined;\r\n const info = this.extractGeometryFromEdge(edge);\r\n if (info && info.detail.curve && info.detail.fraction1) {\r\n const f0 = info.reversed ? info.detail.fraction1 : info.detail.fraction;\r\n const f1 = info.reversed ? info.detail.fraction : info.detail.fraction1;\r\n result = info.detail.curve.clonePartialCurve(f0, f1);\r\n if (result && z !== undefined)\r\n result.tryTransformInPlace(Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, z));\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a [[Loop]] for the given face or super face.\r\n * @param face a node in the face loop, or an array of HalfEdges that comprise a loop (e.g., a super face).\r\n * @param options bundle of options.\r\n * @returns the Loop, or `undefined` if it is not closed within xy-tolerance.\r\n */\r\n public static createLoopInFace(face: HalfEdge | HalfEdge[], options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | undefined {\r\n const consolidate = options?.announceEdge ? false : options?.compress ?? false; // can't compress if announcing\r\n const loop = Loop.create();\r\n const addEdgeCurve = (edge: HalfEdge): void => {\r\n const curve = this.createCurveInEdge(edge, options?.z);\r\n if (curve) {\r\n options?.announceEdge?.(edge, curve, loop);\r\n loop.tryAddChild(curve);\r\n }\r\n };\r\n if (Array.isArray(face))\r\n face.forEach(addEdgeCurve);\r\n else\r\n face.announceEdgesInFace(addEdgeCurve);\r\n if (consolidate) {\r\n const consolidateOptions = new ConsolidateAdjacentCurvePrimitivesOptions();\r\n consolidateOptions.consolidateLoopSeam = true;\r\n RegionOps.consolidateAdjacentPrimitives(loop, consolidateOptions);\r\n }\r\n if (loop.isPhysicallyClosedCurve(options?.closureTol, true))\r\n return loop;\r\n assert(() => false, \"face is not physically closed\");\r\n return undefined;\r\n }\r\n /**\r\n * Create a [[Loop]] or [[ParityRegion]] for the given face.\r\n * * A ParityRegion is created for a split-washer type face by removing bridge edges.\r\n * @param face a node in the face loop.\r\n * @param options bundle of options.\r\n * @returns the Loop or ParityRegion, or `undefined` if one could not be computed.\r\n */\r\n public static createLoopOrParityRegionInFace(face: HalfEdge, options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | ParityRegion | undefined {\r\n let region: AnyRegion | undefined;\r\n const visitMask = options?.visitMask ?? HalfEdgeMask.VISITED;\r\n const bridgeMask = options?.bridgeMask ?? HalfEdgeMask.BRIDGE_EDGE;\r\n let startBridgeEdge: HalfEdge | undefined;\r\n // is it a split-washer face?\r\n if (face.isSplitWasherFace(bridgeMask) && (startBridgeEdge = face.findMaskAroundFace(bridgeMask, true))) {\r\n const loops: Loop[] = [];\r\n const loopEdges: HalfEdge[] = [];\r\n const bridgeStack: HalfEdge[] = [startBridgeEdge];\r\n const announceEdge = (he: HalfEdge) => { he.setMask(visitMask); loopEdges.push(he); };\r\n const announceBridge = (he: HalfEdge) => { if (!he.isMaskSet(visitMask)) bridgeStack.push(he); };\r\n face.clearMaskAroundFace(visitMask);\r\n let bridge: HalfEdge | undefined;\r\n while (undefined !== (bridge = bridgeStack.pop())) {\r\n bridge.setMask(visitMask);\r\n const loopSeed = bridge.findMaskAroundFace(bridgeMask, false); // advance to next loop\r\n if (loopSeed) {\r\n if (loopSeed.isMaskSet(visitMask))\r\n continue;\r\n loopEdges.length = 0;\r\n if (loopSeed.announceEdgesInSuperFace(bridgeMask, announceEdge, announceBridge)) {\r\n const loop = this.createLoopInFace(loopEdges, options);\r\n if (loop) {\r\n loops.push(loop);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n region = RegionOps.sortOuterAndHoleLoopsXY(loops);\r\n region = RegionOps.simplifyRegion(region);\r\n } else {\r\n region = this.createLoopInFace(face, options);\r\n }\r\n return (region && (region instanceof Loop || region instanceof ParityRegion)) ? region : undefined;\r\n }\r\n /** Return true if there are only two edges in the face loop, and their start curvatures are the same. */\r\n private static isNullFace(he: HalfEdge): boolean {\r\n const faceHasTwoEdges = (he.faceSuccessor.faceSuccessor === he);\r\n let faceIsBanana = false;\r\n if (faceHasTwoEdges) {\r\n const c0 = HalfEdgeGraphMerge.curvatureSortKey(he);\r\n const c1 = HalfEdgeGraphMerge.curvatureSortKey(he.faceSuccessor.edgeMate);\r\n if (!Geometry.isSameCoordinate(c0, c1)) // default tol!\r\n faceIsBanana = true; // heuristic: we could also check end curvatures, and/or higher derivatives...\r\n }\r\n return faceHasTwoEdges && !faceIsBanana;\r\n }\r\n /** Look across edge mates (possibly several) for a non-null mate face. */\r\n private static getNonNullEdgeMate(_graph: HalfEdgeGraph, e: HalfEdge): HalfEdge | undefined {\r\n if (this.isNullFace(e))\r\n return undefined;\r\n let e1 = e.edgeMate;\r\n while (this.isNullFace(e1)) {\r\n e1 = e1.faceSuccessor.edgeMate;\r\n if (e1 === e)\r\n return undefined;\r\n }\r\n return e1;\r\n }\r\n public static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, zeroAreaTolerance: number = 1.0e-10): SignedLoops[] {\r\n const q = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\r\n const result: SignedLoops[] = [];\r\n const edgeMap = new Map<HalfEdge, LoopCurveLoopCurve>();\r\n for (const faceSeeds of q) {\r\n const componentAreas: SignedLoops = { positiveAreaLoops: [], negativeAreaLoops: [], slivers: [] };\r\n const edges: LoopCurveLoopCurve[] = [];\r\n for (const faceSeed of faceSeeds) {\r\n const isNullFace = this.isNullFace(faceSeed);\r\n const announceEdge = isNullFace ? undefined : (he: HalfEdge, curveC: CurvePrimitive, loopC: Loop) => {\r\n const mate = this.getNonNullEdgeMate(graph, he);\r\n if (mate !== undefined) {\r\n const e = edgeMap.get(mate);\r\n if (e === undefined) {\r\n // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge\r\n const e1 = new LoopCurveLoopCurve(loopC, curveC, undefined, undefined);\r\n edgeMap.set(he, e1);\r\n } else if (e instanceof LoopCurveLoopCurve) {\r\n e.setB(loopC, curveC);\r\n edges.push(e);\r\n edgeMap.delete(mate);\r\n }\r\n }\r\n };\r\n const loop = this.createLoopInFace(faceSeed, { announceEdge });\r\n if (loop)\r\n this.collectSignedLoop(loop, componentAreas, zeroAreaTolerance, isNullFace);\r\n }\r\n componentAreas.edges = edges;\r\n result.push(componentAreas);\r\n edgeMap.clear();\r\n }\r\n return result;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n*/\r\nexport namespace PlanarSubdivision {\r\n /** Options bundle for [[PlanarSubdivision.createLoopInFace]] and [[PlanarSubdivision.createLoopOrParityRegionInFace]]. */\r\n export interface CreateRegionInFaceOptions {\r\n /**\r\n * Optional callback invoked on each `edge` before its `curve` is added to `loop`.\r\n * * Note that if a [[ParityRegion]] is being constructed, `curve` and `loop` may subsequently be reversed.\r\n */\r\n announceEdge?: (edge: HalfEdge, curve: CurvePrimitive, loop: Loop) => void;\r\n /**\r\n * Whether to consolidate adjacent curves in an output [[Loop]]. Default value is `false`.\r\n * * If `announce` is defined, no compression is performed, as edges and curves would no longer be in 1-1 correspondence.\r\n */\r\n compress?: boolean;\r\n /** Absolute xy-distance for confirming a returned Loop is closed. Default value is [[Geometry.smallMetricDistance]]. */\r\n closureTol?: number;\r\n /**\r\n * Mask preset on bridge edges. Default value is `HalfEdgeMask.BRIDGE_EDGE`.\r\n * * This mask is used to distinguish a split-washer type face, which can result in a [[ParityRegion]].\r\n */\r\n bridgeMask?: HalfEdgeMask;\r\n /** Mask to use for visiting edges when creating a [[ParityRegion]] from a split-washer type face. Default value is `HalfEdgeMask.VISITED`. */\r\n visitMask?: HalfEdgeMask;\r\n /**\r\n * Optional z-coordinate for the result region.\r\n * * If undefined, graph z-coordinates are used, but this may result in a non-planar region if the graph is not planar!\r\n */\r\n z?: number;\r\n }\r\n}"]}