@itwin/core-geometry 5.1.0-dev.4 → 5.1.0-dev.41

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 (470) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/lib/cjs/Geometry.d.ts +12 -4
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +13 -3
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSpline1dNd.d.ts +1 -1
  7. package/lib/cjs/bspline/BSpline1dNd.js +1 -1
  8. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurve.js +7 -1
  11. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  12. package/lib/cjs/bspline/BSplineSurface.d.ts +4 -3
  13. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  14. package/lib/cjs/bspline/BSplineSurface.js +6 -5
  15. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  16. package/lib/cjs/clipping/ClipPlane.d.ts +7 -5
  17. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  18. package/lib/cjs/clipping/ClipPlane.js +9 -5
  19. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  20. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  21. package/lib/cjs/clipping/ClipUtils.js +5 -3
  22. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  23. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -2
  24. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  25. package/lib/cjs/clipping/ConvexClipPlaneSet.js +13 -25
  26. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  27. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  28. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  29. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  30. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  31. package/lib/cjs/core-geometry.d.ts +1 -0
  32. package/lib/cjs/core-geometry.d.ts.map +1 -1
  33. package/lib/cjs/core-geometry.js +1 -0
  34. package/lib/cjs/core-geometry.js.map +1 -1
  35. package/lib/cjs/curve/Arc3d.d.ts +54 -32
  36. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  37. package/lib/cjs/curve/Arc3d.js +56 -37
  38. package/lib/cjs/curve/Arc3d.js.map +1 -1
  39. package/lib/cjs/curve/CurveCollection.d.ts +33 -1
  40. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  41. package/lib/cjs/curve/CurveCollection.js +79 -0
  42. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  43. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  44. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  45. package/lib/cjs/curve/CurveLocationDetail.d.ts +25 -25
  46. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  47. package/lib/cjs/curve/CurveLocationDetail.js +25 -25
  48. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  49. package/lib/cjs/curve/CurvePrimitive.d.ts +2 -2
  50. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  51. package/lib/cjs/curve/CurveTypes.d.ts +1 -1
  52. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  53. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  54. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
  55. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  56. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +9 -5
  57. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  58. package/lib/cjs/curve/Query/PlanarSubdivision.js +27 -11
  59. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  60. package/lib/cjs/curve/RegionMomentsXY.d.ts +1 -0
  61. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  62. package/lib/cjs/curve/RegionMomentsXY.js +21 -39
  63. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  64. package/lib/cjs/curve/RegionOps.d.ts +55 -29
  65. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  66. package/lib/cjs/curve/RegionOps.js +96 -35
  67. package/lib/cjs/curve/RegionOps.js.map +1 -1
  68. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +27 -26
  69. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  70. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +70 -54
  71. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  72. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  73. package/lib/cjs/curve/StrokeOptions.js +1 -1
  74. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  75. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  77. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  78. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  79. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  81. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +0 -1
  82. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  83. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  84. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  85. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js +34 -0
  86. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  87. package/lib/cjs/geometry3d/AngleSweep.d.ts +24 -17
  88. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  89. package/lib/cjs/geometry3d/AngleSweep.js +31 -17
  90. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  91. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  92. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  93. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +19 -25
  94. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  95. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  96. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  97. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  98. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +7 -2
  99. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  100. package/lib/cjs/geometry3d/GrowableXYZArray.js +20 -2
  101. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  102. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +2 -1
  103. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  104. package/lib/cjs/geometry3d/IndexedXYZCollection.js +7 -3
  105. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  106. package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
  107. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/Plane3d.js +6 -1
  109. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  110. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  111. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  113. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  114. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  115. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  116. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  117. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  118. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  119. package/lib/cjs/geometry3d/Point2dVector2d.js +0 -2
  120. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  121. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
  122. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  123. package/lib/cjs/geometry3d/Point3dVector3d.js +4 -5
  124. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  125. package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
  126. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  127. package/lib/cjs/geometry3d/PointHelpers.js +66 -26
  128. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  129. package/lib/cjs/geometry3d/PolygonOps.d.ts +49 -2
  130. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  131. package/lib/cjs/geometry3d/PolygonOps.js +38 -2
  132. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  133. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  134. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  135. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  136. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  137. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
  138. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  139. package/lib/cjs/geometry3d/PolylineOps.js +5 -4
  140. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  141. package/lib/cjs/geometry3d/Range.d.ts +18 -10
  142. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  143. package/lib/cjs/geometry3d/Range.js +32 -10
  144. package/lib/cjs/geometry3d/Range.js.map +1 -1
  145. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  146. package/lib/cjs/geometry3d/Ray2d.js +0 -1
  147. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  148. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  149. package/lib/cjs/geometry3d/Ray3d.js +11 -23
  150. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  151. package/lib/cjs/geometry3d/Transform.d.ts +21 -2
  152. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  153. package/lib/cjs/geometry3d/Transform.js +32 -13
  154. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  155. package/lib/cjs/geometry4d/Point4d.d.ts +8 -5
  156. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  157. package/lib/cjs/geometry4d/Point4d.js +27 -16
  158. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  159. package/lib/cjs/numerics/BezierPolynomials.d.ts +2 -0
  160. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  161. package/lib/cjs/numerics/BezierPolynomials.js +11 -0
  162. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  163. package/lib/cjs/numerics/SmallSystem.d.ts +77 -36
  164. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  165. package/lib/cjs/numerics/SmallSystem.js +129 -73
  166. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  167. package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
  168. package/lib/cjs/polyface/FacetOrientation.js +1 -1
  169. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  170. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
  171. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  172. package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
  173. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  174. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  175. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  176. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
  177. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  178. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  179. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  180. package/lib/cjs/polyface/IndexedPolyfaceWalker.js +47 -32
  181. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  182. package/lib/cjs/polyface/Polyface.d.ts +19 -5
  183. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  184. package/lib/cjs/polyface/Polyface.js +18 -2
  185. package/lib/cjs/polyface/Polyface.js.map +1 -1
  186. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
  187. package/lib/cjs/polyface/PolyfaceBuilder.js +3 -3
  188. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  189. package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
  190. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  191. package/lib/cjs/polyface/PolyfaceClip.js +39 -42
  192. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  193. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  194. package/lib/cjs/polyface/PolyfaceData.js +1 -1
  195. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  196. package/lib/cjs/polyface/PolyfaceQuery.d.ts +119 -78
  197. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  198. package/lib/cjs/polyface/PolyfaceQuery.js +315 -231
  199. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  200. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  201. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  202. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
  203. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  204. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  205. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  206. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  207. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  208. package/lib/cjs/serialization/GeometrySamples.d.ts +1 -1
  209. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  210. package/lib/cjs/serialization/GeometrySamples.js +3 -3
  211. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  212. package/lib/cjs/serialization/IModelJsonSchema.d.ts +3 -3
  213. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  214. package/lib/cjs/solid/LinearSweep.d.ts +2 -3
  215. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  216. package/lib/cjs/solid/LinearSweep.js +2 -3
  217. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  218. package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
  219. package/lib/cjs/solid/RotationalSweep.js +2 -2
  220. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  221. package/lib/cjs/topology/ChainMerge.d.ts +1 -1
  222. package/lib/cjs/topology/ChainMerge.js +1 -1
  223. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  224. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +1 -0
  225. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  226. package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -0
  227. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  228. package/lib/cjs/topology/Merging.d.ts +0 -1
  229. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  230. package/lib/cjs/topology/Merging.js +49 -46
  231. package/lib/cjs/topology/Merging.js.map +1 -1
  232. package/lib/cjs/topology/Triangulation.d.ts +9 -14
  233. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  234. package/lib/cjs/topology/Triangulation.js +29 -22
  235. package/lib/cjs/topology/Triangulation.js.map +1 -1
  236. package/lib/esm/Geometry.d.ts +12 -4
  237. package/lib/esm/Geometry.d.ts.map +1 -1
  238. package/lib/esm/Geometry.js +13 -3
  239. package/lib/esm/Geometry.js.map +1 -1
  240. package/lib/esm/bspline/BSpline1dNd.d.ts +1 -1
  241. package/lib/esm/bspline/BSpline1dNd.js +1 -1
  242. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  243. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  244. package/lib/esm/bspline/BSplineCurve.js +7 -1
  245. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  246. package/lib/esm/bspline/BSplineSurface.d.ts +4 -3
  247. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  248. package/lib/esm/bspline/BSplineSurface.js +6 -5
  249. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  250. package/lib/esm/clipping/ClipPlane.d.ts +7 -5
  251. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  252. package/lib/esm/clipping/ClipPlane.js +9 -5
  253. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  254. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  255. package/lib/esm/clipping/ClipUtils.js +5 -3
  256. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  257. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -2
  258. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  259. package/lib/esm/clipping/ConvexClipPlaneSet.js +13 -25
  260. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  261. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  262. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  263. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  264. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  265. package/lib/esm/core-geometry.d.ts +1 -0
  266. package/lib/esm/core-geometry.d.ts.map +1 -1
  267. package/lib/esm/core-geometry.js +1 -0
  268. package/lib/esm/core-geometry.js.map +1 -1
  269. package/lib/esm/curve/Arc3d.d.ts +54 -32
  270. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  271. package/lib/esm/curve/Arc3d.js +56 -37
  272. package/lib/esm/curve/Arc3d.js.map +1 -1
  273. package/lib/esm/curve/CurveCollection.d.ts +33 -1
  274. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  275. package/lib/esm/curve/CurveCollection.js +79 -0
  276. package/lib/esm/curve/CurveCollection.js.map +1 -1
  277. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  278. package/lib/esm/curve/CurveFactory.js.map +1 -1
  279. package/lib/esm/curve/CurveLocationDetail.d.ts +25 -25
  280. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  281. package/lib/esm/curve/CurveLocationDetail.js +25 -25
  282. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  283. package/lib/esm/curve/CurvePrimitive.d.ts +2 -2
  284. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  285. package/lib/esm/curve/CurveTypes.d.ts +1 -1
  286. package/lib/esm/curve/CurveTypes.js.map +1 -1
  287. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  288. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
  289. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  290. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +9 -5
  291. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  292. package/lib/esm/curve/Query/PlanarSubdivision.js +27 -11
  293. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  294. package/lib/esm/curve/RegionMomentsXY.d.ts +1 -0
  295. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  296. package/lib/esm/curve/RegionMomentsXY.js +21 -39
  297. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  298. package/lib/esm/curve/RegionOps.d.ts +55 -29
  299. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  300. package/lib/esm/curve/RegionOps.js +96 -35
  301. package/lib/esm/curve/RegionOps.js.map +1 -1
  302. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +27 -26
  303. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  304. package/lib/esm/curve/RegionOpsClassificationSweeps.js +70 -54
  305. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  306. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  307. package/lib/esm/curve/StrokeOptions.js +1 -1
  308. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  309. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  310. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  311. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  312. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  313. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  314. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  315. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +0 -1
  316. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  317. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  318. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  319. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js +30 -0
  320. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  321. package/lib/esm/geometry3d/AngleSweep.d.ts +24 -17
  322. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  323. package/lib/esm/geometry3d/AngleSweep.js +31 -17
  324. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  325. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  326. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  327. package/lib/esm/geometry3d/CoincidentGeometryOps.js +19 -25
  328. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  329. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  330. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  331. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  332. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +7 -2
  333. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  334. package/lib/esm/geometry3d/GrowableXYZArray.js +20 -2
  335. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  336. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +2 -1
  337. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  338. package/lib/esm/geometry3d/IndexedXYZCollection.js +7 -3
  339. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  340. package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
  341. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  342. package/lib/esm/geometry3d/Plane3d.js +6 -1
  343. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  344. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  345. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  346. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  347. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  348. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  349. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  350. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  351. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  352. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  353. package/lib/esm/geometry3d/Point2dVector2d.js +0 -2
  354. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  355. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
  356. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  357. package/lib/esm/geometry3d/Point3dVector3d.js +4 -5
  358. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  359. package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
  360. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  361. package/lib/esm/geometry3d/PointHelpers.js +66 -26
  362. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  363. package/lib/esm/geometry3d/PolygonOps.d.ts +49 -2
  364. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  365. package/lib/esm/geometry3d/PolygonOps.js +38 -2
  366. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  367. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  368. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  369. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  370. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  371. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
  372. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  373. package/lib/esm/geometry3d/PolylineOps.js +5 -4
  374. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  375. package/lib/esm/geometry3d/Range.d.ts +18 -10
  376. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  377. package/lib/esm/geometry3d/Range.js +32 -10
  378. package/lib/esm/geometry3d/Range.js.map +1 -1
  379. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  380. package/lib/esm/geometry3d/Ray2d.js +0 -1
  381. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  382. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  383. package/lib/esm/geometry3d/Ray3d.js +11 -23
  384. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  385. package/lib/esm/geometry3d/Transform.d.ts +21 -2
  386. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  387. package/lib/esm/geometry3d/Transform.js +32 -13
  388. package/lib/esm/geometry3d/Transform.js.map +1 -1
  389. package/lib/esm/geometry4d/Point4d.d.ts +8 -5
  390. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  391. package/lib/esm/geometry4d/Point4d.js +27 -16
  392. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  393. package/lib/esm/numerics/BezierPolynomials.d.ts +2 -0
  394. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  395. package/lib/esm/numerics/BezierPolynomials.js +11 -0
  396. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  397. package/lib/esm/numerics/SmallSystem.d.ts +77 -36
  398. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  399. package/lib/esm/numerics/SmallSystem.js +129 -73
  400. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  401. package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
  402. package/lib/esm/polyface/FacetOrientation.js +1 -1
  403. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  404. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
  405. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  406. package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
  407. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  408. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  409. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  410. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
  411. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  412. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  413. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  414. package/lib/esm/polyface/IndexedPolyfaceWalker.js +47 -32
  415. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  416. package/lib/esm/polyface/Polyface.d.ts +19 -5
  417. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  418. package/lib/esm/polyface/Polyface.js +18 -2
  419. package/lib/esm/polyface/Polyface.js.map +1 -1
  420. package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
  421. package/lib/esm/polyface/PolyfaceBuilder.js +3 -3
  422. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  423. package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
  424. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  425. package/lib/esm/polyface/PolyfaceClip.js +39 -42
  426. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  427. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  428. package/lib/esm/polyface/PolyfaceData.js +1 -1
  429. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  430. package/lib/esm/polyface/PolyfaceQuery.d.ts +119 -78
  431. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  432. package/lib/esm/polyface/PolyfaceQuery.js +316 -232
  433. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  434. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  435. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  436. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
  437. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  438. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  439. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  440. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  441. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  442. package/lib/esm/serialization/GeometrySamples.d.ts +1 -1
  443. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  444. package/lib/esm/serialization/GeometrySamples.js +3 -3
  445. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  446. package/lib/esm/serialization/IModelJsonSchema.d.ts +3 -3
  447. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  448. package/lib/esm/solid/LinearSweep.d.ts +2 -3
  449. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  450. package/lib/esm/solid/LinearSweep.js +2 -3
  451. package/lib/esm/solid/LinearSweep.js.map +1 -1
  452. package/lib/esm/solid/RotationalSweep.d.ts +2 -2
  453. package/lib/esm/solid/RotationalSweep.js +2 -2
  454. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  455. package/lib/esm/topology/ChainMerge.d.ts +1 -1
  456. package/lib/esm/topology/ChainMerge.js +1 -1
  457. package/lib/esm/topology/ChainMerge.js.map +1 -1
  458. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +1 -0
  459. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  460. package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -0
  461. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  462. package/lib/esm/topology/Merging.d.ts +0 -1
  463. package/lib/esm/topology/Merging.d.ts.map +1 -1
  464. package/lib/esm/topology/Merging.js +49 -46
  465. package/lib/esm/topology/Merging.js.map +1 -1
  466. package/lib/esm/topology/Triangulation.d.ts +9 -14
  467. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  468. package/lib/esm/topology/Triangulation.js +29 -22
  469. package/lib/esm/topology/Triangulation.js.map +1 -1
  470. package/package.json +3 -3
@@ -12,10 +12,9 @@ import { XAndY } from "../geometry3d/XYZProps";
12
12
  import { SolidPrimitive } from "./SolidPrimitive";
13
13
  import { SweepContour } from "./SweepContour";
14
14
  /**
15
- * A LinearSweep is a `SolidPrimitive` defined by
16
- * * A set of curves (any Loop, Path, or parityRegion)
15
+ * A LinearSweep is a `SolidPrimitive` defined by:
16
+ * * A set of curves (any Loop, Path, or parityRegion). If the object is "capped", the curves must be planar.
17
17
  * * A sweep vector
18
- * If the object is "capped", the curves must be planar.
19
18
  * @public
20
19
  */
21
20
  export declare class LinearSweep extends SolidPrimitive {
@@ -1 +1 @@
1
- {"version":3,"file":"LinearSweep.d.ts","sourceRoot":"","sources":["../../../src/solid/LinearSweep.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;GAMG;AACH,qBAAa,WAAY,SAAQ,cAA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KAAK,IAAI,WAAW;IAG3B;;;OAGG;IACI,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAUzD;;;;OAIG;IACI,oBAAoB,IAAI,SAAS,GAAG,SAAS;IAGpD;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS;IAItE,uDAAuD;IACvC,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAQ5D,8DAA8D;IACvD,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAG/D;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAMvE,uDAAuD;IAChD,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;IAahE;;OAEG;IACH,IAAW,cAAc,IAAI,OAAO,CAEnC;CACF"}
@@ -14,10 +14,9 @@ const Transform_1 = require("../geometry3d/Transform");
14
14
  const SolidPrimitive_1 = require("./SolidPrimitive");
15
15
  const SweepContour_1 = require("./SweepContour");
16
16
  /**
17
- * A LinearSweep is a `SolidPrimitive` defined by
18
- * * A set of curves (any Loop, Path, or parityRegion)
17
+ * A LinearSweep is a `SolidPrimitive` defined by:
18
+ * * A set of curves (any Loop, Path, or parityRegion). If the object is "capped", the curves must be planar.
19
19
  * * A sweep vector
20
- * If the object is "capped", the curves must be planar.
21
20
  * @public
22
21
  */
23
22
  class LinearSweep extends SolidPrimitive_1.SolidPrimitive {
@@ -1 +1 @@
1
- {"version":3,"file":"LinearSweep.js","sourceRoot":"","sources":["../../../src/solid/LinearSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,wDAAqD;AACrD,wCAAqC;AACrC,wCAAqC;AAErC,mEAAyD;AACzD,yDAAsD;AAEtD,uDAAoD;AAEpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;;GAMG;AACH,MAAa,WAAY,SAAQ,+BAAc;IAC7C,wCAA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YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,CAAC;QACD,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;IAC7D,CAAC;CACF;AAnID,kCAmIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { Path } from \"../curve/Path\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XAndY } from \"../geometry3d/XYZProps\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A LinearSweep is a `SolidPrimitive` defined by\n * * A set of curves (any Loop, Path, or parityRegion)\n * * A sweep vector\n * If the object is \"capped\", the curves must be planar.\n * @public\n */\nexport class LinearSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"linearSweep\";\n\n private _contour: SweepContour;\n private _direction: Vector3d;\n\n private constructor(contour: SweepContour, direction: Vector3d, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._direction = direction;\n }\n /**\n * Create a sweep of a starting contour.\n * @param contour contour to be swept, CAPTURED\n * @param direction sweep vector. The contour is swept the full length of the vector.\n * @param capped true to include end caps\n */\n public static create(contour: AnyCurve, direction: Vector3d, capped: boolean): LinearSweep | undefined {\n const sweepable = SweepContour.createForLinearSweep(contour, direction);\n if (!sweepable)\n return undefined;\n return new LinearSweep(sweepable, direction, capped);\n }\n /** Create a z-direction sweep of the polyline or polygon given as xy linestring values.\n * * If not capped, the xyPoints array is always used unchanged.\n * * If capped but the xyPoints array does not close, exact closure will be enforced by one of these:\n * * * If the final point is almost equal to the first, it is replaced by the exact first point.\n * * * if the final point is not close to the first an extra point is added.\n * * If capped, the point order will be reversed if necessary to produce positive volume.\n * @param xyPoints array of xy coordinates\n * @param z z value to be used for all coordinates\n * @param zSweep the sweep distance in the z direction.\n * @param capped true if caps are to be added.\n */\n public static createZSweep(xyPoints: XAndY[], z: number, zSweep: number, capped: boolean): LinearSweep | undefined {\n const xyz = LineString3d.createXY(xyPoints, z, capped);\n if (capped) {\n xyz.addClosurePoint();\n const area = PolygonOps.areaXY(xyz.points);\n if (area * zSweep < 0.0)\n xyz.points.reverse();\n }\n const contour: CurveCollection = capped ? Loop.create(xyz) : Path.create(xyz);\n return LinearSweep.create(contour, Vector3d.create(0, 0, zSweep), capped);\n }\n /** get a reference to the swept curves */\n public getCurvesRef(): CurveCollection { return this._contour.curves; }\n /** Get a reference to the `SweepContour` carrying the plane of the curves */\n public getSweepContourRef(): SweepContour { return this._contour; }\n /** return a clone of the sweep vector */\n public cloneSweepVector(): Vector3d { return this._direction.clone(); }\n /** Test if `other` is also an instance of `LinearSweep` */\n public isSameGeometryClass(other: any): boolean { return other instanceof LinearSweep; }\n /** Return a deep clone */\n public clone(): LinearSweep {\n return new LinearSweep(this._contour.clone(), this._direction.clone(), this.capped);\n }\n /**\n * Apply a transform to the curves and sweep vector\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n transform.multiplyVector(this._direction, this._direction);\n return true;\n }\n return false;\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin on base contour\n * * x, y directions from base contour.\n * * z direction perpendicular\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._contour.localToWorld.cloneRigid();\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): LinearSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Test for near-equality of coordinates in `other` */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof LinearSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._direction.isAlmostEqual(other._direction)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Invoke strongly typed `handler.handleLinearSweep(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleLinearSweep(this);\n }\n /**\n * Return the curves at a fraction along the sweep direction.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section && vFraction !== 0.0)\n section.tryTransformInPlace(Transform.createTranslation(this._direction.scale(vFraction)));\n return section;\n }\n /** Extend `rangeToExtend` to include this geometry. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\n const contourRange = this._contour.curves.range(transform);\n rangeToExtend.extendRange(contourRange);\n if (transform) {\n const transformedDirection = transform.multiplyVector(this._direction);\n contourRange.low.addInPlace(transformedDirection);\n contourRange.high.addInPlace(transformedDirection);\n } else {\n contourRange.low.addInPlace(this._direction);\n contourRange.high.addInPlace(this._direction);\n }\n rangeToExtend.extendRange(contourRange);\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped && this._contour.curves.isAnyRegionType;\n }\n}\n"]}
1
+ {"version":3,"file":"LinearSweep.js","sourceRoot":"","sources":["../../../src/sol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MAAM,oBAAoB,GAAG,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACvE,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;YAClD,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,CAAC;QACD,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;IAC7D,CAAC;CACF;AAnID,kCAmIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { Path } from \"../curve/Path\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XAndY } from \"../geometry3d/XYZProps\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A LinearSweep is a `SolidPrimitive` defined by:\n * * A set of curves (any Loop, Path, or parityRegion). If the object is \"capped\", the curves must be planar.\n * * A sweep vector\n * @public\n */\nexport class LinearSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"linearSweep\";\n\n private _contour: SweepContour;\n private _direction: Vector3d;\n\n private constructor(contour: SweepContour, direction: Vector3d, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._direction = direction;\n }\n /**\n * Create a sweep of a starting contour.\n * @param contour contour to be swept, CAPTURED\n * @param direction sweep vector. The contour is swept the full length of the vector.\n * @param capped true to include end caps\n */\n public static create(contour: AnyCurve, direction: Vector3d, capped: boolean): LinearSweep | undefined {\n const sweepable = SweepContour.createForLinearSweep(contour, direction);\n if (!sweepable)\n return undefined;\n return new LinearSweep(sweepable, direction, capped);\n }\n /** Create a z-direction sweep of the polyline or polygon given as xy linestring values.\n * * If not capped, the xyPoints array is always used unchanged.\n * * If capped but the xyPoints array does not close, exact closure will be enforced by one of these:\n * * * If the final point is almost equal to the first, it is replaced by the exact first point.\n * * * if the final point is not close to the first an extra point is added.\n * * If capped, the point order will be reversed if necessary to produce positive volume.\n * @param xyPoints array of xy coordinates\n * @param z z value to be used for all coordinates\n * @param zSweep the sweep distance in the z direction.\n * @param capped true if caps are to be added.\n */\n public static createZSweep(xyPoints: XAndY[], z: number, zSweep: number, capped: boolean): LinearSweep | undefined {\n const xyz = LineString3d.createXY(xyPoints, z, capped);\n if (capped) {\n xyz.addClosurePoint();\n const area = PolygonOps.areaXY(xyz.points);\n if (area * zSweep < 0.0)\n xyz.points.reverse();\n }\n const contour: CurveCollection = capped ? Loop.create(xyz) : Path.create(xyz);\n return LinearSweep.create(contour, Vector3d.create(0, 0, zSweep), capped);\n }\n /** get a reference to the swept curves */\n public getCurvesRef(): CurveCollection { return this._contour.curves; }\n /** Get a reference to the `SweepContour` carrying the plane of the curves */\n public getSweepContourRef(): SweepContour { return this._contour; }\n /** return a clone of the sweep vector */\n public cloneSweepVector(): Vector3d { return this._direction.clone(); }\n /** Test if `other` is also an instance of `LinearSweep` */\n public isSameGeometryClass(other: any): boolean { return other instanceof LinearSweep; }\n /** Return a deep clone */\n public clone(): LinearSweep {\n return new LinearSweep(this._contour.clone(), this._direction.clone(), this.capped);\n }\n /**\n * Apply a transform to the curves and sweep vector\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n transform.multiplyVector(this._direction, this._direction);\n return true;\n }\n return false;\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin on base contour\n * * x, y directions from base contour.\n * * z direction perpendicular\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._contour.localToWorld.cloneRigid();\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): LinearSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Test for near-equality of coordinates in `other` */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof LinearSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._direction.isAlmostEqual(other._direction)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Invoke strongly typed `handler.handleLinearSweep(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleLinearSweep(this);\n }\n /**\n * Return the curves at a fraction along the sweep direction.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section && vFraction !== 0.0)\n section.tryTransformInPlace(Transform.createTranslation(this._direction.scale(vFraction)));\n return section;\n }\n /** Extend `rangeToExtend` to include this geometry. */\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\n const contourRange = this._contour.curves.range(transform);\n rangeToExtend.extendRange(contourRange);\n if (transform) {\n const transformedDirection = transform.multiplyVector(this._direction);\n contourRange.low.addInPlace(transformedDirection);\n contourRange.high.addInPlace(transformedDirection);\n } else {\n contourRange.low.addInPlace(this._direction);\n contourRange.high.addInPlace(this._direction);\n }\n rangeToExtend.extendRange(contourRange);\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped && this._contour.curves.isAnyRegionType;\n }\n}\n"]}
@@ -12,8 +12,8 @@ import { Transform } from "../geometry3d/Transform";
12
12
  import { SolidPrimitive } from "./SolidPrimitive";
13
13
  import { SweepContour } from "./SweepContour";
14
14
  /**
15
- * A RotationalSweep is
16
- * * A planar contour (any Loop, Path, or parityRegion).
15
+ * A RotationalSweep is:
16
+ * * A planar contour (any Loop, Path, or parityRegion)
17
17
  * * An axis vector.
18
18
  * * The planar contour is expected to be in the plane of the axis vector.
19
19
  * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.
@@ -13,8 +13,8 @@ const Transform_1 = require("../geometry3d/Transform");
13
13
  const SolidPrimitive_1 = require("./SolidPrimitive");
14
14
  const SweepContour_1 = require("./SweepContour");
15
15
  /**
16
- * A RotationalSweep is
17
- * * A planar contour (any Loop, Path, or parityRegion).
16
+ * A RotationalSweep is:
17
+ * * A planar contour (any Loop, Path, or parityRegion)
18
18
  * * An axis vector.
19
19
  * * The planar contour is expected to be in the plane of the axis vector.
20
20
  * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.
@@ -1 +1 @@
1
- {"version":3,"file":"RotationalSweep.js","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,0DAAuD;AACvD,0CAAkD;AAClD,+CAA4C;AAE5C,qDAAkD;AAGlD,uDAAoD;AACpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;;;;GAQG;AACH,MAAa,eAAgB,SAAQ,+BAAc;IACjD,wCAAwC;IACxB,kBAAkB,GAAG,iBAAiB,CAAC;IAE/C,QAAQ,CAAe;IACvB,eAAe,CAAQ;IACvB,WAAW,CAAQ;IAC3B,YAAoB,OAAqB,EAA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AmJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A RotationalSweep is\n * * A planar contour (any Loop, Path, or parityRegion).\n * * An axis vector.\n * * The planar contour is expected to be in the plane of the axis vector.\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\n * * A sweep angle.\n * @public\n */\nexport class RotationalSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"rotationalSweep\";\n\n private _contour: SweepContour;\n private _normalizedAxis: Ray3d;\n private _sweepAngle: Angle;\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._normalizedAxis = normalizedAxis;\n this._sweepAngle = sweepAngle;\n }\n /**\n * Create a rotational sweep.\n * @param contour profile to sweep, coplanar with axis (CAPTURED).\n * @param axis rotation axis.\n * @param sweepAngle signed angular sweep.\n * @param capped whether to cap the surface to make a solid.\n */\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\n if (!axis.direction.normalizeInPlace())\n return undefined;\n const sweepable = SweepContour.createForRotation(contour, axis);\n if (!sweepable)\n return undefined;\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\n }\n /**\n * Return a coordinate frame (right handed unit vectors).\n * * origin at origin of rotation ray.\n * * z direction along the rotation ray.\n * * y direction perpendicular to the base contour plane.\n */\n public getConstructiveFrame(): Transform | undefined {\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\n if (axes) {\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\n }\n return undefined;\n }\n /** Return clone of (not reference to) the axis vector. */\n public cloneAxisRay(): Ray3d {\n return this._normalizedAxis.clone();\n }\n /** Return (REFERENCE TO) the swept curves. */\n public getCurves(): CurveCollection {\n return this._contour.curves;\n }\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\n public getSweepContourRef(): SweepContour {\n return this._contour;\n }\n /** Return the sweep angle. */\n public getSweep(): Angle {\n return this._sweepAngle.clone();\n }\n /** Test if `other` is a `RotationalSweep` */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof RotationalSweep;\n }\n /** Test for same axis, capping, and swept geometry. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RotationalSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\n && this._sweepAngle.isAlmostEqual(other._sweepAngle)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Return a deep clone */\n public clone(): RotationalSweep {\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\n }\n /**\n * Transform the contour and axis.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n this._normalizedAxis.transformInPlace(transform);\n if (transform.matrix.determinant() < 0.0)\n this._sweepAngle.setRadians(-this._sweepAngle.radians);\n return this._normalizedAxis.direction.normalizeInPlace();\n }\n return false;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RotationalSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRotationalSweep(this);\n }\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\n const radians = this._sweepAngle.radians * vFraction;\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\n result ? result.matrix : undefined) as Matrix3d);\n return rotation;\n }\n /**\n * Return the curves of a constant-v section of the solid.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section) {\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\n }\n return section;\n }\n /** Extend range using sampled points on the surface. */\n public extendRange(range: Range3d, transform?: Transform) {\n const degreeStep = 360 / 32;\n const options = StrokeOptions.createForCurves();\n options.angleTol = Angle.createDegrees(degreeStep);\n const strokes = this._contour.curves.cloneStroked(options);\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\n const stepTransform = Transform.createIdentity();\n if (transform) {\n const compositeTransform = Transform.createIdentity();\n for (let i = 0; i <= numStep; i++) {\n transform.multiplyTransformTransform(\n this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform,\n );\n strokes.extendRange(range, compositeTransform);\n }\n } else {\n for (let i = 0; i <= numStep; i++)\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\n }\n }\n /** Specify if the sweep forms a closed volume. */\n public get isClosedVolume(): boolean {\n return this.capped || this._sweepAng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C,KAAK,EAAE,kBAAkB,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE;gBAC/B,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IACD,kDAAkD;IAClD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;IACtD,CAAC;CACF;AAnJD,0CAmJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A RotationalSweep is:\n * * A planar contour (any Loop, Path, or parityRegion)\n * * An axis vector.\n * * The planar contour is expected to be in the plane of the axis vector.\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\n * * A sweep angle.\n * @public\n */\nexport class RotationalSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"rotationalSweep\";\n\n private _contour: SweepContour;\n private _normalizedAxis: Ray3d;\n private _sweepAngle: Angle;\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._normalizedAxis = normalizedAxis;\n this._sweepAngle = sweepAngle;\n }\n /**\n * Create a rotational sweep.\n * @param contour profile to sweep, coplanar with axis (CAPTURED).\n * @param axis rotation axis.\n * @param sweepAngle signed angular sweep.\n * @param capped whether to cap the surface to make a solid.\n */\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\n if (!axis.direction.normalizeInPlace())\n return undefined;\n const sweepable = SweepContour.createForRotation(contour, axis);\n if (!sweepable)\n return undefined;\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\n }\n /**\n * Return a coordinate frame (right handed unit vectors).\n * * origin at origin of rotation ray.\n * * z direction along the rotation ray.\n * * y direction perpendicular to the base contour plane.\n */\n public getConstructiveFrame(): Transform | undefined {\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\n if (axes) {\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\n }\n return undefined;\n }\n /** Return clone of (not reference to) the axis vector. */\n public cloneAxisRay(): Ray3d {\n return this._normalizedAxis.clone();\n }\n /** Return (REFERENCE TO) the swept curves. */\n public getCurves(): CurveCollection {\n return this._contour.curves;\n }\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\n public getSweepContourRef(): SweepContour {\n return this._contour;\n }\n /** Return the sweep angle. */\n public getSweep(): Angle {\n return this._sweepAngle.clone();\n }\n /** Test if `other` is a `RotationalSweep` */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof RotationalSweep;\n }\n /** Test for same axis, capping, and swept geometry. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RotationalSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\n && this._sweepAngle.isAlmostEqual(other._sweepAngle)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Return a deep clone */\n public clone(): RotationalSweep {\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\n }\n /**\n * Transform the contour and axis.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n this._normalizedAxis.transformInPlace(transform);\n if (transform.matrix.determinant() < 0.0)\n this._sweepAngle.setRadians(-this._sweepAngle.radians);\n return this._normalizedAxis.direction.normalizeInPlace();\n }\n return false;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RotationalSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRotationalSweep(this);\n }\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\n const radians = this._sweepAngle.radians * vFraction;\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\n result ? result.matrix : undefined) as Matrix3d);\n return rotation;\n }\n /**\n * Return the curves of a constant-v section of the solid.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section) {\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\n }\n return section;\n }\n /** Extend range using sampled points on the surface. */\n public extendRange(range: Range3d, transform?: Transform) {\n const degreeStep = 360 / 32;\n const options = StrokeOptions.createForCurves();\n options.angleTol = Angle.createDegrees(degreeStep);\n const strokes = this._contour.curves.cloneStroked(options);\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\n const stepTransform = Transform.createIdentity();\n if (transform) {\n const compositeTransform = Transform.createIdentity();\n for (let i = 0; i <= numStep; i++) {\n transform.multiplyTransformTransform(\n this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform,\n );\n strokes.extendRange(range, compositeTransform);\n }\n } else {\n for (let i = 0; i <= numStep; i++)\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\n }\n }\n /** Specify if the sweep forms a closed volume. */\n public get isClosedVolume(): boolean {\n return this.capped || this._sweepAngle.isFullCircle;\n }\n}\n"]}
@@ -110,7 +110,7 @@ export declare class ChainMergeContext {
110
110
  * * Return the number of excisions.
111
111
  */
112
112
  private exciseAndMarkSlingEdges;
113
- /** Collect chains which have maximum edge count, broken at an vertex with other than 2 edges.
113
+ /** Collect chains which have maximum edge count, broken at vertices with more than 2 edges.
114
114
  * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`
115
115
  */
116
116
  collectMaximalChains(): LineString3d[];
@@ -250,7 +250,7 @@ class ChainMergeContext {
250
250
  }
251
251
  return n;
252
252
  }
253
- /** Collect chains which have maximum edge count, broken at an vertex with other than 2 edges.
253
+ /** Collect chains which have maximum edge count, broken at vertices with more than 2 edges.
254
254
  * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`
255
255
  */
256
256
  collectMaximalChains() {
@@ -1 +1 @@
1
- {"version":3,"file":"ChainMerge.js","sourceRoot":"","sources":["../../../src/topology/ChainMerge.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,wDAAqD;AACrD,0CAA+D;AAC/D,qEAAkE;AAClE,mEAAkE;AAClE,mCAAgE;AAChE,uCAA6C;AAoB7C,oGAAoG;AACpG,MAAM,iCAAiC;IACrC;;OAEG;IACI,SAAS,CAAS;IACzB;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AAE,CAAC;YAC7C,IAAI,CAAC,uCAAuC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACM,+BAA+B;QACpC,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,oBAAY,CAAC,OAAO,CAAC;QACvC,6CAA6C;QAC7C,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC,2FAA2F;QAC3F,yDAAyD;QACzD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpD,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;QACD,+CAA+C;QAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjOD,8CAiOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\n\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\nimport { HalfEdgeGraphOps } from \"./Merging\";\n\n/**\n * interface containing various options appropriate to merging lines segments into chains.\n * @internal\n */\nexport interface ChainMergeContextOptions {\n /**\n * Tolerance for declaring points equal\n * * Default is `Geometry.smallMetricDistance`\n */\n tolerance?: number;\n /**\n * Direction for primary sort.\n * * Default is `Vector3d.create(0.294234298, 0.72391399, 0.45234328798)`\n * * this vector should NOT be along a principal x,y,z direction.\n * * The internal form will be normalized.\n */\n primarySortDirection?: Vector3d;\n}\n/** Internal form of ChainMergeContextOptions -- same field names, but required to have contents. */\nclass ChainMergeContextValidatedOptions {\n /**\n * Tolerance for declaring points equal.\n */\n public tolerance: number;\n /** UNNORMALIZED base vector for sorting.\n * * Actual vector hoisted into an instance is normalized.\n */\n private static readonly _defaultPrimarySortDirection = Vector3d.create(0.294234298, 0.72391399, 0.45234328798);\n /**\n * Direction for primary sort. This is normalized !!!\n */\n public primarySortDirection: Vector3d;\n /** return a unit vector aligned with optional direction.\n * * Default return is into the first quadrant at a quirky angle so any perpendicular plane is unlikely to hit many points\n */\n public static createPrimarySortVector(vector?: Vector3d): Vector3d {\n if (vector === undefined) {\n vector = this._defaultPrimarySortDirection.clone();\n }\n return vector.normalizeWithDefault(\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.x,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.y,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.z);\n }\n /**\n * PRIVATE constructor -- assumes all inputs are validated in public create method !!!!\n * @param tolerance\n * @param unitVectorForPrimarySort\n */\n private constructor(tolerance: number, unitVectorForPrimarySort: Vector3d) {\n this.tolerance = tolerance;\n this.primarySortDirection = unitVectorForPrimarySort;\n }\n /** return the default option set. */\n public static createFromUnValidated(options?: ChainMergeContextOptions): ChainMergeContextValidatedOptions {\n const result = new ChainMergeContextValidatedOptions(Geometry.smallMetricDistance, ChainMergeContextValidatedOptions.createPrimarySortVector());\n if (options !== undefined) {\n if (options.tolerance !== undefined)\n result.tolerance = options.tolerance;\n if (options.primarySortDirection !== undefined)\n result.primarySortDirection = ChainMergeContextValidatedOptions.createPrimarySortVector();\n }\n return result;\n }\n /** Clone this context. */\n public clone(): ChainMergeContextValidatedOptions {\n return new ChainMergeContextValidatedOptions(this.tolerance, this.primarySortDirection);\n }\n}\n/**\n * * Context for assembling line segments into chains.\n * * Use the context in phases:\n * * Create the context: `context = ChainMergeContext.create ()`\n * * Add line with any combination of:\n * * `context.addSegment(pointA, pointB)`\n * * `context.addLineSegment3dArray (segments)`\n * * Scan all coordinate data for common coordinates. Twist nodes together to form chains:\n * * `context.clusterAndMergeVerticesXYZ ()`\n * * Collect the chains:\n * * myLinestringArray = context.collectMaximalChains();\n * * The context carries an optional plane which is used by addSegmentsOnPlane\n *\n * @internal\n */\nexport class ChainMergeContext {\n\n private _graph: HalfEdgeGraph;\n private _options: ChainMergeContextValidatedOptions;\n private _plane?: PlaneAltitudeEvaluator;\n private _convexClipper?: ConvexClipPlaneSet;\n private constructor(options: ChainMergeContextValidatedOptions) {\n this._graph = new HalfEdgeGraph();\n this._options = options;\n }\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set plane(value: PlaneAltitudeEvaluator | undefined) { this._plane = value; }\n /** Property access for the reference plane. */\n public get plane(): PlaneAltitudeEvaluator | undefined { return this._plane; }\n\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set convexClipper(value: ConvexClipPlaneSet | undefined) { this._convexClipper = value; }\n /** Property access for the reference plane. */\n public get convexClipper(): ConvexClipPlaneSet | undefined { return this._convexClipper; }\n\n /**\n * * Construct an empty chain merge graph.\n * * The options parameter may contain any combination of the options values.\n * * tolerance = absolute tolerance for declaring points equal.\n * * Default is `Geometry.smallMetricDistance`\n * * primarySortDirection = direction for first sort.\n * * To minimize clash among points on primary sort, this should NOT be perpendicular to any principal plane.\n * * The default points into the first octant with non-obvious components.\n */\n public static create(options?: ChainMergeContextOptions): ChainMergeContext {\n const validatedOptions = ChainMergeContextValidatedOptions.createFromUnValidated(options);\n return new ChainMergeContext(validatedOptions);\n }\n /** Add a segment to the evolving graph. */\n public addSegment(pointA: Point3d, pointB: Point3d) {\n this._graph.createEdgeXYZXYZ(pointA.x, pointA.y, pointA.z, 0, pointB.x, pointB.y, pointB.z, 0);\n }\n /** Add all segments from an array to the graph. */\n public addLineSegment3dArray(data: LineSegment3d[]) {\n for (const segment of data) {\n this.addSegment(segment.point0Ref, segment.point1Ref);\n }\n }\n /** Add edges for all segments that are \"on\" the plane.\n * * No action if `this.plane` is undefined.\n */\n public addSegmentsOnPlane(points: GrowableXYZArray, addClosure: boolean = false) {\n if (!this._plane)\n return;\n const plane = this._plane;\n let i0 = addClosure ? points.length - 1 : 0;\n let a0 = points.evaluateUncheckedIndexPlaneAltitude(i0, plane);\n let i1 = addClosure ? 0 : 1;\n let a1;\n for (; i1 < points.length; i0 = i1++ , a0 = a1) {\n a1 = points.evaluateUncheckedIndexPlaneAltitude(i1, plane);\n if (Geometry.isSmallMetricDistance(a0) && Geometry.isSmallMetricDistance(a1))\n this._graph.createEdgeXYZXYZ(\n points.getXAtUncheckedPointIndex(i0), points.getYAtUncheckedPointIndex(i0), points.getZAtUncheckedPointIndex(i0), 0,\n points.getXAtUncheckedPointIndex(i1), points.getYAtUncheckedPointIndex(i1), points.getZAtUncheckedPointIndex(i1), 0);\n }\n }\n /**\n * Return a numeric value to be used for sorting, with little chance widely separated nodes will have identical key.\n * * Any single x,y,z component is a poor choice because horizontal and vertical alignment is common.\n * * Hence take dot product of x,y,z with non-trivial fraction values.\n * @param node node with x,y,z coordinates\n */\n private primarySortKey(node: HalfEdge): number {\n return this._options.primarySortDirection.dotProductXYZ(node.x, node.y, node.z);\n }\n /** Return difference of sortData members as sort comparison */\n private static nodeCompareSortData(nodeA: HalfEdge, nodeB: HalfEdge): number {\n return nodeA.sortData! - nodeB.sortData!;\n }\n /** test if nodeA is a dangling edge end (i.e. edges around vertex equal 1, but detect it without walking all the way around. */\n private static isIsolatedEnd(nodeA: HalfEdge): boolean {\n return nodeA.vertexSuccessor === nodeA;\n }\n\n /** test if nodeA is at a vertex with exactly 2 edges (i.e. edges around vertex equal w, but detect it without walking all the way around. */\n private static isChainInteriorVertex(nodeA: HalfEdge): boolean {\n const nodeB = nodeA.vertexSuccessor;\n return nodeB !== nodeA && nodeB.vertexSuccessor === nodeA;\n }\n\n /**\n * * isolate all edge ends.\n * * perform cluster analysis to determine nearly coincident points.\n * * pinch all edges together at each vertex.\n */\n public clusterAndMergeVerticesXYZ() {\n HalfEdgeGraphOps.isolateAllEdges(this._graph);\n for (const p of this._graph.allHalfEdges) {\n p.sortData = this.primarySortKey(p);\n }\n const sortArray = this._graph.allHalfEdges.slice();\n sortArray.sort((nodeA, nodeB) => ChainMergeContext.nodeCompareSortData(nodeA, nodeB));\n const xyzTolerance = this._options.tolerance;\n // A node is unvisited if it is its own vertex successor !!!\n // otherwise the node has already been twisted into a base vertex.\n const n = sortArray.length;\n for (let i0 = 0; i0 < n; i0++) {\n const node0 = sortArray[i0];\n const qMin = node0.sortData!;\n const qMax = qMin + xyzTolerance;\n if (ChainMergeContext.isIsolatedEnd(node0)) {\n for (let i1 = i0 + 1; i1 < n; i1++) {\n const node1 = sortArray[i1];\n if (ChainMergeContext.isIsolatedEnd(node1)) {\n if (node1.sortData! > qMax)\n break;\n if (node0.distanceXYZ(node1) <= xyzTolerance) {\n HalfEdge.pinch(node0, node1);\n node1.setXYZFrom(node0); // force true equal coordinates.\n }\n }\n }\n }\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalLineString3dFromStartNode(chains: LineString3d[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const ls = LineString3d.create();\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n chains.push(ls);\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalGrowableXYXArrayFromStartNode(result: GrowableXYZArray[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const points = new GrowableXYZArray();\n points.pushXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n points.pushXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n if (points.length > 0)\n result.push(points);\n }\n }\n\n /**\n * * find edges with start, end in same vertex loop.\n * * pinch them away from the loop\n * * set mask on both sides.\n * * Return the number of excisions.\n */\n private exciseAndMarkSlingEdges(mask: HalfEdgeMask): number {\n let n = 0;\n for (const p of this._graph.allHalfEdges) {\n if (p.distanceXYZ(p.edgeMate) < this._options.tolerance\n && !p.isMaskSet(mask)) {\n const q = p.edgeMate;\n HalfEdge.pinch(p, p.vertexPredecessor);\n HalfEdge.pinch(q, q.vertexPredecessor);\n p.setMask(mask);\n q.setMask(mask);\n n++;\n }\n }\n return n;\n }\n /** Collect chains which have maximum edge count, broken at an vertex with other than 2 edges.\n * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`\n */\n public collectMaximalChains(): LineString3d[] {\n const result: LineString3d[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n public collectMaximalGrowableXYZArrays(): GrowableXYZArray[] {\n const result: GrowableXYZArray[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"ChainMerge.js","sourceRoot":"","sources":["../../../src/topology/ChainMerge.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,wDAAqD;AACrD,0CAA+D;AAC/D,qEAAkE;AAClE,mEAAkE;AAClE,mCAAgE;AAChE,uCAA6C;AAoB7C,oGAAoG;AACpG,MAAM,iCAAiC;IACrC;;OAEG;IACI,SAAS,CAAS;IACzB;;OAEG;IACK,MAAM,CAAU,4BAA4B,GAAG,0BAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAC/G;;OAEG;IACI,oBAAoB,CAAW;IACtC;;OAEG;IACI,MAAM,CAAC,uBAAuB,CAAC,MAAiB;QACrD,IAAI,MAAM,KAAK,SAAS,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AAO,CAAC;QACvC,6CAA6C;QAC7C,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC,2FAA2F;QAC3F,yDAAyD;QACzD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpD,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;QACD,+CAA+C;QAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjOD,8CAiOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\n\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\nimport { HalfEdgeGraphOps } from \"./Merging\";\n\n/**\n * interface containing various options appropriate to merging lines segments into chains.\n * @internal\n */\nexport interface ChainMergeContextOptions {\n /**\n * Tolerance for declaring points equal\n * * Default is `Geometry.smallMetricDistance`\n */\n tolerance?: number;\n /**\n * Direction for primary sort.\n * * Default is `Vector3d.create(0.294234298, 0.72391399, 0.45234328798)`\n * * this vector should NOT be along a principal x,y,z direction.\n * * The internal form will be normalized.\n */\n primarySortDirection?: Vector3d;\n}\n/** Internal form of ChainMergeContextOptions -- same field names, but required to have contents. */\nclass ChainMergeContextValidatedOptions {\n /**\n * Tolerance for declaring points equal.\n */\n public tolerance: number;\n /** UNNORMALIZED base vector for sorting.\n * * Actual vector hoisted into an instance is normalized.\n */\n private static readonly _defaultPrimarySortDirection = Vector3d.create(0.294234298, 0.72391399, 0.45234328798);\n /**\n * Direction for primary sort. This is normalized !!!\n */\n public primarySortDirection: Vector3d;\n /** return a unit vector aligned with optional direction.\n * * Default return is into the first quadrant at a quirky angle so any perpendicular plane is unlikely to hit many points\n */\n public static createPrimarySortVector(vector?: Vector3d): Vector3d {\n if (vector === undefined) {\n vector = this._defaultPrimarySortDirection.clone();\n }\n return vector.normalizeWithDefault(\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.x,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.y,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.z);\n }\n /**\n * PRIVATE constructor -- assumes all inputs are validated in public create method !!!!\n * @param tolerance\n * @param unitVectorForPrimarySort\n */\n private constructor(tolerance: number, unitVectorForPrimarySort: Vector3d) {\n this.tolerance = tolerance;\n this.primarySortDirection = unitVectorForPrimarySort;\n }\n /** return the default option set. */\n public static createFromUnValidated(options?: ChainMergeContextOptions): ChainMergeContextValidatedOptions {\n const result = new ChainMergeContextValidatedOptions(Geometry.smallMetricDistance, ChainMergeContextValidatedOptions.createPrimarySortVector());\n if (options !== undefined) {\n if (options.tolerance !== undefined)\n result.tolerance = options.tolerance;\n if (options.primarySortDirection !== undefined)\n result.primarySortDirection = ChainMergeContextValidatedOptions.createPrimarySortVector();\n }\n return result;\n }\n /** Clone this context. */\n public clone(): ChainMergeContextValidatedOptions {\n return new ChainMergeContextValidatedOptions(this.tolerance, this.primarySortDirection);\n }\n}\n/**\n * * Context for assembling line segments into chains.\n * * Use the context in phases:\n * * Create the context: `context = ChainMergeContext.create ()`\n * * Add line with any combination of:\n * * `context.addSegment(pointA, pointB)`\n * * `context.addLineSegment3dArray (segments)`\n * * Scan all coordinate data for common coordinates. Twist nodes together to form chains:\n * * `context.clusterAndMergeVerticesXYZ ()`\n * * Collect the chains:\n * * myLinestringArray = context.collectMaximalChains();\n * * The context carries an optional plane which is used by addSegmentsOnPlane\n *\n * @internal\n */\nexport class ChainMergeContext {\n\n private _graph: HalfEdgeGraph;\n private _options: ChainMergeContextValidatedOptions;\n private _plane?: PlaneAltitudeEvaluator;\n private _convexClipper?: ConvexClipPlaneSet;\n private constructor(options: ChainMergeContextValidatedOptions) {\n this._graph = new HalfEdgeGraph();\n this._options = options;\n }\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set plane(value: PlaneAltitudeEvaluator | undefined) { this._plane = value; }\n /** Property access for the reference plane. */\n public get plane(): PlaneAltitudeEvaluator | undefined { return this._plane; }\n\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set convexClipper(value: ConvexClipPlaneSet | undefined) { this._convexClipper = value; }\n /** Property access for the reference plane. */\n public get convexClipper(): ConvexClipPlaneSet | undefined { return this._convexClipper; }\n\n /**\n * * Construct an empty chain merge graph.\n * * The options parameter may contain any combination of the options values.\n * * tolerance = absolute tolerance for declaring points equal.\n * * Default is `Geometry.smallMetricDistance`\n * * primarySortDirection = direction for first sort.\n * * To minimize clash among points on primary sort, this should NOT be perpendicular to any principal plane.\n * * The default points into the first octant with non-obvious components.\n */\n public static create(options?: ChainMergeContextOptions): ChainMergeContext {\n const validatedOptions = ChainMergeContextValidatedOptions.createFromUnValidated(options);\n return new ChainMergeContext(validatedOptions);\n }\n /** Add a segment to the evolving graph. */\n public addSegment(pointA: Point3d, pointB: Point3d) {\n this._graph.createEdgeXYZXYZ(pointA.x, pointA.y, pointA.z, 0, pointB.x, pointB.y, pointB.z, 0);\n }\n /** Add all segments from an array to the graph. */\n public addLineSegment3dArray(data: LineSegment3d[]) {\n for (const segment of data) {\n this.addSegment(segment.point0Ref, segment.point1Ref);\n }\n }\n /** Add edges for all segments that are \"on\" the plane.\n * * No action if `this.plane` is undefined.\n */\n public addSegmentsOnPlane(points: GrowableXYZArray, addClosure: boolean = false) {\n if (!this._plane)\n return;\n const plane = this._plane;\n let i0 = addClosure ? points.length - 1 : 0;\n let a0 = points.evaluateUncheckedIndexPlaneAltitude(i0, plane);\n let i1 = addClosure ? 0 : 1;\n let a1;\n for (; i1 < points.length; i0 = i1++ , a0 = a1) {\n a1 = points.evaluateUncheckedIndexPlaneAltitude(i1, plane);\n if (Geometry.isSmallMetricDistance(a0) && Geometry.isSmallMetricDistance(a1))\n this._graph.createEdgeXYZXYZ(\n points.getXAtUncheckedPointIndex(i0), points.getYAtUncheckedPointIndex(i0), points.getZAtUncheckedPointIndex(i0), 0,\n points.getXAtUncheckedPointIndex(i1), points.getYAtUncheckedPointIndex(i1), points.getZAtUncheckedPointIndex(i1), 0);\n }\n }\n /**\n * Return a numeric value to be used for sorting, with little chance widely separated nodes will have identical key.\n * * Any single x,y,z component is a poor choice because horizontal and vertical alignment is common.\n * * Hence take dot product of x,y,z with non-trivial fraction values.\n * @param node node with x,y,z coordinates\n */\n private primarySortKey(node: HalfEdge): number {\n return this._options.primarySortDirection.dotProductXYZ(node.x, node.y, node.z);\n }\n /** Return difference of sortData members as sort comparison */\n private static nodeCompareSortData(nodeA: HalfEdge, nodeB: HalfEdge): number {\n return nodeA.sortData! - nodeB.sortData!;\n }\n /** test if nodeA is a dangling edge end (i.e. edges around vertex equal 1, but detect it without walking all the way around. */\n private static isIsolatedEnd(nodeA: HalfEdge): boolean {\n return nodeA.vertexSuccessor === nodeA;\n }\n\n /** test if nodeA is at a vertex with exactly 2 edges (i.e. edges around vertex equal w, but detect it without walking all the way around. */\n private static isChainInteriorVertex(nodeA: HalfEdge): boolean {\n const nodeB = nodeA.vertexSuccessor;\n return nodeB !== nodeA && nodeB.vertexSuccessor === nodeA;\n }\n\n /**\n * * isolate all edge ends.\n * * perform cluster analysis to determine nearly coincident points.\n * * pinch all edges together at each vertex.\n */\n public clusterAndMergeVerticesXYZ() {\n HalfEdgeGraphOps.isolateAllEdges(this._graph);\n for (const p of this._graph.allHalfEdges) {\n p.sortData = this.primarySortKey(p);\n }\n const sortArray = this._graph.allHalfEdges.slice();\n sortArray.sort((nodeA, nodeB) => ChainMergeContext.nodeCompareSortData(nodeA, nodeB));\n const xyzTolerance = this._options.tolerance;\n // A node is unvisited if it is its own vertex successor !!!\n // otherwise the node has already been twisted into a base vertex.\n const n = sortArray.length;\n for (let i0 = 0; i0 < n; i0++) {\n const node0 = sortArray[i0];\n const qMin = node0.sortData!;\n const qMax = qMin + xyzTolerance;\n if (ChainMergeContext.isIsolatedEnd(node0)) {\n for (let i1 = i0 + 1; i1 < n; i1++) {\n const node1 = sortArray[i1];\n if (ChainMergeContext.isIsolatedEnd(node1)) {\n if (node1.sortData! > qMax)\n break;\n if (node0.distanceXYZ(node1) <= xyzTolerance) {\n HalfEdge.pinch(node0, node1);\n node1.setXYZFrom(node0); // force true equal coordinates.\n }\n }\n }\n }\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalLineString3dFromStartNode(chains: LineString3d[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const ls = LineString3d.create();\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n chains.push(ls);\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalGrowableXYXArrayFromStartNode(result: GrowableXYZArray[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const points = new GrowableXYZArray();\n points.pushXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n points.pushXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n if (points.length > 0)\n result.push(points);\n }\n }\n\n /**\n * * find edges with start, end in same vertex loop.\n * * pinch them away from the loop\n * * set mask on both sides.\n * * Return the number of excisions.\n */\n private exciseAndMarkSlingEdges(mask: HalfEdgeMask): number {\n let n = 0;\n for (const p of this._graph.allHalfEdges) {\n if (p.distanceXYZ(p.edgeMate) < this._options.tolerance\n && !p.isMaskSet(mask)) {\n const q = p.edgeMate;\n HalfEdge.pinch(p, p.vertexPredecessor);\n HalfEdge.pinch(q, q.vertexPredecessor);\n p.setMask(mask);\n q.setMask(mask);\n n++;\n }\n }\n return n;\n }\n /** Collect chains which have maximum edge count, broken at vertices with more than 2 edges.\n * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`\n */\n public collectMaximalChains(): LineString3d[] {\n const result: LineString3d[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n public collectMaximalGrowableXYZArrays(): GrowableXYZArray[] {\n const result: GrowableXYZArray[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n}\n"]}
@@ -44,6 +44,7 @@ export declare class HalfEdgeGraphSearch {
44
44
  static collectFaceAreaSummary(source: HalfEdgeGraph | HalfEdge[], collectAllNodes?: boolean, areaFunction?: NodeToNumberFunction): SignedDataSummary<HalfEdge>;
45
45
  /**
46
46
  * Search the graph for the face with the most negative area.
47
+ * * If the graph has exactly one connected component, this is its outer face.
47
48
  * @param oneCandidateNodePerFace graph or an array containing one node from each face to be considered.
48
49
  * @returns node on the negative area face with largest absolute area, or `undefined` if no negative area face.
49
50
  */
@@ -1 +1 @@
1
- {"version":3,"file":"HalfEdgeGraphSearch.d.ts","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,yBAAyB,EAAgB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/H,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAChC;AACD;;;GAGG;AACH,q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AmC,CAC/C,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,yBAAyB,EACzC,sBAAsB,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChE,IAAI;IAoBP;;;;;;;;;OASG;WACW,mCAAmC,CAAC,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,GAAG,QAAQ,EAAE,EAAE;CAkBlH"}
@@ -69,6 +69,7 @@ class HalfEdgeGraphSearch {
69
69
  }
70
70
  /**
71
71
  * Search the graph for the face with the most negative area.
72
+ * * If the graph has exactly one connected component, this is its outer face.
72
73
  * @param oneCandidateNodePerFace graph or an array containing one node from each face to be considered.
73
74
  * @returns node on the negative area face with largest absolute area, or `undefined` if no negative area face.
74
75
  */
@@ -1 +1 @@
1
- {"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,+CAA8C;AAC9C,mCAA+H;AAC/H,2DAAwD;AACxD,mEAAgE;AAWhE;;;GAGG;AACH,MAAa,kBAAkB;IACrB,WAAW,CAAe;IAC1B,YAAY,CAAU;IAC9B;;;;OAIG;IACH,YAAmB,IAAkB,EAAE,cAAuB,IAAI;QAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IACD,0EAA0E;IACnE,QAAQ,CAAC,IAAc;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC;IAChE,CAAC;CACF;AAhBD,gDAgBC;AACD;;;GAGG;AACH,MAAa,mBAAmB;IAC9B;;;;OAIG;IACI,MAAM,CAAC,cAAc,CAAC,IAAc;QACzC,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;IAC/B,C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QACH,CAAC;IACH,CAAC;IACD;;;;;;;;;OASG;IACI,MAAM,CAAC,mCAAmC,CAAC,KAAoB,EAAE,YAA0B;QAChG,+EAA+E;QAC/E,MAAM,KAAK,GAAiB,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,cAAc,GAAG,CAAC,IAAc,EAAW,EAAE;YACjD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvF,CAAC,CAAC;QACF,MAAM,sBAAsB,GAAG,CAAC,IAAc,EAAE,OAAe,EAAE,EAAE;YACjE,IAAI,OAAO,KAAK,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACtC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;QACpG,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAvZD,kDAuZC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\nimport { Range1d } from \"../geometry3d/Range\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeFunction, NodeToNumberFunction } from \"./Graph\";\nimport { SignedDataSummary } from \"./SignedDataSummary\";\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\n\n// cspell:word internaldocs\n\n/**\n * Interface for an object that executes boolean tests on edges.\n * @internal\n */\nexport interface HalfEdgeTestObject {\n testEdge(h: HalfEdge): boolean;\n}\n/**\n * Class to test match of half edge mask.\n * @internal\n */\nexport class HalfEdgeMaskTester {\n private _targetMask: HalfEdgeMask;\n private _targetValue: boolean;\n /**\n * Constructor\n * @param mask mask to test in `testEdge` function\n * @param targetValue value to match for true return\n */\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\n this._targetMask = mask;\n this._targetValue = targetValue;\n }\n /** Return true if the value of the targetMask matches the targetValue. */\n public testEdge(edge: HalfEdge): boolean {\n return edge.isMaskSet(this._targetMask) === this._targetValue;\n }\n}\n/**\n * Class for different types of searches for HalfEdgeGraph.\n * @internal\n */\nexport class HalfEdgeGraphSearch {\n /**\n * Static method for face area computation -- useful as function parameter in `collectFaceAreaSummary`.\n * * This simply calls `node.signedFaceArea()`\n * @param node instance for signedFaceArea call.\n */\n public static signedFaceArea(node: HalfEdge): number {\n return node.signedFaceArea();\n }\n /**\n * Return a summary of face data (e.g., area) as computed by the callback on the faces of the graph.\n * * Callers with curved edge graphs must supply their own area function.\n * @param source graph or array of nodes to examine.\n * @param collectAllNodes flag to pass to the `SignedDataSummary` constructor to control collection of nodes.\n * @param areaFunction function to obtain area (or other numeric value). Default computes polygonal face area.\n */\n public static collectFaceAreaSummary(\n source: HalfEdgeGraph | HalfEdge[],\n collectAllNodes: boolean = false,\n areaFunction: NodeToNumberFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node),\n ): SignedDataSummary<HalfEdge> {\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\n let allFaces: HalfEdge[];\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n for (const node of allFaces) {\n const area = areaFunction(node);\n result.announceItem(node, area);\n }\n return result;\n }\n /**\n * Search the graph for the face with the most negative area.\n * @param oneCandidateNodePerFace graph or an array containing one node from each face to be considered.\n * @returns node on the negative area face with largest absolute area, or `undefined` if no negative area face.\n */\n public static findMinimumAreaFace(\n oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[], faceAreaFunction?: NodeToNumberFunction,\n ): HalfEdge | undefined {\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\n return summary.largestNegativeItem;\n }\n /**\n * Test if the graph is triangulated.\n * * Return `false` if:\n * * number of positive area faces with more than 3 edges is larger than `numPositiveExceptionsAllowed`.\n * * graph has more than 1 negative area face when `allowMultipleNegativeAreaFaces` is `false`.\n * * 2-edge faces are ignored.\n */\n public static isTriangulatedCCW(\n source: HalfEdgeGraph | HalfEdge[],\n allowMultipleNegativeAreaFaces: boolean = true,\n numPositiveExceptionsAllowed: number = 0,\n ): boolean {\n let allFaces: HalfEdge[];\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n let numNegative = 0;\n let numPositiveExceptions = 0;\n for (const node of allFaces) {\n const numEdges = node.countEdgesAroundFace();\n if (numEdges >= 3) {\n const area = node.signedFaceArea();\n if (area > 0) {\n if (numEdges > 3) {\n numPositiveExceptions++;\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\n return false;\n }\n } else {\n numNegative++;\n if (numNegative > 1) {\n if (!allowMultipleNegativeAreaFaces)\n return false;\n }\n }\n }\n }\n return true;\n }\n /**\n * Process a face during graph traversal.\n * @param faceSeed a node in the face.\n * @param mask mask to set on each node of the face.\n * @param allNodeStack array appended with each node of the face.\n * @param onePerFaceStack array appended with `faceSeed`.\n */\n private static pushAndMaskAllNodesInFace(\n faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[],\n ): void {\n onePerFaceStack.push(faceSeed);\n faceSeed.collectAroundFace((node: HalfEdge) => {\n node.setMask(mask);\n allNodeStack.push(node);\n });\n }\n /**\n * Traverse (via Depth First Search) to all accessible faces from the given seed.\n * @param faceSeed first node to start the traverse.\n * @param visitMask mask applied to all faces as visited.\n * @param parityEdgeTester function to test if an edge is adjacent to two faces of opposite parity, e.g., a boundary\n * edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not supplied and `parityMask`\n * is supplied, the default parity rule is to alternate parity state in a \"bullseye\" pattern starting at the seed face,\n * with each successive concentric ring of faces at constant topological distance from the seed face receiving the\n * opposite parity state of the previous ring.\n * @param parityMask mask to apply to the first face and faces that share the same parity as the first face, as\n * determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If (non-null) parity mask\n * is given, on return it is entirely set or entirely clear around each face.\n * @returns an array that contains one representative node in each face of the connected component.\n */\n private static parityFloodFromSeed(\n faceSeed: HalfEdge,\n visitMask: HalfEdgeMask,\n parityEdgeTester: HalfEdgeTestObject | undefined,\n parityMask: HalfEdgeMask,\n ): HalfEdge[] {\n const faces: HalfEdge[] = [];\n if (faceSeed.isMaskSet(visitMask))\n return faces; // empty array\n const allMasks = parityMask | visitMask;\n const stack: HalfEdge[] = [];\n // the seed face is arbitrarily assigned the parity mask\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(faceSeed, allMasks, stack, faces);\n while (stack.length > 0) {\n const p = stack.pop()!;\n const mate = p.edgeMate;\n if (!mate)\n continue;\n if (!mate.isMaskSet(visitMask)) {\n let newState = p.isMaskSet(parityMask);\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\n newState = !newState;\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\n }\n }\n return faces;\n }\n /**\n * * Correct the parity mask in the faces of a component.\n * * It is assumed that the parity mask is applied _consistently_ throughout the supplied faces, but maybe\n * not _correctly_.\n * * A consistently applied parity mask is \"correct\" if it is set on the negative area (\"exterior\") face of\n * a connected component.\n * * This method finds a face with negative area and toggles the mask throughout the input faces if this face\n * lacks the parity mask.\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\n */\n private static correctParityInSingleComponent(parityMask: HalfEdgeMask, faces: HalfEdge[]): void {\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\n if (!exteriorHalfEdge) {\n // graph has all degenerate faces; do nothing\n } else if (exteriorHalfEdge.isMaskSet(parityMask)) {\n // all should be well; nothing to do\n } else {\n for (const faceSeed of faces) {\n if (faceSeed.isMaskSet(parityMask)) {\n faceSeed.clearMaskAroundFace(parityMask);\n } else {\n faceSeed.setMaskAroundFace(parityMask);\n }\n }\n }\n }\n /** Apply `correctParityInSingleComponent` to each array in components (quick exit if `parityMask` is `NULL_MASK`). */\n private static correctParityInComponentArrays(parityMask: HalfEdgeMask, components: HalfEdge[][]): void {\n if (parityMask === HalfEdgeMask.NULL_MASK)\n return;\n for (const facesInComponent of components)\n HalfEdgeGraphSearch.correctParityInSingleComponent(parityMask, facesInComponent);\n }\n /**\n * Collect connected components of the graph (via Depth First Search).\n * @param graph graph to inspect.\n * @param parityEdgeTester (optional) function to test if an edge is adjacent to two faces of opposite parity,\n * e.g., a boundary edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not\n * supplied and `parityMask` is supplied, the default parity rule is to alternate parity state in a \"bullseye\"\n * pattern starting at the seed face, with each successive concentric ring of faces at constant topological\n * distance from the seed face receiving the opposite parity state of the previous ring.\n * @param parityMask (optional) mask to apply to the first face and faces that share the same parity as the\n * first face, as determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If\n * (non-null) parity mask is given, on return it is entirely set or entirely clear around each face.\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\n */\n public static collectConnectedComponentsWithExteriorParityMasks(\n graph: HalfEdgeGraph,\n parityEdgeTester: HalfEdgeTestObject | undefined,\n parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK,\n ): HalfEdge[][] {\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\n const components = [];\n const visitMask = HalfEdgeMask.VISITED;\n const allMasks = parityMask | visitMask;\n graph.clearMask(allMasks);\n for (const faceSeed of graph.allHalfEdges) {\n if (!faceSeed.isMaskSet(visitMask)) {\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\n // parityFloodFromSeed does not return an empty array because it is called on an unvisited faceSeed\n components.push(newFaces);\n }\n }\n HalfEdgeGraphSearch.correctParityInComponentArrays(parityMask, components);\n return components;\n }\n /**\n * Breadth First Search through connected component of a graph.\n * @param component vector of nodes, one per face.\n * @param seed seed node in component.\n * @param visitMask mask to apply to visited nodes. Assumed cleared throughout component.\n * @param ignoreMask (optional) mask preset on faces to ignore. Default value is `HalfEdgeMask.EXTERIOR` to\n * ignore exterior faces. Pass `HalfEdgeMask.NULL_MASK` to process all faces.\n * @param maxFaceCount (optional) maximum number of faces in the component. Should be positive; otherwise\n * `Infinity` is used.\n * @returns node at which to start next component if maximum face count exceeded, or undefined.\n */\n private static exploreComponent(\n component: HalfEdge[],\n seed: HalfEdge,\n visitMask: HalfEdgeMask,\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\n maxFaceCount: number = Infinity,\n ): HalfEdge | undefined {\n if (maxFaceCount <= 0)\n maxFaceCount = Infinity;\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\n let numFaces = 0;\n const candidates: HalfEdge[] = []; // the queue\n candidates.push(seed);\n while (candidates.length !== 0 && numFaces < maxFaceCount) {\n // shift is O(n) and may be inefficient for large queues; if needed, we can replace\n // queue by circular array or implement the queue using 2 stacks; both are O(1)\n const node = candidates.shift()!;\n if (node.isMaskSet(boundaryMask))\n continue;\n component.push(node);\n ++numFaces;\n const enqueueNeighboringFaces: NodeFunction = (heNode: HalfEdge) => {\n heNode.setMask(visitMask);\n const neighbor = heNode.vertexSuccessor;\n if (!neighbor.isMaskSet(boundaryMask))\n candidates.push(neighbor);\n };\n node.collectAroundFace(enqueueNeighboringFaces);\n }\n if (candidates.length === 0)\n return undefined;\n else {\n const front = candidates[0];\n while (candidates.length !== 0) {\n // try to find a node at the boundary of both the geometry and previous component\n const node = candidates.shift()!; // shift may be inefficient for large queues\n if (node.vertexSuccessor.isMaskSet(ignoreMask))\n return node;\n if (node.edgeMate.isMaskSet(ignoreMask))\n return node;\n }\n return front;\n }\n }\n /**\n * Collect connected components of the graph (via Breadth First Search).\n * @param graph graph to inspect.\n * @param maxFaceCount (optional) maximum number of faces in each component. Should be positive; otherwise\n * `Infinity` is used.\n * @param ignoreMask (optional) mask preset on faces to ignore. Default value is `HalfEdgeMask.EXTERIOR` to ignore\n * exterior faces. Pass `HalfEdgeMask.NULL_MASK` to process all faces.\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\n */\n public static collectConnectedComponents(\n graph: HalfEdgeGraph,\n maxFaceCount: number = Infinity,\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\n ): HalfEdge[][] {\n const components: HalfEdge[][] = [];\n if (graph.countMask(ignoreMask) === 0)\n ignoreMask = HalfEdgeMask.NULL_MASK;\n const visitMask = HalfEdgeMask.VISITED;\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\n // Starting with the input node, look ahead for a boundary face. Failing that, return the input node.\n // Starting all floods at the boundary reduces the chance of ending up with a ring-shaped component at the boundary.\n const findNextFloodSeed = (index: number) => {\n for (let i = index; i < graph.countNodes(); ++i) {\n if (!graph.allHalfEdges[i].isMaskSet(boundaryMask)\n && graph.allHalfEdges[i].edgeMate.isMaskSet(boundaryMask)) {\n index = i;\n break;\n }\n }\n return index;\n };\n for (let i = 0; i < graph.countNodes(); ++i) {\n if (graph.allHalfEdges[i].isMaskSet(boundaryMask))\n continue;\n const i0 = findNextFloodSeed(i);\n let seed: HalfEdge | undefined = graph.allHalfEdges[i0];\n do { // flood this component\n const component: HalfEdge[] = [];\n seed = HalfEdgeGraphSearch.exploreComponent(component, seed, visitMask, ignoreMask, maxFaceCount);\n if (component.length !== 0)\n components.push(component);\n } while (seed !== undefined);\n if (!graph.allHalfEdges[i].isMaskSet(visitMask))\n --i; // reprocess this node\n }\n return components;\n }\n /**\n * Test if test point (xTest,yTest) is inside/outside a face or on an edge.\n * @param seedNode any node on the face loop.\n * @param xTest x coordinate of the test point.\n * @param yTest y coordinate of the test point.\n * @returns 0 if ON, 1 if IN, -1 if OUT.\n */\n public static pointInOrOnFaceXY(seedNode: HalfEdge, xTest: number, yTest: number): number | undefined {\n const context = new XYParitySearchContext(xTest, yTest);\n // walk around looking for an accepted node to start the search (seedNode is usually ok)\n let nodeA = seedNode;\n let nodeB = seedNode.faceSuccessor;\n for (; ; nodeA = nodeB) {\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\n break;\n if (nodeB === seedNode) {\n // the test point and the face are all on line \"y = yTest\"\n const range = Range1d.createXX(nodeB.x, nodeB.faceSuccessor.x);\n return range.containsX(xTest) ? 0 : -1;\n }\n nodeB = nodeA.faceSuccessor;\n }\n // nodeB is the real start node for search, so stop when we revisit it. For each edge, accumulate parity and hits\n let nodeC = nodeB.faceSuccessor;\n for (; ;) {\n if (!context.advance(nodeC.x, nodeC.y)) {\n return context.classifyCounts();\n }\n if (nodeC === nodeB)\n break;\n nodeC = nodeC.faceSuccessor;\n }\n return context.classifyCounts();\n }\n /**\n * Collect boundary edges starting from `seed`.\n * * If `seed` is not a boundary node or is already visited, the function exists early.\n * @param seed start node.\n * @param visitMask mask to set on processed nodes.\n * @param isBoundaryEdge function to test if an edge in a boundary edge.\n * @param announceEdgeInBoundary callback invoked on each edge in the boundary loop in order. The counter is zero\n * for the first edge, and incremented with each successive edge.\n */\n public static collectExtendedBoundaryLoopFromSeed(\n seed: HalfEdge,\n visitMask: HalfEdgeMask,\n isBoundaryEdge: HalfEdgeToBooleanFunction,\n announceEdgeInBoundary: (edge: HalfEdge, counter: number) => void,\n ): void {\n let counter = 0;\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\n announceEdgeInBoundary(seed, counter++);\n seed.setMask(visitMask);\n const vertexBase = seed.faceSuccessor;\n let candidateAroundVertex = vertexBase;\n for (; ;) {\n if (candidateAroundVertex.getMask(visitMask)) // end of boundary loop\n return;\n if (isBoundaryEdge(candidateAroundVertex)) {\n seed = candidateAroundVertex;\n break;\n }\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\n if (candidateAroundVertex === vertexBase)\n break; // prevent infinite loop in case exteriorMask is not set on the edge mate of the boundary edge\n }\n }\n }\n /**\n * Collect boundary edges in the graph.\n * * A boundary edge is defined by `exteriorMask` being set on only its \"exterior\" edge mate.\n * * Each boundary edge is identified in the output by its edge mate that lacks `exteriorMask`.\n * * Each inner array is ordered in the output so that its boundary edges form a connected path. If `exteriorMask`\n * is preset consistently around each \"exterior\" face, these paths are loops.\n * @param graph the graph to query\n * @param exteriorMask mask preset on exactly one side of boundary edges\n * @returns array of boundary loops, each loop an array of the unmasked mates of boundary edges\n */\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\n const loops: HalfEdge[][] = [];\n const visitMask = graph.grabMask(true);\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\n };\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\n if (counter === 0)\n loops.push([]);\n loops[loops.length - 1].push(edge);\n };\n for (const seed of graph.allHalfEdges) {\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\n }\n graph.dropMask(visitMask);\n return loops;\n }\n}\n"]}
1
+ {"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GA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C,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACtC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;QACpG,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAxZD,kDAwZC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\nimport { Range1d } from \"../geometry3d/Range\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeFunction, NodeToNumberFunction } from \"./Graph\";\nimport { SignedDataSummary } from \"./SignedDataSummary\";\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\n\n// cspell:word internaldocs\n\n/**\n * Interface for an object that executes boolean tests on edges.\n * @internal\n */\nexport interface HalfEdgeTestObject {\n testEdge(h: HalfEdge): boolean;\n}\n/**\n * Class to test match of half edge mask.\n * @internal\n */\nexport class HalfEdgeMaskTester {\n private _targetMask: HalfEdgeMask;\n private _targetValue: boolean;\n /**\n * Constructor\n * @param mask mask to test in `testEdge` function\n * @param targetValue value to match for true return\n */\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\n this._targetMask = mask;\n this._targetValue = targetValue;\n }\n /** Return true if the value of the targetMask matches the targetValue. */\n public testEdge(edge: HalfEdge): boolean {\n return edge.isMaskSet(this._targetMask) === this._targetValue;\n }\n}\n/**\n * Class for different types of searches for HalfEdgeGraph.\n * @internal\n */\nexport class HalfEdgeGraphSearch {\n /**\n * Static method for face area computation -- useful as function parameter in `collectFaceAreaSummary`.\n * * This simply calls `node.signedFaceArea()`\n * @param node instance for signedFaceArea call.\n */\n public static signedFaceArea(node: HalfEdge): number {\n return node.signedFaceArea();\n }\n /**\n * Return a summary of face data (e.g., area) as computed by the callback on the faces of the graph.\n * * Callers with curved edge graphs must supply their own area function.\n * @param source graph or array of nodes to examine.\n * @param collectAllNodes flag to pass to the `SignedDataSummary` constructor to control collection of nodes.\n * @param areaFunction function to obtain area (or other numeric value). Default computes polygonal face area.\n */\n public static collectFaceAreaSummary(\n source: HalfEdgeGraph | HalfEdge[],\n collectAllNodes: boolean = false,\n areaFunction: NodeToNumberFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node),\n ): SignedDataSummary<HalfEdge> {\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\n let allFaces: HalfEdge[];\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n for (const node of allFaces) {\n const area = areaFunction(node);\n result.announceItem(node, area);\n }\n return result;\n }\n /**\n * Search the graph for the face with the most negative area.\n * * If the graph has exactly one connected component, this is its outer face.\n * @param oneCandidateNodePerFace graph or an array containing one node from each face to be considered.\n * @returns node on the negative area face with largest absolute area, or `undefined` if no negative area face.\n */\n public static findMinimumAreaFace(\n oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[], faceAreaFunction?: NodeToNumberFunction,\n ): HalfEdge | undefined {\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\n return summary.largestNegativeItem;\n }\n /**\n * Test if the graph is triangulated.\n * * Return `false` if:\n * * number of positive area faces with more than 3 edges is larger than `numPositiveExceptionsAllowed`.\n * * graph has more than 1 negative area face when `allowMultipleNegativeAreaFaces` is `false`.\n * * 2-edge faces are ignored.\n */\n public static isTriangulatedCCW(\n source: HalfEdgeGraph | HalfEdge[],\n allowMultipleNegativeAreaFaces: boolean = true,\n numPositiveExceptionsAllowed: number = 0,\n ): boolean {\n let allFaces: HalfEdge[];\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n let numNegative = 0;\n let numPositiveExceptions = 0;\n for (const node of allFaces) {\n const numEdges = node.countEdgesAroundFace();\n if (numEdges >= 3) {\n const area = node.signedFaceArea();\n if (area > 0) {\n if (numEdges > 3) {\n numPositiveExceptions++;\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\n return false;\n }\n } else {\n numNegative++;\n if (numNegative > 1) {\n if (!allowMultipleNegativeAreaFaces)\n return false;\n }\n }\n }\n }\n return true;\n }\n /**\n * Process a face during graph traversal.\n * @param faceSeed a node in the face.\n * @param mask mask to set on each node of the face.\n * @param allNodeStack array appended with each node of the face.\n * @param onePerFaceStack array appended with `faceSeed`.\n */\n private static pushAndMaskAllNodesInFace(\n faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[],\n ): void {\n onePerFaceStack.push(faceSeed);\n faceSeed.collectAroundFace((node: HalfEdge) => {\n node.setMask(mask);\n allNodeStack.push(node);\n });\n }\n /**\n * Traverse (via Depth First Search) to all accessible faces from the given seed.\n * @param faceSeed first node to start the traverse.\n * @param visitMask mask applied to all faces as visited.\n * @param parityEdgeTester function to test if an edge is adjacent to two faces of opposite parity, e.g., a boundary\n * edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not supplied and `parityMask`\n * is supplied, the default parity rule is to alternate parity state in a \"bullseye\" pattern starting at the seed face,\n * with each successive concentric ring of faces at constant topological distance from the seed face receiving the\n * opposite parity state of the previous ring.\n * @param parityMask mask to apply to the first face and faces that share the same parity as the first face, as\n * determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If (non-null) parity mask\n * is given, on return it is entirely set or entirely clear around each face.\n * @returns an array that contains one representative node in each face of the connected component.\n */\n private static parityFloodFromSeed(\n faceSeed: HalfEdge,\n visitMask: HalfEdgeMask,\n parityEdgeTester: HalfEdgeTestObject | undefined,\n parityMask: HalfEdgeMask,\n ): HalfEdge[] {\n const faces: HalfEdge[] = [];\n if (faceSeed.isMaskSet(visitMask))\n return faces; // empty array\n const allMasks = parityMask | visitMask;\n const stack: HalfEdge[] = [];\n // the seed face is arbitrarily assigned the parity mask\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(faceSeed, allMasks, stack, faces);\n while (stack.length > 0) {\n const p = stack.pop()!;\n const mate = p.edgeMate;\n if (!mate)\n continue;\n if (!mate.isMaskSet(visitMask)) {\n let newState = p.isMaskSet(parityMask);\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\n newState = !newState;\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\n }\n }\n return faces;\n }\n /**\n * * Correct the parity mask in the faces of a component.\n * * It is assumed that the parity mask is applied _consistently_ throughout the supplied faces, but maybe\n * not _correctly_.\n * * A consistently applied parity mask is \"correct\" if it is set on the negative area (\"exterior\") face of\n * a connected component.\n * * This method finds a face with negative area and toggles the mask throughout the input faces if this face\n * lacks the parity mask.\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\n */\n private static correctParityInSingleComponent(parityMask: HalfEdgeMask, faces: HalfEdge[]): void {\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\n if (!exteriorHalfEdge) {\n // graph has all degenerate faces; do nothing\n } else if (exteriorHalfEdge.isMaskSet(parityMask)) {\n // all should be well; nothing to do\n } else {\n for (const faceSeed of faces) {\n if (faceSeed.isMaskSet(parityMask)) {\n faceSeed.clearMaskAroundFace(parityMask);\n } else {\n faceSeed.setMaskAroundFace(parityMask);\n }\n }\n }\n }\n /** Apply `correctParityInSingleComponent` to each array in components (quick exit if `parityMask` is `NULL_MASK`). */\n private static correctParityInComponentArrays(parityMask: HalfEdgeMask, components: HalfEdge[][]): void {\n if (parityMask === HalfEdgeMask.NULL_MASK)\n return;\n for (const facesInComponent of components)\n HalfEdgeGraphSearch.correctParityInSingleComponent(parityMask, facesInComponent);\n }\n /**\n * Collect connected components of the graph (via Depth First Search).\n * @param graph graph to inspect.\n * @param parityEdgeTester (optional) function to test if an edge is adjacent to two faces of opposite parity,\n * e.g., a boundary edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not\n * supplied and `parityMask` is supplied, the default parity rule is to alternate parity state in a \"bullseye\"\n * pattern starting at the seed face, with each successive concentric ring of faces at constant topological\n * distance from the seed face receiving the opposite parity state of the previous ring.\n * @param parityMask (optional) mask to apply to the first face and faces that share the same parity as the\n * first face, as determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If\n * (non-null) parity mask is given, on return it is entirely set or entirely clear around each face.\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\n */\n public static collectConnectedComponentsWithExteriorParityMasks(\n graph: HalfEdgeGraph,\n parityEdgeTester: HalfEdgeTestObject | undefined,\n parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK,\n ): HalfEdge[][] {\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\n const components = [];\n const visitMask = HalfEdgeMask.VISITED;\n const allMasks = parityMask | visitMask;\n graph.clearMask(allMasks);\n for (const faceSeed of graph.allHalfEdges) {\n if (!faceSeed.isMaskSet(visitMask)) {\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\n // parityFloodFromSeed does not return an empty array because it is called on an unvisited faceSeed\n components.push(newFaces);\n }\n }\n HalfEdgeGraphSearch.correctParityInComponentArrays(parityMask, components);\n return components;\n }\n /**\n * Breadth First Search through connected component of a graph.\n * @param component vector of nodes, one per face.\n * @param seed seed node in component.\n * @param visitMask mask to apply to visited nodes. Assumed cleared throughout component.\n * @param ignoreMask (optional) mask preset on faces to ignore. Default value is `HalfEdgeMask.EXTERIOR` to\n * ignore exterior faces. Pass `HalfEdgeMask.NULL_MASK` to process all faces.\n * @param maxFaceCount (optional) maximum number of faces in the component. Should be positive; otherwise\n * `Infinity` is used.\n * @returns node at which to start next component if maximum face count exceeded, or undefined.\n */\n private static exploreComponent(\n component: HalfEdge[],\n seed: HalfEdge,\n visitMask: HalfEdgeMask,\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\n maxFaceCount: number = Infinity,\n ): HalfEdge | undefined {\n if (maxFaceCount <= 0)\n maxFaceCount = Infinity;\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\n let numFaces = 0;\n const candidates: HalfEdge[] = []; // the queue\n candidates.push(seed);\n while (candidates.length !== 0 && numFaces < maxFaceCount) {\n // shift is O(n) and may be inefficient for large queues; if needed, we can replace\n // queue by circular array or implement the queue using 2 stacks; both are O(1)\n const node = candidates.shift()!;\n if (node.isMaskSet(boundaryMask))\n continue;\n component.push(node);\n ++numFaces;\n const enqueueNeighboringFaces: NodeFunction = (heNode: HalfEdge) => {\n heNode.setMask(visitMask);\n const neighbor = heNode.vertexSuccessor;\n if (!neighbor.isMaskSet(boundaryMask))\n candidates.push(neighbor);\n };\n node.collectAroundFace(enqueueNeighboringFaces);\n }\n if (candidates.length === 0)\n return undefined;\n else {\n const front = candidates[0];\n while (candidates.length !== 0) {\n // try to find a node at the boundary of both the geometry and previous component\n const node = candidates.shift()!; // shift may be inefficient for large queues\n if (node.vertexSuccessor.isMaskSet(ignoreMask))\n return node;\n if (node.edgeMate.isMaskSet(ignoreMask))\n return node;\n }\n return front;\n }\n }\n /**\n * Collect connected components of the graph (via Breadth First Search).\n * @param graph graph to inspect.\n * @param maxFaceCount (optional) maximum number of faces in each component. Should be positive; otherwise\n * `Infinity` is used.\n * @param ignoreMask (optional) mask preset on faces to ignore. Default value is `HalfEdgeMask.EXTERIOR` to ignore\n * exterior faces. Pass `HalfEdgeMask.NULL_MASK` to process all faces.\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\n */\n public static collectConnectedComponents(\n graph: HalfEdgeGraph,\n maxFaceCount: number = Infinity,\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\n ): HalfEdge[][] {\n const components: HalfEdge[][] = [];\n if (graph.countMask(ignoreMask) === 0)\n ignoreMask = HalfEdgeMask.NULL_MASK;\n const visitMask = HalfEdgeMask.VISITED;\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\n // Starting with the input node, look ahead for a boundary face. Failing that, return the input node.\n // Starting all floods at the boundary reduces the chance of ending up with a ring-shaped component at the boundary.\n const findNextFloodSeed = (index: number) => {\n for (let i = index; i < graph.countNodes(); ++i) {\n if (!graph.allHalfEdges[i].isMaskSet(boundaryMask)\n && graph.allHalfEdges[i].edgeMate.isMaskSet(boundaryMask)) {\n index = i;\n break;\n }\n }\n return index;\n };\n for (let i = 0; i < graph.countNodes(); ++i) {\n if (graph.allHalfEdges[i].isMaskSet(boundaryMask))\n continue;\n const i0 = findNextFloodSeed(i);\n let seed: HalfEdge | undefined = graph.allHalfEdges[i0];\n do { // flood this component\n const component: HalfEdge[] = [];\n seed = HalfEdgeGraphSearch.exploreComponent(component, seed, visitMask, ignoreMask, maxFaceCount);\n if (component.length !== 0)\n components.push(component);\n } while (seed !== undefined);\n if (!graph.allHalfEdges[i].isMaskSet(visitMask))\n --i; // reprocess this node\n }\n return components;\n }\n /**\n * Test if test point (xTest,yTest) is inside/outside a face or on an edge.\n * @param seedNode any node on the face loop.\n * @param xTest x coordinate of the test point.\n * @param yTest y coordinate of the test point.\n * @returns 0 if ON, 1 if IN, -1 if OUT.\n */\n public static pointInOrOnFaceXY(seedNode: HalfEdge, xTest: number, yTest: number): number | undefined {\n const context = new XYParitySearchContext(xTest, yTest);\n // walk around looking for an accepted node to start the search (seedNode is usually ok)\n let nodeA = seedNode;\n let nodeB = seedNode.faceSuccessor;\n for (; ; nodeA = nodeB) {\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\n break;\n if (nodeB === seedNode) {\n // the test point and the face are all on line \"y = yTest\"\n const range = Range1d.createXX(nodeB.x, nodeB.faceSuccessor.x);\n return range.containsX(xTest) ? 0 : -1;\n }\n nodeB = nodeA.faceSuccessor;\n }\n // nodeB is the real start node for search, so stop when we revisit it. For each edge, accumulate parity and hits\n let nodeC = nodeB.faceSuccessor;\n for (; ;) {\n if (!context.advance(nodeC.x, nodeC.y)) {\n return context.classifyCounts();\n }\n if (nodeC === nodeB)\n break;\n nodeC = nodeC.faceSuccessor;\n }\n return context.classifyCounts();\n }\n /**\n * Collect boundary edges starting from `seed`.\n * * If `seed` is not a boundary node or is already visited, the function exists early.\n * @param seed start node.\n * @param visitMask mask to set on processed nodes.\n * @param isBoundaryEdge function to test if an edge in a boundary edge.\n * @param announceEdgeInBoundary callback invoked on each edge in the boundary loop in order. The counter is zero\n * for the first edge, and incremented with each successive edge.\n */\n public static collectExtendedBoundaryLoopFromSeed(\n seed: HalfEdge,\n visitMask: HalfEdgeMask,\n isBoundaryEdge: HalfEdgeToBooleanFunction,\n announceEdgeInBoundary: (edge: HalfEdge, counter: number) => void,\n ): void {\n let counter = 0;\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\n announceEdgeInBoundary(seed, counter++);\n seed.setMask(visitMask);\n const vertexBase = seed.faceSuccessor;\n let candidateAroundVertex = vertexBase;\n for (; ;) {\n if (candidateAroundVertex.getMask(visitMask)) // end of boundary loop\n return;\n if (isBoundaryEdge(candidateAroundVertex)) {\n seed = candidateAroundVertex;\n break;\n }\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\n if (candidateAroundVertex === vertexBase)\n break; // prevent infinite loop in case exteriorMask is not set on the edge mate of the boundary edge\n }\n }\n }\n /**\n * Collect boundary edges in the graph.\n * * A boundary edge is defined by `exteriorMask` being set on only its \"exterior\" edge mate.\n * * Each boundary edge is identified in the output by its edge mate that lacks `exteriorMask`.\n * * Each inner array is ordered in the output so that its boundary edges form a connected path. If `exteriorMask`\n * is preset consistently around each \"exterior\" face, these paths are loops.\n * @param graph the graph to query\n * @param exteriorMask mask preset on exactly one side of boundary edges\n * @returns array of boundary loops, each loop an array of the unmasked mates of boundary edges\n */\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\n const loops: HalfEdge[][] = [];\n const visitMask = graph.grabMask(true);\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\n };\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\n if (counter === 0)\n loops.push([]);\n loops[loops.length - 1].push(edge);\n };\n for (const seed of graph.allHalfEdges) {\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\n }\n graph.dropMask(visitMask);\n return loops;\n }\n}\n"]}
@@ -124,7 +124,6 @@ export declare class HalfEdgeGraphMerge {
124
124
  */
125
125
  static clusterAndMergeXYTheta(graph: HalfEdgeGraph, outboundRadiansFunction?: (he: HalfEdge) => number): void;
126
126
  private static buildVerticalSweepPriorityQueue;
127
- private static snapFractionToNode;
128
127
  private static computeIntersectionFractionsOnEdges;
129
128
  /**
130
129
  * Split edges at intersections.
@@ -1 +1 @@
1
- {"version":3,"file":"Merging.d.ts","sourceRoot":"","sources":["../../../src/topology/Merging.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKhE,qBAAa,cAAc;IAClB,SAAS,SAAK;IACd,mBAAmB,SAAK;IACxB,QAAQ,SAAK;IACb,SAAS,SAAK;IACd,OAAO,SAAK;IACZ,OAAO,SAAK;;CAGpB;A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