@itwin/core-geometry 4.2.0-dev.3 → 4.2.0-dev.31

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 (462) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/lib/cjs/Geometry.d.ts +2 -2
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +4 -3
  6. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  7. package/lib/cjs/clipping/AlternatingConvexClipTree.js +1 -1
  8. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  9. package/lib/cjs/clipping/BooleanClipNode.d.ts +4 -3
  10. package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
  11. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  12. package/lib/cjs/clipping/ClipPlane.d.ts +12 -8
  13. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  14. package/lib/cjs/clipping/ClipPlane.js +5 -3
  15. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  16. package/lib/cjs/clipping/ClipUtils.d.ts +27 -9
  17. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  18. package/lib/cjs/clipping/ClipUtils.js +84 -3
  19. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  20. package/lib/cjs/clipping/ClipVector.d.ts +6 -5
  21. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  22. package/lib/cjs/clipping/ClipVector.js +1 -1
  23. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  24. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +6 -4
  25. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  26. package/lib/cjs/clipping/ConvexClipPlaneSet.js +3 -2
  27. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  28. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +4 -3
  29. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  30. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +2 -2
  31. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  32. package/lib/cjs/core-geometry.d.ts +1 -3
  33. package/lib/cjs/core-geometry.d.ts.map +1 -1
  34. package/lib/cjs/core-geometry.js +1 -3
  35. package/lib/cjs/core-geometry.js.map +1 -1
  36. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  37. package/lib/cjs/curve/Arc3d.js +4 -4
  38. package/lib/cjs/curve/Arc3d.js.map +1 -1
  39. package/lib/cjs/curve/CoordinateXYZ.d.ts +15 -15
  40. package/lib/cjs/curve/CoordinateXYZ.d.ts.map +1 -1
  41. package/lib/cjs/curve/CoordinateXYZ.js +15 -15
  42. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  43. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +1 -1
  44. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  45. package/lib/cjs/curve/CurveCollection.d.ts +20 -20
  46. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  47. package/lib/cjs/curve/CurveCollection.js +21 -23
  48. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  49. package/lib/cjs/curve/CurveCurve.d.ts +41 -26
  50. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  51. package/lib/cjs/curve/CurveCurve.js +73 -40
  52. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  53. package/lib/cjs/curve/CurveFactory.d.ts +1 -1
  54. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  55. package/lib/cjs/curve/CurveLocationDetail.d.ts +12 -1
  56. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  57. package/lib/cjs/curve/CurveLocationDetail.js +13 -2
  58. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  59. package/lib/cjs/curve/CurveOps.d.ts +1 -1
  60. package/lib/cjs/curve/CurveOps.js.map +1 -1
  61. package/lib/cjs/curve/CurveProcessor.d.ts +1 -1
  62. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  63. package/lib/cjs/curve/CurveTypes.d.ts +19 -0
  64. package/lib/cjs/curve/CurveTypes.d.ts.map +1 -0
  65. package/lib/cjs/curve/{CurveChain.js → CurveTypes.js} +1 -1
  66. package/lib/cjs/curve/CurveTypes.js.map +1 -0
  67. package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts +1 -1
  68. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  69. package/lib/cjs/curve/ParityRegion.d.ts +3 -3
  70. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  71. package/lib/cjs/curve/ParityRegion.js +2 -2
  72. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  73. package/lib/cjs/curve/Path.d.ts +1 -1
  74. package/lib/cjs/curve/Path.d.ts.map +1 -1
  75. package/lib/cjs/curve/Path.js +1 -1
  76. package/lib/cjs/curve/Path.js.map +1 -1
  77. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
  78. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  79. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +2 -2
  80. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  81. package/lib/cjs/curve/Query/CurveSplitContext.d.ts +1 -1
  82. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  83. package/lib/cjs/curve/Query/CylindricalRange.d.ts +1 -1
  84. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  85. package/lib/cjs/curve/Query/InOutTests.d.ts +1 -1
  86. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  87. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +1 -1
  88. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  89. package/lib/cjs/curve/RegionOps.d.ts +54 -5
  90. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  91. package/lib/cjs/curve/RegionOps.js +154 -3
  92. package/lib/cjs/curve/RegionOps.js.map +1 -1
  93. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +1 -1
  94. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  95. package/lib/cjs/curve/StrokeOptions.d.ts +20 -11
  96. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  97. package/lib/cjs/curve/StrokeOptions.js +22 -11
  98. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  99. package/lib/cjs/curve/UnionRegion.d.ts +3 -3
  100. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  101. package/lib/cjs/curve/UnionRegion.js +3 -3
  102. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  103. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +225 -0
  104. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  105. package/lib/cjs/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +249 -189
  106. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  107. package/lib/{esm/curve → cjs/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
  108. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  109. package/lib/cjs/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +31 -42
  110. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  111. package/lib/cjs/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
  112. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  113. package/lib/cjs/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +12 -14
  114. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  115. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +1 -1
  116. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  117. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +1 -0
  118. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  119. package/lib/cjs/geometry3d/BarycentricTriangle.js +1 -0
  120. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  121. package/lib/cjs/geometry3d/FrameBuilder.d.ts +57 -36
  122. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  123. package/lib/cjs/geometry3d/FrameBuilder.js +99 -74
  124. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  125. package/lib/cjs/geometry3d/GeometryHandler.d.ts +3 -10
  126. package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
  127. package/lib/cjs/geometry3d/GeometryHandler.js +2 -6
  128. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  129. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +0 -8
  130. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  131. package/lib/cjs/geometry3d/GrowableXYZArray.js +0 -16
  132. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  133. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +4 -4
  134. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  135. package/lib/cjs/geometry3d/IndexedXYZCollection.js +12 -0
  136. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  137. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  138. package/lib/cjs/geometry3d/Matrix3d.js +3 -6
  139. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  140. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  141. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  142. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -2
  143. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  144. package/lib/cjs/geometry3d/Point3dVector3d.js +0 -1
  145. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  146. package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -2
  147. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  148. package/lib/cjs/geometry3d/PolygonOps.js +2 -3
  149. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  150. package/lib/cjs/geometry3d/Range.d.ts +1 -1
  151. package/lib/cjs/geometry3d/Range.js +1 -1
  152. package/lib/cjs/geometry3d/Range.js.map +1 -1
  153. package/lib/cjs/geometry3d/Ray3d.d.ts +3 -1
  154. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  155. package/lib/cjs/geometry3d/Ray3d.js +4 -3
  156. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  157. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +2 -1
  158. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  159. package/lib/cjs/geometry3d/ReusableObjectCache.js +1 -1
  160. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  161. package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -1
  162. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  163. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  164. package/lib/cjs/geometry3d/Transform.js +4 -6
  165. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  166. package/lib/cjs/geometry3d/YawPitchRollAngles.js +1 -1
  167. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  168. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  169. package/lib/cjs/geometry4d/Matrix4d.js +4 -2
  170. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  171. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  172. package/lib/cjs/numerics/Polynomials.d.ts +2 -2
  173. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  174. package/lib/cjs/numerics/Polynomials.js +2 -2
  175. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  176. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -6
  177. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  178. package/lib/cjs/polyface/PolyfaceBuilder.js +48 -15
  179. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  180. package/lib/cjs/polyface/PolyfaceClip.d.ts +16 -7
  181. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  182. package/lib/cjs/polyface/PolyfaceClip.js +38 -7
  183. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  184. package/lib/cjs/polyface/PolyfaceData.d.ts +5 -39
  185. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  186. package/lib/cjs/polyface/PolyfaceData.js +7 -41
  187. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  188. package/lib/cjs/polyface/PolyfaceQuery.d.ts +10 -8
  189. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  190. package/lib/cjs/polyface/PolyfaceQuery.js +64 -18
  191. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  192. package/lib/cjs/serialization/GeometrySamples.d.ts +6 -0
  193. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  194. package/lib/cjs/serialization/GeometrySamples.js +61 -1
  195. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  196. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  197. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  198. package/lib/cjs/solid/RotationalSweep.d.ts +1 -1
  199. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  200. package/lib/cjs/solid/RuledSweep.d.ts +1 -1
  201. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  202. package/lib/cjs/solid/SweepContour.d.ts +35 -26
  203. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  204. package/lib/cjs/solid/SweepContour.js +84 -100
  205. package/lib/cjs/solid/SweepContour.js.map +1 -1
  206. package/lib/cjs/topology/Graph.d.ts +29 -11
  207. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  208. package/lib/cjs/topology/Graph.js +45 -26
  209. package/lib/cjs/topology/Graph.js.map +1 -1
  210. package/lib/cjs/topology/HalfEdgeMarkSet.d.ts +2 -2
  211. package/lib/cjs/topology/HalfEdgeMarkSet.d.ts.map +1 -1
  212. package/lib/cjs/topology/HalfEdgeMarkSet.js +4 -4
  213. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  214. package/lib/cjs/topology/Merging.d.ts +3 -0
  215. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  216. package/lib/cjs/topology/Merging.js +19 -5
  217. package/lib/cjs/topology/Merging.js.map +1 -1
  218. package/lib/cjs/topology/Triangulation.d.ts +15 -7
  219. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  220. package/lib/cjs/topology/Triangulation.js +89 -47
  221. package/lib/cjs/topology/Triangulation.js.map +1 -1
  222. package/lib/esm/Geometry.d.ts +2 -2
  223. package/lib/esm/Geometry.d.ts.map +1 -1
  224. package/lib/esm/Geometry.js.map +1 -1
  225. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +4 -3
  226. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  227. package/lib/esm/clipping/AlternatingConvexClipTree.js +1 -1
  228. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  229. package/lib/esm/clipping/BooleanClipNode.d.ts +4 -3
  230. package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
  231. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  232. package/lib/esm/clipping/ClipPlane.d.ts +12 -8
  233. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  234. package/lib/esm/clipping/ClipPlane.js +5 -3
  235. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  236. package/lib/esm/clipping/ClipUtils.d.ts +27 -9
  237. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  238. package/lib/esm/clipping/ClipUtils.js +84 -3
  239. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  240. package/lib/esm/clipping/ClipVector.d.ts +6 -5
  241. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  242. package/lib/esm/clipping/ClipVector.js +1 -1
  243. package/lib/esm/clipping/ClipVector.js.map +1 -1
  244. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +6 -4
  245. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  246. package/lib/esm/clipping/ConvexClipPlaneSet.js +3 -2
  247. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  248. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +4 -3
  249. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  250. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +2 -2
  251. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  252. package/lib/esm/core-geometry.d.ts +1 -3
  253. package/lib/esm/core-geometry.d.ts.map +1 -1
  254. package/lib/esm/core-geometry.js +1 -3
  255. package/lib/esm/core-geometry.js.map +1 -1
  256. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  257. package/lib/esm/curve/Arc3d.js +4 -4
  258. package/lib/esm/curve/Arc3d.js.map +1 -1
  259. package/lib/esm/curve/CoordinateXYZ.d.ts +15 -15
  260. package/lib/esm/curve/CoordinateXYZ.d.ts.map +1 -1
  261. package/lib/esm/curve/CoordinateXYZ.js +15 -15
  262. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  263. package/lib/esm/curve/CurveChainWithDistanceIndex.js +1 -1
  264. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  265. package/lib/esm/curve/CurveCollection.d.ts +20 -20
  266. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  267. package/lib/esm/curve/CurveCollection.js +20 -21
  268. package/lib/esm/curve/CurveCollection.js.map +1 -1
  269. package/lib/esm/curve/CurveCurve.d.ts +41 -26
  270. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  271. package/lib/esm/curve/CurveCurve.js +73 -40
  272. package/lib/esm/curve/CurveCurve.js.map +1 -1
  273. package/lib/esm/curve/CurveFactory.d.ts +1 -1
  274. package/lib/esm/curve/CurveFactory.js.map +1 -1
  275. package/lib/esm/curve/CurveLocationDetail.d.ts +12 -1
  276. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  277. package/lib/esm/curve/CurveLocationDetail.js +11 -1
  278. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  279. package/lib/esm/curve/CurveOps.d.ts +1 -1
  280. package/lib/esm/curve/CurveOps.js.map +1 -1
  281. package/lib/esm/curve/CurveProcessor.d.ts +1 -1
  282. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  283. package/lib/esm/curve/CurveTypes.d.ts +19 -0
  284. package/lib/esm/curve/CurveTypes.d.ts.map +1 -0
  285. package/lib/esm/curve/{CurveChain.js → CurveTypes.js} +1 -1
  286. package/lib/esm/curve/CurveTypes.js.map +1 -0
  287. package/lib/esm/curve/CurveWireMomentsXYZ.d.ts +1 -1
  288. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  289. package/lib/esm/curve/ParityRegion.d.ts +3 -3
  290. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  291. package/lib/esm/curve/ParityRegion.js +2 -2
  292. package/lib/esm/curve/ParityRegion.js.map +1 -1
  293. package/lib/esm/curve/Path.d.ts +1 -1
  294. package/lib/esm/curve/Path.d.ts.map +1 -1
  295. package/lib/esm/curve/Path.js +1 -1
  296. package/lib/esm/curve/Path.js.map +1 -1
  297. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
  298. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  299. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -1
  300. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  301. package/lib/esm/curve/Query/CurveSplitContext.d.ts +1 -1
  302. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  303. package/lib/esm/curve/Query/CylindricalRange.d.ts +1 -1
  304. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  305. package/lib/esm/curve/Query/InOutTests.d.ts +1 -1
  306. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  307. package/lib/esm/curve/Query/StrokeCountChain.d.ts +1 -1
  308. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  309. package/lib/esm/curve/RegionOps.d.ts +54 -5
  310. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  311. package/lib/esm/curve/RegionOps.js +153 -3
  312. package/lib/esm/curve/RegionOps.js.map +1 -1
  313. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +1 -1
  314. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  315. package/lib/esm/curve/StrokeOptions.d.ts +20 -11
  316. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  317. package/lib/esm/curve/StrokeOptions.js +22 -11
  318. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  319. package/lib/esm/curve/UnionRegion.d.ts +3 -3
  320. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  321. package/lib/esm/curve/UnionRegion.js +3 -3
  322. package/lib/esm/curve/UnionRegion.js.map +1 -1
  323. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +225 -0
  324. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  325. package/lib/esm/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +249 -189
  326. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  327. package/lib/{cjs/curve → esm/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
  328. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  329. package/lib/esm/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +30 -40
  330. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  331. package/lib/esm/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
  332. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  333. package/lib/esm/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +11 -13
  334. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  335. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +1 -1
  336. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  337. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +1 -0
  338. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  339. package/lib/esm/geometry3d/BarycentricTriangle.js +1 -0
  340. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  341. package/lib/esm/geometry3d/FrameBuilder.d.ts +57 -36
  342. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  343. package/lib/esm/geometry3d/FrameBuilder.js +99 -74
  344. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  345. package/lib/esm/geometry3d/GeometryHandler.d.ts +3 -10
  346. package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
  347. package/lib/esm/geometry3d/GeometryHandler.js +2 -6
  348. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  349. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +0 -8
  350. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  351. package/lib/esm/geometry3d/GrowableXYZArray.js +0 -16
  352. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  353. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +4 -4
  354. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  355. package/lib/esm/geometry3d/IndexedXYZCollection.js +12 -0
  356. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  357. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  358. package/lib/esm/geometry3d/Matrix3d.js +3 -6
  359. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  360. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  361. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  362. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -2
  363. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  364. package/lib/esm/geometry3d/Point3dVector3d.js +0 -1
  365. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  366. package/lib/esm/geometry3d/PolygonOps.d.ts +2 -2
  367. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  368. package/lib/esm/geometry3d/PolygonOps.js +2 -3
  369. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  370. package/lib/esm/geometry3d/Range.d.ts +1 -1
  371. package/lib/esm/geometry3d/Range.js +1 -1
  372. package/lib/esm/geometry3d/Range.js.map +1 -1
  373. package/lib/esm/geometry3d/Ray3d.d.ts +3 -1
  374. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  375. package/lib/esm/geometry3d/Ray3d.js +4 -3
  376. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  377. package/lib/esm/geometry3d/ReusableObjectCache.d.ts +2 -1
  378. package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  379. package/lib/esm/geometry3d/ReusableObjectCache.js +1 -1
  380. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  381. package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -1
  382. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  383. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  384. package/lib/esm/geometry3d/Transform.js +4 -6
  385. package/lib/esm/geometry3d/Transform.js.map +1 -1
  386. package/lib/esm/geometry3d/YawPitchRollAngles.js +1 -1
  387. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  388. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  389. package/lib/esm/geometry4d/Matrix4d.js +4 -2
  390. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  391. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  392. package/lib/esm/numerics/Polynomials.d.ts +2 -2
  393. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  394. package/lib/esm/numerics/Polynomials.js +2 -2
  395. package/lib/esm/numerics/Polynomials.js.map +1 -1
  396. package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -6
  397. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  398. package/lib/esm/polyface/PolyfaceBuilder.js +48 -15
  399. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  400. package/lib/esm/polyface/PolyfaceClip.d.ts +16 -7
  401. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  402. package/lib/esm/polyface/PolyfaceClip.js +38 -7
  403. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  404. package/lib/esm/polyface/PolyfaceData.d.ts +5 -39
  405. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  406. package/lib/esm/polyface/PolyfaceData.js +7 -41
  407. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  408. package/lib/esm/polyface/PolyfaceQuery.d.ts +10 -8
  409. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  410. package/lib/esm/polyface/PolyfaceQuery.js +64 -18
  411. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  412. package/lib/esm/serialization/GeometrySamples.d.ts +6 -0
  413. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  414. package/lib/esm/serialization/GeometrySamples.js +61 -1
  415. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  416. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  417. package/lib/esm/solid/LinearSweep.js.map +1 -1
  418. package/lib/esm/solid/RotationalSweep.d.ts +1 -1
  419. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  420. package/lib/esm/solid/RuledSweep.d.ts +1 -1
  421. package/lib/esm/solid/RuledSweep.js.map +1 -1
  422. package/lib/esm/solid/SweepContour.d.ts +35 -26
  423. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  424. package/lib/esm/solid/SweepContour.js +84 -100
  425. package/lib/esm/solid/SweepContour.js.map +1 -1
  426. package/lib/esm/topology/Graph.d.ts +29 -11
  427. package/lib/esm/topology/Graph.d.ts.map +1 -1
  428. package/lib/esm/topology/Graph.js +45 -26
  429. package/lib/esm/topology/Graph.js.map +1 -1
  430. package/lib/esm/topology/HalfEdgeMarkSet.d.ts +2 -2
  431. package/lib/esm/topology/HalfEdgeMarkSet.d.ts.map +1 -1
  432. package/lib/esm/topology/HalfEdgeMarkSet.js +2 -2
  433. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  434. package/lib/esm/topology/Merging.d.ts +3 -0
  435. package/lib/esm/topology/Merging.d.ts.map +1 -1
  436. package/lib/esm/topology/Merging.js +19 -5
  437. package/lib/esm/topology/Merging.js.map +1 -1
  438. package/lib/esm/topology/Triangulation.d.ts +15 -7
  439. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  440. package/lib/esm/topology/Triangulation.js +89 -47
  441. package/lib/esm/topology/Triangulation.js.map +1 -1
  442. package/package.json +4 -4
  443. package/lib/cjs/curve/CurveChain.d.ts +0 -17
  444. package/lib/cjs/curve/CurveChain.d.ts.map +0 -1
  445. package/lib/cjs/curve/CurveChain.js.map +0 -1
  446. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts +0 -164
  447. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  448. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +0 -1
  449. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  450. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +0 -1
  451. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  452. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +0 -1
  453. package/lib/esm/curve/CurveChain.d.ts +0 -17
  454. package/lib/esm/curve/CurveChain.d.ts.map +0 -1
  455. package/lib/esm/curve/CurveChain.js.map +0 -1
  456. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts +0 -164
  457. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  458. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +0 -1
  459. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  460. package/lib/esm/curve/CurveCurveIntersectXY.js.map +0 -1
  461. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  462. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +0 -1
@@ -3,20 +3,19 @@ import { Angle } from "../geometry3d/Angle";
3
3
  * Tolerance blob for various stroking methods.
4
4
  *
5
5
  * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength
6
- * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.
7
- * * angle is the angle between two contiguous strokes or across a facet edge.
8
- * * maxEdgeLength is the length of a stroke or a edge of a facet.
9
- *
10
- * It is rare for all three to be active at once:
6
+ * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.
7
+ * * angle is the angle between two contiguous strokes or across a facet edge.
8
+ * * maxEdgeLength is the length of a stroke or a edge of a facet.
9
+ * * It is rare for all three to be active at once.
11
10
  * * Nearly all stroke and facet use cases will apply an angle tolerance.
12
- * * * For curves, 15 degrees is typical
13
- * * * For facets, 22.5 degrees is typical.
14
- * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.
15
- * * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.
11
+ * * For curves, 15 degrees is typical
12
+ * * For facets, 22.5 degrees is typical.
13
+ * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.
14
+ * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.
16
15
  * * When creating output for devices such as 3D printing will want a chord tolerance.
17
16
  * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.
18
17
  * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.
19
- * * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.
18
+ * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.
20
19
  * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.
21
20
  * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.
22
21
  * @public
@@ -28,7 +27,10 @@ export declare class StrokeOptions {
28
27
  angleTol?: Angle;
29
28
  /** Maximum length of a single stroke. */
30
29
  maxEdgeLength?: number;
31
- /** Caller expects convex facets. */
30
+ /**
31
+ * Caller expects convex facets.
32
+ * @deprecated in 4.x - never used. See [[shouldTriangulate]] and [[maximizeConvexFacets]].
33
+ */
32
34
  needConvexFacets?: boolean;
33
35
  /** Minimum strokes on a primitive */
34
36
  minStrokesPerPrimitive?: number;
@@ -56,6 +58,13 @@ export declare class StrokeOptions {
56
58
  get hasChordTol(): boolean;
57
59
  /** Ask if maxEdgeLength is specified */
58
60
  get hasMaxEdgeLength(): boolean;
61
+ private _maximizeConvexFacets?;
62
+ /**
63
+ * Whether to post-process a planar triangulation by removing edges to maximize the size of convex facets.
64
+ * * Setting this to true also sets [[shouldTriangulate]] to true.
65
+ */
66
+ get maximizeConvexFacets(): boolean;
67
+ set maximizeConvexFacets(value: boolean);
59
68
  /** Return a deep clone */
60
69
  clone(): StrokeOptions;
61
70
  /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeOptions.d.ts","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IACxB,8CAA8C;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB,qCAAqC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC;IACxB,yCAAyC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IAC9B,qCAAqC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAClC,qCAAqC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACvC,qDAAqD;IAC9C,iBAAiB,EAAE,OAAO,CAAS;IAC1C,OAAO,CAAC,YAAY,CAAC,CAAU;IAC/B,OAAO,CAAC,aAAa,CAAC,CAAU;IAChC,OAAO,CAAC,WAAW,CAAC,CAAU;IAC9B,oCAAoC;IACpC,IAAW,UAAU,IAAI,OAAO,CAE/B;IACD,IAAW,UAAU,CAAC,KAAK,EAAE,OAAO,EAEnC;IACD,oCAAoC;IACpC,IAAW,WAAW,IAAI,OAAO,CAEhC;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,OAAO,EAEpC;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various stroking methods.
16
16
  *
17
17
  * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength
18
- * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.
19
- * * angle is the angle between two contiguous strokes or across a facet edge.
20
- * * maxEdgeLength is the length of a stroke or a edge of a facet.
21
- *
22
- * It is rare for all three to be active at once:
18
+ * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.
19
+ * * angle is the angle between two contiguous strokes or across a facet edge.
20
+ * * maxEdgeLength is the length of a stroke or a edge of a facet.
21
+ * * It is rare for all three to be active at once.
23
22
  * * Nearly all stroke and facet use cases will apply an angle tolerance.
24
- * * * For curves, 15 degrees is typical
25
- * * * For facets, 22.5 degrees is typical.
26
- * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.
27
- * * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.
23
+ * * For curves, 15 degrees is typical
24
+ * * For facets, 22.5 degrees is typical.
25
+ * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.
26
+ * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.
28
27
  * * When creating output for devices such as 3D printing will want a chord tolerance.
29
28
  * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.
30
29
  * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.
31
- * * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.
30
+ * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.
32
31
  * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.
33
32
  * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.
34
33
  * @public
@@ -73,13 +72,24 @@ class StrokeOptions {
73
72
  get hasMaxEdgeLength() {
74
73
  return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;
75
74
  }
75
+ /**
76
+ * Whether to post-process a planar triangulation by removing edges to maximize the size of convex facets.
77
+ * * Setting this to true also sets [[shouldTriangulate]] to true.
78
+ */
79
+ get maximizeConvexFacets() {
80
+ return this._maximizeConvexFacets ?? false;
81
+ }
82
+ set maximizeConvexFacets(value) {
83
+ this._maximizeConvexFacets = value;
84
+ if (value)
85
+ this.shouldTriangulate = value;
86
+ }
76
87
  /** Return a deep clone */
77
88
  clone() {
78
89
  const options = new StrokeOptions();
79
90
  options.chordTol = this.chordTol;
80
91
  options.angleTol = this.angleTol?.clone();
81
92
  options.maxEdgeLength = this.maxEdgeLength;
82
- options.needConvexFacets = this.needConvexFacets;
83
93
  options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;
84
94
  options.shouldTriangulate = this.shouldTriangulate;
85
95
  options._needNormals = this._needNormals;
@@ -87,6 +97,7 @@ class StrokeOptions {
87
97
  options._needParams = this._needParams;
88
98
  options.needColors = this.needColors;
89
99
  options.defaultCircleStrokes = this.defaultCircleStrokes;
100
+ options._maximizeConvexFacets = this._maximizeConvexFacets;
90
101
  return options;
91
102
  }
92
103
  /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,+CAA4C;AAE5C,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,aAAa;IAA1B;QAWE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;QA2B1C,8CAA8C;QACvC,yBAAoB,GAAG,EAAE,CAAC;IA0InC,CAAC;IAlKC,oCAAoC;IACpC,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,IAAI,CAAC,sBAAsB,CAAC;eACxF,IAAI,CAAC,sBAAsB,GAAG,QAAQ;YACzC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlLD,sCAkLC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n *\r\n * It is rare for all three to be active at once:\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * * For curves, 15 degrees is typical\r\n * * * For facets, 22.5 degrees is typical.\r\n * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n /** Distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** Turning angle between strokes. */\r\n public angleTol?: Angle;\r\n /** Maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /** Caller expects convex facets. */\r\n public needConvexFacets?: boolean;\r\n /** Minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** Whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean {\r\n return this._needParams !== undefined ? this._needParams : false;\r\n }\r\n public set needParams(value: boolean) {\r\n this._needParams = value;\r\n }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean {\r\n return this._needNormals !== undefined ? this._needNormals : false;\r\n }\r\n public set needNormals(value: boolean) {\r\n this._needNormals = value;\r\n }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean {\r\n return this._needTwoSided !== undefined ? this._needTwoSided : false;\r\n }\r\n public set needTwoSided(value: boolean) {\r\n this._needTwoSided = value;\r\n }\r\n /** Optional color request flag */\r\n public needColors?: boolean;\r\n /** Default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** Ask if angleTol is specified */\r\n public get hasAngleTol(): boolean {\r\n return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;\r\n }\r\n /** Ask if chordTol is specified */\r\n public get hasChordTol(): boolean {\r\n return this.chordTol !== undefined && this.chordTol > 0.0;\r\n }\r\n /** Ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean {\r\n return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;\r\n }\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.needConvexFacets = this.needConvexFacets;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n return options;\r\n }\r\n /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of the existing count or count needed for angle condition for given\r\n * sweepRadians.\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance\r\n * from the options.\r\n */\r\n public static applyAngleTol(\r\n options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number,\r\n ): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(\r\n options: StrokeOptions | undefined, minCount: number, edgeLength: number,\r\n ): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,\r\n * chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given\r\n * arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,+CAA4C;AAE5C,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,aAAa;IAA1B;QAcE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;QA2B1C,8CAA8C;QACvC,yBAAoB,GAAG,EAAE,CAAC;IAuJnC,CAAC;IA/KC,oCAAoC;IACpC,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,W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a,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;SAC7D;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,iGAAiG;IAC1F,2BAA2B,CAAC,QAAgB;QACjD,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC;eACxF,IAAI,CAAC,sBAAsB,GAAG,QAAQ;YACzC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlMD,sCAkMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n * * It is rare for all three to be active at once.\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * For curves, 15 degrees is typical\r\n * * For facets, 22.5 degrees is typical.\r\n * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n /** Distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** Turning angle between strokes. */\r\n public angleTol?: Angle;\r\n /** Maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /**\r\n * Caller expects convex facets.\r\n * @deprecated in 4.x - never used. See [[shouldTriangulate]] and [[maximizeConvexFacets]].\r\n */\r\n public needConvexFacets?: boolean;\r\n /** Minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** Whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean {\r\n return this._needParams !== undefined ? this._needParams : false;\r\n }\r\n public set needParams(value: boolean) {\r\n this._needParams = value;\r\n }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean {\r\n return this._needNormals !== undefined ? this._needNormals : false;\r\n }\r\n public set needNormals(value: boolean) {\r\n this._needNormals = value;\r\n }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean {\r\n return this._needTwoSided !== undefined ? this._needTwoSided : false;\r\n }\r\n public set needTwoSided(value: boolean) {\r\n this._needTwoSided = value;\r\n }\r\n /** Optional color request flag */\r\n public needColors?: boolean;\r\n /** Default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** Ask if angleTol is specified */\r\n public get hasAngleTol(): boolean {\r\n return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;\r\n }\r\n /** Ask if chordTol is specified */\r\n public get hasChordTol(): boolean {\r\n return this.chordTol !== undefined && this.chordTol > 0.0;\r\n }\r\n /** Ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean {\r\n return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;\r\n }\r\n private _maximizeConvexFacets?: boolean;\r\n /**\r\n * Whether to post-process a planar triangulation by removing edges to maximize the size of convex facets.\r\n * * Setting this to true also sets [[shouldTriangulate]] to true.\r\n */\r\n public get maximizeConvexFacets(): boolean {\r\n return this._maximizeConvexFacets ?? false;\r\n }\r\n public set maximizeConvexFacets(value: boolean) {\r\n this._maximizeConvexFacets = value;\r\n if (value)\r\n this.shouldTriangulate = value;\r\n }\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n options._maximizeConvexFacets = this._maximizeConvexFacets;\r\n return options;\r\n }\r\n /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of the existing count or count needed for angle condition for given\r\n * sweepRadians.\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance\r\n * from the options.\r\n */\r\n public static applyAngleTol(\r\n options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number,\r\n ): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(\r\n options: StrokeOptions | undefined, minCount: number, edgeLength: number,\r\n ): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,\r\n * chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given\r\n * arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module Curve
3
3
  */
4
4
  import { GeometryHandler } from "../geometry3d/GeometryHandler";
5
- import { AnyCurve } from "./CurveChain";
5
+ import { AnyCurve } from "./CurveTypes";
6
6
  import { CurveCollection } from "./CurveCollection";
7
7
  import { RecursiveCurveProcessor } from "./CurveProcessor";
8
8
  import { GeometryQuery } from "./GeometryQuery";
@@ -27,7 +27,7 @@ export declare class UnionRegion extends CurveCollection {
27
27
  get children(): Array<ParityRegion | Loop>;
28
28
  /** Constructor -- initialize with no children */
29
29
  constructor();
30
- /** Create a `UnionRegion` with given region children */
30
+ /** Create a `UnionRegion` by capturing the given regions as children. */
31
31
  static create(...data: Array<ParityRegion | Loop>): UnionRegion;
32
32
  /** Return the boundary type (5) of a corresponding MicroStation CurveVector */
33
33
  dgnBoundaryType(): number;
@@ -38,7 +38,7 @@ export declare class UnionRegion extends CurveCollection {
38
38
  /** Return new empty `UnionRegion` */
39
39
  cloneEmptyPeer(): UnionRegion;
40
40
  /**
41
- * Try to add a child.
41
+ * Try to add a child (by capturing it).
42
42
  * * Returns false if the `AnyCurve` child is not a region type.
43
43
  */
44
44
  tryAddChild(child: AnyCurve): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"UnionRegion.d.ts","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,M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AAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
@@ -31,7 +31,7 @@ class UnionRegion extends CurveCollection_1.CurveCollection {
31
31
  this.curveCollectionType = "unionRegion";
32
32
  this._children = [];
33
33
  }
34
- /** Create a `UnionRegion` with given region children */
34
+ /** Create a `UnionRegion` by capturing the given regions as children. */
35
35
  static create(...data) {
36
36
  const result = new UnionRegion();
37
37
  for (const child of data) {
@@ -63,11 +63,11 @@ class UnionRegion extends CurveCollection_1.CurveCollection {
63
63
  return new UnionRegion();
64
64
  }
65
65
  /**
66
- * Try to add a child.
66
+ * Try to add a child (by capturing it).
67
67
  * * Returns false if the `AnyCurve` child is not a region type.
68
68
  */
69
69
  tryAddChild(child) {
70
- if (child && child instanceof ParityRegion_1.ParityRegion || child instanceof Loop_1.Loop) {
70
+ if (child && (child instanceof ParityRegion_1.ParityRegion || child instanceof Loop_1.Loop)) {
71
71
  this._children.push(child);
72
72
  return true;
73
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UnionRegion.js","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,uDAAoD;AAGpD,iCAA8B;AAC9B,iDAA8C;AAG9C;;;;;;GAMG;AACH,MAAa,WAAY,SAAQ,iCAAe;IAG9C,yCAAyC;IAClC,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,WAAW,CAAC;IACtC,CAAC;IAGD,kCAAkC;IAClC,IAAoB,QAAQ;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,iDAAiD;IACjD;QACE,KAAK,EAAE,CAAC;QAdV,wCAAwC;QACxB,wBAAmB,GAAG,aAAa,CAAC;QAclD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IACD,wDAAwD;IACjD,MAAM,CAAC,MAAM,CAAC,GAAG,IAAgC;QACtD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,C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,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAtED,kCAsEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { Loop } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `UnionRegion` is a collection of other planar region types -- `Loop` and `ParityRegion`.\r\n * * The composite is the union of the contained regions.\r\n * * A point is \"in\" the composite if it is \"in\" one or more of the contained regions.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class UnionRegion extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"unionRegion\";\r\n /** Test if `other` is a `UnionRegion` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof UnionRegion;\r\n }\r\n /** Collection of Loop and ParityRegion children. */\r\n protected _children: Array<ParityRegion | Loop>;\r\n /** Return the array of regions */\r\n public override get children(): Array<ParityRegion | Loop> {\r\n return this._children;\r\n }\r\n /** Constructor -- initialize with no children */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Create a `UnionRegion` with given region children */\r\n public static create(...data: Array<ParityRegion | Loop>): UnionRegion {\r\n const result = new UnionRegion();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (5) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 5;\r\n }\r\n /** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceUnionRegion(this, indexInParent);\r\n }\r\n /** Return structural clone with stroked primitives. */\r\n public cloneStroked(options?: StrokeOptions): UnionRegion {\r\n const clone = new UnionRegion();\r\n let child;\r\n for (child of this._children) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n return clone;\r\n }\r\n /** Return new empty `UnionRegion` */\r\n public cloneEmptyPeer(): UnionRegion {\r\n return new UnionRegion();\r\n }\r\n /**\r\n * Try to add a child.\r\n * * Returns false if the `AnyCurve` child is not a region type.\r\n */\r\n public tryAddChild(child: AnyCurve): boolean {\r\n if (child && child instanceof ParityRegion || child instanceof Loop) {\r\n this._children.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child identified by index. */\r\n public getChild(i: number): Loop | ParityRegion | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleUnionRegion(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleUnionRegion(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"UnionRegion.js","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,uDAAoD;AAGpD,iCAA8B;AAC9B,iDAA8C;AAG9C;;;;;;GAMG;AACH,MAAa,WAAY,SAAQ,iCAAe;IAG9C,yCAAyC;IAClC,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,WAAW,CAAC;IACtC,CAAC;IAGD,kCAAkC;IAClC,IAAoB,QAAQ;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,iDAAiD;IACjD;QACE,KAAK,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CAA0C;IACnC,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAtED,kCAsEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { AnyCurve } from \"./CurveTypes\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { Loop } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `UnionRegion` is a collection of other planar region types -- `Loop` and `ParityRegion`.\r\n * * The composite is the union of the contained regions.\r\n * * A point is \"in\" the composite if it is \"in\" one or more of the contained regions.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class UnionRegion extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"unionRegion\";\r\n /** Test if `other` is a `UnionRegion` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof UnionRegion;\r\n }\r\n /** Collection of Loop and ParityRegion children. */\r\n protected _children: Array<ParityRegion | Loop>;\r\n /** Return the array of regions */\r\n public override get children(): Array<ParityRegion | Loop> {\r\n return this._children;\r\n }\r\n /** Constructor -- initialize with no children */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Create a `UnionRegion` by capturing the given regions as children. */\r\n public static create(...data: Array<ParityRegion | Loop>): UnionRegion {\r\n const result = new UnionRegion();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (5) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 5;\r\n }\r\n /** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceUnionRegion(this, indexInParent);\r\n }\r\n /** Return structural clone with stroked primitives. */\r\n public cloneStroked(options?: StrokeOptions): UnionRegion {\r\n const clone = new UnionRegion();\r\n let child;\r\n for (child of this._children) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n return clone;\r\n }\r\n /** Return new empty `UnionRegion` */\r\n public cloneEmptyPeer(): UnionRegion {\r\n return new UnionRegion();\r\n }\r\n /**\r\n * Try to add a child (by capturing it).\r\n * * Returns false if the `AnyCurve` child is not a region type.\r\n */\r\n public tryAddChild(child: AnyCurve): boolean {\r\n if (child && (child instanceof ParityRegion || child instanceof Loop)) {\r\n this._children.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child identified by index. */\r\n public getChild(i: number): Loop | ParityRegion | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleUnionRegion(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleUnionRegion(this);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,225 @@
1
+ /** @packageDocumentation
2
+ * @module Curve
3
+ */
4
+ import { BSplineCurve3d } from "../../bspline/BSplineCurve";
5
+ import { BSplineCurve3dH } from "../../bspline/BSplineCurve3dH";
6
+ import { RecurseToCurvesGeometryHandler } from "../../geometry3d/GeometryHandler";
7
+ import { Arc3d } from "../Arc3d";
8
+ import { AnyCurve } from "../CurveTypes";
9
+ import { CurveLocationDetail, CurveLocationDetailPair } from "../CurveLocationDetail";
10
+ import { CurvePrimitive } from "../CurvePrimitive";
11
+ import { LineSegment3d } from "../LineSegment3d";
12
+ import { LineString3d } from "../LineString3d";
13
+ /**
14
+ * Handler class for XY close approach between _geometryB and another geometry.
15
+ * * Approach means the XY distance (z is ignored) between _geometryB and another geometry.
16
+ * * Closest approach is a measure of the proximity of one curve to another. It's the length of the shortest line
17
+ * segment perpendicular to both curves; if the curves intersect, the closest approach is zero. In the context of
18
+ * this class, z-coordinates are ignored, so the closest approach is as seen in the top view. If you have coplanar
19
+ * input curves and want to find closest approach in their plane, rotate them first into a plane parallel to the
20
+ * xy-plane, then afterward, rotate the results back as required.
21
+ * * Close approach can also be from a curve endpoint perpendicular to another curve or from a curve endpoint to
22
+ * another curve endpoint.
23
+ * * Instances are initialized and called from CurveCurve.
24
+ * * geometryB is saved for later reference.
25
+ * @internal
26
+ */
27
+ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
28
+ private _geometryB;
29
+ private _circularArcB;
30
+ private _circularRadiusB;
31
+ private setGeometryB;
32
+ /**
33
+ * Maximum XY distance (z is ignored). Approach larger than this is not interesting.
34
+ * This is caller defined and can be undefined.
35
+ */
36
+ private _maxDistanceToAccept;
37
+ /** Squared max distance. This is private, and is forced to at least small metric distance squared. */
38
+ private _maxDistanceSquared;
39
+ /**
40
+ * Start and end points of line segments that meet closest approach criteria, i.e., they are perpendicular to
41
+ * both curves and their length is smaller than _maxDistanceToAccept.
42
+ */
43
+ private _results;
44
+ private static _workPointAA0;
45
+ private static _workPointAA1;
46
+ private static _workPointBB0;
47
+ private static _workPointBB1;
48
+ private static _workPointB;
49
+ private reinitialize;
50
+ /**
51
+ * Constructor.
52
+ * @param geometryB second curve for intersection. Saved for reference by specific handler methods.
53
+ */
54
+ constructor(geometryB: AnyCurve | undefined);
55
+ /** Set the (possibly undefined) max XY distance (z is ignored) to accept. */
56
+ set maxDistanceToAccept(value: number | undefined);
57
+ /** Access the (possibly undefined) max XY distance (z is ignored) to accept. */
58
+ get maxDistanceToAccept(): number | undefined;
59
+ /** Ask if the maxDistanceToAccept value is defined and positive */
60
+ get isMaxDistanceSet(): boolean;
61
+ /** Reset the geometry and flags, leaving all other parts unchanged (and preserving accumulated intersections) */
62
+ resetGeometry(geometryB: AnyCurve): void;
63
+ /** returns true if `fraction` is in [0,1] within tolerance */
64
+ private acceptFraction;
65
+ /**
66
+ * Return the results structure for the intersection calculation, structured as an array of CurveLocationDetailPair.
67
+ * @param reinitialize if true, a new results structure is created for use by later calls.
68
+ */
69
+ grabPairedResults(reinitialize?: boolean): CurveLocationDetailPair[];
70
+ /** Returns `true` if `detail` has same curve and fraction. */
71
+ private sameCurveAndFraction;
72
+ /**
73
+ * If distance between pointA and pointB is less than maxDistance, record CurveLocationDetailPair which is
74
+ * the approach from pointA to pointB.
75
+ */
76
+ private testAndRecordPointPairApproach;
77
+ /**
78
+ * Create a close approach pair if XY distance is within maxDistance.
79
+ * @param localFractionA a fraction on first curve
80
+ * @param cpA the first curve
81
+ * @param fractionA0 start of the first curve
82
+ * @param fractionA1 end of the first curve
83
+ * @param localFractionB a fraction on second curve
84
+ * @param cpB the second curve
85
+ * @param fractionB0 start of the second curve
86
+ * @param fractionB1 end of the second curve
87
+ * @param reversed true to have order reversed in final structures
88
+ * @param intervalDetails optional CurveLocationDetailPair
89
+ */
90
+ private recordPointWithLocalFractions;
91
+ /**
92
+ * Capture a close approach pair that has point and local fraction but not curve.
93
+ * * Record the pair, each detail modified with global fraction and input curve.
94
+ * * Pair is neither modified nor recorded if it would be a duplicate of the last recorded pair.
95
+ * @param pair details computed with local fractions
96
+ * @param cpA curveA
97
+ * @param fractionA0 global start fraction on curveA
98
+ * @param fractionA1 global end fraction on curveA
99
+ * @param cpB curveB
100
+ * @param fractionB0 global start fraction on curveB
101
+ * @param fractionB1 global end fraction on curveB
102
+ * @param reversed whether to reverse the details in the pair
103
+ */
104
+ private capturePairWithLocalFractions;
105
+ /**
106
+ * Emit recordPoint for multiple pairs (on full curve) if within maxDistance.
107
+ * @param cpA first curve primitive (possibly different from curve in detailA, but fraction compatible)
108
+ * @param cpB second curve primitive (possibly different from curve in detailA, but fraction compatible)
109
+ * @param pairs array of pairs
110
+ * @param reversed true to have order reversed in final structures.
111
+ */
112
+ recordPairs(cpA: CurvePrimitive, cpB: CurvePrimitive, pairs: CurveLocationDetailPair[] | undefined, reversed: boolean): void;
113
+ /**
114
+ * Record fully assembled (but possibly reversed) detail pair.
115
+ * @param detailA first detail
116
+ * @param detailB second detail
117
+ * @param reversed true to have order reversed in final structures.
118
+ */
119
+ captureDetailPair(detailA: CurveLocationDetail | undefined, detailB: CurveLocationDetail | undefined, reversed: boolean): void;
120
+ private static updatePointToSegmentDistance;
121
+ /**
122
+ * Return fractions of close approach within maxDistance between two line segments (a0,a1) and (b0,b1).
123
+ * * Math details can be found at docs/learning/geometry/CurveCurve.md
124
+ * @param a0 start point of line a
125
+ * @param a1 end point of line a
126
+ * @param b0 start point of line b
127
+ * @param b1 end point of line b
128
+ * @param maxDistanceSquared maximum distance squared (assumed to be positive)
129
+ * @returns the fractional (not xy) coordinates in result.x and result.y. result.x is fraction on line a.
130
+ * result.y is fraction on line b.
131
+ */
132
+ private static segmentSegmentBoundedApproach;
133
+ /**
134
+ * Check different combination of fractions on curveA and curveB. If distance between points at 2 fractions
135
+ * is less than maxDistance, record CurveLocationDetailPair which is the approach between the 2 points.
136
+ * Optionally, record close approaches of one curve's points if they fall between the other curve's points.
137
+ * @param cpA curveA
138
+ * @param fA0 fraction0 on curveA
139
+ * @param fA1 fraction1 on curveA
140
+ * @param testProjectionOnA whether to record projections of the given curveB points onto curveA
141
+ * @param cpB curveB
142
+ * @param fB0 fraction0 on curveB
143
+ * @param fB1 fraction0 on curveB
144
+ * @param testProjectionOnB whether to record projections of the given curveA points onto curveB
145
+ * @param reversed true to have order reversed in final structures.
146
+ */
147
+ private testAndRecordFractionalPairApproach;
148
+ /** Find the closest approach between pointA and cpB. Add the approach if it's within fB0 and fB1. */
149
+ private testAndRecordProjection;
150
+ /**
151
+ * Compute intersection of two line segments.
152
+ * Filter by extension rules.
153
+ * Record with fraction mapping.
154
+ * * The fraction mappings allow portions of a linestring to be passed here.
155
+ */
156
+ private computeSegmentSegment3D;
157
+ /** Low level dispatch of segment with segment. */
158
+ private dispatchSegmentSegment;
159
+ /**
160
+ * Low level dispatch of segment with arc.
161
+ * Find close approaches within maxDistance between a line segments (pointA0, pointA1) and an arc.
162
+ * To consider:
163
+ * 1) intersection between arc and segment.
164
+ * 2) arc endpoints to segment endpoints or arc endpoints projection to the segment.
165
+ * 3) line parallel to arc tangent.
166
+ * @param cpA curve A (line segment or line string)
167
+ * @param pointA0 start point of the segment
168
+ * @param fractionA0 fraction of the start of the segment
169
+ * @param pointA1 end point of the segment
170
+ * @param fractionA1 fraction of the end of the segment
171
+ * @param arc the arc
172
+ * @param reversed true to have order reversed in final structures
173
+ */
174
+ private dispatchSegmentArc;
175
+ /** Low level dispatch of circular arc with circular arc. radiusA must be larger than or equal to radiusB. */
176
+ private dispatchCircularCircularOrdered;
177
+ /** Find the fractional point (if any) on the circular `arc` in the direction of `radialVector`. */
178
+ private resolveDirectionToArcXYFraction;
179
+ /** Low level dispatch of arc with arc. Only circular arcs are supported. */
180
+ private dispatchArcArc;
181
+ /** Low level dispatch of arc with (beziers of) a bspline curve */
182
+ private dispatchArcBsplineCurve3d;
183
+ /** Low level dispatch of (beziers of) a bspline curve with (beziers of) a bspline curve */
184
+ private dispatchBSplineCurve3dBSplineCurve3d;
185
+ /** Low level dispatch of linestring with (beziers of) a bspline curve */
186
+ dispatchLineStringBSplineCurve(lsA: LineString3d, curveB: BSplineCurve3d, reversed: boolean): any;
187
+ /** Low level dispatch of segment with (beziers of) a bspline curve */
188
+ dispatchSegmentBsplineCurve(segA: LineSegment3d, curveB: BSplineCurve3d, reversed: boolean): any;
189
+ /** Detail computation for segment approaching linestring. */
190
+ computeSegmentLineString(segA: LineSegment3d, lsB: LineString3d, reversed: boolean): void;
191
+ /** Detail computation for arc approaching linestring. */
192
+ computeArcLineString(arcA: Arc3d, lsB: LineString3d, reversed: boolean): any;
193
+ /** Low level dispatch of curve collection. */
194
+ private dispatchCurveCollection;
195
+ /** Double dispatch handler for strongly typed segment. */
196
+ handleLineSegment3d(segmentA: LineSegment3d): any;
197
+ /**
198
+ * Set bits for comparison to range xy
199
+ * * bit 0x01 => x smaller than range.low.x
200
+ * * bit 0x02 => x larger than range.high.x
201
+ * * bit 0x04 => y smaller than range.low.y
202
+ * * bit 0x08 => y larger than range.high.y
203
+ * * If we divide XY plane into 9 areas using the range, the function returns 0 for points
204
+ * inside the range. Below is other binary numbers returned by the function for all 9 areas:
205
+ * 1001 | 1000 | 1010
206
+ * ------------------
207
+ * 1 | 0 | 10
208
+ * ------------------
209
+ * 101 | 100 | 110
210
+ * @param xy point to test
211
+ * @param range range for comparison
212
+ */
213
+ private classifyBitsPointRangeXY;
214
+ /** Low level dispatch of line string with line string. */
215
+ private computeLineStringLineString;
216
+ /** Double dispatch handler for strongly typed linestring. */
217
+ handleLineString3d(lsA: LineString3d): any;
218
+ /** Double dispatch handler for strongly typed arc. */
219
+ handleArc3d(arc0: Arc3d): any;
220
+ /** Double dispatch handler for strongly typed bspline curve. */
221
+ handleBSplineCurve3d(curve: BSplineCurve3d): any;
222
+ /** Double dispatch handler for strongly typed homogeneous bspline curve .. */
223
+ handleBSplineCurve3dH(_curve: BSplineCurve3dH): any;
224
+ }
225
+ //# sourceMappingURL=CurveCurveCloseApproachXY.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurveCurveCloseApproachXY.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveCurveCloseApproachXY.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,c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