@itwin/core-geometry 4.1.0-dev.6 → 4.1.0-dev.63

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 (310) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  3. package/lib/cjs/clipping/ClipPrimitive.js +2 -0
  4. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  5. package/lib/cjs/core-geometry.d.ts +1 -0
  6. package/lib/cjs/core-geometry.d.ts.map +1 -1
  7. package/lib/cjs/core-geometry.js +4 -1
  8. package/lib/cjs/core-geometry.js.map +1 -1
  9. package/lib/cjs/curve/Arc3d.d.ts +1 -0
  10. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  11. package/lib/cjs/curve/Arc3d.js +1 -0
  12. package/lib/cjs/curve/Arc3d.js.map +1 -1
  13. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +61 -41
  14. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +69 -46
  16. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  17. package/lib/cjs/curve/CurveCollection.d.ts +36 -26
  18. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  19. package/lib/cjs/curve/CurveCollection.js +46 -39
  20. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  21. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  22. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  23. package/lib/cjs/curve/CurveFactory.d.ts +67 -3
  24. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  25. package/lib/cjs/curve/CurveFactory.js +75 -7
  26. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  27. package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
  28. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  29. package/lib/cjs/curve/CurveLocationDetail.js +9 -7
  30. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  31. package/lib/cjs/curve/CurvePrimitive.d.ts +4 -3
  32. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  33. package/lib/cjs/curve/CurvePrimitive.js +4 -3
  34. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  35. package/lib/cjs/curve/LineSegment3d.d.ts +6 -4
  36. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  37. package/lib/cjs/curve/LineSegment3d.js +4 -4
  38. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  39. package/lib/cjs/curve/LineString3d.d.ts +1 -1
  40. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  41. package/lib/cjs/curve/LineString3d.js +1 -1
  42. package/lib/cjs/curve/LineString3d.js.map +1 -1
  43. package/lib/cjs/curve/Loop.d.ts +7 -5
  44. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  45. package/lib/cjs/curve/Loop.js +18 -6
  46. package/lib/cjs/curve/Loop.js.map +1 -1
  47. package/lib/cjs/curve/ParityRegion.d.ts +7 -7
  48. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  49. package/lib/cjs/curve/ParityRegion.js +19 -11
  50. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  51. package/lib/cjs/curve/Path.d.ts +6 -6
  52. package/lib/cjs/curve/Path.d.ts.map +1 -1
  53. package/lib/cjs/curve/Path.js +15 -9
  54. package/lib/cjs/curve/Path.js.map +1 -1
  55. package/lib/cjs/curve/ProxyCurve.d.ts +4 -6
  56. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  57. package/lib/cjs/curve/ProxyCurve.js +7 -7
  58. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  59. package/lib/cjs/curve/RegionOps.d.ts +69 -47
  60. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  61. package/lib/cjs/curve/RegionOps.js +70 -47
  62. package/lib/cjs/curve/RegionOps.js.map +1 -1
  63. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  64. package/lib/cjs/curve/StrokeOptions.js +6 -2
  65. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  66. package/lib/cjs/curve/UnionRegion.d.ts +6 -5
  67. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  68. package/lib/cjs/curve/UnionRegion.js +17 -8
  69. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
  71. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  72. package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
  73. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -0
  75. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  76. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +5 -2
  77. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  79. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  80. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  81. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
  83. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  84. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +153 -87
  85. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  86. package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  87. package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
  88. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  89. package/lib/cjs/geometry3d/Angle.d.ts +9 -0
  90. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  91. package/lib/cjs/geometry3d/Angle.js +13 -0
  92. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  93. package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
  94. package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
  95. package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
  96. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  97. package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
  98. package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
  99. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  100. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  101. package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
  102. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  103. package/lib/cjs/geometry3d/GeometryHandler.d.ts +5 -5
  104. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  105. package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
  106. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  107. package/lib/cjs/geometry3d/Matrix3d.js +27 -0
  108. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  109. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  110. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  111. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +35 -32
  112. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  113. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +8 -0
  114. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  115. package/lib/cjs/geometry3d/Point3dVector3d.js +13 -0
  116. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  117. package/lib/cjs/geometry3d/PolylineOps.d.ts +16 -1
  118. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  119. package/lib/cjs/geometry3d/PolylineOps.js +55 -0
  120. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  121. package/lib/cjs/geometry3d/Range.d.ts +134 -94
  122. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  123. package/lib/cjs/geometry3d/Range.js +297 -145
  124. package/lib/cjs/geometry3d/Range.js.map +1 -1
  125. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  126. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  127. package/lib/cjs/geometry3d/Transform.d.ts +7 -0
  128. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  129. package/lib/cjs/geometry3d/Transform.js +12 -0
  130. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  131. package/lib/cjs/polyface/PolyfaceQuery.d.ts +64 -6
  132. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  133. package/lib/cjs/polyface/PolyfaceQuery.js +104 -19
  134. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  135. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
  136. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  137. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +79 -1
  138. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  139. package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
  140. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  141. package/lib/cjs/serialization/GeometrySamples.js +30 -0
  142. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  143. package/lib/cjs/solid/LinearSweep.d.ts +2 -1
  144. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  145. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  146. package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
  147. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  148. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  149. package/lib/cjs/solid/RuledSweep.d.ts +2 -1
  150. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  151. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  152. package/lib/cjs/solid/SweepContour.d.ts +2 -2
  153. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  154. package/lib/cjs/solid/SweepContour.js +9 -0
  155. package/lib/cjs/solid/SweepContour.js.map +1 -1
  156. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  157. package/lib/esm/clipping/ClipPrimitive.js +2 -0
  158. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  159. package/lib/esm/core-geometry.d.ts +1 -0
  160. package/lib/esm/core-geometry.d.ts.map +1 -1
  161. package/lib/esm/core-geometry.js +2 -0
  162. package/lib/esm/core-geometry.js.map +1 -1
  163. package/lib/esm/curve/Arc3d.d.ts +1 -0
  164. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  165. package/lib/esm/curve/Arc3d.js +1 -0
  166. package/lib/esm/curve/Arc3d.js.map +1 -1
  167. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +61 -41
  168. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  169. package/lib/esm/curve/CurveChainWithDistanceIndex.js +69 -46
  170. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  171. package/lib/esm/curve/CurveCollection.d.ts +36 -26
  172. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  173. package/lib/esm/curve/CurveCollection.js +46 -39
  174. package/lib/esm/curve/CurveCollection.js.map +1 -1
  175. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  176. package/lib/esm/curve/CurveCurve.js.map +1 -1
  177. package/lib/esm/curve/CurveFactory.d.ts +67 -3
  178. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  179. package/lib/esm/curve/CurveFactory.js +74 -6
  180. package/lib/esm/curve/CurveFactory.js.map +1 -1
  181. package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
  182. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  183. package/lib/esm/curve/CurveLocationDetail.js +9 -7
  184. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  185. package/lib/esm/curve/CurvePrimitive.d.ts +4 -3
  186. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  187. package/lib/esm/curve/CurvePrimitive.js +4 -3
  188. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  189. package/lib/esm/curve/LineSegment3d.d.ts +6 -4
  190. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  191. package/lib/esm/curve/LineSegment3d.js +4 -4
  192. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  193. package/lib/esm/curve/LineString3d.d.ts +1 -1
  194. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  195. package/lib/esm/curve/LineString3d.js +1 -1
  196. package/lib/esm/curve/LineString3d.js.map +1 -1
  197. package/lib/esm/curve/Loop.d.ts +7 -5
  198. package/lib/esm/curve/Loop.d.ts.map +1 -1
  199. package/lib/esm/curve/Loop.js +18 -6
  200. package/lib/esm/curve/Loop.js.map +1 -1
  201. package/lib/esm/curve/ParityRegion.d.ts +7 -7
  202. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  203. package/lib/esm/curve/ParityRegion.js +19 -11
  204. package/lib/esm/curve/ParityRegion.js.map +1 -1
  205. package/lib/esm/curve/Path.d.ts +6 -6
  206. package/lib/esm/curve/Path.d.ts.map +1 -1
  207. package/lib/esm/curve/Path.js +15 -9
  208. package/lib/esm/curve/Path.js.map +1 -1
  209. package/lib/esm/curve/ProxyCurve.d.ts +4 -6
  210. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  211. package/lib/esm/curve/ProxyCurve.js +7 -7
  212. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  213. package/lib/esm/curve/RegionOps.d.ts +69 -47
  214. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  215. package/lib/esm/curve/RegionOps.js +70 -47
  216. package/lib/esm/curve/RegionOps.js.map +1 -1
  217. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  218. package/lib/esm/curve/StrokeOptions.js +6 -2
  219. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  220. package/lib/esm/curve/UnionRegion.d.ts +6 -5
  221. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  222. package/lib/esm/curve/UnionRegion.js +17 -8
  223. package/lib/esm/curve/UnionRegion.js.map +1 -1
  224. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
  225. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  226. package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
  227. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  228. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -0
  229. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  230. package/lib/esm/curve/internalContexts/MultiChainCollector.js +5 -2
  231. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  232. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  233. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  234. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  235. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  236. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
  237. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  238. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +153 -87
  239. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  240. package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  241. package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
  242. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  243. package/lib/esm/geometry3d/Angle.d.ts +9 -0
  244. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  245. package/lib/esm/geometry3d/Angle.js +13 -0
  246. package/lib/esm/geometry3d/Angle.js.map +1 -1
  247. package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
  248. package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
  249. package/lib/esm/geometry3d/BilinearPatch.js +51 -55
  250. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  251. package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
  252. package/lib/esm/geometry3d/Ellipsoid.js +1 -1
  253. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  254. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  255. package/lib/esm/geometry3d/FrameBuilder.js +13 -11
  256. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  257. package/lib/esm/geometry3d/GeometryHandler.d.ts +5 -5
  258. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  259. package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
  260. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  261. package/lib/esm/geometry3d/Matrix3d.js +27 -0
  262. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  263. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  264. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  265. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +35 -32
  266. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  267. package/lib/esm/geometry3d/Point3dVector3d.d.ts +8 -0
  268. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  269. package/lib/esm/geometry3d/Point3dVector3d.js +13 -0
  270. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  271. package/lib/esm/geometry3d/PolylineOps.d.ts +16 -1
  272. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  273. package/lib/esm/geometry3d/PolylineOps.js +56 -1
  274. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  275. package/lib/esm/geometry3d/Range.d.ts +134 -94
  276. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  277. package/lib/esm/geometry3d/Range.js +297 -145
  278. package/lib/esm/geometry3d/Range.js.map +1 -1
  279. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  280. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  281. package/lib/esm/geometry3d/Transform.d.ts +7 -0
  282. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  283. package/lib/esm/geometry3d/Transform.js +12 -0
  284. package/lib/esm/geometry3d/Transform.js.map +1 -1
  285. package/lib/esm/polyface/PolyfaceQuery.d.ts +64 -6
  286. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  287. package/lib/esm/polyface/PolyfaceQuery.js +103 -19
  288. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  289. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
  290. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  291. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +78 -1
  292. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  293. package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
  294. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  295. package/lib/esm/serialization/GeometrySamples.js +30 -0
  296. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  297. package/lib/esm/solid/LinearSweep.d.ts +2 -1
  298. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  299. package/lib/esm/solid/LinearSweep.js.map +1 -1
  300. package/lib/esm/solid/RotationalSweep.d.ts +2 -1
  301. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  302. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  303. package/lib/esm/solid/RuledSweep.d.ts +2 -1
  304. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  305. package/lib/esm/solid/RuledSweep.js.map +1 -1
  306. package/lib/esm/solid/SweepContour.d.ts +2 -2
  307. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  308. package/lib/esm/solid/SweepContour.js +9 -0
  309. package/lib/esm/solid/SweepContour.js.map +1 -1
  310. package/package.json +5 -5
@@ -22,8 +22,9 @@ const Loop_1 = require("../Loop");
22
22
  const Path_1 = require("../Path");
23
23
  const RegionOps_1 = require("../RegionOps");
24
24
  const StrokeOptions_1 = require("../StrokeOptions");
25
+ // cspell:word CCWXY
25
26
  /**
26
- * Classification of contortions at a joint.
27
+ * Classification of how the joint is constructed.
27
28
  * @internal
28
29
  */
29
30
  var JointMode;
@@ -36,26 +37,44 @@ var JointMode;
36
37
  JointMode[JointMode["Gap"] = 4] = "Gap";
37
38
  })(JointMode || (JointMode = {}));
38
39
  /**
39
- * * Control parameters for joint construction.
40
- * * Decision order is:
41
- * * if turn angle is greater than minArcDegrees, make an arc.
42
- * * if turn angle is less than or equal maxChamferTurnDegrees, extend curves along tangent to single intersection point.
43
- * * if turn angle is greater than maxChamferTurnDegrees, construct multiple lines that are tangent to the turn circle "from the outside",
44
- * with each equal turn less than maxChamferTurnDegrees.
45
- * * otherwise make single edge.
40
+ * Control parameters for joint construction.
41
+ * * Define a "joint" as the common point between adjacent segments of the input curve.
42
+ * * Define the "turn angle" at a joint to be the angle in [0,pi] between the first derivatives (tangents) of
43
+ * the segments at the joint.
44
+ * * When creating offsets, if an offset needs to do an "outside" turn, the first applicable construction is applied:
45
+ * * If the turn angle is larger than `options.minArcDegrees`, a circular arc is constructed to offset the joint.
46
+ * * If the turn angle is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to
47
+ * single intersection point (to create a sharp corner).
48
+ * * If the turn angle is larger than `options.maxChamferDegrees`, the joint is offset with a line string whose edges:
49
+ * * lie outside the arc that would have been created by the first construction
50
+ * * have uniform turn angle less than `options.maxChamferDegrees`
51
+ * * touch the arc at their midpoint (except first and last edge).
46
52
  * @public
47
53
  */
48
54
  class JointOptions {
49
- /** Construct JointOptions.
55
+ /**
56
+ * Construct JointOptions.
50
57
  * * leftOffsetDistance is required
51
58
  * * minArcDegrees and maxChamferDegrees are optional.
52
59
  */
53
- constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false) {
54
- /** smallest arc to construct.
55
- * * If this control angle is large, arcs are never created.
60
+ constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false, allowSharpestCorners = false) {
61
+ /**
62
+ * Smallest arc to construct.
63
+ * * If this control angle is 180 degrees or more, arcs are never created.
56
64
  */
57
65
  this.minArcDegrees = 180.0;
66
+ /** Largest turn angle at which to construct a sharp corner, or largest turn angle in a multi-segment chamfer. */
58
67
  this.maxChamferTurnDegrees = 90;
68
+ /**
69
+ * Whether to remove the internal turn angle upper bound for sharp corner construction.
70
+ * * By default, a sharp corner is not created at a joint when the turn angle is too large, so as to avoid offsets whose
71
+ * ranges blow up. Internally, this is implemented by applying an upper bound of 120 degrees to `maxChamferTurnDegrees`.
72
+ * * When `allowSharpestCorners` is true, this internal upper bound is removed, allowing sharp corners for turn angles
73
+ * up to `maxChamferTurnDegrees`.
74
+ * * Thus, if you know your input turn angles are no greater than `maxChamferTurnDegrees`, you can create an offset
75
+ * with sharp corners at each joint by setting `minArcDegrees` to 180 and `allowSharpestCorners` to true.
76
+ */
77
+ this.allowSharpestCorners = false;
59
78
  /** Offset distance, positive to left of base curve. */
60
79
  this.leftOffsetDistance = 0;
61
80
  /** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */
@@ -64,10 +83,11 @@ class JointOptions {
64
83
  this.minArcDegrees = minArcDegrees;
65
84
  this.maxChamferTurnDegrees = maxChamferDegrees;
66
85
  this.preserveEllipticalArcs = preserveEllipticalArcs;
86
+ this.allowSharpestCorners = allowSharpestCorners;
67
87
  }
68
88
  /** Return a deep clone. */
69
89
  clone() {
70
- return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs);
90
+ return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs, this.allowSharpestCorners);
71
91
  }
72
92
  /** Copy values of input options */
73
93
  setFrom(other) {
@@ -75,6 +95,7 @@ class JointOptions {
75
95
  this.minArcDegrees = other.minArcDegrees;
76
96
  this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;
77
97
  this.preserveEllipticalArcs = other.preserveEllipticalArcs;
98
+ this.allowSharpestCorners = other.allowSharpestCorners;
78
99
  }
79
100
  /**
80
101
  * Parse a number or JointOptions up to JointOptions:
@@ -85,17 +106,22 @@ class JointOptions {
85
106
  static create(leftOffsetDistanceOrOptions) {
86
107
  if (leftOffsetDistanceOrOptions instanceof JointOptions)
87
108
  return leftOffsetDistanceOrOptions;
88
- // if (Number.isFinite(leftOffsetDistanceOrOptions))
89
109
  return new JointOptions(leftOffsetDistanceOrOptions);
90
110
  }
91
- /** return true if the options indicate this amount of turn should be handled with an arc. */
111
+ /**
112
+ /** Return true if the options indicate this amount of turn should be handled with an arc. */
92
113
  needArc(theta) {
93
114
  return Math.abs(theta.degrees) >= this.minArcDegrees;
94
115
  }
95
- /** Test if turn by theta should be output as single point. */
116
+ /** Return the number of corners needed to chamfer the given turn angle. */
96
117
  numChamferPoints(theta) {
97
118
  const degrees = Math.abs(theta.degrees);
98
- const stepDegrees = Geometry_1.Geometry.clamp(this.maxChamferTurnDegrees, 10, 120);
119
+ const minStepDegreesClamp = 10;
120
+ let maxStepDegreesClamp = 120;
121
+ if (this.allowSharpestCorners) {
122
+ maxStepDegreesClamp = this.maxChamferTurnDegrees;
123
+ }
124
+ const stepDegrees = Geometry_1.Geometry.clamp(this.maxChamferTurnDegrees, minStepDegreesClamp, maxStepDegreesClamp);
99
125
  if (degrees <= stepDegrees)
100
126
  return 1;
101
127
  return Math.ceil(degrees / stepDegrees);
@@ -112,17 +138,41 @@ class OffsetOptions {
112
138
  this.jointOptions = JointOptions.create(offsetDistanceOrOptions);
113
139
  this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions_1.StrokeOptions.createForCurves();
114
140
  }
115
- get minArcDegrees() { return this.jointOptions.minArcDegrees; }
116
- set minArcDegrees(value) { this.jointOptions.minArcDegrees = value; }
117
- get maxChamferTurnDegrees() { return this.jointOptions.maxChamferTurnDegrees; }
118
- set maxChamferTurnDegrees(value) { this.jointOptions.maxChamferTurnDegrees = value; }
119
- get leftOffsetDistance() { return this.jointOptions.leftOffsetDistance; }
120
- set leftOffsetDistance(value) { this.jointOptions.leftOffsetDistance = value; }
121
- get preserveEllipticalArcs() { return this.jointOptions.preserveEllipticalArcs; }
122
- set preserveEllipticalArcs(value) { this.jointOptions.preserveEllipticalArcs = value; }
123
- /** Convert variant input into OffsetOptions.
141
+ get minArcDegrees() {
142
+ return this.jointOptions.minArcDegrees;
143
+ }
144
+ set minArcDegrees(value) {
145
+ this.jointOptions.minArcDegrees = value;
146
+ }
147
+ get maxChamferTurnDegrees() {
148
+ return this.jointOptions.maxChamferTurnDegrees;
149
+ }
150
+ set maxChamferTurnDegrees(value) {
151
+ this.jointOptions.maxChamferTurnDegrees = value;
152
+ }
153
+ get allowSharpestCorners() {
154
+ return this.jointOptions.allowSharpestCorners;
155
+ }
156
+ set allowSharpestCorners(value) {
157
+ this.jointOptions.allowSharpestCorners = value;
158
+ }
159
+ get leftOffsetDistance() {
160
+ return this.jointOptions.leftOffsetDistance;
161
+ }
162
+ set leftOffsetDistance(value) {
163
+ this.jointOptions.leftOffsetDistance = value;
164
+ }
165
+ get preserveEllipticalArcs() {
166
+ return this.jointOptions.preserveEllipticalArcs;
167
+ }
168
+ set preserveEllipticalArcs(value) {
169
+ this.jointOptions.preserveEllipticalArcs = value;
170
+ }
171
+ /**
172
+ * Convert variant input into OffsetOptions.
124
173
  * * If a JointOptions is provided, it is captured.
125
- * * If an OffsetOptions is provided, a reference to it is returned. */
174
+ * * If an OffsetOptions is provided, a reference to it is returned.
175
+ */
126
176
  static create(offsetDistanceOrOptions) {
127
177
  if (offsetDistanceOrOptions instanceof OffsetOptions)
128
178
  return offsetDistanceOrOptions;
@@ -152,7 +202,9 @@ class Joint {
152
202
  this.swingPoint = swingPoint;
153
203
  this.flexure = JointMode.Unknown;
154
204
  }
155
- /** try to construct an arc transition from ray0 to ray1 with given center. */
205
+ /**
206
+ * Try to construct an arc transition from ray0 to ray1 with given center.
207
+ */
156
208
  static constructArc(ray0, center, ray1) {
157
209
  if (center !== undefined && Geometry_1.Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {
158
210
  const angle = ray0.direction.angleToXY(ray1.direction);
@@ -197,6 +249,7 @@ class Joint {
197
249
  destination.packedPoints.push(point);
198
250
  }
199
251
  }
252
+ /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */
200
253
  static collectStrokesFromChain(start, destination, maxTest = 100) {
201
254
  let numOut = -2 * maxTest; // allow extra things to happen
202
255
  Joint.visitJointsOnChain(start, (joint) => {
@@ -208,7 +261,7 @@ class Joint {
208
261
  if (fA === 0.0 && fB === 1.0)
209
262
  curve1 = joint.curve1.clone();
210
263
  else if (fA < fB)
211
- curve1 = joint.curve1.clonePartialCurve(fA, fB);
264
+ curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve
212
265
  if (curve1) {
213
266
  if (!joint.jointCurve) {
214
267
  this.addPoint(destination, curve1.startPoint());
@@ -248,6 +301,7 @@ class Joint {
248
301
  }
249
302
  }
250
303
  }
304
+ /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */
251
305
  static collectCurvesFromChain(start, destination, maxTest = 100) {
252
306
  if (start === undefined)
253
307
  return;
@@ -262,13 +316,13 @@ class Joint {
262
316
  if (fA === 0.0 && fB === 1.0)
263
317
  curve1 = joint.curve1.clone();
264
318
  else if (fA < fB)
265
- curve1 = joint.curve1.clonePartialCurve(fA, fB);
319
+ curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve
266
320
  this.collectPrimitive(destination, curve1);
267
321
  }
268
322
  return numOut++ < maxTest;
269
323
  }, maxTest);
270
324
  }
271
- /** Execute `joint.annotateJointMode()` at all joints on the chain. */
325
+ /** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */
272
326
  static annotateChain(start, options, maxTest = 100) {
273
327
  if (start)
274
328
  Joint.visitJointsOnChain(start, (joint) => { joint.annotateJointMode(options); return true; }, maxTest);
@@ -276,7 +330,7 @@ class Joint {
276
330
  /**
277
331
  * Visit joints on a chain.
278
332
  * * terminate on `false` return from `callback`
279
- * @param start first (and, for cyclic chain, final) Joint
333
+ * @param start first (and, for cyclic chain, final) joint
280
334
  * @param callback function to call with each Joint as a single parameter.
281
335
  */
282
336
  static visitJointsOnChain(start, callback, maxTest = 100) {
@@ -284,7 +338,7 @@ class Joint {
284
338
  if (joint) {
285
339
  let numTest = 0;
286
340
  while (joint !== undefined) {
287
- if (numTest++ >= maxTest + 5)
341
+ if (numTest++ >= maxTest + 5) // allow extra things to happen
288
342
  return true;
289
343
  if (!callback(joint))
290
344
  return false;
@@ -300,13 +354,13 @@ class Joint {
300
354
  if (this.curve0 && this.curve1) {
301
355
  const ray0 = this.curve0.fractionToPointAndDerivative(1.0);
302
356
  const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
303
- const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1);
357
+ const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
304
358
  if (intersection.approachType === CurveLocationDetail_1.CurveCurveApproachType.Intersection) {
305
359
  if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {
306
360
  this.fraction0 = 1.0;
307
361
  this.fraction1 = 0.0;
308
362
  this.flexure = JointMode.Extend;
309
- const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef());
363
+ const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines
310
364
  if (options.needArc(theta)) {
311
365
  const arc = Joint.constructArc(ray0, this.curve0.baseCurveEnd, ray1);
312
366
  if (arc) {
@@ -314,13 +368,12 @@ class Joint {
314
368
  return;
315
369
  }
316
370
  }
317
- const numChamferPoints = options.numChamferPoints(theta);
318
- if (numChamferPoints <= 1) {
371
+ const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring
372
+ if (numChamferPoints <= 1) { // create sharp corner
319
373
  this.jointCurve = LineString3d_1.LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);
320
374
  return;
321
375
  }
322
- if (numChamferPoints > 1) {
323
- // A nontrivial linestring ...
376
+ if (numChamferPoints > 1) { // create chamfer corner (a line string)
324
377
  const radians0 = theta.radians;
325
378
  const numHalfStep = 2.0 * numChamferPoints;
326
379
  const halfStepRadians = radians0 / numHalfStep;
@@ -340,19 +393,20 @@ class Joint {
340
393
  }
341
394
  }
342
395
  }
343
- // desperation appears ...
396
+ // if there is no intersection between the 2 ray lines, fill the gap by a line segment
344
397
  this.flexure = JointMode.Gap;
345
398
  this.jointCurve = LineSegment3d_1.LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
346
399
  this.fraction0 = 1.0;
347
400
  this.fraction1 = 0.0;
348
401
  }
349
402
  }
350
- // Select the index at which summed fraction difference is smallest.
403
+ /** Select the index at which summed fraction difference is smallest */
351
404
  selectIntersectionIndexByFraction(fractionA, fractionB, intersections) {
352
405
  let index = -1;
353
406
  let aMin = Number.MAX_VALUE;
354
407
  for (let i = 0; i < intersections.length; i++) {
355
- const a = Math.abs(intersections[i].detailA.fraction - fractionA) + Math.abs(intersections[i].detailB.fraction - fractionB);
408
+ const a = Math.abs(intersections[i].detailA.fraction - fractionA)
409
+ + Math.abs(intersections[i].detailB.fraction - fractionB);
356
410
  if (a < aMin) {
357
411
  aMin = a;
358
412
  index = i;
@@ -361,42 +415,42 @@ class Joint {
361
415
  return index;
362
416
  }
363
417
  /**
364
- * Examine the adjacent geometry
365
- * * set JointMode: one of Cap Extend, or Trim
418
+ * Examine the adjacent geometry to set some of joint attributes:
419
+ * * set JointMode: one of Cap, Extend, or Trim
366
420
  * * set fraction0 and fraction1 of intersection of curve0 and curve1
421
+ * * set joint curve
367
422
  * * this REFERENCES curve0, curve1, fraction0, fraction1
368
423
  * * this does not reference nextJoint and previousJoint
369
424
  */
370
425
  annotateJointMode(options) {
371
- if (this.curve0 && !this.curve1) {
426
+ if (!this.curve0 && this.curve1) { // joint at the start of the chain
372
427
  this.flexure = JointMode.Cap;
373
- this.fraction0 = 1.0;
428
+ this.fraction1 = 0.0;
374
429
  }
375
- else if (this.curve1 && !this.curve0) {
430
+ else if (this.curve0 && !this.curve1) { // joint at the end of the chain
376
431
  this.flexure = JointMode.Cap;
377
- this.fraction1 = 0.0;
432
+ this.fraction0 = 1.0;
378
433
  }
379
- else if (this.curve0 && this.curve1) {
380
- // check for direct intersection -- occurs on offset of colinear base segments, and closed primitives
381
- if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) {
434
+ else if (this.curve0 && this.curve1) { // joints at the middle of the chain
435
+ if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments
382
436
  this.fraction0 = 1.0;
383
437
  this.fraction1 = 0.0;
384
438
  this.flexure = JointMode.Trim;
385
439
  }
386
- else if (this.curve0 instanceof LineSegment3d_1.LineSegment3d && this.curve1 instanceof LineSegment3d_1.LineSegment3d) {
387
- const ray0 = this.curve0.fractionToPointAndDerivative(0.0); // And we know that is full length ray !
388
- const ray1 = this.curve1.fractionToPointAndDerivative(0.0); // ditto
389
- const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1);
440
+ else if (this.curve0 instanceof LineSegment3d_1.LineSegment3d && this.curve1 instanceof LineSegment3d_1.LineSegment3d) { // pair of lines
441
+ const ray0 = this.curve0.fractionToPointAndDerivative(0.0);
442
+ const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
443
+ const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
390
444
  if (intersection.approachType === CurveLocationDetail_1.CurveCurveApproachType.Intersection) {
391
445
  this.fraction0 = intersection.detailA.fraction;
392
446
  this.fraction1 = intersection.detailB.fraction;
393
- if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) {
447
+ if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend
394
448
  this.annotateExtension(options);
395
449
  }
396
- else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) {
450
+ else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim
397
451
  this.flexure = JointMode.Trim;
398
452
  }
399
- else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) {
453
+ else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment
400
454
  this.flexure = JointMode.Gap;
401
455
  this.jointCurve = LineSegment3d_1.LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
402
456
  this.fraction0 = 1.0;
@@ -404,15 +458,15 @@ class Joint {
404
458
  }
405
459
  }
406
460
  }
407
- else { // generic pair of curves ...
461
+ else { // generic pair of curves
408
462
  const intersections = CurveCurve_1.CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);
409
463
  const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);
410
- if (intersectionIndex >= 0) {
464
+ if (intersectionIndex >= 0) { // need to trim
411
465
  this.flexure = JointMode.Trim;
412
466
  this.fraction0 = intersections[intersectionIndex].detailA.fraction;
413
467
  this.fraction1 = intersections[intersectionIndex].detailB.fraction;
414
468
  }
415
- else {
469
+ else { // need to extend
416
470
  this.annotateExtension(options);
417
471
  }
418
472
  }
@@ -420,7 +474,8 @@ class Joint {
420
474
  }
421
475
  /**
422
476
  * * Examine the primitive trim fractions between each pair of joints.
423
- * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at surrounding primitives
477
+ * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at
478
+ * surrounding primitives
424
479
  * @param start
425
480
  */
426
481
  static removeDegeneratePrimitives(start, options, maxTest) {
@@ -455,8 +510,7 @@ class Joint {
455
510
  }
456
511
  */
457
512
  const eliminateF = f0 >= f1 || f0 > 1.0;
458
- const eliminateG = (g0 !== undefined && g0 > 1.0)
459
- || (g0 !== undefined && g1 !== undefined && g0 >= g1);
513
+ const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);
460
514
  if (eliminateF && eliminateG) {
461
515
  const jointC = jointB.nextJoint;
462
516
  const newJoint = new Joint(jointA.curve0, jointC.curve1, undefined);
@@ -512,9 +566,8 @@ class Joint {
512
566
  * @internal
513
567
  */
514
568
  class PolygonWireOffsetContext {
515
- /** construct a context. */
516
- constructor() {
517
- }
569
+ /** Construct a context. */
570
+ constructor() { }
518
571
  // Construct a single offset from base points
519
572
  static createOffsetSegment(basePointA, basePointB, distance) {
520
573
  Point3dVector3d_1.Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);
@@ -527,13 +580,25 @@ class PolygonWireOffsetContext {
527
580
  return undefined;
528
581
  }
529
582
  /**
530
- * Construct curves that are offset from a polygon.
531
- * * The construction will remove "some" local effects of features smaller than the offset distance, but will not detect self intersection with far-away edges.
532
- * @param points
533
- * @param wrap
534
- * @param offsetDistance
583
+ * Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in
584
+ * a plane parallel to xy-plane).
585
+ * * This is a simple wire offset (in the form of a line string), not an area.
586
+ * * If offsetDistance is given as a number, default OffsetOptions are applied.
587
+ * * See [[JointOptions]] class doc for offset construction rules.
588
+ * @param points a single loop or path
589
+ * @param wrap true to offset the wraparound joint. Assumes first = last point.
590
+ * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions
591
+ * object.
535
592
  */
536
593
  constructPolygonWireXYOffset(points, wrap, leftOffsetDistanceOrOptions) {
594
+ /**
595
+ * if "wrap = true", then first and last point in the points array must be close; otherwise
596
+ * generated offset will be invalid.
597
+ */
598
+ if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {
599
+ wrap = false;
600
+ }
601
+ /** create raw offsets as a linked list (joint0) */
537
602
  const options = JointOptions.create(leftOffsetDistanceOrOptions);
538
603
  const numPoints = points.length;
539
604
  let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);
@@ -553,7 +618,9 @@ class PolygonWireOffsetContext {
553
618
  newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);
554
619
  Joint.link(previousJoint, newJoint);
555
620
  }
621
+ /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */
556
622
  Joint.annotateChain(joint0, options, numPoints);
623
+ /** make limited passes through the Joint chain until no self-intersections are removed */
557
624
  for (let pass = 0; pass++ < 5;) {
558
625
  const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);
559
626
  joint0 = state.newStart;
@@ -567,6 +634,7 @@ class PolygonWireOffsetContext {
567
634
  */
568
635
  }
569
636
  // Joint.collectPrimitivesFromChain(joint0, result, numPoints);
637
+ /** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */
570
638
  const chain = LineString3d_1.LineString3d.create();
571
639
  Joint.collectStrokesFromChain(joint0, chain, numPoints);
572
640
  const n = chain.packedPoints.length;
@@ -590,14 +658,13 @@ exports.PolygonWireOffsetContext = PolygonWireOffsetContext;
590
658
  */
591
659
  class CurveChainWireOffsetContext {
592
660
  /** construct a context. */
593
- constructor() {
594
- }
661
+ constructor() { }
595
662
  /**
596
663
  * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.
597
- * * return cp
598
- * @param cp primitive to annotate
664
+ * @param cp curve primitive to annotate
599
665
  * @param startPoint optional start point
600
666
  * @param endPoint optional end point
667
+ * @return the input CurvePrimitive with annotations
601
668
  */
602
669
  static applyBasePoints(cp, startPoint, endPoint) {
603
670
  if (cp !== undefined) {
@@ -609,7 +676,7 @@ class CurveChainWireOffsetContext {
609
676
  return cp;
610
677
  }
611
678
  /**
612
- * Create the offset of a single primitive.
679
+ * Create the offset of a single primitive as viewed in the xy-plane (ignoring z).
613
680
  * * each primitive may be labeled (as an `any` object) with start or end point of base curve:
614
681
  * * `(primitive as any).baseCurveStart: Point3d`
615
682
  * * `(primitive as any).baseCurveEnd: Point3d`
@@ -633,15 +700,10 @@ class CurveChainWireOffsetContext {
633
700
  }
634
701
  /**
635
702
  * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
636
- * * The construction will remove "some" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.
703
+ * * The construction will remove "some" local effects of features smaller than the offset distance, but will
704
+ * not detect self intersection among widely separated edges.
637
705
  * * If offsetDistance is given as a number, default OffsetOptions are applied.
638
- * * When the offset needs to do an "outside" turn, the first applicable construction is applied:
639
- * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.
640
- * * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.
641
- * * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:
642
- * * outside the arc
643
- * * have uniform turn angle less than `options.maxChamferDegrees`
644
- * * each line segment (except first and last) touches the arc at its midpoint.
706
+ * * See [[JointOptions]] class doc for offset construction rules.
645
707
  * @param curves base curves.
646
708
  * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
647
709
  */
@@ -649,14 +711,15 @@ class CurveChainWireOffsetContext {
649
711
  const wrap = curves instanceof Loop_1.Loop;
650
712
  const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);
651
713
  const simpleOffsets = [];
652
- // setup pass: get simple offsets of each primitive
714
+ /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */
653
715
  for (const c of curves.children) {
654
716
  const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);
655
717
  if (c1 === undefined) {
656
718
  // bad .. maybe arc to inside?
657
719
  }
658
- else if (c1 instanceof CurvePrimitive_1.CurvePrimitive)
720
+ else if (c1 instanceof CurvePrimitive_1.CurvePrimitive) {
659
721
  simpleOffsets.push(c1);
722
+ }
660
723
  else if (Array.isArray(c1)) {
661
724
  for (const c2 of c1) {
662
725
  if (c2 instanceof CurvePrimitive_1.CurvePrimitive)
@@ -664,6 +727,7 @@ class CurveChainWireOffsetContext {
664
727
  }
665
728
  }
666
729
  }
730
+ /** create joints between array elements to make offsets as a linked list (joint0) */
667
731
  let fragment0;
668
732
  let newJoint;
669
733
  let previousJoint;
@@ -682,8 +746,10 @@ class CurveChainWireOffsetContext {
682
746
  }
683
747
  if (joint0 && previousJoint && curves instanceof Loop_1.Loop)
684
748
  Joint.link(previousJoint, joint0);
749
+ /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */
685
750
  const numOffset = simpleOffsets.length;
686
751
  Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);
752
+ /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */
687
753
  const outputCurves = [];
688
754
  Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);
689
755
  return RegionOps_1.RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);