@itwin/core-geometry 5.1.0-dev.9 → 5.2.0-dev.1

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 (598) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/lib/cjs/Geometry.d.ts +18 -10
  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 +4 -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 +2 -0
  32. package/lib/cjs/core-geometry.d.ts.map +1 -1
  33. package/lib/cjs/core-geometry.js +2 -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 +40 -1
  40. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  41. package/lib/cjs/curve/CurveCollection.js +90 -0
  42. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  43. package/lib/cjs/curve/CurveFactory.d.ts +3 -2
  44. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  45. package/lib/cjs/curve/CurveFactory.js +6 -5
  46. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  47. package/lib/cjs/curve/CurveLocationDetail.d.ts +27 -25
  48. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  49. package/lib/cjs/curve/CurveLocationDetail.js +30 -25
  50. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  51. package/lib/cjs/curve/CurvePrimitive.d.ts +9 -2
  52. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurvePrimitive.js +11 -0
  54. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  55. package/lib/cjs/curve/CurveTypes.d.ts +1 -1
  56. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  57. package/lib/cjs/curve/LineSegment3d.d.ts +2 -0
  58. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  59. package/lib/cjs/curve/LineSegment3d.js +4 -0
  60. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  61. package/lib/cjs/curve/LineString3d.d.ts +7 -0
  62. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  63. package/lib/cjs/curve/LineString3d.js +15 -3
  64. package/lib/cjs/curve/LineString3d.js.map +1 -1
  65. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  66. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
  67. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  68. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +34 -8
  69. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  70. package/lib/cjs/curve/Query/PlanarSubdivision.js +129 -33
  71. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  72. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +4 -3
  73. package/lib/cjs/curve/Query/StrokeCountChain.d.ts.map +1 -1
  74. package/lib/cjs/curve/Query/StrokeCountChain.js +20 -9
  75. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  76. package/lib/cjs/curve/RegionMomentsXY.d.ts +2 -1
  77. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  78. package/lib/cjs/curve/RegionMomentsXY.js +26 -41
  79. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  80. package/lib/cjs/curve/RegionOps.d.ts +74 -39
  81. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  82. package/lib/cjs/curve/RegionOps.js +146 -46
  83. package/lib/cjs/curve/RegionOps.js.map +1 -1
  84. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +36 -27
  85. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  86. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +161 -55
  87. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  88. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  89. package/lib/cjs/curve/StrokeOptions.js +1 -1
  90. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  91. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  92. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
  93. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
  94. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  95. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  96. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  97. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  98. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  100. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +0 -1
  101. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  102. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  103. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  104. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js +34 -0
  105. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  106. package/lib/cjs/geometry3d/AngleSweep.d.ts +25 -18
  107. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/AngleSweep.js +32 -18
  109. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  110. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  111. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +19 -25
  113. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  114. package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
  115. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  116. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  117. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  118. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  119. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -3
  120. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  121. package/lib/cjs/geometry3d/GrowableXYZArray.js +21 -3
  122. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  123. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +11 -1
  124. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  125. package/lib/cjs/geometry3d/IndexedXYZCollection.js +21 -3
  126. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  127. package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
  128. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  129. package/lib/cjs/geometry3d/Plane3d.js +6 -1
  130. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  131. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  132. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  133. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  134. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  135. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  136. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  137. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  138. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  139. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  140. package/lib/cjs/geometry3d/Point2dVector2d.js +0 -2
  141. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  142. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
  143. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  144. package/lib/cjs/geometry3d/Point3dVector3d.js +4 -5
  145. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  146. package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
  147. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  148. package/lib/cjs/geometry3d/PointHelpers.js +66 -26
  149. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  150. package/lib/cjs/geometry3d/PolygonOps.d.ts +49 -2
  151. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  152. package/lib/cjs/geometry3d/PolygonOps.js +38 -2
  153. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  154. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  155. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  156. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  157. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  158. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
  159. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  160. package/lib/cjs/geometry3d/PolylineOps.js +5 -4
  161. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  162. package/lib/cjs/geometry3d/Range.d.ts +18 -10
  163. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  164. package/lib/cjs/geometry3d/Range.js +32 -10
  165. package/lib/cjs/geometry3d/Range.js.map +1 -1
  166. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  167. package/lib/cjs/geometry3d/Ray2d.js +0 -1
  168. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  169. package/lib/cjs/geometry3d/Ray3d.d.ts +7 -9
  170. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  171. package/lib/cjs/geometry3d/Ray3d.js +23 -45
  172. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  173. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +39 -29
  174. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  175. package/lib/cjs/geometry3d/ReusableObjectCache.js +49 -35
  176. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  177. package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -4
  178. package/lib/cjs/geometry3d/SortablePolygon.d.ts.map +1 -1
  179. package/lib/cjs/geometry3d/SortablePolygon.js +48 -43
  180. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  181. package/lib/cjs/geometry3d/Transform.d.ts +21 -2
  182. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  183. package/lib/cjs/geometry3d/Transform.js +32 -13
  184. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  185. package/lib/cjs/geometry4d/Point4d.d.ts +8 -5
  186. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  187. package/lib/cjs/geometry4d/Point4d.js +27 -16
  188. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  189. package/lib/cjs/numerics/BezierPolynomials.d.ts +2 -0
  190. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  191. package/lib/cjs/numerics/BezierPolynomials.js +11 -0
  192. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  193. package/lib/cjs/numerics/SmallSystem.d.ts +77 -36
  194. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  195. package/lib/cjs/numerics/SmallSystem.js +129 -73
  196. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  197. package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
  198. package/lib/cjs/polyface/FacetOrientation.js +1 -1
  199. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  200. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
  201. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  202. package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
  203. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  204. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  205. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  206. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
  207. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  208. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  209. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  210. package/lib/cjs/polyface/IndexedPolyfaceWalker.js +51 -32
  211. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  212. package/lib/cjs/polyface/Polyface.d.ts +19 -5
  213. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  214. package/lib/cjs/polyface/Polyface.js +18 -2
  215. package/lib/cjs/polyface/Polyface.js.map +1 -1
  216. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
  217. package/lib/cjs/polyface/PolyfaceBuilder.js +6 -6
  218. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  219. package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
  220. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  221. package/lib/cjs/polyface/PolyfaceClip.js +39 -42
  222. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  223. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  224. package/lib/cjs/polyface/PolyfaceData.js +1 -1
  225. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  226. package/lib/cjs/polyface/PolyfaceQuery.d.ts +119 -78
  227. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  228. package/lib/cjs/polyface/PolyfaceQuery.js +315 -231
  229. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  230. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  231. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  232. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
  233. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  234. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  235. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  236. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  237. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  238. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  239. package/lib/cjs/serialization/BGFBReader.js +2 -3
  240. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  241. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  242. package/lib/cjs/serialization/BGFBWriter.js +2 -4
  243. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  244. package/lib/cjs/serialization/GeometrySamples.d.ts +1 -1
  245. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  246. package/lib/cjs/serialization/GeometrySamples.js +3 -3
  247. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  248. package/lib/cjs/serialization/IModelJsonSchema.d.ts +3 -3
  249. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  250. package/lib/cjs/serialization/IModelJsonSchema.js +5 -5
  251. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  252. package/lib/cjs/solid/Box.d.ts.map +1 -1
  253. package/lib/cjs/solid/Box.js +7 -0
  254. package/lib/cjs/solid/Box.js.map +1 -1
  255. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  256. package/lib/cjs/solid/Cone.js +6 -0
  257. package/lib/cjs/solid/Cone.js.map +1 -1
  258. package/lib/cjs/solid/LinearSweep.d.ts +2 -3
  259. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  260. package/lib/cjs/solid/LinearSweep.js +11 -7
  261. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  262. package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
  263. package/lib/cjs/solid/RotationalSweep.js +2 -2
  264. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  265. package/lib/cjs/solid/RuledSweep.d.ts +1 -1
  266. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  267. package/lib/cjs/solid/RuledSweep.js +5 -1
  268. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  269. package/lib/cjs/solid/Sphere.d.ts.map +1 -1
  270. package/lib/cjs/solid/Sphere.js +6 -3
  271. package/lib/cjs/solid/Sphere.js.map +1 -1
  272. package/lib/cjs/solid/SweepContour.d.ts +1 -1
  273. package/lib/cjs/solid/SweepContour.js +1 -1
  274. package/lib/cjs/solid/SweepContour.js.map +1 -1
  275. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  276. package/lib/cjs/solid/TorusPipe.js +4 -0
  277. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  278. package/lib/cjs/topology/ChainMerge.d.ts +1 -1
  279. package/lib/cjs/topology/ChainMerge.js +1 -1
  280. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  281. package/lib/cjs/topology/Graph.d.ts +64 -14
  282. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  283. package/lib/cjs/topology/Graph.js +149 -32
  284. package/lib/cjs/topology/Graph.js.map +1 -1
  285. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +3 -2
  286. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  287. package/lib/cjs/topology/HalfEdgeGraphSearch.js +3 -2
  288. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  289. package/lib/cjs/topology/Merging.d.ts +0 -1
  290. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  291. package/lib/cjs/topology/Merging.js +49 -46
  292. package/lib/cjs/topology/Merging.js.map +1 -1
  293. package/lib/cjs/topology/RegularizeFace.d.ts.map +1 -1
  294. package/lib/cjs/topology/RegularizeFace.js +2 -1
  295. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  296. package/lib/cjs/topology/Triangulation.d.ts +9 -14
  297. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  298. package/lib/cjs/topology/Triangulation.js +29 -22
  299. package/lib/cjs/topology/Triangulation.js.map +1 -1
  300. package/lib/esm/Geometry.d.ts +18 -10
  301. package/lib/esm/Geometry.d.ts.map +1 -1
  302. package/lib/esm/Geometry.js +13 -3
  303. package/lib/esm/Geometry.js.map +1 -1
  304. package/lib/esm/bspline/BSpline1dNd.d.ts +1 -1
  305. package/lib/esm/bspline/BSpline1dNd.js +1 -1
  306. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  307. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  308. package/lib/esm/bspline/BSplineCurve.js +7 -1
  309. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  310. package/lib/esm/bspline/BSplineSurface.d.ts +4 -3
  311. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  312. package/lib/esm/bspline/BSplineSurface.js +4 -5
  313. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  314. package/lib/esm/clipping/ClipPlane.d.ts +7 -5
  315. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  316. package/lib/esm/clipping/ClipPlane.js +9 -5
  317. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  318. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  319. package/lib/esm/clipping/ClipUtils.js +5 -3
  320. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  321. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -2
  322. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  323. package/lib/esm/clipping/ConvexClipPlaneSet.js +13 -25
  324. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  325. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  326. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  327. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  328. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  329. package/lib/esm/core-geometry.d.ts +2 -0
  330. package/lib/esm/core-geometry.d.ts.map +1 -1
  331. package/lib/esm/core-geometry.js +2 -0
  332. package/lib/esm/core-geometry.js.map +1 -1
  333. package/lib/esm/curve/Arc3d.d.ts +54 -32
  334. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  335. package/lib/esm/curve/Arc3d.js +56 -37
  336. package/lib/esm/curve/Arc3d.js.map +1 -1
  337. package/lib/esm/curve/CurveCollection.d.ts +40 -1
  338. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  339. package/lib/esm/curve/CurveCollection.js +90 -0
  340. package/lib/esm/curve/CurveCollection.js.map +1 -1
  341. package/lib/esm/curve/CurveFactory.d.ts +3 -2
  342. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  343. package/lib/esm/curve/CurveFactory.js +6 -5
  344. package/lib/esm/curve/CurveFactory.js.map +1 -1
  345. package/lib/esm/curve/CurveLocationDetail.d.ts +27 -25
  346. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  347. package/lib/esm/curve/CurveLocationDetail.js +30 -25
  348. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  349. package/lib/esm/curve/CurvePrimitive.d.ts +9 -2
  350. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  351. package/lib/esm/curve/CurvePrimitive.js +11 -0
  352. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  353. package/lib/esm/curve/CurveTypes.d.ts +1 -1
  354. package/lib/esm/curve/CurveTypes.js.map +1 -1
  355. package/lib/esm/curve/LineSegment3d.d.ts +2 -0
  356. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  357. package/lib/esm/curve/LineSegment3d.js +4 -0
  358. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  359. package/lib/esm/curve/LineString3d.d.ts +7 -0
  360. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  361. package/lib/esm/curve/LineString3d.js +15 -3
  362. package/lib/esm/curve/LineString3d.js.map +1 -1
  363. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  364. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
  365. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  366. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +34 -8
  367. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  368. package/lib/esm/curve/Query/PlanarSubdivision.js +131 -35
  369. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  370. package/lib/esm/curve/Query/StrokeCountChain.d.ts +4 -3
  371. package/lib/esm/curve/Query/StrokeCountChain.d.ts.map +1 -1
  372. package/lib/esm/curve/Query/StrokeCountChain.js +20 -9
  373. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  374. package/lib/esm/curve/RegionMomentsXY.d.ts +2 -1
  375. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  376. package/lib/esm/curve/RegionMomentsXY.js +26 -41
  377. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  378. package/lib/esm/curve/RegionOps.d.ts +74 -39
  379. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  380. package/lib/esm/curve/RegionOps.js +146 -46
  381. package/lib/esm/curve/RegionOps.js.map +1 -1
  382. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +36 -27
  383. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  384. package/lib/esm/curve/RegionOpsClassificationSweeps.js +161 -56
  385. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  386. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  387. package/lib/esm/curve/StrokeOptions.js +1 -1
  388. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  389. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  390. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
  391. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
  392. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  393. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  394. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  395. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  396. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  397. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  398. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +0 -1
  399. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  400. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  401. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  402. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js +30 -0
  403. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  404. package/lib/esm/geometry3d/AngleSweep.d.ts +25 -18
  405. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  406. package/lib/esm/geometry3d/AngleSweep.js +32 -18
  407. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  408. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  409. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  410. package/lib/esm/geometry3d/CoincidentGeometryOps.js +19 -25
  411. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  412. package/lib/esm/geometry3d/Ellipsoid.js +1 -1
  413. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  414. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  415. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  416. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  417. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -3
  418. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  419. package/lib/esm/geometry3d/GrowableXYZArray.js +21 -3
  420. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  421. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +11 -1
  422. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  423. package/lib/esm/geometry3d/IndexedXYZCollection.js +21 -3
  424. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  425. package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
  426. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  427. package/lib/esm/geometry3d/Plane3d.js +6 -1
  428. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  429. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  430. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  431. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  432. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  433. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  434. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  435. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  436. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  437. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  438. package/lib/esm/geometry3d/Point2dVector2d.js +0 -2
  439. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  440. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
  441. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  442. package/lib/esm/geometry3d/Point3dVector3d.js +4 -5
  443. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  444. package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
  445. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  446. package/lib/esm/geometry3d/PointHelpers.js +66 -26
  447. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  448. package/lib/esm/geometry3d/PolygonOps.d.ts +49 -2
  449. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  450. package/lib/esm/geometry3d/PolygonOps.js +38 -2
  451. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  452. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  453. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  454. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  455. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  456. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
  457. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  458. package/lib/esm/geometry3d/PolylineOps.js +5 -4
  459. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  460. package/lib/esm/geometry3d/Range.d.ts +18 -10
  461. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  462. package/lib/esm/geometry3d/Range.js +32 -10
  463. package/lib/esm/geometry3d/Range.js.map +1 -1
  464. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  465. package/lib/esm/geometry3d/Ray2d.js +0 -1
  466. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  467. package/lib/esm/geometry3d/Ray3d.d.ts +7 -9
  468. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  469. package/lib/esm/geometry3d/Ray3d.js +23 -45
  470. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  471. package/lib/esm/geometry3d/ReusableObjectCache.d.ts +39 -29
  472. package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  473. package/lib/esm/geometry3d/ReusableObjectCache.js +47 -33
  474. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  475. package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -4
  476. package/lib/esm/geometry3d/SortablePolygon.d.ts.map +1 -1
  477. package/lib/esm/geometry3d/SortablePolygon.js +48 -43
  478. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  479. package/lib/esm/geometry3d/Transform.d.ts +21 -2
  480. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  481. package/lib/esm/geometry3d/Transform.js +32 -13
  482. package/lib/esm/geometry3d/Transform.js.map +1 -1
  483. package/lib/esm/geometry4d/Point4d.d.ts +8 -5
  484. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  485. package/lib/esm/geometry4d/Point4d.js +27 -16
  486. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  487. package/lib/esm/numerics/BezierPolynomials.d.ts +2 -0
  488. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  489. package/lib/esm/numerics/BezierPolynomials.js +11 -0
  490. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  491. package/lib/esm/numerics/SmallSystem.d.ts +77 -36
  492. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  493. package/lib/esm/numerics/SmallSystem.js +129 -73
  494. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  495. package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
  496. package/lib/esm/polyface/FacetOrientation.js +1 -1
  497. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  498. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
  499. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  500. package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
  501. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  502. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  503. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  504. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
  505. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  506. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  507. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  508. package/lib/esm/polyface/IndexedPolyfaceWalker.js +51 -32
  509. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  510. package/lib/esm/polyface/Polyface.d.ts +19 -5
  511. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  512. package/lib/esm/polyface/Polyface.js +18 -2
  513. package/lib/esm/polyface/Polyface.js.map +1 -1
  514. package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
  515. package/lib/esm/polyface/PolyfaceBuilder.js +6 -6
  516. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  517. package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
  518. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  519. package/lib/esm/polyface/PolyfaceClip.js +39 -42
  520. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  521. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  522. package/lib/esm/polyface/PolyfaceData.js +1 -1
  523. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  524. package/lib/esm/polyface/PolyfaceQuery.d.ts +119 -78
  525. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  526. package/lib/esm/polyface/PolyfaceQuery.js +316 -232
  527. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  528. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  529. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  530. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
  531. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  532. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  533. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  534. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  535. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  536. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  537. package/lib/esm/serialization/BGFBReader.js +2 -3
  538. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  539. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  540. package/lib/esm/serialization/BGFBWriter.js +2 -4
  541. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  542. package/lib/esm/serialization/GeometrySamples.d.ts +1 -1
  543. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  544. package/lib/esm/serialization/GeometrySamples.js +3 -3
  545. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  546. package/lib/esm/serialization/IModelJsonSchema.d.ts +3 -3
  547. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  548. package/lib/esm/serialization/IModelJsonSchema.js +5 -5
  549. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  550. package/lib/esm/solid/Box.d.ts.map +1 -1
  551. package/lib/esm/solid/Box.js +7 -0
  552. package/lib/esm/solid/Box.js.map +1 -1
  553. package/lib/esm/solid/Cone.d.ts.map +1 -1
  554. package/lib/esm/solid/Cone.js +6 -0
  555. package/lib/esm/solid/Cone.js.map +1 -1
  556. package/lib/esm/solid/LinearSweep.d.ts +2 -3
  557. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  558. package/lib/esm/solid/LinearSweep.js +11 -7
  559. package/lib/esm/solid/LinearSweep.js.map +1 -1
  560. package/lib/esm/solid/RotationalSweep.d.ts +2 -2
  561. package/lib/esm/solid/RotationalSweep.js +2 -2
  562. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  563. package/lib/esm/solid/RuledSweep.d.ts +1 -1
  564. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  565. package/lib/esm/solid/RuledSweep.js +5 -1
  566. package/lib/esm/solid/RuledSweep.js.map +1 -1
  567. package/lib/esm/solid/Sphere.d.ts.map +1 -1
  568. package/lib/esm/solid/Sphere.js +6 -3
  569. package/lib/esm/solid/Sphere.js.map +1 -1
  570. package/lib/esm/solid/SweepContour.d.ts +1 -1
  571. package/lib/esm/solid/SweepContour.js +1 -1
  572. package/lib/esm/solid/SweepContour.js.map +1 -1
  573. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  574. package/lib/esm/solid/TorusPipe.js +4 -0
  575. package/lib/esm/solid/TorusPipe.js.map +1 -1
  576. package/lib/esm/topology/ChainMerge.d.ts +1 -1
  577. package/lib/esm/topology/ChainMerge.js +1 -1
  578. package/lib/esm/topology/ChainMerge.js.map +1 -1
  579. package/lib/esm/topology/Graph.d.ts +64 -14
  580. package/lib/esm/topology/Graph.d.ts.map +1 -1
  581. package/lib/esm/topology/Graph.js +149 -32
  582. package/lib/esm/topology/Graph.js.map +1 -1
  583. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +3 -2
  584. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  585. package/lib/esm/topology/HalfEdgeGraphSearch.js +3 -2
  586. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  587. package/lib/esm/topology/Merging.d.ts +0 -1
  588. package/lib/esm/topology/Merging.d.ts.map +1 -1
  589. package/lib/esm/topology/Merging.js +49 -46
  590. package/lib/esm/topology/Merging.js.map +1 -1
  591. package/lib/esm/topology/RegularizeFace.d.ts.map +1 -1
  592. package/lib/esm/topology/RegularizeFace.js +2 -1
  593. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  594. package/lib/esm/topology/Triangulation.d.ts +9 -14
  595. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  596. package/lib/esm/topology/Triangulation.js +29 -22
  597. package/lib/esm/topology/Triangulation.js.map +1 -1
  598. package/package.json +7 -6
@@ -1 +1 @@
1
- {"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAA2B,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oBAAoB;AAEpB;;;GAGG;AACH,IAAK,SAOJ;AAPD,WAAK,SAAS;IACZ,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,6CAAU,CAA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tC,IAAI,SAAS,EAAE,CAAC;gBACd,QAAQ,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3E,IAAI,QAAQ,KAAK,SAAS;oBACxB,IAAI,MAAM,KAAK,SAAS;wBACtB,MAAM,GAAG,QAAQ,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;YACxB,CAAC;QACH,CAAC;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,IAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,SAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF","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/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\nimport { CurveCurve } from \"../CurveCurve\";\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop } from \"../Loop\";\nimport { JointOptions, OffsetOptions } from \"../OffsetOptions\";\nimport { Path } from \"../Path\";\nimport { RegionOps } from \"../RegionOps\";\n\n// cspell:word CCWXY\n\n/**\n * Classification of how the joint is constructed.\n * @internal\n */\nenum JointMode {\n Unknown = 0, /** used when joint mode is unknown. */\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\n JustGeometry = 3, /** unused */\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\n}\n\n/**\n * Description of geometry around a joint.\n * @internal\n */\nclass Joint {\n /** Enumeration of how the joint is constructed. */\n public flexure: JointMode;\n /** Curve before the joint. */\n public curve0?: CurvePrimitive;\n /** Fractional position on curve0 (may be a trim or extension). */\n public fraction0?: number;\n /** Curve after the joint (may be a trim or extension). */\n public curve1?: CurvePrimitive;\n /** Fractional position on curve1. */\n public fraction1?: number;\n /** Curve to be added within the joint. */\n public jointCurve?: CurvePrimitive;\n /** Common point on the original curves. */\n public swingPoint?: Point3d;\n /** Pointer to next joint. */\n public nextJoint?: Joint;\n /** Pointer to previous joint. */\n public previousJoint?: Joint;\n // capture references to all data members\n public constructor(\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined,\n ) {\n this.curve0 = curve0;\n this.curve1 = curve1;\n this.swingPoint = swingPoint;\n this.flexure = JointMode.Unknown;\n }\n /**\n * Try to construct an arc transition from ray0 to ray1 with given center.\n */\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\n const angle = ray0.direction.angleToXY(ray1.direction);\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\n const vector90 = vector0.rotate90CCWXY();\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\n }\n return undefined;\n }\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\n public shallowExtract(): any {\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\n }\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\n public static link(joint0: Joint, joint1: Joint | undefined) {\n joint0.nextJoint = joint1;\n if (joint1)\n joint1.previousJoint = joint0;\n if (joint0.curve1 && joint1 && !joint1.curve0)\n joint1.curve0 = joint0.curve1;\n else if (!joint0.curve1 && joint1 && joint1.curve0)\n joint0.curve1 = joint1.curve0;\n }\n /**\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\n * * Otherwise return defaultValue\n */\n public nextJointFraction0(defaultValue: number): number {\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\n return this.nextJoint.fraction0;\n return defaultValue;\n }\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\n if (curve) {\n curve.emitStrokes(destination);\n }\n }\n private static addPoint(destination: LineString3d, point: Point3d) {\n if (destination.packedPoints.length > 0) {\n const pointA = destination.endPoint();\n if (!pointA.isAlmostEqual(point))\n destination.packedPoints.push(point);\n }\n }\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.addStrokes(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n if (curve1) {\n if (!joint.jointCurve) {\n this.addPoint(destination, curve1.startPoint());\n }\n }\n this.addStrokes(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\n if (primitive) {\n if (destination.length > 0) {\n const pointA = destination[destination.length - 1].endPoint();\n const pointB = primitive.startPoint();\n if (!pointA.isAlmostEqual(pointB)) {\n destination.push(LineSegment3d.create(pointA, pointB));\n }\n }\n destination.push(primitive);\n }\n }\n private static adjustJointToPrimitives(joint: Joint) {\n const ls = joint.jointCurve;\n if (ls instanceof LineString3d) {\n if (joint.curve0) {\n const curvePoint = joint.curve0.endPoint();\n const jointPoint0 = ls.startPoint();\n if (!curvePoint.isAlmostEqual(jointPoint0))\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\n }\n if (joint.curve1) {\n const curvePoint = joint.curve1.startPoint();\n const jointPoint1 = ls.endPoint();\n if (!curvePoint.isAlmostEqual(jointPoint1))\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\n }\n }\n }\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\n if (start === undefined)\n return;\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.adjustJointToPrimitives(joint);\n this.collectPrimitive(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n this.collectPrimitive(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n /**\n * Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints' attributes,\n * such as whether to extend both curves to intersection or to fill the gap between curves.\n */\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\n if (start)\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\n }\n /**\n * Visit joints on a chain.\n * * Terminates if `callback` returns `false`.\n * @param start first (and, for cyclic chain, final) joint.\n * @param callback function to call with each Joint as a single parameter.\n * @param maxTest\n */\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\n let joint: Joint | undefined = start;\n if (joint) {\n let numTest = 0;\n while (joint !== undefined) {\n if (numTest++ >= maxTest + 5) // allow extra things to happen\n return true;\n if (!callback(joint))\n return false;\n joint = joint.nextJoint;\n if (joint === start)\n break;\n }\n }\n return true;\n }\n /** NOTE: no assumption on type of curve0, curve1 */\n private annotateExtension(options: JointOptions) {\n if (this.curve0 && this.curve1) {\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Extend;\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\n if (options.needArc(theta)) {\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc) {\n this.jointCurve = arc;\n return;\n }\n }\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\n if (numChamferPoints <= 1) { // create sharp corner\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\n return;\n }\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\n const radians0 = theta.radians;\n const numHalfStep = 2.0 * numChamferPoints;\n const halfStepRadians = radians0 / numHalfStep;\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc !== undefined) {\n const radialFraction = 1 / Math.cos(halfStepRadians);\n const jointCurve = LineString3d.create();\n this.jointCurve = jointCurve;\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\n\n for (let i = 0; i < numChamferPoints; i++) {\n const arcFraction = (1 + 2 * i) / numHalfStep;\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\n }\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\n return;\n }\n }\n }\n }\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n /** Select the index at which summed fraction difference is smallest */\n private selectIntersectionIndexByFraction(\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[],\n ): number {\n let index = -1;\n let aMin = Number.MAX_VALUE;\n for (let i = 0; i < intersections.length; i++) {\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\n + Math.abs(intersections[i].detailB.fraction - fractionB);\n if (a < aMin) {\n aMin = a;\n index = i;\n }\n }\n return index;\n }\n /**\n * Examine the adjacent geometry to set some of joint attributes:\n * * set JointMode: one of Cap, Extend, or Trim\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\n * * set joint curve\n * * this REFERENCES curve0, curve1, fraction0, fraction1\n * * this does not reference nextJoint and previousJoint\n */\n public annotateJointMode(options: JointOptions): void {\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\n this.flexure = JointMode.Cap;\n this.fraction1 = 0.0;\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\n this.flexure = JointMode.Cap;\n this.fraction0 = 1.0;\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\n if (this.curve0.endPoint().isAlmostEqualXY(this.curve1.startPoint())) { // joint between colinear xy-segments\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Trim;\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection || intersection.approachType === CurveCurveApproachType.PerpendicularChord) {\n this.fraction0 = intersection.detailA.fraction;\n this.fraction1 = intersection.detailB.fraction;\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\n this.annotateExtension(options);\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\n this.flexure = JointMode.Trim;\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n } else { // generic pair of curves\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\n if (intersectionIndex >= 0) { // need to trim\n this.flexure = JointMode.Trim;\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\n } else { // need to extend\n this.annotateExtension(options);\n }\n }\n }\n }\n /**\n * * Examine the primitive trim fractions between each pair of joints.\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\n * surrounding primitives\n * @param start\n */\n public static removeDegeneratePrimitives(\n start: Joint, options: JointOptions, maxTest: number,\n ): { newStart: Joint, numJointRemoved: number } {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\n */\n let jointA: Joint | undefined = start;\n let numRemoved = 0;\n const maxRemove = 1;\n let numTest = 0;\n if (jointA) {\n while (jointA !== undefined && numTest++ < maxTest) {\n const jointB = jointA.nextJoint;\n if (jointA\n && jointB\n && jointA.previousJoint\n && jointB.nextJoint\n && jointA.fraction1 !== undefined\n && jointB.fraction0 !== undefined\n ) {\n const f0 = jointA.fraction1;\n const f1 = jointB.fraction0;\n const g0 = jointB.fraction1;\n const g1 = jointB.nextJoint.fraction0;\n // f0 and f1 are fractions on the single primitive between these joints.\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\n }\n */\n const eliminateF = f0 >= f1 || f0 > 1.0;\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\n if (eliminateF && eliminateG) {\n const jointC = jointB.nextJoint;\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointC.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n if (newJoint.nextJoint)\n newJoint.nextJoint.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n } else if (eliminateF) {\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointB.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n newJoint.nextJoint!.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n numRemoved++;\n if (jointA === start)\n start = newJoint;\n jointA = newJoint;\n if (numRemoved >= maxRemove) {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\n */\n return { newStart: start, numJointRemoved: numRemoved };\n }\n }\n }\n jointA = jointA.nextJoint;\n if (jointA === start)\n break;\n }\n }\n return { newStart: start, numJointRemoved: numRemoved };\n }\n}\n\n/**\n * Context for building a wire xy-offset.\n * @internal\n */\nexport class PolygonWireOffsetContext {\n /** Construct a context. */\n public constructor() { }\n private static _unitAlong = Vector3d.create();\n private static _unitPerp = Vector3d.create();\n private static _offsetA = Point3d.create();\n private static _offsetB = Point3d.create();\n // Construct a single offset from base points\n private static createOffsetSegment(\n basePointA: Point3d, basePointB: Point3d, distance: number,\n ): CurvePrimitive | undefined {\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\n this._unitAlong.z = 0.0; // xy-offset\n if (this._unitAlong.normalizeInPlace()) {\n this._unitAlong.rotate90CCWXY(this._unitPerp);\n const segment = LineSegment3d.create(\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB),\n );\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\n return segment;\n }\n return undefined;\n }\n /**\n * Construct a wire (not area) that is offset from given polyline or polygon.\n * * For best results, points should be in a horizontal plane because z-coordinates are ignored.\n * * This is a simple wire offset (in the form of a line string), not an area.\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\n * * See [[JointOptions]] class doc for offset construction rules.\n * @param points a single loop or path\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\n * object.\n */\n public constructPolygonWireXYOffset(\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions,\n ): CurveChain | undefined {\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1]))\n wrap = false; // no wrap possible for polylines\n // create raw offset segments as a linked list of Joints, starting with joint0\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\n const numPoints = points.length;\n let fragment0: CurvePrimitive | undefined;\n let joint0, previousJoint: Joint | undefined;\n for (let i = 0; i + 1 < numPoints; ++i) {\n if (!previousJoint) { // start the linked list at the first nontrivial xy-segment\n if (fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance))\n previousJoint = joint0 = new Joint(undefined, fragment0, points[i]);\n } else {\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\n if (fragment1) { // append the next nontrivial xy-segment\n const newJoint = new Joint(fragment0, fragment1, points[i]);\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n }\n if (!fragment0 || !previousJoint || !joint0)\n return undefined; // no edge with positive xy-length\n const lastJoint = wrap ? joint0 : new Joint(fragment0, undefined, points[numPoints - 1]);\n Joint.link(previousJoint, lastJoint);\n Joint.annotateChain(joint0, options, numPoints);\n // make limited passes through the Joint chain until no self-intersections are removed\n for (let pass = 0; pass++ < 5;) {\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\n joint0 = state.newStart;\n if (state.numJointRemoved === 0)\n break;\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\n }\n */\n }\n const chain = LineString3d.create();\n Joint.collectStrokesFromChain(joint0, chain, numPoints); // compute offset corners (by extension/trim)\n const n = chain.packedPoints.length;\n if (n > 1) {\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\n return Loop.create(chain);\n else\n return Path.create(chain);\n }\n return undefined;\n }\n}\n\n/**\n * Context for building a wire xy-offset from a Path or Loop of CurvePrimitives\n * @internal\n */\nexport class CurveChainWireOffsetContext {\n /** construct a context. */\n public constructor() { }\n /**\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\n * @param cp curve primitive to annotate\n * @param startPoint optional start point\n * @param endPoint optional end point\n * @return the input CurvePrimitive with annotations\n */\n public static applyBasePoints(\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined,\n ): CurvePrimitive | undefined {\n if (cp !== undefined) {\n if (startPoint !== undefined)\n (cp as any).baseCurveStart = startPoint;\n if (endPoint !== undefined)\n (cp as any).baseCurveEnd = endPoint;\n }\n return cp;\n }\n /**\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\n * * Each primitive may be labeled (as an `any` object) with start or end point of base curve:\n * * `(primitive as any).baseCurveStart: Point3d`\n * * `(primitive as any).baseCurveEnd: Point3d`\n * @param curve primitive to offset\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\n */\n public static createSingleOffsetPrimitiveXY(\n curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions,\n ): CurvePrimitive | CurvePrimitive[] | undefined {\n const offset = curve.constructOffsetXY(offsetDistanceOrOptions);\n if (offset === undefined)\n return undefined;\n // decorate each offset with its base curve's endpoints\n if (Array.isArray(offset)) {\n const basePrims = curve.collectCurvePrimitives(undefined, true, true);\n if (basePrims.length !== offset.length)\n return undefined; // unexpected aggregate curve type!\n for (let i = 0; i < basePrims.length; ++i)\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\n return offset;\n }\n return this.applyBasePoints(offset, curve.startPoint(), curve.endPoint());\n }\n /**\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\n * not detect self intersection among widely separated edges.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\n * @param curves base curves.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\n */\n public static constructCurveXYOffset(\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\n ): CurveCollection | undefined {\n const wrap: boolean = curves instanceof Loop;\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\n const simpleOffsets: CurvePrimitive[] = [];\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\n for (const c of curves.children) {\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\n if (c1 === undefined) {\n // bad; maybe arc to inside?\n } else if (c1 instanceof CurvePrimitive) {\n simpleOffsets.push(c1);\n } else if (Array.isArray(c1)) {\n for (const c2 of c1) {\n if (c2 instanceof CurvePrimitive)\n simpleOffsets.push(c2);\n }\n }\n }\n /** create joints between array elements to make offsets as a linked list (joint0) */\n let fragment0;\n let newJoint;\n let previousJoint;\n let joint0;\n for (const fragment1 of simpleOffsets) {\n if (fragment1) {\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\n if (newJoint !== undefined)\n if (joint0 === undefined)\n joint0 = newJoint;\n if (previousJoint)\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n if (joint0 && previousJoint && curves instanceof Loop)\n Joint.link(previousJoint, joint0);\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\n const numOffset = simpleOffsets.length;\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\n const outputCurves: CurvePrimitive[] = [];\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\n }\n}\n"]}
1
+ {"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAA2B,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,IAAK,SAOJ;AAPD,WAAK,SAAS;IACZ,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,6CAAU,CAAA;IACV,0CAAS,CAAA;IACT,yDAAgB,CAAA;IAChB,uCAAO,CAAA;AACT,CAAC,EAPI,SAAS,KAAT,SAAS,QAOb;AA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AAe,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3E,IAAI,QAAQ,KAAK,SAAS;oBACxB,IAAI,MAAM,KAAK,SAAS;wBACtB,MAAM,GAAG,QAAQ,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;YACxB,CAAC;QACH,CAAC;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,IAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,SAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF","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/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\nimport { CurveCurve } from \"../CurveCurve\";\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop } from \"../Loop\";\nimport { JointOptions, OffsetOptions } from \"../OffsetOptions\";\nimport { Path } from \"../Path\";\nimport { RegionOps } from \"../RegionOps\";\n\n/**\n * Classification of how the joint is constructed.\n * @internal\n */\nenum JointMode {\n Unknown = 0, /** used when joint mode is unknown. */\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\n JustGeometry = 3, /** unused */\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\n}\n\n/**\n * Description of geometry around a joint.\n * @internal\n */\nclass Joint {\n /** Enumeration of how the joint is constructed. */\n public flexure: JointMode;\n /** Curve before the joint. */\n public curve0?: CurvePrimitive;\n /** Fractional position on curve0 (may be a trim or extension). */\n public fraction0?: number;\n /** Curve after the joint (may be a trim or extension). */\n public curve1?: CurvePrimitive;\n /** Fractional position on curve1. */\n public fraction1?: number;\n /** Curve to be added within the joint. */\n public jointCurve?: CurvePrimitive;\n /** Common point on the original curves. */\n public swingPoint?: Point3d;\n /** Pointer to next joint. */\n public nextJoint?: Joint;\n /** Pointer to previous joint. */\n public previousJoint?: Joint;\n // capture references to all data members\n public constructor(\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined,\n ) {\n this.curve0 = curve0;\n this.curve1 = curve1;\n this.swingPoint = swingPoint;\n this.flexure = JointMode.Unknown;\n }\n /**\n * Try to construct an arc transition from ray0 to ray1 with given center.\n */\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\n const angle = ray0.direction.angleToXY(ray1.direction);\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\n const vector90 = vector0.rotate90CCWXY();\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\n }\n return undefined;\n }\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\n public shallowExtract(): any {\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\n }\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\n public static link(joint0: Joint, joint1: Joint | undefined) {\n joint0.nextJoint = joint1;\n if (joint1)\n joint1.previousJoint = joint0;\n if (joint0.curve1 && joint1 && !joint1.curve0)\n joint1.curve0 = joint0.curve1;\n else if (!joint0.curve1 && joint1 && joint1.curve0)\n joint0.curve1 = joint1.curve0;\n }\n /**\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\n * * Otherwise return defaultValue\n */\n public nextJointFraction0(defaultValue: number): number {\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\n return this.nextJoint.fraction0;\n return defaultValue;\n }\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\n if (curve) {\n curve.emitStrokes(destination);\n }\n }\n private static addPoint(destination: LineString3d, point: Point3d) {\n if (destination.packedPoints.length > 0) {\n const pointA = destination.endPoint();\n if (!pointA.isAlmostEqual(point))\n destination.packedPoints.push(point);\n }\n }\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.addStrokes(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n if (curve1) {\n if (!joint.jointCurve) {\n this.addPoint(destination, curve1.startPoint());\n }\n }\n this.addStrokes(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\n if (primitive) {\n if (destination.length > 0) {\n const pointA = destination[destination.length - 1].endPoint();\n const pointB = primitive.startPoint();\n if (!pointA.isAlmostEqual(pointB)) {\n destination.push(LineSegment3d.create(pointA, pointB));\n }\n }\n destination.push(primitive);\n }\n }\n private static adjustJointToPrimitives(joint: Joint) {\n const ls = joint.jointCurve;\n if (ls instanceof LineString3d) {\n if (joint.curve0) {\n const curvePoint = joint.curve0.endPoint();\n const jointPoint0 = ls.startPoint();\n if (!curvePoint.isAlmostEqual(jointPoint0))\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\n }\n if (joint.curve1) {\n const curvePoint = joint.curve1.startPoint();\n const jointPoint1 = ls.endPoint();\n if (!curvePoint.isAlmostEqual(jointPoint1))\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\n }\n }\n }\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\n if (start === undefined)\n return;\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.adjustJointToPrimitives(joint);\n this.collectPrimitive(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n this.collectPrimitive(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n /**\n * Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints' attributes,\n * such as whether to extend both curves to intersection or to fill the gap between curves.\n */\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\n if (start)\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\n }\n /**\n * Visit joints on a chain.\n * * Terminates if `callback` returns `false`.\n * @param start first (and, for cyclic chain, final) joint.\n * @param callback function to call with each Joint as a single parameter.\n * @param maxTest\n */\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\n let joint: Joint | undefined = start;\n if (joint) {\n let numTest = 0;\n while (joint !== undefined) {\n if (numTest++ >= maxTest + 5) // allow extra things to happen\n return true;\n if (!callback(joint))\n return false;\n joint = joint.nextJoint;\n if (joint === start)\n break;\n }\n }\n return true;\n }\n /** NOTE: no assumption on type of curve0, curve1 */\n private annotateExtension(options: JointOptions) {\n if (this.curve0 && this.curve1) {\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Extend;\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\n if (options.needArc(theta)) {\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc) {\n this.jointCurve = arc;\n return;\n }\n }\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\n if (numChamferPoints <= 1) { // create sharp corner\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\n return;\n }\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\n const radians0 = theta.radians;\n const numHalfStep = 2.0 * numChamferPoints;\n const halfStepRadians = radians0 / numHalfStep;\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc !== undefined) {\n const radialFraction = 1 / Math.cos(halfStepRadians);\n const jointCurve = LineString3d.create();\n this.jointCurve = jointCurve;\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\n\n for (let i = 0; i < numChamferPoints; i++) {\n const arcFraction = (1 + 2 * i) / numHalfStep;\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\n }\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\n return;\n }\n }\n }\n }\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n /** Select the index at which summed fraction difference is smallest */\n private selectIntersectionIndexByFraction(\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[],\n ): number {\n let index = -1;\n let aMin = Number.MAX_VALUE;\n for (let i = 0; i < intersections.length; i++) {\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\n + Math.abs(intersections[i].detailB.fraction - fractionB);\n if (a < aMin) {\n aMin = a;\n index = i;\n }\n }\n return index;\n }\n /**\n * Examine the adjacent geometry to set some of joint attributes:\n * * set JointMode: one of Cap, Extend, or Trim\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\n * * set joint curve\n * * this REFERENCES curve0, curve1, fraction0, fraction1\n * * this does not reference nextJoint and previousJoint\n */\n public annotateJointMode(options: JointOptions): void {\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\n this.flexure = JointMode.Cap;\n this.fraction1 = 0.0;\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\n this.flexure = JointMode.Cap;\n this.fraction0 = 1.0;\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\n if (this.curve0.endPoint().isAlmostEqualXY(this.curve1.startPoint())) { // joint between colinear xy-segments\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Trim;\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection || intersection.approachType === CurveCurveApproachType.PerpendicularChord) {\n this.fraction0 = intersection.detailA.fraction;\n this.fraction1 = intersection.detailB.fraction;\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\n this.annotateExtension(options);\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\n this.flexure = JointMode.Trim;\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n } else { // generic pair of curves\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\n if (intersectionIndex >= 0) { // need to trim\n this.flexure = JointMode.Trim;\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\n } else { // need to extend\n this.annotateExtension(options);\n }\n }\n }\n }\n /**\n * * Examine the primitive trim fractions between each pair of joints.\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\n * surrounding primitives\n * @param start\n */\n public static removeDegeneratePrimitives(\n start: Joint, options: JointOptions, maxTest: number,\n ): { newStart: Joint, numJointRemoved: number } {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\n */\n let jointA: Joint | undefined = start;\n let numRemoved = 0;\n const maxRemove = 1;\n let numTest = 0;\n if (jointA) {\n while (jointA !== undefined && numTest++ < maxTest) {\n const jointB = jointA.nextJoint;\n if (jointA\n && jointB\n && jointA.previousJoint\n && jointB.nextJoint\n && jointA.fraction1 !== undefined\n && jointB.fraction0 !== undefined\n ) {\n const f0 = jointA.fraction1;\n const f1 = jointB.fraction0;\n const g0 = jointB.fraction1;\n const g1 = jointB.nextJoint.fraction0;\n // f0 and f1 are fractions on the single primitive between these joints.\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\n }\n */\n const eliminateF = f0 >= f1 || f0 > 1.0;\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\n if (eliminateF && eliminateG) {\n const jointC = jointB.nextJoint;\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointC.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n if (newJoint.nextJoint)\n newJoint.nextJoint.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n } else if (eliminateF) {\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointB.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n newJoint.nextJoint!.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n numRemoved++;\n if (jointA === start)\n start = newJoint;\n jointA = newJoint;\n if (numRemoved >= maxRemove) {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\n */\n return { newStart: start, numJointRemoved: numRemoved };\n }\n }\n }\n jointA = jointA.nextJoint;\n if (jointA === start)\n break;\n }\n }\n return { newStart: start, numJointRemoved: numRemoved };\n }\n}\n\n/**\n * Context for building a wire xy-offset.\n * @internal\n */\nexport class PolygonWireOffsetContext {\n /** Construct a context. */\n public constructor() { }\n private static _unitAlong = Vector3d.create();\n private static _unitPerp = Vector3d.create();\n private static _offsetA = Point3d.create();\n private static _offsetB = Point3d.create();\n // Construct a single offset from base points\n private static createOffsetSegment(\n basePointA: Point3d, basePointB: Point3d, distance: number,\n ): CurvePrimitive | undefined {\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\n this._unitAlong.z = 0.0; // xy-offset\n if (this._unitAlong.normalizeInPlace()) {\n this._unitAlong.rotate90CCWXY(this._unitPerp);\n const segment = LineSegment3d.create(\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB),\n );\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\n return segment;\n }\n return undefined;\n }\n /**\n * Construct a wire (not area) that is offset from given polyline or polygon.\n * * For best results, points should be in a horizontal plane because z-coordinates are ignored.\n * * This is a simple wire offset (in the form of a line string), not an area.\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\n * * See [[JointOptions]] class doc for offset construction rules.\n * @param points a single loop or path\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\n * object.\n */\n public constructPolygonWireXYOffset(\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions,\n ): CurveChain | undefined {\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1]))\n wrap = false; // no wrap possible for polylines\n // create raw offset segments as a linked list of Joints, starting with joint0\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\n const numPoints = points.length;\n let fragment0: CurvePrimitive | undefined;\n let joint0, previousJoint: Joint | undefined;\n for (let i = 0; i + 1 < numPoints; ++i) {\n if (!previousJoint) { // start the linked list at the first nontrivial xy-segment\n if (fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance))\n previousJoint = joint0 = new Joint(undefined, fragment0, points[i]);\n } else {\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\n if (fragment1) { // append the next nontrivial xy-segment\n const newJoint = new Joint(fragment0, fragment1, points[i]);\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n }\n if (!fragment0 || !previousJoint || !joint0)\n return undefined; // no edge with positive xy-length\n const lastJoint = wrap ? joint0 : new Joint(fragment0, undefined, points[numPoints - 1]);\n Joint.link(previousJoint, lastJoint);\n Joint.annotateChain(joint0, options, numPoints);\n // make limited passes through the Joint chain until no self-intersections are removed\n for (let pass = 0; pass++ < 5;) {\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\n joint0 = state.newStart;\n if (state.numJointRemoved === 0)\n break;\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\n }\n */\n }\n const chain = LineString3d.create();\n Joint.collectStrokesFromChain(joint0, chain, numPoints); // compute offset corners (by extension/trim)\n const n = chain.packedPoints.length;\n if (n > 1) {\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\n return Loop.create(chain);\n else\n return Path.create(chain);\n }\n return undefined;\n }\n}\n\n/**\n * Context for building a wire xy-offset from a Path or Loop of CurvePrimitives\n * @internal\n */\nexport class CurveChainWireOffsetContext {\n /** construct a context. */\n public constructor() { }\n /**\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\n * @param cp curve primitive to annotate\n * @param startPoint optional start point\n * @param endPoint optional end point\n * @return the input CurvePrimitive with annotations\n */\n public static applyBasePoints(\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined,\n ): CurvePrimitive | undefined {\n if (cp !== undefined) {\n if (startPoint !== undefined)\n (cp as any).baseCurveStart = startPoint;\n if (endPoint !== undefined)\n (cp as any).baseCurveEnd = endPoint;\n }\n return cp;\n }\n /**\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\n * * Each primitive may be labeled (as an `any` object) with start or end point of base curve:\n * * `(primitive as any).baseCurveStart: Point3d`\n * * `(primitive as any).baseCurveEnd: Point3d`\n * @param curve primitive to offset\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\n */\n public static createSingleOffsetPrimitiveXY(\n curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions,\n ): CurvePrimitive | CurvePrimitive[] | undefined {\n const offset = curve.constructOffsetXY(offsetDistanceOrOptions);\n if (offset === undefined)\n return undefined;\n // decorate each offset with its base curve's endpoints\n if (Array.isArray(offset)) {\n const basePrims = curve.collectCurvePrimitives(undefined, true, true);\n if (basePrims.length !== offset.length)\n return undefined; // unexpected aggregate curve type!\n for (let i = 0; i < basePrims.length; ++i)\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\n return offset;\n }\n return this.applyBasePoints(offset, curve.startPoint(), curve.endPoint());\n }\n /**\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\n * not detect self intersection among widely separated edges.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\n * @param curves base curves.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\n */\n public static constructCurveXYOffset(\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\n ): CurveCollection | undefined {\n const wrap: boolean = curves instanceof Loop;\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\n const simpleOffsets: CurvePrimitive[] = [];\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\n for (const c of curves.children) {\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\n if (c1 === undefined) {\n // bad; maybe arc to inside?\n } else if (c1 instanceof CurvePrimitive) {\n simpleOffsets.push(c1);\n } else if (Array.isArray(c1)) {\n for (const c2 of c1) {\n if (c2 instanceof CurvePrimitive)\n simpleOffsets.push(c2);\n }\n }\n }\n /** create joints between array elements to make offsets as a linked list (joint0) */\n let fragment0;\n let newJoint;\n let previousJoint;\n let joint0;\n for (const fragment1 of simpleOffsets) {\n if (fragment1) {\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\n if (newJoint !== undefined)\n if (joint0 === undefined)\n joint0 = newJoint;\n if (previousJoint)\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n if (joint0 && previousJoint && curves instanceof Loop)\n Joint.link(previousJoint, joint0);\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\n const numOffset = simpleOffsets.length;\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\n const outputCurves: CurvePrimitive[] = [];\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { CurveCollection } from "../CurveCollection";
2
+ import { CurvePrimitive } from "../CurvePrimitive";
3
+ import { CloneCurvesContext } from "./CloneCurvesContext";
4
+ /**
5
+ * Algorithmic class for shallow-copying a CurveCollection with each full-sweep arc replaced by two half-sweep arcs.
6
+ * * Often useful for building graphs from loops.
7
+ * @internal
8
+ */
9
+ export declare class TransferWithSplitArcs extends CloneCurvesContext {
10
+ constructor();
11
+ protected doClone(primitive: CurvePrimitive): CurvePrimitive | CurvePrimitive[];
12
+ static clone(target: CurveCollection): CurveCollection;
13
+ }
14
+ //# sourceMappingURL=TransferWithSplitArcs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransferWithSplitArcs.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/TransferWithSplitArcs.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,kBAAkB;;cAIxC,OAAO,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,GAAG,cAAc,EAAE;WAKjE,KAAK,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe;CAKvE"}
@@ -0,0 +1,30 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Curve
7
+ */
8
+ import { Arc3d } from "../Arc3d";
9
+ import { CloneCurvesContext } from "./CloneCurvesContext";
10
+ /**
11
+ * Algorithmic class for shallow-copying a CurveCollection with each full-sweep arc replaced by two half-sweep arcs.
12
+ * * Often useful for building graphs from loops.
13
+ * @internal
14
+ */
15
+ export class TransferWithSplitArcs extends CloneCurvesContext {
16
+ constructor() {
17
+ super(undefined);
18
+ }
19
+ doClone(primitive) {
20
+ if (primitive instanceof Arc3d && primitive.sweep.isFullCircle) // replace full arc with two half arcs
21
+ return [primitive.clonePartialCurve(0.0, 0.5), primitive.clonePartialCurve(0.5, 1)];
22
+ return primitive;
23
+ }
24
+ static clone(target) {
25
+ const context = new TransferWithSplitArcs();
26
+ target.announceToCurveProcessor(context);
27
+ return context._result;
28
+ }
29
+ }
30
+ //# sourceMappingURL=TransferWithSplitArcs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransferWithSplitArcs.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/TransferWithSplitArcs.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,kBAAkB;IAC3D;QACE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IACkB,OAAO,CAAC,SAAyB;QAClD,IAAI,SAAS,YAAY,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,sCAAsC;YACpG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACtF,OAAO,SAAS,CAAC;IACnB,CAAC;IACM,MAAM,CAAU,KAAK,CAAC,MAAuB;QAClD,MAAM,OAAO,GAAG,IAAI,qBAAqB,EAAE,CAAC;QAC5C,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,OAA0B,CAAC;IAC5C,CAAC;CACF","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 Curve\n */\n\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveCollection } from \"../CurveCollection\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { CloneCurvesContext } from \"./CloneCurvesContext\";\n\n/**\n * Algorithmic class for shallow-copying a CurveCollection with each full-sweep arc replaced by two half-sweep arcs.\n * * Often useful for building graphs from loops.\n * @internal\n */\nexport class TransferWithSplitArcs extends CloneCurvesContext {\n public constructor() {\n super(undefined);\n }\n protected override doClone(primitive: CurvePrimitive): CurvePrimitive | CurvePrimitive[] {\n if (primitive instanceof Arc3d && primitive.sweep.isFullCircle) // replace full arc with two half arcs\n return [primitive.clonePartialCurve(0.0, 0.5), primitive.clonePartialCurve(0.5, 1)];\n return primitive;\n }\n public static override clone(target: CurveCollection): CurveCollection {\n const context = new TransferWithSplitArcs();\n target.announceToCurveProcessor(context);\n return context._result as CurveCollection;\n }\n}"]}
@@ -7,17 +7,20 @@ import { GrowableFloat64Array } from "./GrowableFloat64Array";
7
7
  /**
8
8
  * An `AngleSweep` is a pair of angles at start and end of an interval.
9
9
  *
10
- * * For stroking purposes, the "included interval" is all angles numerically reached
11
- * by theta = start + f*(end-start), where f is between 0 and 1.
12
- * * This stroking formula is simple numbers -- 2PI shifts are not involved.
13
- * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.
14
- * * If "start < end" the angle proceeds CCW around the unit circle.
15
- * * If "end < start" the angle proceeds CW around the unit circle.
16
- * * Angles beyond 360 are fine as endpoints.
17
- * * (350,370) covers the same unit angles as (-10,10).
18
- * * (370,350) covers the same unit angles as (10,-10).
19
- * * math details related fraction API can be found at docs/learning/geometry/Angle.md
20
- * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep
10
+ * * For stroking purposes, the "included interval" is all angles numerically reached
11
+ * by `theta = start + f * (end - start)`, where `0 <= f <= 1`.
12
+ * * This stroking formula is simple numbers -- 2PI shifts are not involved.
13
+ * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.
14
+ * * Angles greater than 360 and less than 0 are fine as endpoints.
15
+ * * An AngleSweep determines orientation only _in concert with a reference vector_, e.g., a plane normal like (0,0,1).
16
+ * * Be careful reading orientation from an AngleSweep without a reference vector!
17
+ * * If "start < end" the angles in the sweep proceed counterclockwise around the reference vector.
18
+ * * If "start > end" the angles in the sweep proceed clockwise around the reference vector.
19
+ * * (350,370) covers the same angles as (-10,10), and both sweeps are counterclockwise around the reference vector.
20
+ * * (370,350) covers the same angles as (10,-10), and both sweeps are clockwise around the reference vector.
21
+ * * (370,350) covers the same angles as (-10,10), but the sweeps have opposite orientation.
22
+ * * Math details can be found at docs/learning/geometry/Angle.md .
23
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep .
21
24
  * @public
22
25
  */
23
26
  export declare class AngleSweep implements BeJSONFunctions {
@@ -72,7 +75,7 @@ export declare class AngleSweep implements BeJSONFunctions {
72
75
  * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.
73
76
  */
74
77
  static createStartEndRadians(startRadians?: number, endRadians?: number, result?: AngleSweep): AngleSweep;
75
- /** Return the angle obtained by subtracting radians from this angle. */
78
+ /** Return the AngleSweep obtained by subtracting radians from the start and end angles of this sweep. */
76
79
  cloneMinusRadians(radians: number): AngleSweep;
77
80
  /** Create an AngleSweep from start and end angles given in degrees. */
78
81
  static createStartEndDegrees(startDegrees?: number, endDegrees?: number, result?: AngleSweep): AngleSweep;
@@ -144,22 +147,26 @@ export declare class AngleSweep implements BeJSONFunctions {
144
147
  * @param fraction fraction of the sweep.
145
148
  * @param radians0 start angle of sweep (in radians).
146
149
  * @param radians1 end angle of sweep (in radians).
147
- * @param toNegativeFraction return an exterior fraction period-shifted to within one period of the start (true) or
148
- * end (false) of the sweep.
150
+ * @param toNegativeFraction exterior fraction handling:
151
+ * * if true, return `fraction` period-shifted to within one period of the start
152
+ * * if false, return `fraction` period-shifted to within one period of the end
153
+ * * if undefined, return the period-shift of `fraction` closest to [0,1].
149
154
  * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is
150
155
  * returned unchanged.
151
156
  */
152
- static fractionToSignedPeriodicFractionStartEnd(fraction: number, radians0: number, radians1: number, toNegativeFraction: boolean): number;
157
+ static fractionToSignedPeriodicFractionStartEnd(fraction: number, radians0: number, radians1: number, toNegativeFraction?: boolean): number;
153
158
  /**
154
159
  * Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of
155
160
  * zero on the desired side.
156
161
  * @param fraction fraction of the sweep.
157
- * @param toNegativeFraction return an exterior fraction period-shifted to within one period of the start (true) or
158
- * end (false) of the sweep.
162
+ * @param toNegativeFraction exterior fraction handling:
163
+ * * if true, return `fraction` period-shifted to within one period of the start
164
+ * * if false, return `fraction` period-shifted to within one period of the end
165
+ * * if undefined, return the period-shift of `fraction` closest to [0,1].
159
166
  * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is
160
167
  * returned unchanged.
161
168
  */
162
- fractionToSignedPeriodicFraction(fraction: number, toNegativeFraction: boolean): number;
169
+ fractionToSignedPeriodicFraction(fraction: number, toNegativeFraction?: boolean): number;
163
170
  /**
164
171
  * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.
165
172
  * * consider radians0 as `start` angle of the sweep and radians1 as `end` angle of the sweep
@@ -1 +1 @@
1
- {"version":3,"file":"AngleSweep.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/AngleSweep.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAY,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CA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uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAE,OAAe,EAAE,gBAAgB,GAAE,MAAY,GAAG,MAAM;IAG5H;;;;;;;;;;;OAWG;IACI,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,kBAAkB,GAAE,OAAe,EAAE,gBAAgB,GAAE,MAAY,GAAG,MAAM;IAIvH,6FAA6F;WAC/E,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,GAAE,OAAc,GAAG,OAAO;IASjI,4DAA4D;IACrD,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAE,OAAc,GAAG,OAAO;IAGnF,6DAA6D;IACtD,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAG5C;;;;;;;;OAQG;IACI,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG;IAc7B,+CAA+C;WACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,UAAU;IAK1D;;;OAGG;IACI,MAAM,IAAI,GAAG;IAGpB;;;;;OAKG;IACI,6BAA6B,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,GAAE,MAAmC,GAAG,OAAO;IAKhH;;;;;OAKG;IACI,0BAA0B,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,GAAE,MAAmC,GAAG,OAAO;IAI7G;;;;;OAKG;IACI,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;CAGjD"}
@@ -10,17 +10,20 @@ import { Angle } from "./Angle";
10
10
  /**
11
11
  * An `AngleSweep` is a pair of angles at start and end of an interval.
12
12
  *
13
- * * For stroking purposes, the "included interval" is all angles numerically reached
14
- * by theta = start + f*(end-start), where f is between 0 and 1.
15
- * * This stroking formula is simple numbers -- 2PI shifts are not involved.
16
- * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.
17
- * * If "start < end" the angle proceeds CCW around the unit circle.
18
- * * If "end < start" the angle proceeds CW around the unit circle.
19
- * * Angles beyond 360 are fine as endpoints.
20
- * * (350,370) covers the same unit angles as (-10,10).
21
- * * (370,350) covers the same unit angles as (10,-10).
22
- * * math details related fraction API can be found at docs/learning/geometry/Angle.md
23
- * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep
13
+ * * For stroking purposes, the "included interval" is all angles numerically reached
14
+ * by `theta = start + f * (end - start)`, where `0 <= f <= 1`.
15
+ * * This stroking formula is simple numbers -- 2PI shifts are not involved.
16
+ * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.
17
+ * * Angles greater than 360 and less than 0 are fine as endpoints.
18
+ * * An AngleSweep determines orientation only _in concert with a reference vector_, e.g., a plane normal like (0,0,1).
19
+ * * Be careful reading orientation from an AngleSweep without a reference vector!
20
+ * * If "start < end" the angles in the sweep proceed counterclockwise around the reference vector.
21
+ * * If "start > end" the angles in the sweep proceed clockwise around the reference vector.
22
+ * * (350,370) covers the same angles as (-10,10), and both sweeps are counterclockwise around the reference vector.
23
+ * * (370,350) covers the same angles as (10,-10), and both sweeps are clockwise around the reference vector.
24
+ * * (370,350) covers the same angles as (-10,10), but the sweeps have opposite orientation.
25
+ * * Math details can be found at docs/learning/geometry/Angle.md .
26
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep .
24
27
  * @public
25
28
  */
26
29
  export class AngleSweep {
@@ -115,7 +118,7 @@ export class AngleSweep {
115
118
  result.setStartEndRadians(startRadians, endRadians);
116
119
  return result;
117
120
  }
118
- /** Return the angle obtained by subtracting radians from this angle. */
121
+ /** Return the AngleSweep obtained by subtracting radians from the start and end angles of this sweep. */
119
122
  cloneMinusRadians(radians) {
120
123
  return new AngleSweep(this._radians0 - radians, this._radians1 - radians);
121
124
  }
@@ -252,8 +255,10 @@ export class AngleSweep {
252
255
  * @param fraction fraction of the sweep.
253
256
  * @param radians0 start angle of sweep (in radians).
254
257
  * @param radians1 end angle of sweep (in radians).
255
- * @param toNegativeFraction return an exterior fraction period-shifted to within one period of the start (true) or
256
- * end (false) of the sweep.
258
+ * @param toNegativeFraction exterior fraction handling:
259
+ * * if true, return `fraction` period-shifted to within one period of the start
260
+ * * if false, return `fraction` period-shifted to within one period of the end
261
+ * * if undefined, return the period-shift of `fraction` closest to [0,1].
257
262
  * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is
258
263
  * returned unchanged.
259
264
  */
@@ -267,16 +272,25 @@ export class AngleSweep {
267
272
  fraction = fraction % period; // period-shifted equivalent fraction closest to 0 with same sign as fraction
268
273
  if (fraction + period < 1)
269
274
  fraction += period; // it's really an interior fraction
270
- if (Geometry.isIn01(fraction) || (toNegativeFraction && fraction < 0) || (!toNegativeFraction && fraction > 1))
275
+ if (Geometry.isIn01(fraction))
271
276
  return fraction;
272
- return toNegativeFraction ? fraction - period : fraction + period; // shift to other side of sweep
277
+ if (toNegativeFraction === true)
278
+ return fraction < 0 ? fraction : fraction - period;
279
+ if (toNegativeFraction === false)
280
+ return fraction > 1 ? fraction : fraction + period;
281
+ const fractionDistFrom01 = fraction < 0 ? -fraction : fraction - 1;
282
+ const fraction2 = fraction < 0 ? fraction + period : fraction - period; // period-shift with opposite sign
283
+ const fraction2DistFrom01 = fraction2 < 0 ? -fraction2 : fraction2 - 1;
284
+ return fractionDistFrom01 < fraction2DistFrom01 ? fraction : fraction2; // choose the period-shift closer to [0,1]
273
285
  }
274
286
  /**
275
287
  * Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of
276
288
  * zero on the desired side.
277
289
  * @param fraction fraction of the sweep.
278
- * @param toNegativeFraction return an exterior fraction period-shifted to within one period of the start (true) or
279
- * end (false) of the sweep.
290
+ * @param toNegativeFraction exterior fraction handling:
291
+ * * if true, return `fraction` period-shifted to within one period of the start
292
+ * * if false, return `fraction` period-shifted to within one period of the end
293
+ * * if undefined, return the period-shift of `fraction` closest to [0,1].
280
294
  * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is
281
295
  * returned unchanged.
282
296
  */